Re: [eclipse-users] declaring constants

From: Marco Gavanelli <marco.gavanelli_at_unife.it>
Date: Fri, 15 Jun 2007 14:28:26 +0200
Nicolas BERGER wrote:
>> 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...

Dear Nicolas,

indeed the solver would propagate the constraints (thus reducing the 
domain of D), because D is an existentially quantified variable. The 
question is: what would you like the behaviour to be?

If you need to declare a constant, you can easily do it, and you do not 
need propagation, but just unification:

	D = [1.99..2.01]

Now D cannot be changed. But I suppose this is not what you need.
For instance, what are the solutions of your previous example?

  X $:: [-1.1..0.72],
  D :: [1,4,7],
  X +  D #< 3,

Is X=0 a solution?
Maybe yes, if you assume that D is equal to 1.
But if D is equal to 7 it is not.
So in the second case there is no point in leaving the value 7 in the 
domain of D.

Cheers,
Marco

-- 
Marco Gavanelli, Ph.D.
Computer Science Division
Dipartimento di Ingegneria
University of Ferrara
Via Saragat 1 - 44100 Ferrara (Italy)
Tel  +39-0532-97-4833
Fax  +39-0532-97-4870
http://www.ing.unife.it/docenti/MarcoGavanelli/
Received on Fri Jun 15 2007 - 13:28:29 CEST

This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET