Daniel Burnett wrote:
I am implementing a Sudoku generator/solver using the FD module and
have run into what appears to be a limitation in the existing
distribution options of FD.distribute.
I have a record with 81 elements, each of which is constrained to be
either 0 or 1, out of which I want my solver to select a number Num of
these elements to have the value 1, subject to a few other
constraints. During the distribution stage, I do not want the
"leftmost" variable to be selected, but rather would like one selected
at random. I cannot seem to find a way to use either the Order or
Filter options of generic() to select elements at random. It is easy
to select values of elements at random by writing a unary function for
generic(value:..), but there doesn't seem to be a comparable way to
select elements.
Can anyone suggest a solution to this that does not require writing a
new distribution algorithm in C/C++?
Have a look at the example in:
http://www.mozart-oz.org/documentation/fdt/node42.html#section.user-defined.split
It is just a matter of implementing a function that randomly selects a
variable out of a set of variables.
Happy New Year!
Cheers,
Luis
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users