- 3.0.2 optimal control module.
NLOptConSettings.hpp
Go to the documentation of this file.
1 /**********************************************************************************************************************
2 This file is part of the Control Toolbox (https://github.com/ethz-adrl/control-toolbox), copyright by ETH Zurich.
3 Licensed under the BSD-2 license (see LICENSE file in main directory)
4 **********************************************************************************************************************/
5 
6 #pragma once
7 
8 #include <map>
9 
10 #include <boost/property_tree/info_parser.hpp>
11 
12 namespace ct {
13 namespace optcon {
14 
15 
17 
23 {
25  enum TYPE
26  {
27  NONE = 0,
32  };
33 
35  std::map<TYPE, std::string> lineSearchTypeToString = {{NONE, "NONE (take full-step updates with alpha=1.0)"},
36  {SIMPLE, "Simple Backtracking with cost/merit"}, {ARMIJO, "ARMIJO-style Backtracking for single-shooting"},
37  {GOLDSTEIN, "GOLDSTEIN backtracking using Riccati matrices"}};
38 
39  std::map<std::string, TYPE> stringToLineSearchType = {
40  {"NONE", NONE}, {"SIMPLE", SIMPLE}, {"ARMIJO", ARMIJO}, {"GOLDSTEIN", GOLDSTEIN}};
41 
42 
45  : type(NONE),
46  adaptive(false),
47  maxIterations(10),
48  alpha_0(1.0),
49  alpha_max(1.0),
50  n_alpha(0.5),
51  armijo_parameter(0.01),
52  debugPrint(false)
53  {
54  }
55 
57  bool parametersOk() const { return (alpha_0 > 0.0) && (n_alpha > 0.0) && (n_alpha < 1.0) && (alpha_max > 0.0); }
59  bool adaptive;
60  size_t maxIterations;
61  double alpha_0;
62  double alpha_max;
63  double
66  bool debugPrint;
69  void print() const
71  {
72  std::cout << "Line Search Settings: " << std::endl;
73  std::cout << "=====================" << std::endl;
74  std::cout << "type:\t" << lineSearchTypeToString.at(type) << std::endl;
75  std::cout << "adaptive:\t" << adaptive << std::endl;
76  std::cout << "maxIter:\t" << maxIterations << std::endl;
77  std::cout << "alpha_0:\t" << alpha_0 << std::endl;
78  std::cout << "alpha_max:\t" << alpha_max << std::endl;
79  std::cout << "n_alpha:\t" << n_alpha << std::endl;
80  std::cout << "armijo_parameter:\t" << armijo_parameter << std::endl;
81  std::cout << "debugPrint:\t" << debugPrint << std::endl;
82  std::cout << " =======" << std::endl;
83  std::cout << std::endl;
84  }
85 
87  void load(const std::string& filename, bool verbose = true, const std::string& ns = "line_search")
88  {
89  if (verbose)
90  std::cout << "Trying to load line search settings from " << filename << ": " << std::endl;
91 
92  boost::property_tree::ptree pt;
93  boost::property_tree::read_info(filename, pt);
94 
95  std::string ls_type = pt.get<std::string>(ns + ".type");
96  if (stringToLineSearchType.find(ls_type) != stringToLineSearchType.end())
97  {
98  type = stringToLineSearchType[ls_type];
99  }
100  else
101  {
102  std::cout << "Invalid line search type specified in config, should be one of the following:" << std::endl;
103 
104  for (auto it = stringToLineSearchType.begin(); it != stringToLineSearchType.end(); it++)
105  {
106  std::cout << it->first << std::endl;
107  }
108 
109  exit(-1);
110  }
111 
112 
113  maxIterations = pt.get<size_t>(ns + ".maxIterations");
114  alpha_0 = pt.get<double>(ns + ".alpha_0");
115  n_alpha = pt.get<double>(ns + ".n_alpha");
116  debugPrint = pt.get<bool>(ns + ".debugPrint");
117  alpha_max = alpha_0;
118  adaptive = false;
119 
120  try
121  {
122  armijo_parameter = pt.get<double>(ns + ".armijo_parameter");
123  } catch (...)
124  {
125  }
126 
127  try
128  {
129  adaptive = pt.get<bool>(ns + ".adaptive");
130  } catch (...)
131  {
132  }
133 
134  try
135  {
136  alpha_max = pt.get<double>(ns + ".alpha_max");
137  } catch (...)
138  {
139  }
140 
141  if (verbose)
142  {
143  std::cout << "Loaded line search settings from " << filename << ": " << std::endl;
144  print();
145  }
146  }
147 };
148 
149 
151 
155 {
156 public:
157  LQOCSolverSettings() : lqoc_debug_print(false), num_lqoc_iterations(10) {}
158 
161 
162  void print() const
163  {
164  std::cout << "======================= LQOCSolverSettings =====================" << std::endl;
165  std::cout << "num_lqoc_iterations: \t" << num_lqoc_iterations << std::endl;
166  std::cout << "lqoc_debug_print: \t" << lqoc_debug_print << std::endl;
167  }
168 
169  void load(const std::string& filename, bool verbose = true, const std::string& ns = "lqoc_solver_settings")
170  {
171  if (verbose)
172  std::cout << "Trying to load LQOCSolverSettings config from " << filename << ": " << std::endl;
173 
174  boost::property_tree::ptree pt;
175  boost::property_tree::read_info(filename, pt);
176 
177  try
178  {
179  num_lqoc_iterations = pt.get<int>(ns + ".num_lqoc_iterations");
180  } catch (...)
181  {
182  }
183  try
184  {
185  lqoc_debug_print = pt.get<bool>(ns + ".lqoc_debug_print");
186  } catch (...)
187  {
188  }
189  }
190 };
191 
192 
199 {
200 public:
203  {
204  GNMS = 0,
212  };
213 
216  {
217  GNRICCATI_SOLVER = 0,
218  HPIPM_SOLVER = 1
219  };
220 
222 
224 
228  : integrator(ct::core::IntegrationType::RK4),
229  discretization(APPROXIMATION::BACKWARD_EULER),
230  timeVaryingDiscretization(false),
231  nlocp_algorithm(GNMS),
232  lqocp_solver(GNRICCATI_SOLVER),
233  loggingPrefix("alg"),
234  epsilon(1e-5),
235  dt(0.001),
236  K_sim(1),
237  K_shot(1),
238  min_cost_improvement(1e-5),
239  maxDefectSum(1e-5),
240  meritFunctionRho(0.0),
241  meritFunctionRhoConstraints(1.0),
242  max_iterations(100),
243  fixedHessianCorrection(false),
244  recordSmallestEigenvalue(false),
245  nThreads(4),
246  nThreadsEigen(4),
247  lineSearchSettings(),
248  debugPrint(false),
249  printSummary(true),
250  useSensitivityIntegrator(false),
251  logToMatlab(false)
252  {
253  }
254 
260  std::string loggingPrefix;
261  double epsilon;
262  double dt;
263  int K_sim;
264  int K_shot;
266  double maxDefectSum;
272  int nThreads;
273  size_t
280  bool logToMatlab;
281 
282 
284 
290  int computeK(double timeHorizon) const
291  {
292  if (timeHorizon < 0.0)
293  {
294  throw std::runtime_error("time Horizon is negative");
295  }
296  return std::max(1, (int)std::lround(timeHorizon / dt));
297  }
298 
300  double getSimulationTimestep() const { return (dt / (double)K_sim); }
301 
303  bool closedLoopShooting() const { return nlocAlgorithmToClosedLoopShooting.at(nlocp_algorithm); }
304 
306  bool isSingleShooting() const { return nlocAlgorithmToSingleShooting.at(nlocp_algorithm); }
307 
309  void print() const
310  {
311  std::cout << "======================= NLOptCon Settings =====================" << std::endl;
312  std::cout << "===============================================================" << std::endl;
313  std::cout << "integrator: " << integratorToString.at(integrator) << std::endl;
314  std::cout << "discretization: " << discretizationToString.at(discretization) << std::endl;
315  std::cout << "time varying discretization: " << timeVaryingDiscretization << std::endl;
316  std::cout << "nonlinear OCP algorithm: " << nlocAlgorithmToString.at(nlocp_algorithm) << std::endl;
317  std::cout << "linear-quadratic OCP solver: " << lqocSolverToString.at(lqocp_solver) << std::endl;
318  std::cout << "dt:\t" << dt << std::endl;
319  std::cout << "K_sim:\t" << K_sim << std::endl;
320  std::cout << "K_shot:\t" << K_shot << std::endl;
321  std::cout << "maxIter:\t" << max_iterations << std::endl;
322  std::cout << "min cost improvement:\t" << min_cost_improvement << std::endl;
323  std::cout << "max defect sum:\t" << maxDefectSum << std::endl;
324  std::cout << "merit function rho defects:\t" << meritFunctionRho << std::endl;
325  std::cout << "merit function rho constraints:\t" << meritFunctionRhoConstraints << std::endl;
326  std::cout << "fixedHessianCorrection:\t" << fixedHessianCorrection << std::endl;
327  std::cout << "recordSmallestEigenvalue:\t" << recordSmallestEigenvalue << std::endl;
328  std::cout << "epsilon:\t" << epsilon << std::endl;
329  std::cout << "nThreads:\t" << nThreads << std::endl;
330  std::cout << "nThreadsEigen:\t" << nThreadsEigen << std::endl;
331  std::cout << "loggingPrefix:\t" << loggingPrefix << std::endl;
332  std::cout << "debugPrint:\t" << debugPrint << std::endl;
333  std::cout << "printSummary:\t" << printSummary << std::endl;
334  std::cout << "useSensitivityIntegrator:\t" << useSensitivityIntegrator << std::endl;
335  std::cout << "logToMatlab:\t" << logToMatlab << std::endl;
336  std::cout << std::endl;
337 
338  lineSearchSettings.print();
339 
340  lqoc_solver_settings.print();
341 
342  std::cout << "===============================================================" << std::endl;
343  }
344 
346 
349  bool parametersOk() const
350  {
351  if (dt <= 0)
352  {
353  std::cout << "Invalid parameter dt in NLOptConSettings, needs to be > 0. dt currently is " << dt
354  << std::endl;
355  return false;
356  }
357 
358  if (K_sim <= 0)
359  {
360  std::cout << "Invalid parameter K_sim in NLOptConSettings, needs to be >= 1. K_sim currently is " << K_sim
361  << std::endl;
362  return false;
363  }
364 
365  if (K_shot <= 0)
366  {
367  std::cout << "Invalid parameter K_shot in NLOptConSettings, needs to be >= 1. K_shot currently is "
368  << K_shot << std::endl;
369  return false;
370  }
371 
372  // TODO need thorough check if this is really the case ....
373  if ((K_shot > 1) && (nlocp_algorithm == ILQR))
374  {
375  std::cout << "Invalid parameter: for iLQR K_shot needs to be 1. K_shot currently is " << K_shot
376  << std::endl;
377  return false;
378  }
379 
380  if (nThreads > 100 || nThreadsEigen > 100)
381  {
382  std::cout << "Number of threads should not exceed 100." << std::endl;
383  return false;
384  }
385  return (lineSearchSettings.parametersOk());
386  }
387 
388 
390 
396  void load(const std::string& filename, bool verbose = true, const std::string& ns = "alg")
397  {
398  if (verbose)
399  std::cout << "Trying to load NLOptCon config from " << filename << ": " << std::endl;
400 
401  boost::property_tree::ptree pt;
402  boost::property_tree::read_info(filename, pt);
403 
404  try
405  {
406  epsilon = pt.get<double>(ns + ".epsilon");
407  } catch (...)
408  {
409  }
410  try
411  {
412  timeVaryingDiscretization = pt.get<bool>(ns + ".timeVaryingDiscretization");
413  } catch (...)
414  {
415  }
416  try
417  {
418  min_cost_improvement = pt.get<double>(ns + ".min_cost_improvement");
419  } catch (...)
420  {
421  }
422  try
423  {
424  maxDefectSum = pt.get<double>(ns + ".maxDefectSum");
425  } catch (...)
426  {
427  }
428  try
429  {
430  meritFunctionRho = pt.get<double>(ns + ".meritFunctionRho");
431  } catch (...)
432  {
433  }
434  try
435  {
436  meritFunctionRhoConstraints = pt.get<double>(ns + ".meritFunctionRhoConstraints");
437  } catch (...)
438  {
439  }
440  try
441  {
442  max_iterations = pt.get<int>(ns + ".max_iterations");
443  } catch (...)
444  {
445  }
446  try
447  {
448  nThreads = pt.get<int>(ns + ".nThreads");
449  } catch (...)
450  {
451  }
452  try
453  {
454  loggingPrefix = pt.get<std::string>(ns + ".loggingPrefix");
455  } catch (...)
456  {
457  }
458  try
459  {
460  debugPrint = pt.get<bool>(ns + ".debugPrint");
461  } catch (...)
462  {
463  }
464  try
465  {
466  printSummary = pt.get<bool>(ns + ".printSummary");
467  } catch (...)
468  {
469  }
470  try
471  {
472  useSensitivityIntegrator = pt.get<bool>(ns + ".useSensitivityIntegrator");
473  } catch (...)
474  {
475  }
476  try
477  {
478  logToMatlab = pt.get<bool>(ns + ".logToMatlab");
479  } catch (...)
480  {
481  }
482  try
483  {
484  dt = pt.get<double>(ns + ".dt");
485  } catch (...)
486  {
487  }
488  try
489  {
490  K_sim = pt.get<int>(ns + ".K_sim");
491  } catch (...)
492  {
493  }
494  try
495  {
496  K_shot = pt.get<int>(ns + ".K_shot");
497  } catch (...)
498  {
499  }
500  try
501  {
502  nThreadsEigen = pt.get<size_t>(ns + ".nThreadsEigen");
503  } catch (...)
504  {
505  }
506  try
507  {
508  recordSmallestEigenvalue = pt.get<bool>(ns + ".recordSmallestEigenvalue");
509  } catch (...)
510  {
511  }
512  try
513  {
514  fixedHessianCorrection = pt.get<bool>(ns + ".fixedHessianCorrection");
515  } catch (...)
516  {
517  }
518 
519  try
520  {
521  lineSearchSettings.load(filename, verbose, ns + ".line_search");
522  } catch (...)
523  {
524  }
525  try
526  {
527  lqoc_solver_settings.load(filename, verbose, ns + ".lqoc_solver_settings");
528  } catch (...)
529  {
530  }
531 
532 
533  try
534  {
535  std::string integratorStr = pt.get<std::string>(ns + ".integrator");
536  if (stringToIntegrator.find(integratorStr) != stringToIntegrator.end())
537  {
538  integrator = stringToIntegrator[integratorStr];
539  }
540  else
541  {
542  std::cout << "Invalid integrator specified in config, should be one of the following:" << std::endl;
543 
544  for (auto it = stringToIntegrator.begin(); it != stringToIntegrator.end(); it++)
545  {
546  std::cout << it->first << std::endl;
547  }
548 
549  exit(-1);
550  }
551 
552  std::string discretizationStr = pt.get<std::string>(ns + ".discretization");
553  if (stringToDiscretization.find(discretizationStr) != stringToDiscretization.end())
554  {
555  discretization = stringToDiscretization[discretizationStr];
556  }
557  else
558  {
559  std::cout << "Invalid discretization specified in config, should be one of the following:" << std::endl;
560 
561  for (auto it = stringToDiscretization.begin(); it != stringToDiscretization.end(); it++)
562  {
563  std::cout << it->first << std::endl;
564  }
565 
566  exit(-1);
567  }
568 
569  std::string nlocp_algorithmStr = pt.get<std::string>(ns + ".nlocp_algorithm");
570  if (stringToNlocAlgorithm.find(nlocp_algorithmStr) != stringToNlocAlgorithm.end())
571  {
572  nlocp_algorithm = stringToNlocAlgorithm[nlocp_algorithmStr];
573  }
574  else
575  {
576  std::cout << "Invalid nlocp_algorithm specified in config, should be one of the following:"
577  << std::endl;
578 
579  for (auto it = stringToNlocAlgorithm.begin(); it != stringToNlocAlgorithm.end(); it++)
580  {
581  std::cout << it->first << std::endl;
582  }
583 
584  exit(-1);
585  }
586 
587 
588  std::string locp_solverStr = pt.get<std::string>(ns + ".locp_solver");
589  if (stringToLqocSolver.find(locp_solverStr) != stringToLqocSolver.end())
590  {
591  lqocp_solver = stringToLqocSolver[locp_solverStr];
592  }
593  else
594  {
595  std::cout << "Invalid locp_solver specified in config, should be one of the following:" << std::endl;
596 
597  for (auto it = stringToLqocSolver.begin(); it != stringToLqocSolver.end(); it++)
598  {
599  std::cout << it->first << std::endl;
600  }
601 
602  exit(-1);
603  }
604 
605  } catch (...)
606  {
607  }
608 
609  if (verbose)
610  {
611  std::cout << "Loaded NLOptCon config from " << filename << ": " << std::endl;
612  print();
613  }
614  }
615 
616 
618 
624  static NLOptConSettings fromConfigFile(const std::string& filename,
625  bool verbose = true,
626  const std::string& ns = "alg")
627  {
628  NLOptConSettings settings;
629  settings.load(filename, true, ns);
630  return settings;
631  }
632 
633 private:
635  std::map<ct::core::IntegrationType, std::string> integratorToString = {{ct::core::IntegrationType::EULER, "Euler"},
636  {ct::core::IntegrationType::RK4, "Runge-Kutta 4th Order"},
637  {ct::core::IntegrationType::MODIFIED_MIDPOINT, "Modified midpoint"},
638  {ct::core::IntegrationType::ODE45, "ode45"}, {ct::core::IntegrationType::RK5VARIABLE, "RK5 variable step"},
639  {ct::core::IntegrationType::RK78, "RK78"}, {ct::core::IntegrationType::BULIRSCHSTOER, "Bulirsch-Stoer"},
640  {ct::core::IntegrationType::EULERCT, "Euler (CT)"},
641  {ct::core::IntegrationType::RK4CT, "Runge-Kutta 4th Order (CT"},
642  {ct::core::IntegrationType::EULER_SYM, "Symplectic Euler"},
643  {ct::core::IntegrationType::RK_SYM, "Symplectic Runge Kutta"}};
644 
645  std::map<std::string, ct::core::IntegrationType> stringToIntegrator = {{"Euler", ct::core::IntegrationType::EULER},
646  {"RK4", ct::core::IntegrationType::RK4}, {"MODIFIED_MIDPOINT", ct::core::IntegrationType::MODIFIED_MIDPOINT},
647  {"ODE45", ct::core::IntegrationType::ODE45}, {"RK5VARIABLE", ct::core::IntegrationType::RK5VARIABLE},
648  {"RK78", ct::core::IntegrationType::RK78}, {"BULIRSCHSTOER", ct::core::IntegrationType::BULIRSCHSTOER},
649  {"EulerCT", ct::core::IntegrationType::EULERCT}, {"RK4CT", ct::core::IntegrationType::RK4CT},
650  {"Euler_Sym", ct::core::IntegrationType::EULER_SYM}, {"Rk_Sym", ct::core::IntegrationType::RK_SYM}};
651 
652 
654  std::map<APPROXIMATION, std::string> discretizationToString = {{APPROXIMATION::FORWARD_EULER, "Forward_euler"},
655  {APPROXIMATION::BACKWARD_EULER, "Backward_euler"}, {APPROXIMATION::SYMPLECTIC_EULER, "Symplectic_euler"},
656  {APPROXIMATION::TUSTIN, "Tustin"}, {APPROXIMATION::MATRIX_EXPONENTIAL, "Matrix_exponential"}};
657 
658  std::map<std::string, APPROXIMATION> stringToDiscretization = {{"Forward_euler", APPROXIMATION::FORWARD_EULER},
659  {"Backward_euler", APPROXIMATION::BACKWARD_EULER}, {"Symplectic_euler", APPROXIMATION::SYMPLECTIC_EULER},
660  {"Tustin", APPROXIMATION::TUSTIN}, {"Matrix_exponential", APPROXIMATION::MATRIX_EXPONENTIAL}};
661 
662 
664  std::map<NLOCP_ALGORITHM, std::string> nlocAlgorithmToString = {{GNMS, "GNMS (Gauss-Newton Multiple Shooting)"},
665  {ILQR, "ILQR (iterative linear-quadratic optimal control)"}, {MS_ILQR, "MS_ILQR (multiple-shooting iLQR)"},
666  {SS_OL, "SS_OL (open-loop Single Shooting)"}, {SS_CL, "SS_CL (closed-loop Single Shooting)"},
667  {GNMS_M_OL, "GNMS_M_OL (GNMS(M) with open-loop shooting)"},
668  {GNMS_M_CL, "GNMS_M_CL (GNMS(M) with closed-loop shooting)"}};
669 
670  std::map<std::string, NLOCP_ALGORITHM> stringToNlocAlgorithm = {{"GNMS", GNMS}, {"ILQR", ILQR},
671  {"MS_ILQR", MS_ILQR}, {"SS_OL", SS_OL}, {"SS_CL", SS_CL}, {"GNMS_M_OL", GNMS_M_OL}, {"GNMS_M_CL", GNMS_M_CL}};
672 
673  std::map<NLOCP_ALGORITHM, bool> nlocAlgorithmToClosedLoopShooting = {{GNMS, false}, {ILQR, true}, {MS_ILQR, true},
674  {SS_OL, false}, {SS_CL, true}, {GNMS_M_OL, false}, {GNMS_M_CL, true}};
675 
676  std::map<NLOCP_ALGORITHM, bool> nlocAlgorithmToSingleShooting = {{GNMS, false}, {ILQR, true}, {MS_ILQR, false},
677  {SS_OL, true}, {SS_CL, true}, {GNMS_M_OL, false}, {GNMS_M_CL, false}};
678 
680  std::map<LQOCP_SOLVER, std::string> lqocSolverToString = {
681  {GNRICCATI_SOLVER, "GNRICCATI_SOLVER"}, {HPIPM_SOLVER, "HPIPM_SOLVER"}};
682 
683  std::map<std::string, LQOCP_SOLVER> stringToLqocSolver = {
684  {"GNRICCATI_SOLVER", GNRICCATI_SOLVER}, {"HPIPM_SOLVER", HPIPM_SOLVER}};
685 };
686 } // namespace optcon
687 } // namespace ct
LineSearchSettings lineSearchSettings
number of threads for eigen parallelization (applies both to MP and ST) Note. in order to activate Ei...
Definition: NLOptConSettings.hpp:275
LQOCP_SOLVER lqocp_solver
which nonlinear optimal control algorithm is to be used
Definition: NLOptConSettings.hpp:259
double maxDefectSum
minimum cost improvement between two interations to assume convergence
Definition: NLOptConSettings.hpp:266
Classical (open-loop) Single Shooting.
Definition: NLOptConSettings.hpp:208
take full-step updates
Definition: NLOptConSettings.hpp:28
bool printSummary
Definition: NLOptConSettings.hpp:278
std::string loggingPrefix
the solver for the linear-quadratic optimal control problem
Definition: NLOptConSettings.hpp:260
size_t nThreadsEigen
number of threads, for MP version
Definition: NLOptConSettings.hpp:274
double armijo_parameter
Definition: NLOptConSettings.hpp:65
double dt
Eigenvalue correction factor for Hessian regularization.
Definition: NLOptConSettings.hpp:262
TYPE type
Definition: NLOptConSettings.hpp:58
bool closedLoopShooting() const
return if this is a closed-loop shooting algorithm (or not)
Definition: NLOptConSettings.hpp:303
int num_lqoc_iterations
Definition: NLOptConSettings.hpp:160
Classical iLQR (1 shooting interval equal to problem horizon)
Definition: NLOptConSettings.hpp:206
double alpha_0
Definition: NLOptConSettings.hpp:61
bool debugPrint
Definition: NLOptConSettings.hpp:66
bool debugPrint
Definition: NLOptConSettings.hpp:277
multiple-shooting iLQR
Definition: NLOptConSettings.hpp:207
Closed-loop single shooting.
Definition: NLOptConSettings.hpp:209
double meritFunctionRhoConstraints
trade off between internal (defect)constraint violation and cost
Definition: NLOptConSettings.hpp:268
double epsilon
the prefix to be stored before the matfile name for logging
Definition: NLOptConSettings.hpp:261
double getSimulationTimestep() const
compute the simulation timestep
Definition: NLOptConSettings.hpp:300
backtracking including riccati matrix measure
Definition: NLOptConSettings.hpp:30
void print() const
print the current line search settings to console
Definition: NLOptConSettings.hpp:70
LineSearchSettings()
default constructor for the NLOptCon line-search settings
Definition: NLOptConSettings.hpp:44
bool isSingleShooting() const
return if this is a single-shooting algorithm (or not)
Definition: NLOptConSettings.hpp:306
std::map< std::string, TYPE > stringToLineSearchType
Definition: NLOptConSettings.hpp:39
NLOCP_ALGORITHM
algorithm types for solving the NLOC problem
Definition: NLOptConSettings.hpp:202
void load(const std::string &filename, bool verbose=true, const std::string &ns="lqoc_solver_settings")
Definition: NLOptConSettings.hpp:169
std::map< TYPE, std::string > lineSearchTypeToString
mappings for line-search types
Definition: NLOptConSettings.hpp:35
double min_cost_improvement
duration of a shot as an integer multiple of dt
Definition: NLOptConSettings.hpp:265
const double dt
Definition: LQOCSolverTiming.cpp:18
NLOCP_ALGORITHM nlocp_algorithm
Definition: NLOptConSettings.hpp:258
LQOCP_SOLVER
the linear optimal control problem solver in the background
Definition: NLOptConSettings.hpp:215
bool useSensitivityIntegrator
Definition: NLOptConSettings.hpp:279
double meritFunctionRho
maximum sum of squared defects (assume covergence if lower than this number)
Definition: NLOptConSettings.hpp:267
Settings for the NLOptCon algorithm.
Definition: NLOptConSettings.hpp:198
bool logToMatlab
Definition: NLOptConSettings.hpp:280
ct::core::Time timeHorizon
Definition: ConstrainedNLOCTest.cpp:15
backtracking including riccati matrix measure and defects
Definition: NLOptConSettings.hpp:31
double alpha_max
Definition: NLOptConSettings.hpp:62
LQOCSolverSettings()
Definition: NLOptConSettings.hpp:157
APPROXIMATION discretization
which integrator to use during the NLOptCon forward rollout
Definition: NLOptConSettings.hpp:256
RK4
bool fixedHessianCorrection
the maximum admissible number of NLOptCon main iterations
Definition: NLOptConSettings.hpp:270
int K_sim
sampling time for the control input (seconds)
Definition: NLOptConSettings.hpp:263
bool timeVaryingDiscretization
Definition: NLOptConSettings.hpp:257
size_t maxIterations
Definition: NLOptConSettings.hpp:60
void print() const
number of allowed sub-iterations of LQOC solver per NLOC main iteration
Definition: NLOptConSettings.hpp:162
GNMS Line Search Settings.
Definition: NLOptConSettings.hpp:22
bool parametersOk() const
check if the currently set line-search parameters are meaningful
Definition: NLOptConSettings.hpp:57
int computeK(double timeHorizon) const
log to matlab (true/false)
Definition: NLOptConSettings.hpp:290
void load(const std::string &filename, bool verbose=true, const std::string &ns="line_search")
load line search settings from file
Definition: NLOptConSettings.hpp:87
void print() const
print the current NLOptCon settings to console
Definition: NLOptConSettings.hpp:309
GNMS(M) with open-loop shooting.
Definition: NLOptConSettings.hpp:210
static NLOptConSettings fromConfigFile(const std::string &filename, bool verbose=true, const std::string &ns="alg")
load settings from config file and return as settings struct
Definition: NLOptConSettings.hpp:624
simple backtracking using cost or merit function
Definition: NLOptConSettings.hpp:29
bool adaptive
Definition: NLOptConSettings.hpp:59
int max_iterations
trade off between external (general and path) constraint violation and cost
Definition: NLOptConSettings.hpp:269
bool recordSmallestEigenvalue
perform Hessian regularization by incrementing the eigenvalues by epsilon.
Definition: NLOptConSettings.hpp:271
LQOC Solver settings.
Definition: NLOptConSettings.hpp:154
LQOCSolverSettings lqoc_solver_settings
the line search settings
Definition: NLOptConSettings.hpp:276
ct::core::IntegrationType integrator
Definition: NLOptConSettings.hpp:255
const bool verbose
Definition: ConstraintComparison.h:18
int nThreads
save the smallest eigenvalue of the Hessian
Definition: NLOptConSettings.hpp:272
int K_shot
number of sub-integration-steps
Definition: NLOptConSettings.hpp:264
double n_alpha
Definition: NLOptConSettings.hpp:64
bool lqoc_debug_print
Definition: NLOptConSettings.hpp:159
Gauss-Newton Multiple Shooting (shooting interval = control interval)
Definition: NLOptConSettings.hpp:205
bool parametersOk() const
perform a quick check if the given NLOptCon settings fulfil minimum requirements
Definition: NLOptConSettings.hpp:349
TYPE
types of backtracking line-search
Definition: NLOptConSettings.hpp:25
typename core::SensitivityApproximationSettings::APPROXIMATION APPROXIMATION
Definition: NLOptConSettings.hpp:221
Definition: NLOptConSettings.hpp:27
NLOptConSettings()
NLOptCon Settings default constructor.
Definition: NLOptConSettings.hpp:227
IntegrationType
void load(const std::string &filename, bool verbose=true, const std::string &ns="alg")
load NLOptCon Settings from file
Definition: NLOptConSettings.hpp:396