Re: Re:search/6 inside bagof/3?

From: Warwick Harvey <>
Date: Mon 04 Nov 2002 01:37:26 PM GMT
Message-ID: <>
On Mon, Nov 04, 2002 at 01:03:28PM +0100, Marco Gavanelli wrote:
> At 12.17 04/11/02, 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.

Unfortunately, due to the design of the search library (it fails when there
is no solution to return), there is no way to find out how many backtracks
were required to prove that there are no more solutions after the last.  It
is not clear how this could/should be fixed (suggestions welcome).

Received on Mon Nov 04 13:38:44 2002

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:18 PM GMT GMT