This program provides new labeling functions:
fd_labeling_sbds(+L,+Sym).
fd_labeling_sbds(+L,+Sym,+Options).
1-Description:
L is the list of variables.
Sym is the list of symmetries using predicates sym/2, sym/3 and group/1.
sym/2 and sym/3 are facts describing the symmetries using list(s)
of permutation over variables, values or couples variable/value (called
a point).
group/1 is a predicate which generates all symmetry predicates from
a list of symmetry generators. The order of variable in L must be the
same as the order chosen for
specify the symmetries.
Options is the list of labeling methods (like gprolog).
2-Specify
symmetries:
The specification of symmetries is very simple and several
methods exist. For help we will take the example
of n-queens, with n=4. L is a
list of four variables representing each row of the board,
each variable has a domain from 1 to 4, for each line (note that 0 is
added for specify symmetries).
There are eight obvious geometric symmetries (with the identity but
which doesn't be specified).
sym(point,LPoint):
In the general case each (variable,value) couple is
converted in a point :
point
= (ivar-1)*number_of_values+value,
where ivar is the position of the variable in L. So
in the list LPoint the ith element takes the value of its symmetric
point. All points must be in the list, even the constant point.
ex: horizontal symmetry (variable 1
permutes with 4, 2 with 3).
sym(point,[16,17,18,19,20,11,12,13,14,15,6,7,8,9,10,1,2,3,4,5]).
Note: the values are between 0 and the maximum of all domains.
sym(varval,LVar,LVal):
In the case of just a permutation in variables or/and values it's not
necessary to specifiy all points. So LVar and
LVal contain the list of (resp) variables and values permutations.
ex: horizontal symmetry:
sym(varval,[4,3,2,1],[0,1,2,3,4]).
reduced
forms sym(point_red,LPointRed), sym(varval_red, LVarRed, LValRed):
It's possible to specify only the permuted points. The lists
LPointRed, LVarRed and LValRed contain cycles of
permuted points, variables or values.
ex: horizontal
symmetry:
sym(point_red,[[16,1],[17,2],[18,3],[19,4],[20,5],[11,6],[12,7],[13,8],[14,9],[15,10]]).
sym(varval_red,[[1,4],[2,3]],[]).
For the cycles, list [a1,...,an] means "a1 becomes a2 becomes
... an becomes a1".
local symmetries
sym(var_local,LVar,LocalVal), sym(val_local,LVal,LocalVar):
Local symmetries allows to specify a variable (resp. value) symmetry
just for some values (resp. variables),
LocalVal (resp. LocalVar) contains only concerned values (resp.
variables).
ex: horizontal
symmetry:
sym(var_local,[4,3,2,1],[1,2,3,4]). (here
is a special case where all values except 0 are considered)
vertical symmetry (line 1 permute with 4 and 2 with
3):
sym(val_local,[0,4,3,2,1],[1,2,3,4}). (here
is a special case where all variables are considered)
group of symmetries group(Sym):
group indicates that program must build all symmetries from generators
contained in Sym with any representation
described above.
ex: group of horizontal and
vertical symmetries (must generates the 180° rotation)
group([
sym(varval,[4,3,2,1],[0,1,2,3,4]),
sym(varval,[1,2,3,4],[0,4,3,2,1])
]).
The symmetrie wich corresponds to 180° rotation, like the two
generators, are stored in the data structure of the program
and add to the other symmetries already specified. But the user have no
access (for the moment) to the generated predicates.
3-Options:
The options of labeling are :
variable_method(V):
standard : leftmost variable is selected (default mode).
max : from the
greatest variable to
the smallest.
middle: from the middle variableto
the bounds.
bounds: from the bounds variableto
the middle.
value_method(V):
min : from the smallest value to the greatest (default mode).
max : from the greatest valueto
the smallest.
middle: from the middle valueto
the bounds.
bounds: from the bounds valueto
the middle.
random: enumerates the values randomly, each value is only tried once.