Re: newbie question

From: Joachim Schimpf <j.schimpf_at_icparc.ic.ac.uk>
Date: Mon 10 Jun 2002 10:36:39 AM GMT
Message-ID: <3D048137.B32532E7@icparc.ic.ac.uk>
Roel Wuyts wrote:
> 
> Hello,
> I have a simple thing that I wanted to check using disjunctive:
> 
> :-      [X,Y,Z]::0..30, disjunctive([X,Y,Z],[12,12,12]).
> 
> This is not feasible, but yet the response is 'yes'.

It is feasible: Remember that [X,Y,Z] are the start times of
the tasks, so for example [0,12,24] is a solution.

The following will fail as expected:
:- [X,Y,Z]::0..23, disjunctive([X,Y,Z],[12,12,12]).


> But it is indicated that the goal is delayed.

This is indeed a newbie question :-)
For almost all constraints, constraint propagation is incomplete,
which means that it can infer some infeasibilities, but not all.
When a goal remains delayed, your answer is "maybe".
The way to make sure that there are no delayed goals, and that you
get a clear yes/no answer, is to instantiate all variables.
In finite-domain programs, the simplest form of doing that is
using labeling/1 at the end, e.g.

?- [X,Y,Z]::0..30, disjunctive([X,Y,Z],[12,12,12]), labeling([X,Y,Z]).
X = 0
Y = 12
Z = 24
More (0.00s cpu)
X = 0
Y = 12
Z = 25
More (0.01s cpu)
...

Note the basic structure of every constraint program:

1. set up domain variables and constraints between them.
2. find instantiations for the variables. This will in general
   involve search. However, the constraints will automatically
   allow only such instantiations that satify them.

A more flexible variant of labeling/1 is search/5 from lib(fd_search).


-- 
 Joachim Schimpf              /             phone: +44 20 7594 8187
 IC-Parc, Imperial College   /            mailto:J.Schimpf@ic.ac.uk
 London SW7 2AZ, UK         /    http://www.icparc.ic.ac.uk/eclipse
Received on Mon Jun 10 11:36:48 2002

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