horizon.transcriptions package¶
Submodules¶
horizon.transcriptions.integrators module¶
-
horizon.transcriptions.integrators.
EULER
(dae, opts=None, casadi_type=<sphinx.ext.autodoc.importer._MockObject object>)¶ - Implements an integration scheme based on Euler integration (http://www.cmth.ph.ic.ac.uk/people/a.mackinnon/Lectures/compphys/node4.html):
- x = x + dt*xdot(x,u)
Parameters: - dae – a dictionary containing ‘x’: state ‘p’: control ‘ode’: a function of the state and control returning the derivative of the state ‘quad’: quadrature term
- opts – a dictionary containing ‘tf’: integration time
- NOTE – this term can be used to take into account also a final time to optimize
- casadi_type – ‘SX’ or ‘MX’
- Returns: Function(‘F_RK’, [X0_RK, U_RK], [X_RK, Q_RK], [‘x0’, ‘p’], [‘xf’, ‘qf’]) or
- Function(‘F_RK’, [X0_RK, U_RK, DT_RK], [X_RK, Q_RK], [‘x0’, ‘p’, ‘time’], [‘xf’, ‘qf’])
which given in input the actual state X0_RK and control U_RK returns the integrated state X_RK and quadrature term Q_RK
-
horizon.transcriptions.integrators.
LEAPFROG
(dae, opts=None, casadi_type=<sphinx.ext.autodoc.importer._MockObject object>)¶
-
horizon.transcriptions.integrators.
RK2
(dae, opts=None, casadi_type=<sphinx.ext.autodoc.importer._MockObject object>)¶ Implements an integration scheme based on 2nd-order Runge-Kutta integration (http://www.cmth.ph.ic.ac.uk/people/a.mackinnon/Lectures/compphys/node11.html): :param dae: a dictionary containing
‘x’: state ‘p’: control ‘ode’: a function of the state and control returning the derivative of the state ‘quad’: quadrature termParameters: - opts – a dictionary containing ‘tf’: integration time
- NOTE – this term can be used to take into account also a final time to optimize
- casadi_type – ‘SX’ or ‘MX’
- Returns: Function(‘F_RK’, [X0_RK, U_RK], [X_RK, Q_RK], [‘x0’, ‘p’], [‘xf’, ‘qf’]) or
- Function(‘F_RK’, [X0_RK, U_RK, DT_RK], [X_RK, Q_RK], [‘x0’, ‘p’, ‘time’], [‘xf’, ‘qf’])
which given in input the actual state X0_RK and control U_RK returns the integrated state X_RK and quadrature term Q_RK
-
horizon.transcriptions.integrators.
RK4
(dae, opts=None, casadi_type=<sphinx.ext.autodoc.importer._MockObject object>)¶ Implements an integration scheme based on 4th-order Runge-Kutta integration: :param dae: a dictionary containing
‘x’: state ‘p’: control ‘ode’: a function of the state and control returning the derivative of the state ‘quad’: quadrature termParameters: - opts – a dictionary containing ‘tf’: integration time
- NOTE – this term can be used to take into account also a final time to optimize
- casadi_type – ‘SX’ or ‘MX’
- Returns: Function(‘F_RK’, [X0_RK, U_RK], [X_RK, Q_RK], [‘x0’, ‘p’], [‘xf’, ‘qf’]) or
- Function(‘F_RK’, [X0_RK, U_RK, DT_RK], [X_RK, Q_RK], [‘x0’, ‘p’, ‘time’], [‘xf’, ‘qf’])
which given in input the actual state X0_RK and control U_RK returns the integrated state X_RK and quadrature term Q_RK
horizon.transcriptions.methods module¶
-
class
horizon.transcriptions.methods.
DirectCollocation
(prob: horizon.problem.Problem, degree: int)¶ Bases:
horizon.transcriptions.transcriptor.Transcriptor
Add auxiliary input variables and constraints that implement the Direct Collocation transcription scheme. This could also be seen as multiple shooting with a different integration strategy that is based on approximating polynomials.
-
class
horizon.transcriptions.methods.
MultipleShooting
(prob: horizon.problem.Problem, integrator)¶ Bases:
horizon.transcriptions.transcriptor.Transcriptor
Add auxiliary input variables and constraints that implement the Multiple Shooting transcription scheme. A defect constraint is defined between all the segments of the trajectory. A desired integrator yields its evolution along the segments.
-
setDefaultIntegrator
(integrator_type)¶
-
horizon.transcriptions.transcriptor module¶
-
class
horizon.transcriptions.transcriptor.
Transcriptor
(prb: horizon.problem.Problem, logger=None)¶ Bases:
abc.ABC
-
classmethod
make_method
(type: str, prb: horizon.problem.Problem, opts=None, logger=None)¶ Construct a transcription method. The optimal control problem is an infinite-dimensional optimization problem, since the decision variables are functions, rather than real numbers. All solution techniques perform transcription, a process by which the trajectory optimization problem (optimizing over functions) is converted into a constrained parameter optimization problem (optimizing over real numbers).
Parameters: - type (str) – type of transcription method (multiple shooting / direct collocation)
- prb (Problem) – the horizon’s problem instance to be solved
- dt (float) – the discretization step
- opts (Dict, optional) – A solver-dependent Dict of options. Defaults to None.
- logger (Logger, optional) – pointer to a logger
-
classmethod
horizon.transcriptions.trial_integrator module¶
-
horizon.transcriptions.trial_integrator.
RK4
(dae, opts=None, casadi_type=<sphinx.ext.autodoc.importer._MockObject object>)¶ Implements an integration scheme based on 4th-order Runge-Kutta integration: :param dae: a dictionary containing
‘x’: state ‘p’: control ‘ode’: a function of the state and control returning the derivative of the state ‘quad’: quadrature termParameters: - opts – a dictionary containing ‘tf’: integration time
- NOTE – this term can be used to take into account also a final time to optimize
- casadi_type – ‘SX’ or ‘MX’
- Returns: Function(‘F_RK’, [X0_RK, U_RK], [X_RK, Q_RK], [‘x0’, ‘p’], [‘xf’, ‘qf’]) or
- Function(‘F_RK’, [X0_RK, U_RK, DT_RK], [X_RK, Q_RK], [‘x0’, ‘p’, ‘time’], [‘xf’, ‘qf’])
which given in input the actual state X0_RK and control U_RK returns the integrated state X_RK and quadrature term Q_RK