Convert a Problem-based model to a Solver-based model using prob2struct in MATLAB
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Raunak Gupta
il 24 Giu 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 Commenti
Vedere anche
Categorie
Scopri di più su Linear Least Squares in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!