Hi,

The point is that you are not able anymore to use variables from other problems. Namely "assignment" is a variable from "p" not "p_new".

Vincent

On 12/05/16 02:18, 'Martin R' via sage-devel wrote:
Hi there!

I am having a severe problem with a program of mine that stopped working,
very likely after upgrading to 7.2.beta5, but I'm afraid I don't know from
which version.  (I believe something after 7.1)

The error I get is:

ValueError: Variable MIPVariable of dimension 1 is a variable from a
different problem

What I want to do is: check whether a MILP has a solution, and if so, check
whether it still has a solution if I add a further constraint.  The MILP's
take a very long time to solve.

What I do and what worked until very recently is roughly:

     p = MixedIntegerLinearProgram(constraint_generation=True,
solver="CPLEX") # solver="GLPK") # twice as long #
     assignment = p.new_variable(binary=True)

     p.add_constraint(... some relations in terms of assignment[box, colour]
... )

     p.solve()

     for (box, colour) in large_list:
         p_new = copy(p)
         p_new.add_constraint(assignment[box, colour] == 0)
         try:
             p_new.solve()

bang!

What should I do?

I don't have a minimal example exhibiting the error, but if absolutely
needed, I'd try to create one.

Many thanks,

Martin


--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to