/* The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is the contents of this file. The Initial Developer of the Original Code is SICS, Swedish Institute of Computer Science AB (SICS). Portions created by the Initial Developer are Copyright (C) 2007 of the Initial Developer. All Rights Reserved. Contributor(s): _____Mats Carlsson _____Nicolas Beldiceanu Alternatively, if the contents of this file is included as a part of SICStus Prolog distribution by SICS, it may be used under the terms of an appropriate SICStus Prolog License Agreement (the "SICStus Prolog License"), in which case the provisions of the SICStus Prolog License are applicable instead of those above. */ :- multifile ctr_predefined/1, ctr_date/2, ctr_persons/2, ctr_origin/3, ctr_usual_name/2, ctr_synonyms/2, ctr_types/2, ctr_arguments/2, ctr_exchangeable/2, ctr_restrictions/2, ctr_typical/2, ctr_example/2, ctr_draw_example/9, ctr_see_also/2, ctr_key_words/2, ctr_derived_collections/2, ctr_graph/7, ctr_graph/9, ctr_eval/2, ctr_sol/3, ctr_logic/3. ctr_date(alldifferent,['20000128','20030820','20040530','20060803','20081227','20090521']). ctr_origin(alldifferent, '\\cite{Lauriere78}', []). ctr_arguments(alldifferent, ['VARIABLES'-collection(var-dvar)]). ctr_exchangeable(alldifferent, [items('VARIABLES',all), vals(['VARIABLES'^var],int,=\=,all,dontcare)]). ctr_synonyms(alldifferent,[alldiff , alldistinct , distinct , bound_alldifferent, bound_alldiff , bound_distinct , rel ]). ctr_restrictions(alldifferent, [required('VARIABLES',var)]). ctr_typical(alldifferent, [size('VARIABLES') > 2]). ctr_graph(alldifferent, ['VARIABLES'], 2, ['CLIQUE'>>collection(variables1,variables2)], [variables1^var = variables2^var], ['MAX_NSCC' =< 1], ['ONE_SUCC']). ctr_example(alldifferent, alldifferent([[var-5],[var-1],[var-9],[var-3]])). ctr_draw_example(alldifferent, ['VARIABLES'], [[[var-5],[var-1],[var-9],[var-3]]], ['CLIQUE'], [1-1,2-2,3-3,4-4], ['MAX_NSCC'([1])], '','MAX_NSCC=1', []). ctr_see_also(alldifferent, [link('generalisation', alldifferent_cst, '%e replaced by %e', [variable,variable+constant]), link('generalisation', alldifferent_interval, '%e replaced by %e', [variable,variable/constant]), link('generalisation', alldifferent_modulo, '%e replaced by %e', [variable,variable mod constant]), link('generalisation', alldifferent_partition, '%e replaced by %e', [variable,in_list(variable,partition)]), link('generalisation', alldifferent_between_sets, '%e replaced by %e', [variable,'set~variable']), link('generalisation', all_min_dist, '%e replaced by %e, all of the same size', [variable,'line~segment']), link('generalisation', disjunctive, '%e replaced by %e', [variable,task]), link('generalisation', lex_alldifferent, '%e replaced by %e', [variable,vector]), link('generalisation', global_cardinality, 'control the number of occurrence of each value with a counter variable', []), link('generalisation', global_cardinality_low_up, 'control the number of occurrence of each value with an interval', []), link('generalisation', nvalue, 'count number of distinct values', []), link('generalisation', diffn, '%e replaced by %k', [variable,orthotope]), link('soft variant', soft_alldifferent_var, '%k', ['variable-based violation measure']), link('soft variant', soft_alldifferent_ctr, '%k', ['decomposition-based violation measure']), link('soft variant', open_alldifferent, '%k', ['open constraint']), link('soft variant', alldifferent_except_0, 'value %e can be used several times', [0]), link('cost variant', minimum_weight_alldifferent, '', []), link('cost variant', weighted_partial_alldiff, '', []), link('common keyword', circuit, '%k', [permutation]), link('common keyword', cycle, '%k', [permutation]), link('common keyword', derangement, '%k', [permutation]), link('common keyword', symmetric_alldifferent, '%k', [permutation]), link('common keyword', circuit_cluster, '%k', [permutation]), link('common keyword', golomb, '%k', ['all different']), link('common keyword', size_max_seq_alldifferent, '%k,%k', ['all different', 'disequality']), link('common keyword', size_max_starting_seq_alldifferent, '%k,%k', ['all different', 'disequality']), link('system of constraints', k_alldifferent, '', []), link('part of system of constraints', neq, '', []), link('implies', alldifferent_except_0, '', []), link('implies', not_all_equal, '', []), link('implied by', alldifferent_consecutive_values, '', []), link('implied by', circuit, '', []), link('implied by', cycle, '', []), link('implied by', strictly_increasing, '', []), link('implied by', strictly_decreasing, '', []), link('shift of concept', alldifferent_on_intersection, '', []), link('shift of concept', alldifferent_same_value, '', []), link('used in reformulation', in_interval_reified, '%k preserving reformulation', ['bound-consistency']), link('uses in its reformulation', elements_alldifferent, '', [])]). ctr_key_words(alldifferent,['core' , 'system of constraints' , 'value constraint' , 'permutation' , 'all different' , 'disequality' , 'bipartite matching' , 'bipartite matching in convex bipartite graphs', 'convex bipartite graph' , 'flow' , 'maximum clique' , 'n-Amazon' , 'n-queen' , 'Costas arrays' , 'Euler knight' , 'Golomb ruler' , 'magic hexagon' , 'magic square' , 'zebra puzzle' , 'Sudoku' , 'graph colouring' , 'Hall interval' , 'arc-consistency' , 'bound-consistency' , 'automaton' , 'automaton with array of counters' , 'one\\_succ' , 'SAT' , 'DFS-bottleneck' , 'entailment' ]). ctr_persons(alldifferent,['Lauri\\`ere J.-L.' , 'Costa M.-C.' , 'R\\\'egin J.-C.' , 'Petersen J.' , 'Berge C.' , 'Leconte M.' , 'Bleuzen-Guernalec N.', 'Colmerauer A.' , 'Puget J.-F.' , 'L\\\'opez-Ortiz A.' , 'Quimper C.-G.' , 'van Beek P.' , 'Mehlhorn K.' , 'Thiel S.' , 'van Hoeve W.-J.' , 'Glover F.' , 'Asratian A. S.' , 'Denley T. M. J.' , 'H\\"aggkvist R.' , 'Williams H. P.' , 'Yan H.' , 'Hooker J. N.' , 'Zanarini A.' , 'Pesant G.' , 'Valiant L. G.' , 'Sloane N. J. A.' , 'Gent I. P.' , 'Nightingale P.' , 'Vellino A.' , 'Bron C.' , 'Kerbosch J.' , 'Bessi\\`ere C.' , 'Katsirelos G.' , 'Narodytska N.' , 'Walsh T.' , 'Rochart G.' , 'Jussien N.' , 'Barichard V.' , 'Roy B.' ]). ctr_sol(alldifferent,'A000142',[1, 2, 6, 24, 120, 720, 5040]). ctr_eval(alldifferent, [builtin(alldifferent_b), reformulation(alldifferent_r)]). alldifferent_b(VARIABLES) :- collection(VARIABLES, [dvar]), get_attr1(VARIABLES, VARS), all_different(VARS). alldifferent_r(VARIABLES) :- collection(VARIABLES, [dvar]), get_attr1(VARIABLES, VARS), get_minimum(VARS, MIN), get_maximum(VARS, MAX), alldifferent_r0(MIN, MAX, VARS). alldifferent_r0(L, MAX, _) :- L > MAX, !. alldifferent_r0(L, MAX, VARS) :- alldifferent_r1(L, MAX, VARS), L1 is L+1, alldifferent_r0(L1, MAX, VARS). alldifferent_r1(L, U, _) :- L > U, !. alldifferent_r1(L, U, VARS) :- alldifferent_r2(VARS, L, U, T), S is U-L+1, call(T #=< S), U1 is U-1, alldifferent_r1(L, U1, VARS). alldifferent_r2([], _, _, 0) :- !. alldifferent_r2([Vi|R], L, U, Bilu+S) :- Vi in L..U #<=> Bilu, alldifferent_r2(R, L, U, S).