linopt mixed integer, binary program
13 views (last 30 days)
Show older comments
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.
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
0 Comments
Accepted Answer
Walter Roberson
on 4 Dec 2013
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}])
More Answers (0)
See Also
Categories
Find more on Memory Usage in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!