Janus 2.0.0
High-performance C++20 dual-mode numerical framework
Loading...
Searching...
No Matches
janus::BirkhoffPseudospectral Class Reference

Birkhoff pseudospectral transcription. More...

#include <BirkhoffPseudospectral.hpp>

Inheritance diagram for janus::BirkhoffPseudospectral:
Collaboration diagram for janus::BirkhoffPseudospectral:

Public Member Functions

 BirkhoffPseudospectral (Opti &opti)
 Construct with a reference to the optimization environment.
std::tuple< SymbolicMatrix, SymbolicMatrix, NumericVectorsetup (int n_states, int n_controls, double t0, double tf, const BirkhoffPseudospectralOptions &opts={})
 Set up the Birkhoff problem with fixed final time.
std::tuple< SymbolicMatrix, SymbolicMatrix, NumericVectorsetup (int n_states, int n_controls, double t0, const SymbolicScalar &tf, const BirkhoffPseudospectralOptions &opts={})
 Set up the Birkhoff problem with variable final time.
const NumericMatrixintegration_matrix () const
 Get the Birkhoff integration matrix.
const NumericVectorquadrature_weights () const
 Get the Birkhoff quadrature weights.
const SymbolicMatrixvirtual_vars () const
 Get the virtual (derivative) decision variables.
SymbolicScalar quadrature (const SymbolicVector &integrand) const
 Compute quadrature of an integrand over the time domain.
Public Member Functions inherited from janus::TranscriptionBase< BirkhoffPseudospectral >
 TranscriptionBase (Opti &opti)
 Construct with a reference to the optimization environment.
void set_initial_state (const NumericVector &x0)
 Pin all initial states to specified values.
void set_final_state (const NumericVector &xf)
 Pin all final states to specified values.
void set_dynamics (Func &&dynamics)
 Register the dynamics function xdot = f(x, u, t).
const SymbolicMatrixstates () const
 Get the state decision variable matrix.
const SymbolicMatrixcontrols () const
 Get the control decision variable matrix.
const NumericVectortime_grid () const
 Get the normalized time grid.
int n_nodes () const
 Get the number of discretization nodes.
int n_states () const
 Get the number of state variables per node.
int n_controls () const
 Get the number of control variables per node.
void add_dynamics_constraints ()
 Add dynamics constraints to the optimization problem.
void add_defect_constraints ()
 Alias for add_dynamics_constraints().
void add_continuity_constraints ()
 Alias for add_dynamics_constraints().

Friends

class TranscriptionBase< BirkhoffPseudospectral >

Additional Inherited Members

Protected Member Functions inherited from janus::TranscriptionBase< BirkhoffPseudospectral >
SymbolicScalar get_duration () const
SymbolicScalar get_time_at_node (int k) const
SymbolicVector get_state_at_node (int k) const
SymbolicVector get_control_at_node (int k) const
Protected Attributes inherited from janus::TranscriptionBase< BirkhoffPseudospectral >
Optiopti_
int n_states_
int n_controls_
int n_nodes_
double t0_
double tf_fixed_
SymbolicScalar tf_symbolic_
bool tf_is_variable_
bool setup_complete_
bool dynamics_set_
bool dynamics_constraints_added_
NumericVector tau_
SymbolicMatrix states_
SymbolicMatrix controls_
std::function< SymbolicVector(const SymbolicVector &, const SymbolicVector &, const SymbolicScalar &)> dynamics_

Detailed Description

Birkhoff pseudospectral transcription.

Uses integration-based (Birkhoff) formulation instead of differentiation.

See also
TranscriptionBase for shared interface
BirkhoffPseudospectralOptions for configuration
Pseudospectral for standard pseudospectral variant

Constructor & Destructor Documentation

◆ BirkhoffPseudospectral()

janus::BirkhoffPseudospectral::BirkhoffPseudospectral ( Opti & opti)
inlineexplicit

Construct with a reference to the optimization environment.

Parameters
optiOpti instance

Member Function Documentation

◆ integration_matrix()

const NumericMatrix & janus::BirkhoffPseudospectral::integration_matrix ( ) const
inline

Get the Birkhoff integration matrix.

Returns
n_nodes x n_nodes integration matrix

◆ quadrature()

SymbolicScalar janus::BirkhoffPseudospectral::quadrature ( const SymbolicVector & integrand) const
inline

Compute quadrature of an integrand over the time domain.

Parameters
integrandsymbolic vector of values at each node
Returns
symbolic scalar approximation of the definite integral

◆ quadrature_weights()

const NumericVector & janus::BirkhoffPseudospectral::quadrature_weights ( ) const
inline

Get the Birkhoff quadrature weights.

Returns
vector of quadrature weights (last row of B)

◆ setup() [1/2]

std::tuple< SymbolicMatrix, SymbolicMatrix, NumericVector > janus::BirkhoffPseudospectral::setup ( int n_states,
int n_controls,
double t0,
const SymbolicScalar & tf,
const BirkhoffPseudospectralOptions & opts = {} )
inline

Set up the Birkhoff problem with variable final time.

Parameters
n_statesnumber of state variables
n_controlsnumber of control variables
t0initial time
tfsymbolic final time (decision variable)
optsBirkhoff options
Returns
tuple of (states, controls, time_grid)

◆ setup() [2/2]

std::tuple< SymbolicMatrix, SymbolicMatrix, NumericVector > janus::BirkhoffPseudospectral::setup ( int n_states,
int n_controls,
double t0,
double tf,
const BirkhoffPseudospectralOptions & opts = {} )
inline

Set up the Birkhoff problem with fixed final time.

Parameters
n_statesnumber of state variables
n_controlsnumber of control variables
t0initial time
tffinal time
optsBirkhoff options
Returns
tuple of (states, controls, time_grid)

◆ virtual_vars()

const SymbolicMatrix & janus::BirkhoffPseudospectral::virtual_vars ( ) const
inline

Get the virtual (derivative) decision variables.

Returns
matrix of size (n_nodes x n_states)

◆ TranscriptionBase< BirkhoffPseudospectral >

friend class TranscriptionBase< BirkhoffPseudospectral >
friend

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