Convert a Problem-based model to a Solver-based model using prob2struct in MATLAB
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Raunak Gupta
el 24 de Jun. de 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 comentarios
Ver también
Categorías
Más información sobre Linear Least Squares en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!