Hi,

 

If you set up your problem (and the variables) correctly as described in
MPG, then it is quite simple:

- create a space s for your problem

- create a clone c of s (by the clone member function): now the variables in
s have been cloned to c.

- solve on s

- later you can use c where the variables are not assigned.

 

Christian

--

Christian Schulte, Professor of Computer Science, KTH,
www.ict.kth.se/~cschulte/

 

From: users-boun...@gecode.org [mailto:users-boun...@gecode.org] On Behalf
Of kTorpi
Sent: Tuesday, October 01, 2013 1:45 PM
To: users@gecode.org
Subject: [gecode-users] unassign variables

 

Image removed by sender.

Hi Everyone,

Is there any way to unassign a variable?

In my application i'm building a model: creating variables and constraints
from them, thees constraints actually BoolExpr objects created using the
minimodel module.

At a point I'd like to solve the  actual constraint (a BoolExpr), I solve
it, concrete values assigned to the variables that I created earlier, and
that the constraint created from. But later, I build other constraints from
these variables, and when I try to solve them, the variables are assigned
yet, but they should not be for me.

I tried to make copy of the vars, but if I use the copy constructor it
actually does not make a "hard copy". I also tried make hard copies like
this:

IntVar var(space, 0, 10);

IntVar hard_copy(space, var.min(), var.max());

but this method creats a totally new variable, which is not part of the
constraint to be solved. :(

Thank you,

Steve

<<~WRD000.jpg>>

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

Reply via email to