Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to set priced variable score #623

Merged
merged 2 commits into from
Nov 6, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/pyscipopt/scip.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1415,7 +1415,7 @@ cdef class Model:

# Variable Functions

def addVar(self, name='', vtype='C', lb=0.0, ub=None, obj=0.0, pricedVar = False):
def addVar(self, name='', vtype='C', lb=0.0, ub=None, obj=0.0, pricedVar=False, pricedVarScore=1.0):
"""Create a new variable. Default variable is non-negative and continuous.

:param name: name of the variable, generic if empty (Default value = '')
Expand All @@ -1425,6 +1425,7 @@ cdef class Model:
:param ub: upper bound of the variable, use None for +infinity (Default value = None)
:param obj: objective value of variable (Default value = 0.0)
:param pricedVar: is the variable a pricing candidate? (Default value = False)
:param pricedVarScore: score of variable in case it is priced, the higher the better (Default value = 1.0)

"""
cdef SCIP_VAR* scip_var
Expand Down Expand Up @@ -1457,7 +1458,7 @@ cdef class Model:
raise Warning("unrecognized variable type")

if pricedVar:
PY_SCIP_CALL(SCIPaddPricedVar(self._scip, scip_var, 1.0))
PY_SCIP_CALL(SCIPaddPricedVar(self._scip, scip_var, pricedVarScore))
else:
PY_SCIP_CALL(SCIPaddVar(self._scip, scip_var))

Expand Down