Re: [eclipse-clp-users] Multiple Value Ordering

From: <mskala_at_...206...>
Date: Sat, 6 Feb 2010 10:18:43 -0500 (EST)
On Sat, 6 Feb 2010, Amine Marref wrote:
> and variables in Vars2 are labelled indomain_max. I want to search for
> Goal by using value choice "indomain_min over Vars1" and value choice
> "indomain_max over Vars2". Is there any way to achieve this behaviour in

The easy thing to do would be to create a set of dummy variables Vars3,
equal to the negatives of the variables in Vars2, and then do indomain_min
over Vars1 and Vars3, like this:

> :-lib(ic).
> :-lib(branch_and_bound).
> :-lib(lists).
>
> solve(Goal):-
>     Vars1 = [X1, X2, X3],
>     Vars2 = [Y1, Y2, Y3],
>     Vars1 #:: [1..10],
>     Vars2 #:: [1..10],
      Vars3 = [Z1, Z2, Z3],
      Z1 #= -Y1,
      Z2 #= -Y2,
      Z3 #= -Y3,
      append(Vars1, Vars3, Vars),
>     Goal #= Y1 + Y2 + Y3 - X1 - X2 - X3,
>     bb_min(search(Vars,0,input_order,indomain_min,complete,[]),Goal,bb_options{timeout:1}).

For a more elaborate combination of heuristics, though, you may end up
having to write your own heuristic; see the documentation for search/6 on
that point.
-- 
Matthew Skala
mskala@...206...                    Embrace and defend.
http://ansuz.sooke.bc.ca/
Received on Sat Feb 06 2010 - 15:52:44 CET

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