[gecode-users] Encoding of tuples as values

Christian Schulte cschulte at kth.se
Mon Feb 20 16:44:29 CET 2012


Hi Martin,

Gecode does not have tuples so you would have to represent this by two
variables. However, this representation is rather weak (you might want to
read Tip 6.3 in MPG what the issue is) as one can only express information
about each component in the tuple individually but not information about
tuples (that is, ruling out certain combinations of values).

Then there is even a hand-optimized propagator for the constraint you are
talking about (it is used for matrix element constraints) but unfortunately
the constraint is not directly available in a Gecode model. If you look at
the file gecode/int/element.cpp and search "pair" you will see what I mean.
Maybe I should make the constraint available in general. What do you say?

Cheers
Christian

--
Christian Schulte, www.ict.kth.se/~cschulte/

-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Martin Mann
Sent: Monday, February 20, 2012 4:08 PM
To: gecode user list
Subject: [gecode-users] Encoding of tuples as values


Hi everybody,

after years I am back to implement a CSP with Gecode and would like to get
your feedback on the best way how to handle the encoding.

My problem has integer tuples (i,j) as values for its variables while i and
j are bound by an interval [1,n], ie. (i,j) \in (n x n), and n usually <
200.

There has been much change in the Gecode library since I used it. Is there
already a way to directly use tuples as values or do I have to encode them
via integers?

If not, do you see a better/faster way of encoding than doing
   v = i*(n+1) + j
such that I get i=(v/(n+1)) and j=(v%(n+1))?

If yes, do you expect a large performance difference between using tuples or
encode/decode integers? I will only need a global "distinct" 
constraint, some binary order constraints and some instances of a
selfwritten binary constraint.

Thanks for your feedback!

Yours,
Martin


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


_______________________________________________
Gecode users mailing list
users at gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users




More information about the users mailing list