10 #include <boost/property_tree/info_parser.hpp> 68 std::cout <<
"=============================================================" << std::endl;
69 std::cout <<
"\tMultiple Shooting Settings: " << std::endl;
70 std::cout <<
"=============================================================" << std::endl;
72 std::cout <<
"Shooting intervals N : " << N_ << std::endl;
73 std::cout <<
"Total Time horizon: " << T_ <<
"s" << std::endl;
74 std::cout <<
"Number of threads: " << nThreads_ << std::endl;
75 std::cout <<
"Splinetype: " << splineToString[
splineType_] << std::endl;
77 std::cout <<
"Objective type: " << objTypeToString[
objectiveType_] << std::endl;
78 std::cout <<
"Integration type: " << integratorToString[
integrationType_] << std::endl;
79 std::cout <<
"Simulation timestep dt_sim: " << dt_sim_ << std::endl;
81 std::cout <<
"=============================================================" << std::endl;
83 solverSettings_.
print();
88 if (N_ < 1 || N_ > 1000)
94 if (nThreads_ < 1 || nThreads_ > 32)
97 if (splineType_ < 0 || !(splineType_ < SplineType_t::num_types_splining))
100 if (costEvaluationType_ < 0 || !(costEvaluationType_ < CostEvaluationType_t::num_types_costevaluation))
103 if (objectiveType_ < 0 || !(objectiveType_ < ObjectiveType_t::num_types_objectives))
106 if (h_min_ < 0.01 || h_min_ > T_)
109 if (integrationType_ < 0 || !(integrationType_ < IntegrationType_t::num_types_integration))
112 if (dt_sim_ <= 0.0 || dt_sim_ > 100.0)
115 if (absErrTol_ <= 1e-20 || absErrTol_ > 1.0)
118 if (relErrTol_ <= 1e-20 || relErrTol_ > 1.0)
124 void load(
const std::string& filename,
bool verbose =
true,
const std::string& ns =
"dms")
127 std::cout <<
"Trying to load DMS config from " << filename <<
": " << std::endl;
129 boost::property_tree::ptree pt;
130 boost::property_tree::read_info(filename, pt);
132 N_ = pt.get<
unsigned int>(ns +
".N");
133 T_ = pt.get<
double>(ns +
".T");
134 nThreads_ = pt.get<
unsigned int>(ns +
".nThreads");
135 splineType_ =
static_cast<SplineType_t
>(pt.get<
unsigned int>(ns +
".InterpolationType"));
136 costEvaluationType_ =
static_cast<CostEvaluationType_t
>(pt.get<
unsigned int>(ns +
".CostEvaluationType"));
137 objectiveType_ =
static_cast<ObjectiveType_t
>(pt.get<
unsigned int>(ns +
".ObjectiveType"));
138 h_min_ = pt.get<
double>(ns +
".h_min");
140 integrationType_ =
static_cast<IntegrationType_t
>(pt.get<
unsigned int>(ns +
".IntegrationType"));
141 dt_sim_ = pt.get<
double>(ns +
".dt_sim");
142 absErrTol_ = pt.get<
double>(ns +
".AbsErrTol");
143 relErrTol_ = pt.get<
double>(ns +
".RelErrTol");
145 solverSettings_.
load(filename,
verbose, ns +
".solver");
146 cppadSettings_.
load(filename,
verbose, ns +
".cppad");
150 std::cout <<
"Loaded DMS config from " << filename <<
": " << std::endl;
156 std::map<SplineType, std::string> splineToString = {
158 std::map<ObjectiveType, std::string> objTypeToString = {
160 std::map<IntegrationType, std::string> integratorToString = {
161 {
EULER,
"Euler"}, {
RK4,
"Runge-Kutta 4th order"}, {
RK5,
"RK5 adaptive step size"}};
162 std::map<CostEvaluationType, std::string> costEvalToString = {{
SIMPLE,
"Simple"}, {
FULL,
"Full"}};
double absErrTol_
Definition: DmsSettings.h:60
ObjectiveType_t objectiveType_
Definition: DmsSettings.h:56
double relErrTol_
Definition: DmsSettings.h:61
enum ct::optcon::DmsSettings::SplineType SplineType_t
Definition: DmsSettings.h:28
Definition: DmsSettings.h:26
Definition: DmsSettings.h:27
Contains the NLP solver settings.
Definition: NlpSolverSettings.h:261
enum ct::optcon::DmsSettings::IntegrationType IntegrationType_t
bool parametersOk() const
Checks whether to settings are filled with meaningful values.
Definition: NlpSolverSettings.h:308
double dt_sim_
Definition: DmsSettings.h:59
Definition: DmsSettings.h:29
double T_
Definition: DmsSettings.h:52
Definition: DmsSettings.h:29
Definition: DmsSettings.h:28
size_t N_
Definition: DmsSettings.h:51
ct::core::DerivativesCppadSettings cppadSettings_
Definition: DmsSettings.h:64
Definition: DmsSettings.h:26
void print()
Prints out settings.
Definition: NlpSolverSettings.h:281
CostEvaluationType
Definition: DmsSettings.h:29
double h_min_
Definition: DmsSettings.h:57
bool parametersOk() const
Definition: DmsSettings.h:86
ObjectiveType
Definition: DmsSettings.h:27
enum ct::optcon::DmsSettings::CostEvaluationType CostEvaluationType_t
Definition: DmsSettings.h:28
NlpSolverSettings solverSettings_
Definition: DmsSettings.h:63
Definition: DmsSettings.h:27
Definition: DmsSettings.h:26
void load(const std::string &filename, bool verbose=true, const std::string &ns="solver")
Loads the settings from a .info file.
Definition: NlpSolverSettings.h:325
SplineType_t splineType_
Definition: DmsSettings.h:54
void load(const std::string &filename, bool verbose=true, const std::string &ns="solver")
Defines the DMS settings.
Definition: DmsSettings.h:23
void load(const std::string &filename, bool verbose=true, const std::string &ns="dms")
Definition: DmsSettings.h:124
void print()
Definition: DmsSettings.h:66
Definition: DmsSettings.h:27
enum ct::optcon::DmsSettings::ObjectiveType ObjectiveType_t
IntegrationType
Definition: DmsSettings.h:28
size_t nThreads_
Definition: DmsSettings.h:53
const bool verbose
Definition: ConstraintComparison.h:18
DmsSettings()
Default constructor. Sets some default DMS settings. Note that the optimal settings are strongly depe...
Definition: DmsSettings.h:36
CostEvaluationType_t costEvaluationType_
Definition: DmsSettings.h:55
IntegrationType_t integrationType_
Definition: DmsSettings.h:58
Definition: DmsSettings.h:29
Definition: DmsSettings.h:28
SplineType
Definition: DmsSettings.h:26