10 #include <boost/property_tree/ptree.hpp> 11 #include <boost/property_tree/info_parser.hpp> 25 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
73 std::cout <<
"=============================================================" << std::endl;
74 std::cout <<
"\tCPPAD Derivatives Settings: " << std::endl;
75 std::cout <<
"=============================================================" << std::endl;
78 std::cout <<
"Enabling multithreading in JIT lib" << std::endl;
79 if (createForwardZero_)
80 std::cout <<
"Generating Forward Zero in JIT lib" << std::endl;
81 if (createReverseOne_)
82 std::cout <<
"Generating Reverse One in JIT lib" << std::endl;
83 if (createReverseTwo_)
84 std::cout <<
"Generating Reverse Two in JIT lib" << std::endl;
86 std::cout <<
"Generating Jacobian in JIT lib" << std::endl;
87 if (createSparseJacobian_)
88 std::cout <<
"Generating Sparse Jacobian in JIT lib" << std::endl;
90 std::cout <<
"Generating Hessian in JIT lib" << std::endl;
91 if (createSparseHessian_)
92 std::cout <<
"Generating Sparse Hessian in JIT lib" << std::endl;
94 std::cout <<
"Using " + compilerToString[
compiler_] +
" to compile the generated derivatives" << std::endl;
96 std::cout <<
"Max Assignements per generated Function:" << maxAssignements_ << std::endl;
98 if (generateSourceCode_)
99 std::cout <<
"Generating and saving Source Code" << std::endl;
101 if (useDynamicLibrary_)
102 std::cout <<
"Creating a dynamic library (*.so will be saved in execution directory)" << std::endl;
119 void load(
const std::string& filename,
bool verbose =
true,
const std::string& ns =
"solver")
121 boost::property_tree::ptree pt;
122 boost::property_tree::read_info(filename, pt);
124 multiThreading_ = pt.get<
bool>(ns +
".MultiThreading");
125 createForwardZero_ = pt.get<
bool>(ns +
".CreateForwardZero");
126 createForwardOne_ = pt.get<
bool>(ns +
".CreateForwardOne");
127 createReverseOne_ = pt.get<
bool>(ns +
".CreateReverseOne");
128 createReverseTwo_ = pt.get<
bool>(ns +
".CreateReverseTwo");
129 createJacobian_ = pt.get<
bool>(ns +
".CreateJacobian");
130 createSparseJacobian_ = pt.get<
bool>(ns +
".CreateSparseJacobian");
131 createHessian_ = pt.get<
bool>(ns +
".CreateHessian");
132 createSparseHessian_ = pt.get<
bool>(ns +
".CreateSparseHessian");
133 maxAssignements_ = pt.get<
unsigned int>(ns +
".MaxAssignements");
134 generateSourceCode_ = pt.get<
bool>(ns +
".GenerateSourceCode");
135 useDynamicLibrary_ = pt.get<
bool>(ns +
".UseDynamicLibrary");
137 std::string compilerStr = pt.get<std::string>(ns +
".Compiler");
139 if (stringTocompiler.find(compilerStr) != stringTocompiler.end())
140 compiler_ = stringTocompiler[compilerStr];
143 std::cout <<
"Invalid compiler specified in config, should be one of the following:" << std::endl;
145 for (
auto it = stringTocompiler.begin(); it != stringTocompiler.end(); it++)
146 std::cout << it->first << std::endl;
151 std::cout <<
"Loaded Derivatives CPPAD settings from " << filename <<
": " << std::endl;
157 std::map<CompilerType, std::string> compilerToString = {{
GCC,
"GCC"}, {
CLANG,
"CLANG"}};
158 std::map<std::string, CompilerType> stringTocompiler = {{
"GCC",
GCC}, {
"CLANG",
CLANG}};
bool createSparseJacobian_
Definition: DerivativesCppadSettings.h:60
bool multiThreading_
Definition: DerivativesCppadSettings.h:54
bool createSparseHessian_
Definition: DerivativesCppadSettings.h:62
bool createReverseTwo_
Definition: DerivativesCppadSettings.h:58
CompilerType compiler_
Definition: DerivativesCppadSettings.h:64
DerivativesCppadSettings()
Default constructor, set default settings.
Definition: DerivativesCppadSettings.h:37
Definition: DerivativesCppadSettings.h:29
bool generateSourceCode_
Definition: DerivativesCppadSettings.h:65
Definition: DerivativesCppadSettings.h:31
bool createReverseOne_
Definition: DerivativesCppadSettings.h:57
Definition: DerivativesCppadSettings.h:30
bool createJacobian_
Definition: DerivativesCppadSettings.h:59
void load(const std::string &filename, bool verbose=true, const std::string &ns="solver")
Loads the settings from a .info file.
Definition: DerivativesCppadSettings.h:119
bool parametersOk() const
Checks whether to settings are filled with meaningful values.
Definition: DerivativesCppadSettings.h:110
const bool verbose
Definition: JacobianCGTest.h:19
bool createHessian_
Definition: DerivativesCppadSettings.h:61
EIGEN_MAKE_ALIGNED_OPERATOR_NEW enum ct::core::DerivativesCppadSettings::CompilerType Compiler_t
bool createForwardZero_
Definition: DerivativesCppadSettings.h:55
Contains the NLP solver settings.
Definition: DerivativesCppadSettings.h:22
bool useDynamicLibrary_
Definition: DerivativesCppadSettings.h:66
bool createForwardOne_
Definition: DerivativesCppadSettings.h:56
CompilerType
Definition: DerivativesCppadSettings.h:27
size_t maxAssignements_
Definition: DerivativesCppadSettings.h:63
void print()
Prints out settings.
Definition: DerivativesCppadSettings.h:71