135 if (new_n == n)
return false;
154 #ifdef MESSAGE_SUPPORT 155 void MultipleShootingVariableGrid::fromMessage(
const messages::MultipleShootingVariableGrid& message, std::stringstream* issues)
157 MultipleShootingGrid::fromMessage(message.multiple_shooting_grid(), issues);
171 if (message.has_grid_adapt_strategy())
173 if (message.grid_adapt_strategy().has_no_grid_adapt())
177 else if (message.grid_adapt_strategy().has_time_based_single_step())
180 message.grid_adapt_strategy().time_based_single_step().dt_hyst_ratio());
182 else if (message.grid_adapt_strategy().has_time_based_aggr_estim())
185 message.grid_adapt_strategy().time_based_aggr_estim().dt_hyst_ratio());
187 else if (message.grid_adapt_strategy().has_simple_shrinking_horizon())
198 void MultipleShootingVariableGrid::toMessage(messages::MultipleShootingVariableGrid& message)
const 200 MultipleShootingGrid::toMessage(*message.mutable_multiple_shooting_grid());
205 message.mutable_xf_fixed()->Resize(
_xf_fixed.size(),
false);
210 message.set_dt_min(
_dt_lb);
211 message.set_dt_max(
_dt_ub);
218 message.mutable_grid_adapt_strategy()->mutable_no_grid_adapt();
223 message.mutable_grid_adapt_strategy()->mutable_time_based_single_step()->set_n_max(
_n_max);
224 message.mutable_grid_adapt_strategy()->mutable_time_based_single_step()->set_dt_hyst_ratio(
_dt_hyst_ratio);
229 message.mutable_grid_adapt_strategy()->mutable_time_based_aggr_estim()->set_n_max(
_n_max);
230 message.mutable_grid_adapt_strategy()->mutable_time_based_aggr_estim()->set_dt_hyst_ratio(
_dt_hyst_ratio);
235 message.mutable_grid_adapt_strategy()->mutable_simple_shrinking_horizon();
240 PRINT_ERROR_NAMED(
"exporting of the selected auto resize strategy not implemented.");
246 message.set_n_min(
_n_min);
#define PRINT_ERROR_NAMED(msg)
#define PRINT_WARNING_COND_NAMED(cond, msg)
void setGridAdaptSimpleShrinkingHorizon()
GridAdaptStrategy _grid_adapt
A matrix or vector expression mapping an existing array of data.
bool isTimeVariableGrid() const override
bool adaptGridTimeBasedSingleStep(NlpFunctions &nlp_fun)
void resampleTrajectory(int n_new, NlpFunctions &nlp_fun)
bool adaptGridTimeBasedAggressiveEstimate(NlpFunctions &nlp_fun)
void setDtBounds(double dt_lb, double dt_ub)
Eigen::Matrix< bool, -1, 1 > _xf_fixed
void setGridAdaptTimeBasedAggressiveEstimate(int n_max, double dt_hyst_ratio=0.1)
bool adaptGridSimpleShrinkingHorizon(NlpFunctions &nlp_fun)
void disableGridAdaptation()
int getN() const override
const double & value() const
Get underlying value.
bool adaptGrid(bool new_run, NlpFunctions &nlp_fun) override
void setGridAdaptTimeBasedSingleStep(int n_max, double dt_hyst_ratio=0.1)
The matrix class, also used for vectors and row-vectors.
EIGEN_DEVICE_FUNC const RoundReturnType round() const