Random element selection during FD distribution?
Daniel Burnett
danburnett2000 at gmail.com
Tue Jan 1 16:41:12 CET 2008
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++?
-- dan
More information about the mozart-users
mailing list