in reply to Re^4: Seven by seven farming puzzle
in thread Seven by seven farming puzzle

I replaced your different_lists and list_sequence with pure constraint versions (instead of your nondeterministic versions), and the changed program runs in practically the same amount of time. Thus, even if I don't understand it, your custom labeling algorithm works well.

The new definitions are as follow. The vdiffer predicate is defined in the prolog code elsewhere in this thread, whereas lex_chain is a new library predicate in Sicstus 4.

different_lists(X, Y) :- vdiffer(X, Y). list_sequence(X) :- lex_chain(X, [op(#<)]).
If, however, you replace only list_sequence but keep your different_lists proceduce, the program gets somewhat faster (shows how the optimized library that comes with Sicstus is better than the proceduces I cobble together).