[ library(ldsb) | Reference Manual | Alphabetic Index ]

ldsb_initialise(+Xs, +Syms)

Initialise LDSB search variables.
Xs
Array of search variables
Syms
List of symmetries

Description

Initialise an array of search variables to use LDSB with the given symmetries. A variables must be initialised with ldsb_initialise before it can be used with ldsb_try or any predicate that relies on it such as ldsb_indomain.

Each element of Syms must be a symmetry specifier from the following set:

Modes and Determinism

Resatisfiable

no

Examples

% A vector of interchangeable variables.
dim(Xs, [N]),
[...]
ldsb_initialise(Xs, [variables_interchange])

% Vector of piecewise interchangeable variables.
Xs = [](A,B,C,D,E,F),
[...]
% A,B,C are interchangeable; D,E,F are interchangeable.
ldsb_initialise(Xs, [variable_interchange([A,B,C]),
                     variable_interchange([D,E,F])])

% Variables with interchangeable values.
dim(Xs, [N]),
Xs #:: 1..M,
ldsb_initialise(Xs, [values_interchange])

% N-queens, with one boolean variable per square.
dim(A, [N,N]),
A #:: 0..1,
[...]
ldsb_initialise(A, [row_reflection, column_reflection, diagonal_reflection])

% N-queens with one integer variable per queen.
% Note that only half of the symmetries are represented.
dim(Xs, [1,N]),    % make Xs a 1xN matrix.
Xs #:: 1..N,
[...]
ldsb_initialise(Xs, [column_reflection, value_reflection])

% Latin square of order N.
dim(Xs, [N,N]),
Xs #:: 1..N,
[...]
ldsb_initialise(Xs, [rows_interchange, columns_interchange, values_interchange, diagonal_reflection])

% Social Golfers problem with one set variable per group.
dim(Xs, [W,G]),
[...]
% Within each week, the groups are interchangeable.
( for(I, 1, W), foreach(Subsym, Subsyms), param(Xs,G) do
    subscript(Xs, [I, 1..G], Submatrix),
    variables_interchange(Submatrix, Subsym) ),
% rows_interchange: weeks are interchangeable
% values_interchange: golfers are interchangeable
ldsb_initialise(Xs, [rows_interchange, values_interchange | Subsyms])

See Also

ldsb_try / 3, ldsb_indomain / 1, ldsb_indomain_set / 1