At 12.17 04/11/02, zeynep.kiziltan@dis.uu.se wrote: >Dear Mark, > >Thank you for the help. > > > To get what you want you have to write: > > > bagof([X,B],search(X,0,input_order,indomain_min,complete,[backtrack(B)]),Bag) > >I tried this, but somehow B is not instantiated to any value, so I cannot see >the number of failures when I have "write(B)" after bagof? In the solution by Mark, the number of backtracks is not in B, but in Bag. Bag is a list of two-element lists. The second of the two-element list is a number, which represents the number of backtracks necessary to get to that solution. If you want the total number, just consider the last one. E.g., :- bagof([X,B],search(X,0,input_order,indomain_min,complete,[backtrack(B)]),Bag), get_last_element(El,Bag), El=[LastSolution,TotalNumberOfBacktracks]. Cheers, Marco :- Marco Gavanelli, Ph.D. Computer Science Division DIF - Dipartimento di Ingegneria University of Ferrara Via Saragat 1 - 44100 Ferrara (Italy) Fax +39-0532-768602 Cell +39-329-4280354 http://www.ing.unife.it/docenti/MarcoGavanelli/ :-Received on Mon Nov 04 12:03:11 2002
This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:18 PM GMT GMT