Hi, What you do is almost correct. What you also have to take into account is the following: (a) in the copy constructor used during cloning you also have to update start and end (b) you have to change the print function: it assumes that all values in succ are actually also positions in succ. So with your change, printing just crashes.
If you had enabled a debug build of the problem you would have seen (b). Cheers Christian -- Christian Schulte, www.ict.kth.se/~cschulte/ -----Original Message----- From: users-boun...@gecode.org [mailto:users-boun...@gecode.org] On Behalf Of Henrik Sent: Sunday, December 18, 2011 9:36 PM To: users@gecode.org Subject: [gecode-users] Path constraint Hi, I might might as well say that i am a newbie at Gecode. I have been looking into creating a path constraint for the TSP example created by Schulte. As you probably know it implements a circuit constraint. What i have done is change the circuit constraint with a path constraint, and added a start and end IntVar. I have then altered the "Actual model" so instead of: TSP(const SizeOptions& opt) : p(ps[opt.size()]), succ(*this, p.size(), 0, p.size()-1), total(*this, 0, p.max()) it instead says: TSP(const SizeOptions& opt) : p(ps[opt.size()]), succ(*this, p.size(), 0, p.size()), start(*this,0,p.size()), end(*this,0,p.size()), total(*this, 0, p.max()) When i run it the program shows part of a route/path and then fails. My question is: Is there something which i have done wrong in the code provided? Thanks in advance, Henrik. _______________________________________________ Gecode users mailing list users@gecode.org https://www.gecode.org/mailman/listinfo/gecode-users _______________________________________________ Gecode users mailing list users@gecode.org https://www.gecode.org/mailman/listinfo/gecode-users