Bill,

That's a difficult problem and with no general answer: computers executed code very quickly, a lot of this code is really stupid wrt to human reasoning. Then, even if you can ask a program "how hard" it worked the answer is maybe not really relevant. However, to ask "how hard" a program worked, obvious things are execution time (see statistics in gprolog) and/or counting the number of backtracking performed by your program. There is no predefined way to do this in gprolog but it is easy to add code to count backtracking using a global variable (see g_assign/2). In addition, if your sudoky program uses FD constraints you could be interested in the backtracks(B) option of the built-in predicate fd_labeling (at then end of the labeling B will be unified by the number of performed backtrackings).

Hope this helps.

Daniel

Bill Woessner a écrit :
Is there any way to ask GProlog "how hard" it worked to satisfy a
query?  I've got a really simple Sudoku solver and I've been testing
it with various puzzles.  But I'd like to develop an objective notion
of "how hard" a given puzzle is.

Thanks in advance,
Bill



--
Ce message a ete verifie par MailScanner
pour des virus ou des polluriels et rien de
suspect n'a ete trouve.



_______________________________________________
Users-prolog mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/users-prolog

Reply via email to