[gecode-users] A new variable composed by two IntVar

Martin Mann mmann at informatik.uni-freiburg.de
Sat Sep 26 17:23:24 CEST 2009


Hi Amina,

why dont you just post a distinct constraint on all variables? will 
solve your problem (a) more efficient and (b) you wont need to implement 
a new propagator. always good to go as far as possible with available 
and tested stuff to reduce coding efforts and errors..

what you can think about as well is to encode your 2D variables via an 
indexing instead of an explicit representation. But this only works if 
your 2D coordinates are within known bounds. by that you can do a unique 
integer encoding for all used 2D points and will need only one variable 
per point instead of two.
this is the way I did for my 3D coordinate problems and it worked well.

if you need a neighboring constraint for lattice points let me know.

have a nice weekend,

martin


amina kemmar schrieb:
> Hello,
> 
> To model my problem, I need to use Point(x-coordinate, y-coordinate), I can separate the point in two variables (IntVar), I obtain:
> 
> ...
> IntVar Px;
> IntVar Py;
> 
> IntVar Gx;
> IntVar Gy;
> 
> Different_Point(*this,Px,Py,Gx,Gy, ICL_DOM); // It is a new constraint which post propagator for Px != Gx and Py != Gy
> ...
>   
> I want to implement the variable PointVar to obtain a model like this:
> 
> ...
> PointVar P;
> PointVar G;
> Different_Point(*this, P, G, ICL_DOM);
> ...
> 
> This new variable is composed by two IntVar, I don't understand how to implement it, if you can
> give me the first step to do this, or any documentation or information about the implementation of a new variable?
> 
> thank you,
> amina.
> 
>  		 	   		  
> _________________________________________________________________
> Vous voulez savoir ce que vous pouvez faire avec le nouveau Windows Live ? Lancez-vous !
> http://www.microsoft.com/windows/windowslive/default.aspx
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users

-- 
Martin Mann, Dipl. Bioinf.
Bioinformatics - Inst. of Computer Science
Albert-Ludwigs-University Freiburg
Tel: ++49-761-203-8259
Fax: ++49-761-203-7462
http://www.bioinf.uni-freiburg.de/~mmann/




More information about the gecode-users mailing list