25 #ifndef SRC_OPTIMAL_CONTROL_INCLUDE_CORBO_OPTIMAL_CONTROL_STRUCTURED_OCP_DISCRETIZATION_GRIDS_FULL_DISCRETIZATION_GRID_BASE_H_ 26 #define SRC_OPTIMAL_CONTROL_INCLUDE_CORBO_OPTIMAL_CONTROL_STRUCTURED_OCP_DISCRETIZATION_GRIDS_FULL_DISCRETIZATION_GRID_BASE_H_ 42 using Ptr = std::shared_ptr<FullDiscretizationGridBase>;
43 using UPtr = std::unique_ptr<FullDiscretizationGridBase>;
71 void clear()
override;
76 void setN(
int n,
bool try_resample =
true)
override;
102 return _x_seq[k].values();
107 void getVertices(std::vector<VertexInterface*>& vertices)
override;
109 #ifdef MESSAGE_SUPPORT 110 void fromMessage(
const messages::DiscretizationGrid& message, std::stringstream* issues)
override {}
111 void toMessage(messages::DiscretizationGrid& message)
const override {}
164 #endif // SRC_OPTIMAL_CONTROL_INCLUDE_CORBO_OPTIMAL_CONTROL_STRUCTURED_OCP_DISCRETIZATION_GRIDS_FULL_DISCRETIZATION_GRID_BASE_H_ virtual void resampleTrajectory(int n_new)
void setXfFixed(const Eigen::Matrix< bool, -1, 1 > &xf_fixed)
int findNearestState(const Eigen::VectorXd &x0)
std::unique_ptr< DiscretizationGridInterface > UPtr
int getInitialN() const override
CostIntegrationRule _cost_integration
bool hasConstantControls() const override
std::vector< VertexInterface * > _active_vertices
virtual ~FullDiscretizationGridBase()=default
Generic interface class for discretization grids.
int getN() const override
bool isTimeVariableGrid() const override
virtual bool isMovingHorizonWarmStartActive() const
Vertex implementation for scalar values.
virtual void createEdges(NlpFunctions &nlp_fun, OptimizationEdgeSet &edges, SystemDynamicsInterface::Ptr dynamics)=0
Representation of time stamps.
void setFiniteDifferencesCollocationMethod(FiniteDifferencesCollocationInterface::Ptr fd_eval)
PartiallyFixedVectorVertex _xf
Vector based vertex with support for partially fixed components.
virtual bool adaptGrid(bool new_run, NlpFunctions &nlp_fun)
void computeActiveVertices() override
FullDiscretizationGridBase()=default
void setCostIntegrationRule(CostIntegrationRule integration)
void setN(int n, bool try_resample=true) override
Return dimension of the control input dimension in the grid.
FiniteDifferencesCollocationInterface::Ptr _fd_eval
bool isEmpty() const override
virtual void initializeSequences(const Eigen::VectorXd &x0, const Eigen::VectorXd &xf, ReferenceTrajectoryInterface &uref, NlpFunctions &nlp_fun)
virtual bool isValid() const
double getInitialDt() const override
bool isUniformGrid() const override
void getVertices(std::vector< VertexInterface *> &vertices) override
void setModified(bool modified)
constexpr const double CORBO_INF_DBL
Representation for infinity (double version)
double getFirstDt() const override
double getFinalTime() const override
const double & value() const
Get underlying value.
const Eigen::VectorXd & getState(int k) const
GridUpdateResult update(const Eigen::VectorXd &x0, ReferenceTrajectoryInterface &xref, ReferenceTrajectoryInterface &uref, NlpFunctions &nlp_fun, OptimizationEdgeSet &edges, SystemDynamicsInterface::Ptr dynamics, bool new_run, const Time &t, ReferenceTrajectoryInterface *sref=nullptr, const Eigen::VectorXd *prev_u=nullptr, double prev_u_dt=0, ReferenceTrajectoryInterface *xinit=nullptr, ReferenceTrajectoryInterface *uinit=nullptr) override
bool getFirstControlInput(Eigen::VectorXd &u0) override
virtual void warmStartShifting(const Eigen::VectorXd &x0)
Interface class for reference trajectories.
std::shared_ptr< DiscretizationGridInterface > Ptr
std::vector< VectorVertex > _u_seq
void setWarmStart(bool active)
std::vector< VertexInterface * > & getActiveVertices() override
bool hasSingleDt() const override
DiscretizationGridInterface::Ptr getInstance() const override=0
Return a newly created shared instance of the implemented class.
Eigen::Matrix< bool, -1, 1 > _xf_fixed
const Eigen::VectorXd & values() const
Read-access to the underlying value vector.
void updateBounds(const NlpFunctions &nlp_fun)
std::vector< VectorVertex > _x_seq
const NlpFunctions * _nlp_fun
std::shared_ptr< TimeSeries > Ptr
bool checkAndInitializeXfFixedFlags(int dim_x)
void getStateAndControlTimeSeries(TimeSeries::Ptr x_sequence, TimeSeries::Ptr u_sequence, double t_max=CORBO_INF_DBL) const override
Return state and control trajectory as time series object (shared instance)
void setInitialDt(double dt) override
std::shared_ptr< FiniteDifferencesCollocationInterface > Ptr
virtual bool isGridAdaptActive() const
virtual bool isDtFixedIntended() const
std::shared_ptr< SystemDynamicsInterface > Ptr
bool providesStateTrajectory() const override