mpt_solve

Purpose

A gateway function to solve non-parametric optimization problems (without errorchecks)

Syntax

R = mpt_solve(S)

Description

The function is the main routine for fast calls for solving non-parametric optimization problems in MPT. In fact, it is a subroutine of Opt as a part of solve method. The Opt class serves as general wrapper for preprocessing the data involved in optimization, including necessary error checks. Once the data are valid, then are passed to mpt_solve function that calls the appropriate solver. It is assumed that QP/LP/MIQP/MILP and entering this function (for LP/MILP ../../../../fig/mpt/modules/solvers/mpt_solve1.png) is of the form

../../../../fig/mpt/modules/solvers/mpt_solve28.png

where the set ../../../../fig/mpt/modules/solvers/mpt_solve2.png represents which is given by strings in vartype field. The matrices ../../../../fig/mpt/modules/solvers/mpt_solve8.png, ../../../../fig/mpt/modules/solvers/mpt_solve9.png, ../../../../fig/mpt/modules/solvers/mpt_solve10.png, and vectors ../../../../fig/mpt/modules/solvers/mpt_solve11.png,../../../../fig/mpt/modules/solvers/mpt_solve12.png, ../../../../fig/mpt/modules/solvers/mpt_solve13.png, lb, ub are the problem data, then ../../../../fig/mpt/modules/solvers/mpt_solve14.png are the decision variables. The LCP must be given as:

../../../../fig/mpt/modules/solvers/mpt_solve29.png

where the matrices ../../../../fig/mpt/modules/solvers/mpt_solve15.png, ../../../../fig/mpt/modules/solvers/mpt_solve16.png, and vectors ../../../../fig/mpt/modules/solvers/mpt_solve17.png are the problem data, ../../../../fig/mpt/modules/solvers/mpt_solve18.png, ../../../../fig/mpt/modules/solvers/mpt_solve19.png are the decision variables to be determined. The function mpt_solve processes the problem data and passes it to the appropriate solver. The particular solver can be specified by providing solver name or it is selected automatically from the list of available solvers. Based on the solver name, the appropriated function is called:

Input Arguments

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 ../../../../fig/mpt/modules/solvers/mpt_solve20.png

Class: double

S.b

right hand side of the inequality constraints ../../../../fig/mpt/modules/solvers/mpt_solve21.png

Class: double

S.Ae

linear part of the equality constraints ../../../../fig/mpt/modules/solvers/mpt_solve22.png

Class: double

Default: []

S.be

right hand side of the equality constraints ../../../../fig/mpt/modules/solvers/mpt_solve23.png

Class: double

Default: []

S.lb

lower bound for the variables ../../../../fig/mpt/modules/solvers/mpt_solve24.png

Class: double

Default: []

S.ub

upper bound for the variables ../../../../fig/mpt/modules/solvers/mpt_solve25.png

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 ../../../../fig/mpt/modules/solvers/mpt_solve26.png

Class: double

S.me

number of equalities in ../../../../fig/mpt/modules/solvers/mpt_solve27.png

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

Output Arguments

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

Example(s)

Example 1

Solve an LP stored in file sc50b. Load the data
 load sc50b 
 Solve 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: 1

Solve with LCP solver
 S.solver = 'LCP'; 

 R2 = mpt_solve(S) 
R2 = 

        xopt: [48x1 double]
      lambda: [1x1 struct]
         obj: -69.9999999999999
         how: 'ok'
    exitflag: 1

You can see that the results are the same.
 norm(x-R1.xopt) 
ans =

      5.71049616954122e-11

 norm(x-R2.xopt) 
ans =

      5.71049616954122e-11

See Also

opt


© 2010-2013 Martin Herceg: ETH Zurich, herceg@control.ee.ethz.ch