Domain of variable #1734
-
I'm using HiGHs with python and I have some issues about the domain of the variable. Can we specify that we only want a solution with natural number or even binary number ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Yes, the type of a variable can be set to
Bounds on variables can be changed using the following changeColsBounds(n, indices, lower, upper) Feel free to ask further questions |
Beta Was this translation helpful? Give feedback.
Yes, the type of a variable can be set to
highspy.HighsVarType.kInteger
and then its bounds used to define the range of integer values that it may take. How you do this in practice depends on how you are defining your model.If you are populating an instance of the
HighsLp
class, then set the entries of theintegrality_
vector to the valuehighspy.HighsVarType.kInteger
, and the values of thecolLower_
andcolUpper_
vectors to the desired bounds.If you have built the model by defining variables and constraints, you call the following
highspy
method, wheren
is the number of variables that you want to be integer-valued,indices
is the list of lengthn
of the indices of variables to be …