Fixing issue with file names that have spaces, and issue with SCIP not writing 0-valued variables to .sol file.
This commit is contained in:
@@ -2573,8 +2573,8 @@ class SCIP_CMD(LpSolver_CMD):
|
|||||||
|
|
||||||
lp.writeLP(tmpLp)
|
lp.writeLP(tmpLp)
|
||||||
proc = [
|
proc = [
|
||||||
'scip', '-c', 'read %s' % tmpLp, '-c', 'optimize',
|
'scip', '-c', 'read "%s"' % tmpLp, '-c', 'optimize',
|
||||||
'-c', 'write solution %s' % tmpSol, '-c', 'quit'
|
'-c', 'write solution "%s"' % tmpSol, '-c', 'quit'
|
||||||
]
|
]
|
||||||
proc.extend(self.options)
|
proc.extend(self.options)
|
||||||
if not self.msg:
|
if not self.msg:
|
||||||
@@ -2588,7 +2588,14 @@ class SCIP_CMD(LpSolver_CMD):
|
|||||||
raise PulpSolverError("PuLP: Error while executing "+self.path)
|
raise PulpSolverError("PuLP: Error while executing "+self.path)
|
||||||
|
|
||||||
lp.status, values = self.readsol(tmpSol)
|
lp.status, values = self.readsol(tmpSol)
|
||||||
lp.assignVarsVals(values)
|
|
||||||
|
# Make sure to add back in any 0-valued variables SCIP leaves out.
|
||||||
|
finalVals = {}
|
||||||
|
for v in lp.variables():
|
||||||
|
finalVals[v.name] = values.get(v.name, 0.0)
|
||||||
|
|
||||||
|
lp.assignVarsVals(finalVals)
|
||||||
|
|
||||||
if not self.keepFiles:
|
if not self.keepFiles:
|
||||||
for f in (tmpLp, tmpSol):
|
for f in (tmpLp, tmpSol):
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user