|
None | __init__ (self, int num_states, int num_inputs, datetime.timedelta|float dt, int num_steps, Callable[[VariableMatrix, VariableMatrix], VariableMatrix] dynamics, DynamicsType dynamics_type=DynamicsType.EXPLICIT_ODE, TimestepMethod timestep_method=TimestepMethod.FIXED, TranscriptionMethod transcription_method=TranscriptionMethod.DIRECT_TRANSCRIPTION) |
|
None | constrain_initial_state (self, float initial_state) |
|
None | constrain_initial_state (self, int initial_state) |
|
None | constrain_initial_state (self, Variable initial_state) |
|
None | constrain_initial_state (self, Annotated[NDArray[numpy.float64], dict(shape=(None, None))] initial_state) |
|
None | constrain_initial_state (self, VariableMatrix initial_state) |
|
None | constrain_final_state (self, float final_state) |
|
None | constrain_final_state (self, int final_state) |
|
None | constrain_final_state (self, Variable final_state) |
|
None | constrain_final_state (self, Annotated[NDArray[numpy.float64], dict(shape=(None, None))] final_state) |
|
None | constrain_final_state (self, VariableMatrix final_state) |
|
None | for_each_step (self, Callable[[VariableMatrix, VariableMatrix], None] callback) |
|
None | set_lower_input_bound (self, float lower_bound) |
|
None | set_lower_input_bound (self, int lower_bound) |
|
None | set_lower_input_bound (self, Variable lower_bound) |
|
None | set_lower_input_bound (self, Annotated[NDArray[numpy.float64], dict(shape=(None, None))] lower_bound) |
|
None | set_lower_input_bound (self, VariableMatrix lower_bound) |
|
None | set_upper_input_bound (self, float upper_bound) |
|
None | set_upper_input_bound (self, int upper_bound) |
|
None | set_upper_input_bound (self, Variable upper_bound) |
|
None | set_upper_input_bound (self, Annotated[NDArray[numpy.float64], dict(shape=(None, None))] upper_bound) |
|
None | set_upper_input_bound (self, VariableMatrix upper_bound) |
|
None | set_min_timestep (self, datetime.timedelta|float min_timestep) |
|
None | set_max_timestep (self, datetime.timedelta|float max_timestep) |
|
VariableMatrix | X (self) |
|
VariableMatrix | U (self) |
|
VariableMatrix | dt (self) |
|
VariableMatrix | initial_state (self) |
|
VariableMatrix | final_state (self) |
|
Public Member Functions inherited from jormungandr.optimization.Problem |
Variable | decision_variable (self) |
|
VariableMatrix | decision_variable (self, int rows, int cols=1) |
|
VariableMatrix | symmetric_decision_variable (self, int rows) |
|
None | minimize (self, Variable cost) |
|
None | minimize (self, VariableMatrix cost) |
|
None | minimize (self, float cost) |
|
None | maximize (self, Variable objective) |
|
None | maximize (self, VariableMatrix objective) |
|
None | maximize (self, float objective) |
|
None | subject_to (self, EqualityConstraints constraint) |
|
None | subject_to (self, InequalityConstraints constraint) |
|
ExpressionType | cost_function_type (self) |
|
ExpressionType | equality_constraint_type (self) |
|
ExpressionType | inequality_constraint_type (self) |
|
ExitStatus | solve (self, **kwargs) |
|
None | add_callback (self, Callable[[IterationInfo], bool] callback) |
|
None | clear_callbacks (self) |
|
This class allows the user to pose and solve a constrained optimal
control problem (OCP) in a variety of ways.
The system is transcripted by one of three methods (direct
transcription, direct collocation, or single-shooting) and additional
constraints can be added.
In direct transcription, each state is a decision variable constrained
to the integrated dynamics of the previous state. In direct
collocation, the trajectory is modeled as a series of cubic
polynomials where the centerpoint slope is constrained. In single-
shooting, states depend explicitly as a function of all previous
states and all previous inputs.
Explicit ODEs are integrated using RK4.
For explicit ODEs, the function must be in the form dx/dt = f(t, x,
u). For discrete state transition functions, the function must be in
the form xₖ₊₁ = f(t, xₖ, uₖ).
Direct collocation requires an explicit ODE. Direct transcription and
single-shooting can use either an ODE or state transition function.
https://underactuated.mit.edu/trajopt.html goes into more detail on
each transcription method.
None jormungandr.optimization.OCP.__init__ |
( |
|
self, |
|
|
int |
num_states, |
|
|
int |
num_inputs, |
|
|
datetime.timedelta | float |
dt, |
|
|
int |
num_steps, |
|
|
Callable[[VariableMatrix, VariableMatrix], VariableMatrix] |
dynamics, |
|
|
DynamicsType |
dynamics_type = DynamicsType.EXPLICIT_ODE , |
|
|
TimestepMethod |
timestep_method = TimestepMethod.FIXED , |
|
|
TranscriptionMethod |
transcription_method = TranscriptionMethod.DIRECT_TRANSCRIPTION |
|
) |
| |
Build an optimization problem using a system evolution function
(explicit ODE or discrete state transition function).
Parameter ``num_states``:
The number of system states.
Parameter ``num_inputs``:
The number of system inputs.
Parameter ``dt``:
The timestep for fixed-step integration.
Parameter ``num_steps``:
The number of control points.
Parameter ``dynamics``:
Function representing an explicit or implicit ODE, or a discrete
state transition function. - Explicit: dx/dt = f(x, u, *) -
Implicit: f([x dx/dt]', u, *) = 0 - State transition: xₖ₊₁ = f(xₖ,
uₖ)
Parameter ``dynamics_type``:
The type of system evolution function.
Parameter ``timestep_method``:
The timestep method.
Parameter ``transcription_method``:
The transcription method.
Reimplemented from jormungandr.optimization.Problem.