linopt mixed integer, binary program
조회 수: 13 (최근 30일)
이전 댓글 표시
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
채택된 답변
Walter Roberson
2013년 12월 4일
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}])
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Memory Usage에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!