1#ifndef ROBOTOC_TIME_DISCRETIZATION_HPP_
2#define ROBOTOC_TIME_DISCRETIZATION_HPP_
32 const int reserved_num_discrete_events=0);
76 return num_grids_ + 1;
114 return grid_[
size()-1];
122 double max_dt = grid_[0].dt;
123 for (
int i=0; i<num_grids_; ++i) {
124 max_dt = std::max(grid_[i].dt, max_dt);
134 void reserve(
const int reserved_num_discrete_events);
147 void discretize(
const std::shared_ptr<ContactSequence>& contact_sequence,
const double t);
155 void correctTimeSteps(
const std::shared_ptr<ContactSequence>& contact_sequence,
const double t);
160 void disp(std::ostream& os)
const;
166 double T_, max_dt_, eps_;
167 int N_, num_grids_, reserved_num_discrete_events_;
168 std::vector<GridInfo> grid_;
169 std::vector<bool> sto_event_, sto_phase_;
Time discretization of the optimal control problem.
Definition: time_discretization.hpp:20
TimeDiscretization(const TimeDiscretization &)=default
Default copy constructor.
int size() const
Returns the number of grids.
Definition: time_discretization.hpp:75
void disp(std::ostream &os) const
Displays the time discretization onto a ostream.
TimeDiscretization(const double T, const int N, const int reserved_num_discrete_events=0)
Constructor.
const GridInfo & grid(const int i) const
Returns the grid info of the specified stage.
Definition: time_discretization.hpp:84
TimeDiscretization(TimeDiscretization &&) noexcept=default
Default move constructor.
const GridInfo & operator[](const int i) const
Returns the grid info of the specified stage.
Definition: time_discretization.hpp:95
TimeDiscretization()
Default constructor.
double maxTimeStep() const
Gets the maximum time step of the discretization.
Definition: time_discretization.hpp:121
const GridInfo & back() const
Returns the grid info of the terminal stage.
Definition: time_discretization.hpp:113
int reservedNumDiscreteEvents() const
TimeDiscretization & operator=(const TimeDiscretization &)=default
Default copy assign operator.
void correctTimeSteps(const std::shared_ptr< ContactSequence > &contact_sequence, const double t)
Discretizes the finite horizon taking into account the discrete events.
void reserve(const int reserved_num_discrete_events)
Reserve the discrete-event data.
void discretize(const std::shared_ptr< ContactSequence > &contact_sequence, const double t)
Discretizes the finite horizon taking into account the discrete events.
friend std::ostream & operator<<(std::ostream &os, const TimeDiscretization &discretization)
const GridInfo & front() const
Returns the grid info of the initial stage.
Definition: time_discretization.hpp:105
~TimeDiscretization()=default
Default destructor.
int N() const
Definition: time_discretization.hpp:67
Definition: constraint_component_base.hpp:17
Grid information.
Definition: grid_info.hpp:24