Function applied to variable for more flexible domain
AnsweredOptimizing a problem f(x), where 0.0 <= x <=1 .0
Is it possible to achieve below when solving x?
when x < threshold, x== 0
when x >= threshold, x== x
0
-
You can define x as a semi-continuous variable. A semi-continuous variable has the property that it takes a value of 0 or a value between the specified lower and upper bounds. With the Python API, you can define your x variable as follows:
x = model.addVar( lb = threshold, vtype = "S", name ="x")
0 -
Thank you. I'll try it out
0
Please sign in to leave a comment.
Comments
2 comments