Home > mpt > mpt_getInput.m

mpt_getInput

PURPOSE ^

MPT_GETINPUT For a given state, extracts the (optimal) output from a controller structure

SYNOPSIS ^

function [U,feasible,region,cost,details]=mpt_getInput(ctrl,x0,Options)

DESCRIPTION ^

MPT_GETINPUT For a given state, extracts the (optimal) output from a controller structure

 [U,feasible,region,cost,details] = mpt_getInput(ctrlStruct,x0,Options)

 ------------------------------------------------------------------------------
 DESCRIPTION
 ------------------------------------------------------------------------------
 For the given state x0, this function extracts the optimal output from a
 controller given by means of the controller structure ctrlStruct. If the
 controller partition is overlapping in the X space, the input U will be picked
 up such that an associated cost is minimized (i.e. if for x0 there are 2 or
 more associated control laws, only the one which minimizes a given criterion
 is returned. The criterion is either value of the objective function for
 optimal solution or minimum time for the time-optimal solution).

 ------------------------------------------------------------------------------
 INPUT
 ------------------------------------------------------------------------------
 ctrl              - MPT controller
 x0                - initial state
 Options.openloop  - 0 by default. If set to 1, the full optimizer as obtained
                     as a solution to the finite-time optimal control problem
                     is returned, i.e. U = [u_0 u_1 ... u_N] where N is the
                     prediction horizon
 Options.recover   - If set to 1 and there is no region associated to the
                     current state x0, but the state itself lies in the
                     feasible set of the controller, control law of the nearest
                     neighbour is used. Default is 0.
 Options.abs_tol   - absolute tolerance
 Options.verbose   - Level of verbosity
 Options.useXU     - if 1, use a control input based on an XUset istead of the 
                     usual (optimization) based control action. (default 0)
 Options.nlsolver  - which solver to use for nonlinear optimization.
                       'global' - can be VERY slow, but gives results which are
                                  close to global optimum (default)
                       'local'  - faster than global, but does not
                                  guarantee global optimality
 Options.nliter    - If global nonlinear solver is chosen, this parameter
                     specifies number of iterations (default is 10)
 Options.MaxSQPIter - Maximum number of iterations for fmincon. If your
                      nonlinear optimization seems to be stuck, try to set this
                      number to something like 1e3.
 Options.lowersolver - Lower bound solver for YALMIP (e.g. 'cdd', 'glpk', 'clp')
 Options.uppersolver - Upper bound solver for YALMIP (e.g. 'fmincon', 'none')
                       Set Options.uppersolver='none' if you don't have fmincon

 Note: If Options is missing or some of the fields are not defined, the default
       values from mptOptions will be used

 ------------------------------------------------------------------------------
 OUTPUT                                                                                                    
 ------------------------------------------------------------------------------
 U         - control input computed as U=F*x0 + G (or via other strategies),
 region    - index of a region which contains the optimal control input
             associated to the given state x0 
 cost      - value of the associated cost function
             NOTE: The cost is not necessarily the cost of the objective
                   function obtained for state x0, it can be also distance to
                   the invariant set(s) in case of time-optimal controller!
 feasible  - returns 1 if  the there is at least one control law associated to
             a given state x0, 0 otherwise
 details
  .inwhich - vector of indicies of regions which contain state x0
  .fullopt - full optimizer associated to the state x0
  .runtime - runtime of the on-line MPC
  .nops    - number of numerical operations (multiplications, summations,
             comparisons) needed to identify and compute a control action
             associated to a given x0 (only for explicit controllers)

 see also MPT_COMPUTETRAJECTORY, MPT_PLOTTIMETRAJECTORY

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Thu 30-Mar-2006 10:26:47 by m2html © 2003