[gecode-users] Queens without using post
Christian Schulte
cschulte at kth.se
Thu Feb 21 01:14:01 CET 2008
Just use linear and rel constraints to do that, a little math tells you:
q[i] + i != q[j] + j ó q[i] q[j] != j-i
Christian
--
Christian Schulte, www.ict.kth.se/~cschulte/
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Mauricio Toro
Sent: Thursday, February 21, 2008 2:17 AM
To: gecode at gecode.org
Subject: [gecode-users] Queens without using post
Hello,
Can somebody help to rewrite this code without using post
Queens(const SizeOptions& opt)
: q(this,opt.size(),0,opt.size()-1) {
const int n = q.size();
switch (opt.propagation()) {
case PROP_BINARY:
for (int i = 0; i<n; i++)
for (int j = i+1; j<n; j++) {
post(this, q[i] != q[j]);
post(this, q[i]+i != q[j]+j);
post(this, q[i]-i != q[j]-j);
}
It is taken from the queens example.
It will be used for the Common Lisp port examples.
We have not ported "post" for Common Lisp yet.
Thanks
--
Mauricio Toro Bermudez
Estudiante de Ingeniería de Sistemas
Pontificia Universidad Javeriana, Colombia
Stagiare à l'Ircam
1, place Igor-Stravinsky 75004 Paris,
France de 2008 à 2009
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20080221/15baa7f1/attachment.htm>
More information about the gecode-users
mailing list