Skip to content

Commit e7026d3

Browse files
committed
Fix and add isRelaxationOnly
1 parent d938ef9 commit e7026d3

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
- Added support for knapsack constraints
77
- Added isPositive(), isNegative(), isFeasLE(), isFeasLT(), isFeasGE(), isFeasGT(), isHugeValue(), and tests
88
- Added SCIP_LOCKTYPE, addVarLocksType(), getNLocksDown(), getNLocksUp(), getNLocksDownType(), getNLocksUpType(), and tests
9-
- Added SCIPvarMarkRelaxationOnly
9+
- Added SCIPvarMarkRelaxationOnly, SCIPvarIsRelaxationOnly
1010
### Fixed
1111
- Raised an error when an expression is used when a variable is required
1212
### Changed

src/pyscipopt/scip.pxd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,7 @@ cdef extern from "scip/scip.h":
818818
SCIP_VARDATA* SCIPvarGetData(SCIP_VAR* var)
819819
SCIP_Real SCIPvarGetAvgSol(SCIP_VAR* var)
820820
void SCIPvarMarkRelaxationOnly(SCIP_VAR* var)
821+
SCIP_Bool SCIPvarIsRelaxationOnly(SCIP_VAR* var)
821822
SCIP_Real SCIPgetVarPseudocost(SCIP* scip, SCIP_VAR* var, SCIP_BRANCHDIR dir)
822823
SCIP_Real SCIPvarGetCutoffSum(SCIP_VAR* var, SCIP_BRANCHDIR dir)
823824
SCIP_Longint SCIPvarGetNBranchings(SCIP_VAR* var, SCIP_BRANCHDIR dir)

src/pyscipopt/scip.pxi

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1690,7 +1690,24 @@ cdef class Variable(Expr):
16901690
None
16911691
16921692
"""
1693-
PY_SCIP_CALL(SCIPvarMarkRelaxationOnly(self.scip_var))
1693+
SCIPvarMarkRelaxationOnly(self.scip_var)
1694+
1695+
def isRelaxationOnly(self):
1696+
"""
1697+
returns whether a variable has been introduced to define a relaxation
1698+
1699+
These variables are only valid for the current SCIP solve round, they are not contained in any (checked)
1700+
constraints, but may be used in cutting planes, for example. Relaxation-only variables are not copied
1701+
by SCIPcopyVars and cuts that contain these variables are not added as linear constraints when
1702+
restarting or transferring information from a copied SCIP to a SCIP. Also conflicts with relaxation-only
1703+
variables are not generated at the moment. Relaxation-only variables do not appear in the objective.
1704+
1705+
Returns
1706+
-------
1707+
bool
1708+
1709+
"""
1710+
return SCIPvarIsRelaxationOnly(self.scip_var)
16941711

16951712
def getNLocksDown(self):
16961713
"""

0 commit comments

Comments
 (0)