A gateway function to solve non-parametric optimization problems (without errorchecks)
R = mpt_solve(S)
S |
structure of the Opt class Class: struct |
S.H |
quadratic part of the objective function Class: double Default: [] |
S.f |
linear part of the objective function Class: double |
S.A |
linear part of the inequality constraints ![]() Class: double |
S.b |
right hand side of the inequality constraints ![]() Class: double |
S.Ae |
linear part of the equality constraints ![]() Class: double Default: [] |
S.be |
right hand side of the equality constraints ![]() Class: double Default: [] |
S.lb |
lower bound for the variables ![]() Class: double Default: [] |
S.ub |
upper bound for the variables ![]() Class: double Default: [] |
S.M |
Positive semi-definite matrix defining LCP. Class: double Default: [] |
S.q |
Right hand side vector defining LCP. Class: double Default: [] |
S.n |
problem dimension (number of variables) Class: double |
S.m |
number of inequalities in ![]() Class: double |
S.me |
number of equalities in ![]() Class: double |
S.problem_type |
a string specifying the problem to be solved Class: char |
S.vartype |
A string specifying the type of variable. Supported characters are
C (continuous), I (integer), B (binary), N (semi-integer), S (semi-continuous).
Example: First variable from three is binary, the rest is continuous: S.vartype='BCC';
Class: char |
S.solver |
S string specifying which solver should be called. Class: char |
S.test |
Call (false) or not to call (true) MPT global settings Class: logical Default: false |
R |
result structure Class: struct |
R.xopt |
Optimal solution Class: double |
R.obj |
Objective value Class: double |
R.lambda |
Lagrangian multipliers Class: double |
R.exitflag |
An integer value that informs if the result was feasible (1), or otherwise (different from 1) Class: double |
R.how |
A string that informs if the result was feasible ('ok'), or if any problem appeared through optimization Class: char |
load sc50bSolve the problem using LINPROG
[x,fval,exitflag,output] = linprog(f,A,b,Aeq,beq,lb,[],[]);
Optimization terminated.It is the same as solving using mpt_solve. Put the data to a structure S.
S.f=f; S.A=A; S.b=b; S.Ae=Aeq; S.be=beq; S.lb=lb;Solve with the default solver
R1 = mpt_solve(S)
R1 = xopt: [48x1 double] lambda: [1x1 struct] obj: -69.9999999999999 how: 'ok' exitflag: 1Solve with LCP solver
S.solver = 'LCP';
R2 = mpt_solve(S)
R2 = xopt: [48x1 double] lambda: [1x1 struct] obj: -69.9999999999999 how: 'ok' exitflag: 1You can see that the results are the same.
norm(x-R1.xopt)
ans = 5.71049616954122e-11
norm(x-R2.xopt)
ans = 5.71049616954122e-11
◀ | mpt_call_qpoases | mpt_call_mplp | ▶ |
© 2010-2013 Martin Herceg: ETH Zurich, herceg@control.ee.ethz.ch