48 std::vector<BaseEdge::Ptr> cost_terms, eq_terms, ineq_terms;
49 for (
int k = 0; k < n - 1; ++k)
86 edge->setFiniteDifferencesCollocationMethod(
_fd_eval);
96 sys_edge->setFiniteDifferencesCollocationMethod(
_fd_eval);
106 edge->setFiniteDifferencesCollocationMethod(
_fd_eval);
156 #ifdef MESSAGE_SUPPORT 157 void FiniteDifferencesGrid::fromMessage(
const messages::FiniteDifferencesGrid& message, std::stringstream* issues)
159 if (message.n() < 2 && issues) *issues <<
"FiniteDifferencesGrid: Number of states must be greater than or equal 2.\n";
160 if (message.dt() <= 0 && issues) *issues <<
"FiniteDifferencesGrid: Dt must be greater than 0.0.\n";
166 switch (message.cost_integration_rule())
168 case messages::FiniteDifferencesGrid::CostIntegrationRule::FiniteDifferencesGrid_CostIntegrationRule_LeftSum:
173 case messages::FiniteDifferencesGrid::CostIntegrationRule::FiniteDifferencesGrid_CostIntegrationRule_TrapezoidalRule:
187 util::get_oneof_field_type(message.fd_collocation(),
"fd_collocation", type,
false);
192 fd_eval->fromMessage(message.fd_collocation(), issues);
197 if (issues) *issues <<
"FiniteDifferencesGrid: unknown finite differences collocation method specified.\n";
202 void FiniteDifferencesGrid::toMessage(messages::FiniteDifferencesGrid& message)
const 215 message.set_cost_integration_rule(
216 messages::FiniteDifferencesGrid::CostIntegrationRule::FiniteDifferencesGrid_CostIntegrationRule_LeftSum);
221 message.set_cost_integration_rule(
222 messages::FiniteDifferencesGrid::CostIntegrationRule::FiniteDifferencesGrid_CostIntegrationRule_TrapezoidalRule);
std::shared_ptr< TrapezoidalIntegralInequalityEdge > Ptr
#define PRINT_ERROR_NAMED(msg)
CostIntegrationRule _cost_integration
std::shared_ptr< LeftSumEqualityEdge > Ptr
BaseEdge::Ptr getFinalStateCostEdge(int k, VectorVertex &xf)
int getN() const override
FinalStageConstraint::Ptr final_stage_constraints
virtual bool isFixed() const
Check if all components are fixed.
StageCost::Ptr stage_cost
std::shared_ptr< LeftSumCostEdge > Ptr
Vertex implementation for scalar values.
void setFiniteDifferencesCollocationMethod(FiniteDifferencesCollocationInterface::Ptr fd_eval)
PartiallyFixedVectorVertex _xf
std::shared_ptr< FDCollocationEdge > Ptr
std::shared_ptr< TrapezoidalIntegralCostEdge > Ptr
void setCostIntegrationRule(CostIntegrationRule integration)
void getFinalControlDeviationEdges(int n, VectorVertex &u_ref, VectorVertex &u_prev, ScalarVertex &u_prev_dt, std::vector< BaseEdge::Ptr > &cost_edges, std::vector< BaseEdge::Ptr > &eq_edges, std::vector< BaseEdge::Ptr > &ineq_edges)
FiniteDifferencesCollocationInterface::Ptr _fd_eval
virtual bool isValid() const
void createEdges(NlpFunctions &nlp_fun, OptimizationEdgeSet &edges, SystemDynamicsInterface::Ptr dynamics) override
std::shared_ptr< LeftSumInequalityEdge > Ptr
std::shared_ptr< BaseEdge > Ptr
void addObjectiveEdge(BaseEdge::Ptr edge)
void clear() override
Clear complete backup container.
void getNonIntegralStageFunctionEdges(int k, VectorVertex &xk, VectorVertex &uk, ScalarVertex &dt, VectorVertex &u_prev, ScalarVertex &u_prev_dt, const StageFunction &stage_fun, std::vector< BaseEdge::Ptr > &edges)
BaseEdge::Ptr getFinalStateConstraintEdge(int k, VectorVertex &xf)
std::vector< VectorVertex > _u_seq
void setWarmStart(bool active)
void addEqualityEdge(BaseEdge::Ptr edge)
Vertex implementation that stores an Eigen::VectorXd (dynamic dimension)
StageInequalityConstraint::Ptr stage_inequalities
std::vector< VectorVertex > _x_seq
std::shared_ptr< TrapezoidalIntegralEqualityDynamicsEdge > Ptr
void addInequalityEdge(BaseEdge::Ptr edge)
std::shared_ptr< FiniteDifferencesCollocationInterface > Ptr
StageEqualityConstraint::Ptr stage_equalities
std::shared_ptr< SystemDynamicsInterface > Ptr