All Classes Files Functions Variables
HybridTrajectoryOptimization Class Reference

HybridTrajectoryOptimization. More...

Inheritance diagram for HybridTrajectoryOptimization:
Collaboration diagram for HybridTrajectoryOptimization:

Public Member Functions

function HybridTrajectoryOptimization (traj_opt, plant, mode_sequence, N, duration, options)
function addModeConstraint (obj, mode_ind, varargin)
function addModeStateConstraint (obj, mode_ind, varargin)
function addModeInputConstraint (obj, mode_ind, varargin)
function addModeInitialCost (obj, mode_ind, initial_cost)
function addModeFinalCost (obj, mode_ind, final_cost_function)
function addModeRunningCost (obj, mode_ind, running_cost_function)
function compile (obj)
function addJumpConstraints (obj)
function getInitialVars (obj, t_init, traj_init)
function solveTraj (obj, t_init, traj_init)
 Solve the nonlinear program and return resulting trajectory. More...
- Public Member Functions inherited from NonlinearProgram
function NonlinearProgram (num_vars, x_name)
function addCompositeConstraints (obj, cnstr, xind, data_ind)
 add a CompositeConstraint to the object, change the constraint evalation of the program. More...
function addConstraint (obj, cnstr, varargin)
 obj = addConstraint(obj,cnstr,varargin) Queries the constraint type and calls the appropriate addConstraint method (e.g. More...
function addNonlinearConstraint (obj, cnstr, xind, data_ind)
 add a NonlinearConstraint to the object, change the constraint evalation of the program. More...
function addLinearConstraint (obj, cnstr, xind)
 add a LinearConstraint to the program More...
function addBoundingBoxConstraint (obj, cnstr, xind)
 add a BoundingBoxConstraint to the program More...
function addCost (obj, cnstr, xind, data_ind)
 Add a cost to the objective function. More...
function addQuadraticCost (obj, Q, x_desired, xind)
 helper function for the very common case of adding the objective g(x) = (x-xd)'Q(x-xd), Q = Q' >= 0 More...
function getArgumentArray (obj, x, xind)
 Retrieves the elements from the vector x related to xind and returns them as a cell array where: args{i} = x(xind{i}) More...
function nonlinearConstraints (obj, x)
 evaluate the nonlinear constraints More...
function objective (obj, x)
 return the value of the objective More...
function objectiveAndNonlinearConstraints (obj, x)
 evaluate the objective and the nonlinear constraints altogher More...
function addDecisionVariable (obj, num_new_vars, var_name)
 appending new decision variables to the end of the current decision variables More...
function replaceCost (obj, cost, cost_idx, xind)
 replace the cost_idx'th cost in the original problem with a new cost More...
function addSharedDataFunction (obj, user_fun, xind)
 Adds the specified shared data function to be evaluated within each iteration of the program. More...
function getNumSharedDataFunctions (obj)
function evaluateSharedDataFunctions (obj, x)
 Evaluate all shared data functions and return the data object. More...
function addDisplayFunction (obj, display_fun, indices)
 add a dispay function that gets called on every iteration of the algorithm More...
function setCheckGrad (obj, check_grad)
function setConstraintErrTol (obj, tol)
function setSolver (obj, solver)
function setSolverOptions (obj, solver, optionname, optionval)
function getNonlinearGradientSparsity (obj)
 This function sets the nonlinear sparsity vector iGfun and jGvar based on the nonlinear sparsity of the objective, nonlinear inequality constraints and nonlinear equality constraints. More...
function bounds (obj)
 return the bounds for all the objective function, nonlinear constraints and linear constraints More...
function solve (obj, x0)
function compareSolvers (obj, x0, solvers)
function isNonlinearConstraintID (obj, cnstr_id)
 Given an ID, determine if any of the nonlinear constraint obj.nlcon has that ID. More...
function isLinearConstraintID (obj, cnstr_id)
 Given an ID, determine if any of the linear constraint obj.lcon has that ID. More...
function isBoundingBoxConstraintID (obj, cnstr_id)
 Given an ID, determine if any of the bounding box constraint obj.bbcon has that ID. More...
function deleteConstraint (obj, delete_cnstr_id)
 delete a constraint from the program More...
function updateConstraint (obj, varargin)
 update a Constraint of the program. More...
function deleteNonlinearConstraint (obj, delete_cnstr_id)
 delete a nonlinear constraint from the program More...
function updateNonlinearConstraint (obj, varargin)
 updateNonlinearConstraint(obj,cnstr_id,cnstr,xind,data_ind) update the nonlinear constraint whose id=cnstr_id with a new Constraint object cnstr, the newly added Constraint cnstr has the ID new_cnstr_id More...
function deleteLinearConstraint (obj, delete_cnstr_id)
 delete the LinearConstraint obj.lcon{cnstr_idx} from the program More...
function updateLinearConstraint (obj, varargin)
 updateLinearConstraint(obj,cnstr_id,cnstr,xind) update the linear constraint whose id=cnstr_id with a new Constraint object cnstr, the newly added Constraint cnstr has the ID new_cnstr_id More...
function deleteBoundingBoxConstraint (obj, cnstr_id)
 delete the BoundingBoxConstraint in obj.bbcon with ID=cnstr_id from the program More...
function updateBoundingBoxConstraint (obj, varargin)
 updateBoundingBoxConstraint(obj,cnstr_id,cnstr,xind) update the BoundingBoxConstraint whose id=cnstr_id with a new BoundingBoxConstraint cnstr More...

Public Attributes

Property N
Property M
Property mode_sequence
Property mode_opt
Property mixed_constraint_args
Property var_offset
Property shared_data_offset
Property plant
Property is_compiled

Additional Inherited Members

- Protected Member Functions inherited from NonlinearProgram
function snopt (obj, x0)
function fmincon (obj, x0)
 if (obj.num_cin + obj.num_ceq) nonlinearConstraints = .nonlinearConstraint; else nonlinearConstraints = []; end More...
function ipopt (obj, x0)
function setVarBounds (obj, lb, ub)
function mapSolverInfo (obj, exitflag, x)
 Based on the solver information and solution, re-map the info. More...
- Protected Attributes inherited from NonlinearProgram
Property num_vars
Property num_cin
Property num_ceq
Property Ain
Property bin
Property Ain_name
Property Aeq
Property beq
Property Aeq_name
Property cin_lb
Property cin_ub
Property cin_name
Property ceq_name
Property x_lb
Property x_ub
Property x_name
Property solver
Property solver_options
Property display_funs
Property display_fun_indices
Property check_grad
Property constraint_err_tol
 numerical gradient at the begining and end of the nonlinear optimization More...
Property nlcon
Property lcon
Property bbcon
Property cost
Property nlcon_xind
Property bbcon_xind
 nlcon{i}.eval(x(nlcon_xind{i}{1},x(nlcon_xind{i}{2},) cost_xind_cell % A cell array, cost_xind{i} is a cell array of int vectors recording the indices of x that is used in evaluating obj.cost{i} More...
Property shared_data_xind_cell
 a cell array like nlcon_xind, where shared_data_xind_cell{i} is a cell array of int vectors recording indices used in evaluating the shared_data_function More...
Property nlcon_dataind
 a cell array of function handles, each of which returns a data object so that shared_data{i} = shared_data_functions(x(shared_data_xind_cell{i}{1}),x(shared_data_xind_cell{i}{2}),) shared_data_functions More...
Property cost_dataind
Property iFfun
 2 if user has their own snopt in MATLAB path More...
Property iCinfun
Property iCeqfun

Detailed Description


Trajectory optimization class for hybrid models Works by constructing a series of trajectory optimization programs for each mode in the mode sequence. The trajectories of each mode are then constrained so that (1) The transitions between them align appropriately and (2) Guard functions are triggered at the transitions and (3) Guard functions are never violated

After construction, constraints can be added to the hybrid optimization program directly, or to the individual mode optimizations. Before running, it is recommended to call the compile() function, which extracts all constraints from the mode optimization programs and adds them to the main program. compile() should only be called ONCE!!

Basic outline: traj_opt = HybridTrajectoryOptimizatino(); % traj_opt = traj_opt.addConstraint() % traj_opt = traj_opt.addModeConstraint() % % traj_opt = traj_opt.compile() traj_opt.solveTraj()

Constructor & Destructor Documentation

function HybridTrajectoryOptimization ( traj_opt  ,
plant  ,
mode_sequence  ,
N  ,
duration  ,
traj_optA reference to the appropriate DirectTrajectoryOptimization class (function handle to the constructor)
mode_sequencea mx1 vector of mode indices
Na mx1 vector of timesteps per mode
durationa mx1 cell-array of durations
optionsperiodic - enforces that the first state/control of the first mode equals the last state/control of the last mode u_const_across_transitions - control input must be constant at transition times
Return values

Member Function Documentation

function addJumpConstraints ( obj  )
Return values
function addModeConstraint ( obj  ,
mode_ind  ,
Return values
function addModeFinalCost ( obj  ,
mode_ind  ,
Return values
function addModeInitialCost ( obj  ,
mode_ind  ,
Return values
function addModeInputConstraint ( obj  ,
mode_ind  ,
Return values
function addModeRunningCost ( obj  ,
mode_ind  ,
Return values
function addModeStateConstraint ( obj  ,
mode_ind  ,
Return values
function compile ( obj  )
Return values
function getInitialVars ( obj  ,
t_init  ,
Return values
function solveTraj ( obj  ,
t_init  ,

Solve the nonlinear program and return resulting trajectory.

t_initinitial timespan for solution. can be a vector of length obj.N specifying the times of each segment, or a scalar indicating the final time.
traj_init(optional) a structure containing Trajectory objects specifying the initial guess for the system inputs traj_init.u , traj_init.x, %
Default: small random numbers
Return values

Member Data Documentation

Property is_compiled
Property M
Property mixed_constraint_args
Property mode_opt
Property mode_sequence
Property N
Property plant
Property shared_data_offset
Property var_offset

The documentation for this class was generated from the following file: