How can I make optimization variables binary while using prob2struct?
Show older comments
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!!
Answers (0)
Categories
Find more on Quadratic Programming and Cone Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!