Get Started

Configuration Options: automatic selected direct collocation method

This guide will help you configure ICLOCS2 for solving optimal control problems with automatically chosen direct collocation methods. For the current version of ICLOCS2, this function will need to be used together with already configured setting files settings_h.m and settings_hp.m.


Transcription and Discretization Methods

First we define the transcription and discretization methods as

options.transcription='AutoDirect';

and set solution construction method as default

options.resultRep='default';

Derivative generation

The derivative information can be supplied to ICLOCS2 via a number of different ways by setting

options.resultRep='...';

with

  • analytic: For simple problems, analytic differentiation may be used for the best computation speed. When this option is selected, the user must additionally supply the following file containing the derived analytical derivatives
    • gradCost.m: The gradient of the cost in analytic form
    • jacConst.m: The gradient of the plant model, path constraints and boundary constraints (constraint Jacobian)
    • hessianLagrangian.m: The Hessian of the Lagrangian
  • numeric: For many practical problems, obtaining analytical derivative expressions can be challenging (for example, when look-up tables are used). For these problems, numerical means of supplying the derivative information may be used. When this option is used in ICLOCS2, the Jacobian information will always be calculated with finite difference approximations. As for the Hessian update, the user may futher specify (in the settings later) whether it should supplied with finite differences in ICLOCS2 or fast Hessian update methods (e.g. BFGS) from the NLP solver.
  • adigator: When using finite difference, degradation in accuracy may occur due to numerical errors. One alternative is to use algorithmic differentiation which is accurate up machine precision. Adigator is a forward-mode algorithmic differentiation toolbox that may be used for supplying derivative information in ICLOCS2, at a computation cost slightly higher than finite difference. See HERE for details on obtaining and configuring Adigator.

NLP solver

Next is to specify the NLP solver

options.NLPsolver='...';

with

  • ipopt: The interior-point-method based IPOPT solver (recommanded). You may further specify the solver settings (see IPOPT documentations), here we just detail on a few important ones
    • options.ipopt.tol: Desired convergence tolerance (relative).
    • options.ipopt.max_iter: The maximum number of iterations.
    • options.ipopt.hessian_approximation: Indicates what information for the Hessian of the Lagrangian function is used by the solver. Set it to 'exact' to use second derivatives provided by ICLOCS2 (exact Hessian, finite difference and algorithmic differentiation). Alternatively, set it to 'limited-memory to use the built-in limited memory BFGS update by IPOPT (this is mandatory when multiple shooting method is used).
  • fmincon: Use of fmincon is supported but not recommmanded as the solution speed can be significantly slower with a higher chance of failure. Read HERE for further details.
  • worhp: ICLOCS2 also support the sequential quadratic programming (SQP) solver WORHP. The settings of WORHP solver should be configured with the .xml file in the WORHP package.

Hot start

The initial guess of the solving process can be selected by

options.start='...';

with

  • Cold: Linear interpolation between the initial point and the final point for the state and input trajectory. No costate/multiplier information supplied.
  • Warm: Initial guess of the state and input trajectory interpolated from the solution of previous solve. No costate/multiplier information supplied.
  • Hot: Initial guess of the state and input trajectory as well as costate/multipliers interpolated from the solution of previous solve.

Automatic scaling

For problems that contain variables of drastically different numerical ranges (e.g. altitude from 0 to 20000 m but angles only from -6 to 6 rad), automatic scaling is recommanded which may significantly reduce the number of iterations and computation time needed.

options.scaling=1;

Constraint on mesh interval sizes

Here you can define the minimum mesh interval size (in terms of actual time) that will be allowed for the mesh refinement process.

options.mintimeinterval=...;