Skip to content

Commit

Permalink
Merge pull request scipopt#356 from SCIP-Interfaces/sm/probingbounds
Browse files Browse the repository at this point in the history
adds bound changes in probing
  • Loading branch information
fserra authored Mar 27, 2020
2 parents da9204a + 3052e8d commit 0518867
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- add Model.applyCutsProbing and Model.propagateProbing
- add Model.separateSol
- add methods to work with nonlinear rows
- adds chgVarUbProbing and chgVarLbProbing to change a variables upper or lower bound during probing mode.

## 2.2.3 - 2019-12-10
### Added
Expand Down
2 changes: 2 additions & 0 deletions src/pyscipopt/scip.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,8 @@ cdef extern from "scip/scip.h":
SCIP_RETCODE SCIPgetProbingDepth(SCIP* scip)
SCIP_RETCODE SCIPbacktrackProbing(SCIP* scip, int probingdepth)
SCIP_RETCODE SCIPchgVarObjProbing(SCIP* scip, SCIP_VAR* var, SCIP_Real newobj)
SCIP_RETCODE SCIPchgVarUbProbing(SCIP* scip, SCIP_VAR* var, SCIP_Real newbound)
SCIP_RETCODE SCIPchgVarLbProbing(SCIP* scip, SCIP_VAR* var, SCIP_Real newbound)
SCIP_RETCODE SCIPsolveProbingLP(SCIP* scip, int itlim, SCIP_Bool* lperror, SCIP_Bool* cutoff)
SCIP_RETCODE SCIPendProbing(SCIP* scip)
SCIP_RETCODE SCIPfixVarProbing(SCIP* scip, SCIP_VAR* var, SCIP_Real fixedval)
Expand Down
20 changes: 20 additions & 0 deletions src/pyscipopt/scip.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3766,6 +3766,26 @@ cdef class Model:
"""changes (column) variable's objective value during probing mode"""
PY_SCIP_CALL( SCIPchgVarObjProbing(self._scip, var.scip_var, newobj) )

def chgVarLbProbing(self, Variable var, lb):
"""changes the variable lower bound during probing mode
:param Variable var: variable to change bound of
:param lb: new lower bound (set to None for -infinity)
"""
if lb is None:
lb = -SCIPinfinity(self._scip)
PY_SCIP_CALL(SCIPchgVarLbProbing(self._scip, var.scip_var, lb))

def chgVarUbProbing(self, Variable var, ub):
"""changes the variable upper bound during probing mode
:param Variable var: variable to change bound of
:param ub: new upper bound (set to None for +infinity)
"""
if ub is None:
ub = SCIPinfinity(self._scip)
PY_SCIP_CALL(SCIPchgVarUbProbing(self._scip, var.scip_var, ub))

def fixVarProbing(self, Variable var, fixedval):
"""Fixes a variable at the current probing node."""
PY_SCIP_CALL( SCIPfixVarProbing(self._scip, var.scip_var, fixedval) )
Expand Down

0 comments on commit 0518867

Please sign in to comment.