Re: [eclipse-users] declaring constants

From: Stefano Novello \(snovello\) <snovello_at_...5...>
Date: Fri, 15 Jun 2007 08:33:02 -0400
Hello Nicolas,
What you may want is a constant that is in a range, but you don't know
it's value.


In ECLiPSe

D = 1.99__2.00, X is 1+D.
?- D = 1.99__2.0, X is 1 + D.
D = 1.99__2.0
X = 2.9899999999999998__3.0
Yes (0.00s cpu)

When you use maths (is/2) or lib(ic) this range will be taken into
account in the computation.

D in this case is a ground value that will never change. Its not a
variable at all.

Cheers
Stefano

> -----Original Message-----
> From: 
> eclipse-users-bounces+snovello=cisco.com@...2... 
> [mailto:eclipse-users-bounces+snovello=cisco.com@...64...
> om] On Behalf Of Nicolas BERGER
> Sent: Friday, June 15, 2007 1:43 PM
> To: Marco Gavanelli
> Cc: eclipse-users@...2...
> Subject: Re: [eclipse-users] declaring constants
> 
> > Nicolas BERGER wrote:
> >> Hi everyone
> >>
> >> Is it possible to declare constants i.e. variable that are 
> not reduced ?
> >> For example, in the following problem, not reducing the 
> domain of D 
> >> but only the domains of X and Y :
> >>
> >> [X,Y] $:: [-1.1..0.72],
> >> D :: [1,4,7],
> >> X +  D #< 3,
> >>  Y + D #< 1.
> >
> > Hi Nicolas,
> >
> > What exactly do you mean with this?
> > Maybe you mean that for each value in the domain of D, 
> there exists a 
> > value in the domain of X such that the constraint X+D #< 3 
> is satisfied.
> >
> > If this is the case, you probably need a quantified CSP 
> solver (QCSP).
> >
> 
> 
> Have a look at the following *real-life* (robot arm movement) CSP :
> 
>     	Tx is 10.0,
>     	Ty is 6.0,
>     	X0 is 8,
>     	Y0 is 4,
>     	D $:: [1.99..2.01],
> 
>     	A $:: [2.0..8.0],
>     	B $:: [2.0..8.0],
>     	Alpha $:: [0.. pi],
>     	Beta $:: [0.. pi],
>     	X  $:: [0..Tx],
>     	Y  $:: [0..Ty],
>     	I  :: [2..5],
>     	J  :: [2..5] ;
> 
> 	A * sin(Alpha) $= B * sin(Beta - Alpha) + Y,
> 	A * cos(Alpha) $= X - (B * cos(Beta - Alpha)),
> 	A * cos(Alpha) $=< Tx,
> 	X $=< Tx,
> 	A * sin(Alpha) $=< Ty,
> 	Y $=< Ty,
> 	(X - X0)^2 + (Y - Y0)^2 $=< 4,
> 	A $= (I - 1) * D,
> 	B $= (J - 1) * D.
> 
> 
> D here is a constant term, it doesn't have to be reduced, it 
> is just some feature of the problem : 1.99 $=< D $=< 2.01. 
> Actually, this problem comes from a C++ constraint solving 
> library (ELISA) where D can be declared as of type 
> "IntervalConstant"...
> 
> Here what I have first thought of is excluding it from the 
> "locate" var list :
> 	locate([A,B,Alpha,Beta,X,Y,I,J],
> 		[A,B,Alpha,Beta,X,Y,I,J],1e-6,lin).
> 
> 
> I suppose it means D is excluded from the search procedure 
> (i.e. won't be
> splitted) but I don't know if it excludes it from the 
> propagation of domain reductions raised by the constraints...
> 
> 
> 
> Nicolas.
> 
> 
> _______________________________________________
> ECLiPSe-Users mailing list
> ECLiPSe-Users@...2...
> http://www.crosscoreop.com/mailman/listinfo/eclipse-users
> 
Received on Fri Jun 15 2007 - 13:34:02 CEST

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