Dear Gecode users and maintainers I was wondering whether I can use auxilliary variables to formulate and post constraints (i.e., propagators) in my model in the initial constructor without copying them in the copy constructor (as long as I don't want to use their values later on and thus do not need them as member variables in my Space subclass). It seems that this is true and everything still works correctly. (However, I may need to post branchings for them, too, depending on how they are used.) Am I right? So, I conclude that variable implementations are taken care of either by the Space or indirectly when the propagators/branchers are copying their views.
Are there any caveats? Here's a small working example (which is not useful, but a test to experiment whether I am right): using namespace Gecode; class Test : public Space { protected: IntVar a, b; public: Test(void) { a = IntVar(*this, 1, 5); b = IntVar(*this, 1, 5); IntVar a_temp = IntVar(*this, 1, 5); IntVar b_temp = IntVar(*this, 1, 5); rel(*this, a == a_temp); rel(*this, b == b_temp); rel(*this, 2 * a_temp == b_temp); branch(*this, a, INT_VAL_MED()); branch(*this, b, INT_VAL_MED()); } void print(void) const { std::cout << a << " " << b << std::endl; } Test(Test& s) : Space(s) { a.update(*this, s.a); b.update(*this, s.b); } virtual Space* copy() { return new Test(*this); } }; Thanks Sebastian _______________________________________________ Gecode users mailing list users@gecode.org https://www.gecode.org/mailman/listinfo/gecode-users