How can I make optimization variables binary while using prob2struct?
이전 댓글 표시
Hello,
I am solving a quadratic maximization problem, where I have created a matrix of binary variables x with 6 rows and 10 columns using the statement:
x=optimvar('x',6,10,'type','integer','LowerBound',0,'UpperBound',1);
Once my problem has been defined with all of the constraints and the objective function, I had to solve it, for which I used:
problem=prob2struct(prob_1);
[x,fvar]=quadprog(problem);
I had defined prob_1 as the name of the optimization problem that I am solving.
Although the program does not give out any errors or warnings, the solution for the variables that Matlab is giving me is not binary: it is respecting the upper and lower bound that I had set for my program, but it does not read the 'type','integer'part, and I do not understand why.
What could I do to ensure that Matlab gives out an integer solution to this problem?
Thx!!
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Quadratic Programming and Cone Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!