Lars Kotthoff wrote: > Dear list, > > is there a general, preferably easy, way of getting the number of search tree > nodes explored when searching for the solution to a problem? A "node" is a place where a nondeterministic choice is made, e.g. in indomain/1 when you are using finite domains. You need to add a nonlogical counter to your code, e.g. labeling(AllVars) :- setval(nodes, 0), ( foreach(Var, AllVars) do ( var(Var) -> incval(nodes) % count before making choice ; true % don't count trivial nodes ), indomain(Var) ), getval(nodes, NN), printf("Solution found with %d nodes%n", [NN]). In constraint programming, it is more customary to count backtracks instead of nodes, see http://eclipse-clp.org/doc/tutorial/tutorial088.html#toc82 -- JoachimReceived on Thu Jan 08 2009 - 04:42:42 CET
This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET