Re: [eclipse-clp-users] Locate parameters

From: Joachim Schimpf <joachim.schimpf_at_...44...>
Date: Thu, 22 Oct 2009 08:49:45 +1100
simone pascucci wrote:
> Hi,
> 
> I'm getting into eclipse but still I have many questions unsoluted. The 
> usage of locate is between them, if I understand well, locate/2 expects 
> a list of variables as first argument. In many cases a program does not 
> provide a unique list of variables but could group them in different 
> lists following some logic of the main application.

Your question also applies to finite domain programs that use integer
variables with labeling/1.

You can use several calls to locate/2 (or labeling/1), each with a
different list.  As a guideline, you should locate the "difficult"
variables first (your application might give you some idea of which
these are).


> I would like to ask if there's some best practice dealing with these 
> cases, such as building a unique list of variables runtime,

You can always use append/3 to concatenate your individual variable
lists.  There is also term_variables/2 which can extract all variables
from any given data structure.


 > and retrieve the original subdivision with programming effort,

There should be no need for this - you can just keep the original
lists in addition to the combined one.


 > or pass directly a
> unique list, and working with indexes to deal with different types of 
> variables.

locate/2 corresponds to labeling/1 in the sense that it implements
a naive left-to-right variable-selection strategy, see
http://eclipse-clp.org/doc/tutorial/tutorial086.html .

We do currently not have anything that implements smarter variable
selection strategies for non-integer variables in the way that
search/6 does.  In general, more research has been done on search
with finite domain variables than with continuous variables.
You may need to use problem-specific heuristics, but if in the
course of your work you develop a general purpose improvement of
locate/2, please contribute it back!


-- Joachim
Received on Wed Oct 21 2009 - 21:50:00 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 16 2024 - 09:13:20 CEST