Skip to content

Commit

Permalink
Merge pull request #757 from igorbanfi/issue-755
Browse files Browse the repository at this point in the history
Update Model._modelvars before freeTransfrom
  • Loading branch information
mmghannam authored Nov 30, 2023
2 parents e9a242e + c9c780c commit 19763ba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/pyscipopt/scip.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,11 @@ cdef class Model:

def freeTransform(self):
"""Frees all solution process data including presolving and transformed problem, only original problem is kept"""
self._modelvars = {
var: value
for var, value in self._modelvars.items()
if value.isOriginal()
}
PY_SCIP_CALL(SCIPfreeTransform(self._scip))

def version(self):
Expand Down
5 changes: 5 additions & 0 deletions tests/test_pricer.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ def test_cuttingstock():
assert type(s.getNSols()) == int
assert s.getNSols() == s.data["nSols"]

# Testing freeTransform
s.freeTransform()
for i in range(10):
s.addVar()

def test_incomplete_pricer():
class IncompletePricer(Pricer):
pass
Expand Down

0 comments on commit 19763ba

Please sign in to comment.