MATLAB: Linopt mixed integer, binary program

binary variableslinoptMATLABmixed integer program

Hi All, I am trying to figure out the syntax of the linopt::minimize function in MuPAD.
I want to specify some of my variables as integers, leave some as floats, and have some as binary variables.
I know that if leave the floating point variables alone, they will remain floating point.
If I set max and mins on the binary variable to 1 and 0 (that is, x <= 1, x >= 0), I can limit the variable to values between 0 and 1.
However, I cannot figure out the syntax for specifying a subset of variables to be integers.
In the linopt function, I am specifically referring to the argument seti.
For example, if I have the problem:
linopt::minimize([{xa1 + xa2 + xa3 + xa4 + xa5 <= 20,
xb1 + xb2 + xb3 +xb4 + xb5 <= 50,
xa1 <= 5,
xa2 <= 3,
xa3 <= 7,
xa4 <= 1,
xa5 <= 9,
xa1 - 2*xb1 = 0,
xa2 - 3*xb2 = 0,
xa3 - xb3 = 0,
xa4 - 4*xb4 = 0,
xa5 - 2*xb5 = 0},
-10*xa1-11*xa2-12*xa3-10*xa4-11*xa5])
I get the solution:
[OPTIMAL, {xa1 = 0, xa2 = 3, xa4 = 1, xa3 = 7, xa5 = 9, xb1 = 0, xb2 = 1, xb4 = 1/4, xb3 = 7, xb5 = 9/2}, -226]
But, I want xb4 and xb5 to be integer values.
How do I specify my problem so that xb4 and xb5 are integers?
Thanks for the help,
Lance

Best Answer

linopt::minimize([{xa1 + xa2 + xa3 + xa4 + xa5 <= 20,
xb1 + xb2 + xb3 +xb4 + xb5 <= 50,
xa1 <= 5,
xa2 <= 3,
xa3 <= 7,
xa4 <= 1,
xa5 <= 9,
xa1 - 2*xb1 = 0,
xa2 - 3*xb2 = 0,
xa3 - xb3 = 0,
xa4 - 4*xb4 = 0,
xa5 - 2*xb5 = 0},
-10*xa1-11*xa2-12*xa3-10*xa4-11*xa5, {}, {xb4, xb5}])