Re: how to value selection in tree search?

From: <wh_at_icparc.ic.ac.uk>
Date: Thu 09 Dec 2004 12:22:46 PM GMT
Message-ID: <20041209122246.GA16142@tempest.icparc.ic.ac.uk>
Hi,

Others have made some good suggestions.  I just thought I'd add another
idea.

On Tue, Dec 07, 2004 at 10:14:00AM -0800, Chuang Liu wrote:
> hi there:
> I am using library fd to implement a tree search
> method. I like to control the value selection for
> variables during the search process. I have a variable
> whose domain is [1, 2, 3, 4, 5], and I associate a
> weight to every value. I want the search process to
> try value with higher weight first.
> 
> I tried to sort the value domain based on the weight
> of values like
> V :: [2, 1, 3, 5, 4],
> indomain(V) 

If your ordering is dynamic or you have a different one for each variable,
you might find it easier to use member/2 to do the labelling.  E.g.

    V :: [1..5],
    member(V, [2, 1, 3, 5, 4])

member/2 will try to instantiate V to each element of the list in order (on
backtracking).

Cheers,
Warwick
Received on Thu Dec 09 12:25:26 2004

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