latom.nlp.nlp¶
@authors: Alberto FOSSA’ Giuliana Elena MICELI
Classes
|
LinearSolver that uses linalg.solve or LU factor/solve. |
|
High-order Gauss Lobatto Transcription |
|
Class used to group systems together; instantiate or inherit. |
|
MultiPhaseNLP transcribes a continuous-time optimal control problem in trajectory optimization constituted by multiple phases into a Non Linear Programming Problem (NLP) using the libraries OpenMDAO and dymos. |
|
NLP class transcribes a continuous-time optimal control problem in trajectory optimization into a Non Linear Programming Problem (NLP) using the OpenMDAO and dymos libraries. |
|
The Phase object in Dymos. |
|
Top-level container for the systems and drivers. |
|
Radau Pseudospectral Method Transcription |
|
The RungeKutta Transcription class. |
|
SinglePhaseNLP transcribes a continuous-time optimal control problem in trajectory optimization constituted by a single phase into a Non Linear Programming Problem (NLP) using the libraries OpenMDAO and dymos. |
|
Recorder that saves cases in a sqlite db. |
|
A Trajectory object serves as a container for one or more Phases, as well as the linkage conditions between phases. |
|
Driver wrapper for pyoptsparse. |
-
class
latom.nlp.nlp.NLP(body, sc, method, nb_seg, order, solver, snopt_opts=None, rec_file=None)[source]¶ Bases:
objectNLP class transcribes a continuous-time optimal control problem in trajectory optimization into a Non Linear Programming Problem (NLP) using the OpenMDAO and dymos libraries.
- Parameters
body (Primary) – Instance of Primary class representing the central attracting body
sc (Spacecraft) – Instance of Spacecraft class representing the spacecraft
method (str) – Transcription method used to discretize the continuous time trajectory into a finite set of nodes, allowed
gauss-lobatto,radau-psandrunge-kuttanb_seg (int or tuple) – Number of segments in which each phase is discretized
order (int or tuple) – Transcription order within each phase, must be odd
solver (str) – NLP solver, must be supported by OpenMDAO
snopt_opts (dict or None, optional) – SNOPT optional settings expressed as key-value pairs. Refer to the SNOPT User Guide 1 for more details. Default is None
rec_file (str or None, optional) – Name of the file in which the computed solution is recorded or None. Default is None
- Variables
body (Primary) – Instance of Primary class representing the central attracting body
sc (Spacecraft) – Instance of Spacecraft class representing the spacecraft
method (str) – Transcription method used to discretize the continuous time trajectory into a finite set of nodes, allowed
gauss-lobatto,radau-psandrunge-kuttanb_seg (int or tuple) – Number of segments in which each phase is discretized
order (int or tuple) – Transcription order within each phase, must be odd
solver (str) – NLP solver, must be supported by OpenMDAO
snopt_opts (dict or None) – SNOPT optional settings expressed as key-value pairs. Refer to the SNOPT User Guide 1 for more details.
rec_file (str or None) – Name of the file in which the computed solution is recorded or None
p (Problem) – OpenMDAO Problem class instance representing the NLP
trajectory (Trajectory) – Dymos Trajectory class instance representing the spacecraft trajectory
p_exp (Problem) – OpenMDAO Problem class instance representing the explicitly simulated trajectory
References
- 1(1,2,3,4)
Gill, Philip E., et al. User’s Guide for SNOPT Version 7.7: Software for Large-Scale Nonlinear Programming, Feb. 2019, p. 126.
-
class
latom.nlp.nlp.SinglePhaseNLP(body, sc, method, nb_seg, order, solver, ode_class, ode_kwargs, ph_name, snopt_opts=None, rec_file=None)[source]¶ Bases:
latom.nlp.nlp.NLPSinglePhaseNLP transcribes a continuous-time optimal control problem in trajectory optimization constituted by a single phase into a Non Linear Programming Problem (NLP) using the libraries OpenMDAO and dymos.
- Parameters
body (Primary) – Instance of Primary class representing the central attracting body
sc (Spacecraft) – Instance of Spacecraft class representing the spacecraft
method (str) – Transcription method used to discretize the continuous time trajectory into a finite set of nodes, allowed
gauss-lobatto,radau-psandrunge-kuttanb_seg (int) – Number of segments in which each phase is discretized
order (int) – Transcription order within each phase, must be odd
solver (str) – NLP solver, must be supported by OpenMDAO
ode_class (ExplicitComponent) – Instance of OpenMDAO ExplicitComponent describing the Ordinary Differential Equations (ODEs) that drive the system dynamics
ode_kwargs (dict) – Keywords arguments to be passed to ode_class
ph_name (str) – Name of the phase within OpenMDAO
snopt_opts (dict or None, optional) – SNOPT optional settings expressed as key-value pairs. Refer to the SNOPT User Guide 1 for more details. Default is None
rec_file (str or None, optional) – Name of the file in which the computed solution is recorded or None. Default is None
- Variables
phase (Phase) – Dymos Phase object representing the unique phase of the Trajectory class instance
phase_name (str) – Complete name of the Phase instance within OpenMDAO
state_nodes (ndarray) – Indexes corresponding to the state discretization nodes of the discretized phase
control_nodes (ndarray) – Indexes corresponding to the control discretization nodes of the discretized phase
t_all (ndarray) – Time instants corresponding to all discretization nodes [-]
t_state (ndarray) – Time instants corresponding to the state discretization nodes [-]
t_control (ndarray) – Time instants corresponding to the control discretization nodes [-]
idx_state_control (ndarray) – Indexes of the state discretization nodes among the control discretization nodes
tof (float) – Phase time of flight (TOF) [-]
-
set_objective()[source]¶ Set the NLP objective as the minimization of the opposite of the final spacecraft mass.
-
set_time_options(tof, t_bounds)[source]¶ Set the time options on the phase.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
t_bounds (tuple) – Time of flight lower and upper bounds expressed as a fraction of tof
-
set_time_guess(tof)[source]¶ Compute the time grid on the phase to retrieve the time instants corresponding to states, controls and all discretization nodes.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
-
cleanup()¶ Clean up resources.
-
exp_sim(rec_file=None)¶ Explicitly simulate the implicitly obtained optimal solution using Scipy solve_ivp method.
-
setup()¶ Set up the Jacobian type, linear solver and derivatives type.
-
class
latom.nlp.nlp.MultiPhaseNLP(body, sc, method, nb_seg, order, solver, ode_class, ode_kwargs, ph_name, snopt_opts=None, rec_file=None)[source]¶ Bases:
latom.nlp.nlp.NLPMultiPhaseNLP transcribes a continuous-time optimal control problem in trajectory optimization constituted by multiple phases into a Non Linear Programming Problem (NLP) using the libraries OpenMDAO and dymos.
- Parameters
body (Primary) – Instance of Primary class representing the central attracting body
sc (Spacecraft) – Instance of Spacecraft class representing the spacecraft
method (str) – Transcription method used to discretize the continuous time trajectory into a finite set of nodes, allowed
gauss-lobatto,radau-psandrunge-kuttanb_seg (int or tuple) – Number of segments in which each phase is discretized
order (int or tuple) – Transcription order within each phase, must be odd
solver (str) – NLP solver, must be supported by OpenMDAO
ode_class (tuple) – Instance of OpenMDAO ExplicitComponent describing the Ordinary Differential Equations (ODEs) that drive the system dynamics
ode_kwargs (tuple) – Keywords arguments to be passed to ode_class
ph_name (tuple) – Name of the phase within OpenMDAO
snopt_opts (dict or None, optional) – SNOPT optional settings expressed as key-value pairs. Refer to the SNOPT User Guide 1 for more details. Default is None
rec_file (str or None, optional) – Name of the file in which the computed solution is recorded or None. Default is None
- Variables
transcription (list) – List of dymos transcription class instances representing the transcription method, order and segments within each phase
phase (list) – List of dymos Phase object representing the different phases of the Trajectory class instance
phase_name (list) – List of complete names of the Phase instance within OpenMDAO
-
set_time_phase(ti, tof, phase, phase_name)[source]¶ Compute the time grid within one phase to retrieve the time instants corresponding to the state, control and all discretization nodes.
- Parameters
ti (float) – Initial time [-]
tof (float) – Time of flight (TOF) [-]
phase (Phase) – Current phase
phase_name (str) – Current phase name
- Returns
state_nodes (ndarray) – Indexes corresponding to the state discretization nodes
control_nodes (ndarray) – Indexes corresponding to the control discretization nodes
t_state (ndarray) – Time instants on the state discretization nodes [-]
t_control (ndarray) – Time instants on the control discretization nodes [-]
t_all (ndarray) – Time instants on all discretization nodes [-]
-
cleanup()¶ Clean up resources.
-
exp_sim(rec_file=None)¶ Explicitly simulate the implicitly obtained optimal solution using Scipy solve_ivp method.
-
setup()¶ Set up the Jacobian type, linear solver and derivatives type.