Re: [eclipse-clp-users] Finding all Solutions to bb_min

From: Joachim Schimpf <joachim.schimpf_at_...44...>
Date: Sat, 15 May 2010 22:46:39 +1000
Amine Marref wrote:
> Hello,
> 
> I want to find the list of all solutions to a goal whose cost is to be 
> minimized using bb_min/3.
> 
> e.g., I use
> setof(VARS, 
> bb_min(search(VARS,0,input_order,indomain_max,complete,[]),Cost,_),LIST)
> in order to populate LIST with elements VARS where Cost is the optimal 
> Cost in the search, and VARS is a possible assignment of variables that 
> yields the (optimal) Cost.
> 
> Using the clause above, I am getting only *one* assignment to VARS 
> although there are many assignments to VARS in my problem that lead to 
> the optimal Cost.
> 
> Any help?

You have to do this in two steps:
1. find the optimum cost
2. find all solutions with this cost

% Use bb_min/6 for step 1:
     bb_min(search(Vars), Cost, [], _Ignore, Cost, Options),

% then repeat your search goal (Cost is now fixed):
     search(Vars).

-- Joachim
Received on Sat May 15 2010 - 12:46:48 CEST

This archive was generated by hypermail 2.2.0 : Mon Jul 09 2018 - 02:05:29 CEST