Convert a Problem-based model to a Solver-based model using prob2struct in MATLAB
7 views (last 30 days)
Show older comments
I'm trying to convert a problem-based model to a solver-based model so that I can use other solvers to solve my problem. The prob2struct function returns a structure which defines the model with some matrixes like Aeq and beq. I'm confused about what does matrix C and d in the returned structure mean. A demo code is attached below.
clc
clear
qprob = optimproblem;
var_x = optimvar('var_x',2);
constr = var_x >= 5;
qprob.Constraints.x_range = constr;
qprob.Constraints.xs = var_x(1) >= var_x(2) + 10;
qprob.Objective = sum((var_x - [2,3]').^2)+8;
opts = optimoptions('lsqlin','Algorithm','interior-point');
[sol,fval,exitflag,output,lambda] = solve(qprob,'options',opts);
problem = prob2struct(qprob);
0 Comments
Answers (1)
Raunak Gupta
on 24 Jun 2020
Hi,
Since the problem is framed using ‘lsqlin’ the prob2struct is returning the problem structure as per lsqlin optimization problem setup. Here it is explained how the objective function is setup in terms of matrices. For detailed description about matrices you may look here.
Hope this clarifies doubt about matric C and d.
0 Comments
See Also
Categories
Find more on Linear Least Squares 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!