@@ -1677,6 +1677,49 @@ cdef class Variable(Expr):
16771677 """
16781678 return SCIPvarGetAvgSol(self .scip_var)
16791679
1680+ def markRelaxationOnly (self ):
1681+ """
1682+ marks that this variable has only been introduced to define a relaxation
1683+
1684+ The variable must not have a coefficient in the objective and must be deletable.
1685+ If it is not marked deletable, it will be marked as deletable, which is only possible before
1686+ the variable is added to a problem.
1687+
1688+ Returns
1689+ -------
1690+ None
1691+
1692+ """
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)
1711+
1712+ def isDeletable (self ):
1713+ """
1714+ Returns whether variable is allowed to be deleted completely from the problem.
1715+
1716+ Returns
1717+ -------
1718+ bool
1719+
1720+ """
1721+ return SCIPvarIsDeletable(self .scip_var)
1722+
16801723 def getNLocksDown (self ):
16811724 """
16821725 Returns the number of locks for rounding down.
@@ -3745,7 +3788,7 @@ cdef class Model:
37453788
37463789 # Variable Functions
37473790
3748- def addVar (self , name = ' ' , vtype = ' C' , lb = 0.0 , ub = None , obj = 0.0 , pricedVar = False , pricedVarScore = 1.0 ):
3791+ def addVar (self , name = ' ' , vtype = ' C' , lb = 0.0 , ub = None , obj = 0.0 , pricedVar = False , pricedVarScore = 1.0 , deletable = False ):
37493792 """
37503793 Create a new variable. Default variable is non-negative and continuous.
37513794
@@ -3801,6 +3844,9 @@ cdef class Model:
38013844 else :
38023845 raise Warning (" unrecognized variable type" )
38033846
3847+ if deletable:
3848+ SCIPvarMarkDeletable(scip_var)
3849+
38043850 if pricedVar:
38053851 PY_SCIP_CALL(SCIPaddPricedVar(self ._scip, scip_var, pricedVarScore))
38063852 else :
0 commit comments