From 45a01ede087f1752ff6607a85c6ceb71052c53a8 Mon Sep 17 00:00:00 2001 From: stu Date: Thu, 2 Oct 2014 11:53:00 +1300 Subject: [PATCH] fix for problem with LpProblem.deepcopy() --- src/pulp/pulp.py | 2 +- src/pulp/tests.py | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pulp/pulp.py b/src/pulp/pulp.py index f7aca00..2819d1e 100644 --- a/src/pulp/pulp.py +++ b/src/pulp/pulp.py @@ -1133,7 +1133,7 @@ class LpProblem(object): def deepcopy(self): """Make a copy of self. Expressions are copied by value""" lpcopy = LpProblem(name = self.name, sense = self.sense) - if lpcopy.objective is not None: + if self.objective is not None: lpcopy.objective = self.objective.copy() lpcopy.constraints = {} for k,v in self.constraints.items(): diff --git a/src/pulp/tests.py b/src/pulp/tests.py index 14ec552..412523d 100644 --- a/src/pulp/tests.py +++ b/src/pulp/tests.py @@ -505,7 +505,6 @@ def pulpTest122(solver): prob += -y+z == 7, "c3" prob.extend((w >= -1).makeElasticSubProblem(penalty = 1.1)) print("\t Testing elastic constraints (penalty unchanged)") - prob.writeLP('debug.lp') pulpTestCheck(prob, solver, [LpStatusOptimal], {x:4, y:-1, z:6, w:-1.0}) @@ -524,7 +523,6 @@ def pulpTest123(solver): prob += -y+z == 7, "c3" prob.extend((w >= -1).makeElasticSubProblem(penalty = 0.9)) print("\t Testing elastic constraints (penalty unbounded)") - prob.writeLP('debug.lp') if solver.__class__ in [COINMP_DLL, GUROBI, CPLEX_CMD, CPLEX_PY, YAPOSIB]: # COINMP_DLL Does not report unbounded problems, correctly pulpTestCheck(prob, solver, [LpStatusInfeasible])