[gecode-users] finding out whether there is a constraint between two variables/ equality between two variables

Guido Tack tack at ps.uni-sb.de
Mon May 22 14:31:53 CEST 2006


Hi.

> Is it possible for each IntVar to see whether there is a constraint between
> the IntVar and another IntVar?

No, currently not. And it would be quite hard to use because of entailment. 
Think of checking whether there's a constraint x<y. There might be a 
propagator ensuring x<y, there might also be a strictly stronger one ensuring 
x+1=y, or there might be none, as x<y is already entailed by the store.

> I am looking for something like:
> bool myfuntion(IntVar a, IntVar b)
> that should return true only if there is at least a single constraint that
> involves both a and b.
>
> or
> void myfunction(IntVar a, IntVarArgs b)
>
> assigns b to be all IntVars that are present in the same constraints as a.

Could you be a little more specific as to what you are planning to do with 
that information?

> Also regarding the comparison between two IntVar variables a, b, I was
> wondering if it is possible to check [NOT post] equality [whether the
> domain of the two variables contain the same values] in a way that doesn't
> include iterating over their values?

Equality is, unlike in many other CP systems, not implemented via aliasing. 
This means that if you post "x=y", you actually post a propagator enforcing 
that. As already said above, you currently cannot check whether there is such 
a propagator.
If you only want to know whether two variables might be equal, i.e. whether 
the intersection of their domains is not empty, what's wrong with iterating 
over the domains?

Cheers,
	Guido

-- 
Guido Tack
Programming Systems Lab, Saarland University, Germany
http://www.ps.uni-sb.de/~tack




More information about the gecode-users mailing list