[gecode-users] unassign variables

Christian Schulte cschulte at kth.se
Tue Oct 1 13:50:09 CEST 2013


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-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of kTorpi
Sent: Tuesday, October 01, 2013 1:45 PM
To: users at 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20131001/ab90fd78/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ~WRD000.jpg
Type: image/jpeg
Size: 823 bytes
Desc: not available
URL: <http://www.gecode.org/pipermail/users/attachments/20131001/ab90fd78/attachment.jpg>


More information about the users mailing list