Variable API#
- class pyscipopt.Variable#
Is a linear expression and has SCIP_VAR*
- getAvgSol()#
Get the weighted average solution of variable in all feasible primal solutions found.
- Return type:
float
- getImplType()#
Returns the implied integral type of the variable
- Return type:
PY_SCIP_IMPLINTTYPE
- getIndex()#
Retrieve the unique index of the variable.
- Return type:
int
- getLPSol()#
Retrieve the current LP solution value of variable.
- Return type:
float
- getLbGlobal()#
Retrieve global lower bound of variable.
- Return type:
float
- getLbLocal()#
Retrieve current lower bound of variable.
- Return type:
float
- getLbOriginal()#
Retrieve original lower bound of variable.
- Return type:
float
- getNBranchings(branchdir)#
returns the number of times a bound of the variable was changed in given direction due to branching
- Parameters:
branchdir (PY_SCIP_BRANCHDIR) – branching direction (downwards, or upwards)
- Return type:
int
- getNBranchingsCurrentRun(branchdir)#
returns the number of times a bound of the variable was changed in given direction due to branching in the current run
- Parameters:
branchdir (PY_SCIP_BRANCHDIR) – branching direction (downwards, or upwards)
- Return type:
int
- getNLocksDown()#
Returns the number of locks for rounding down.
- Return type:
int
- getNLocksDownType(locktype)#
Returns the number of locks for rounding down of a certain type.
- Parameters:
locktype (SCIP_LOCKTYPE) – type of variable locks
- Return type:
int
- getNLocksUp()#
Returns the number of locks for rounding up.
- Return type:
int
- getNLocksUpType(locktype)#
Returns the number of locks for rounding up of a certain type.
- Parameters:
locktype (SCIP_LOCKTYPE) – type of variable locks
- Return type:
int
- getObj()#
Retrieve current objective value of variable.
- Return type:
float
- getStatus()#
Retrieve the variable status (ORIGINAL, LOOSE, COLUMN, FIXED, AGGREGATED, MULTAGGR, NEGATED)
- Returns:
“ORIGINAL”, “LOOSE”, “COLUMN”, “FIXED”, “AGGREGATED”, “MULTAGGR”, “NEGATED”
- Return type:
str
- getUbGlobal()#
Retrieve global upper bound of variable.
- Return type:
float
- getUbLocal()#
Retrieve current upper bound of variable.
- Return type:
float
- getUbOriginal()#
Retrieve original upper bound of variable.
- Return type:
float
- isActive()#
Returns whether variable is an active (neither fixed nor aggregated) variable.
- Return type:
boolean
- isBinary()#
Returns whether variable is of BINARY type.
- Return type:
bool
- isDeletable()#
Returns whether variable is allowed to be deleted completely from the problem.
- Return type:
bool
- isImpliedIntegral()#
Returns whether variable is implied integral (weakly or strongly).
- Return type:
bool
- isInLP()#
Retrieve whether the variable is a COLUMN variable that is member of the current LP.
- Return type:
bool
- isIntegral()#
Returns whether variable is of INTEGER type.
- Return type:
bool
- isNonImpliedIntegral()#
Returns TRUE if the variable is integral, but not implied integral..
- Return type:
bool
- isOriginal()#
Retrieve whether the variable belongs to the original problem
- Return type:
bool
- isRelaxationOnly()#
returns whether a variable has been introduced to define a relaxation
These variables are only valid for the current SCIP solve round, they are not contained in any (checked) constraints, but may be used in cutting planes, for example. Relaxation-only variables are not copied by SCIPcopyVars and cuts that contain these variables are not added as linear constraints when restarting or transferring information from a copied SCIP to a SCIP. Also conflicts with relaxation-only variables are not generated at the moment. Relaxation-only variables do not appear in the objective.
- Return type:
bool
- markRelaxationOnly()#
marks that this variable has only been introduced to define a relaxation
The variable must not have a coefficient in the objective and must be deletable. If it is not marked deletable, it will be marked as deletable, which is only possible before the variable is added to a problem.
- Return type:
None
- varMayRound(direction='down')#
Checks whether it is possible to round variable up / down and stay feasible for the relaxation.
- Parameters:
direction (str) – “up” or “down”
- Return type:
bool
- vtype()#
Retrieve the variables type (BINARY, INTEGER, CONTINUOUS, or IMPLINT)
- Returns:
“BINARY”, “INTEGER”, “CONTINUOUS”, or “IMPLINT”
- Return type:
str