146 if (new_n == n)
return false;
165 #ifdef MESSAGE_SUPPORT 166 void FiniteDifferencesVariableGrid::fromMessage(
const messages::FiniteDifferencesVariableGrid& message, std::stringstream* issues)
168 FiniteDifferencesGrid::fromMessage(message.finite_differences_grid(), issues);
182 if (message.has_grid_adapt_strategy())
184 if (message.grid_adapt_strategy().has_no_grid_adapt())
188 else if (message.grid_adapt_strategy().has_time_based_single_step())
191 message.grid_adapt_strategy().time_based_single_step().dt_hyst_ratio());
193 else if (message.grid_adapt_strategy().has_time_based_aggr_estim())
196 message.grid_adapt_strategy().time_based_aggr_estim().dt_hyst_ratio());
198 else if (message.grid_adapt_strategy().has_simple_shrinking_horizon())
209 void FiniteDifferencesVariableGrid::toMessage(messages::FiniteDifferencesVariableGrid& message)
const 211 FiniteDifferencesGrid::toMessage(*message.mutable_finite_differences_grid());
216 message.mutable_xf_fixed()->Resize(
_xf_fixed.size(),
false);
221 message.set_dt_min(
_dt_lb);
222 message.set_dt_max(
_dt_ub);
229 message.mutable_grid_adapt_strategy()->mutable_no_grid_adapt();
234 message.mutable_grid_adapt_strategy()->mutable_time_based_single_step()->set_n_max(
_n_max);
235 message.mutable_grid_adapt_strategy()->mutable_time_based_single_step()->set_dt_hyst_ratio(
_dt_hyst_ratio);
240 message.mutable_grid_adapt_strategy()->mutable_time_based_aggr_estim()->set_n_max(
_n_max);
241 message.mutable_grid_adapt_strategy()->mutable_time_based_aggr_estim()->set_dt_hyst_ratio(
_dt_hyst_ratio);
246 message.mutable_grid_adapt_strategy()->mutable_simple_shrinking_horizon();
251 PRINT_ERROR_NAMED(
"exporting of the selected auto resize strategy not implemented.");
257 message.set_n_min(
_n_min);
void setDtBounds(double dt_lb, double dt_ub)
#define PRINT_ERROR_NAMED(msg)
virtual void resampleTrajectory(int n_new)
#define PRINT_WARNING_COND_NAMED(cond, msg)
bool adaptGridTimeBasedAggressiveEstimate(NlpFunctions &nlp_fun)
A matrix or vector expression mapping an existing array of data.
int getN() const override
bool adaptGrid(bool new_run, NlpFunctions &nlp_fun) override
bool adaptGridSimpleShrinkingHorizon(NlpFunctions &nlp_fun)
bool isTimeVariableGrid() const override
void setGridAdaptSimpleShrinkingHorizon(bool adapt_first_iter=false)
bool adaptGridTimeBasedSingleStep(NlpFunctions &nlp_fun)
GridAdaptStrategy _grid_adapt
void setGridAdaptTimeBasedSingleStep(int n_max, double dt_hyst_ratio=0.1, bool adapt_first_iter=false)
void disableGridAdaptation()
void setGridAdaptTimeBasedAggressiveEstimate(int n_max, double dt_hyst_ratio=0.1, bool adapt_first_iter=false)
Eigen::Matrix< bool, -1, 1 > _xf_fixed
const NlpFunctions * _nlp_fun
The matrix class, also used for vectors and row-vectors.
EIGEN_DEVICE_FUNC const RoundReturnType round() const