Convert a Problem-based model to a Solver-based model using prob2struct in MATLAB

1 次查看(过去 30 天)
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);

回答(1 个)

Raunak Gupta
Raunak Gupta 2020-6-24
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.

类别

Help CenterFile Exchange 中查找有关 Linear Least Squares 的更多信息

标签

产品


版本

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by