Commit cb99c1eb authored by Laurent Belcour's avatar Laurent Belcour

Adding a function get_string to the argument object.

Adding more functionalities to the Ipopt fitter
parent 12b40171
......@@ -131,6 +131,18 @@ class arguments
return std::string() ;
}
}
//! \brief acces to the string value associated with the parameter
//! \a key.
//!
//! The \a default_value argument will be returned if the \a key
//! has no associated value.
std::string get_string(const std::string& key, std::string default_value = "") const
{
if(_map.count(key) > 0)
return _map.find(key)->second.c_str() ;
else
return default_value ;
}
//! \brief acces to the float value associated with the parameter
//! \a key.
//!
......
......@@ -265,9 +265,15 @@ bool nonlinear_fitter_ipopt::fit_data(const data* d, function* fit, const argume
// Static parameters for the Solver
app->Options()->SetStringValue("hessian_approximation", "limited-memory");
#ifdef DEBUG
app->Options()->SetIntegerValue("print_level", 5);
#else
app->Options()->SetIntegerValue("print_level", 0);
#endif
// Solver's options
app->Options()->SetIntegerValue("max_iter", args.get_int("ipopt-max-iter", 10));
app->Options()->SetStringValue("linear_solver", args.get_string("ipopt-solver", "mumps"));
// Solves the NL problem
......
......@@ -28,11 +28,21 @@
*
* <pre>
* INCLUDEPATH += [path-to-ipopt-include]
* LIBS += -L[path-to-ipopt-lib] -lipopt
* LIBS += -L[path-to-ipopt-lib] -lipopt -lipoptamplinterface
* -lcoinmumps -lcoinmetis -lcoinlapack -lcoinblas -lcoinasl
* </pre>
*
*
* <h3>Plugin parameters</h3>
* <ul>
* <li><b>--ipopt-max-iter</b> <em>[int]</em> to control the number
* of iterations the non linear solver will take before returning a
* solution. <em>Note that this solution might incorrect.</em></li>
* <li><b>--ceres-solverr</b> <em>[string]</em> to control the type
* linear solver that will be used during matrix operations. See
* <a href="http://www.coin-or.org/Ipopt/documentation/node50.html">
* here</a> for the list of possible choices.</li>
* </ul>
*
*/
class nonlinear_fitter_ipopt: public fitter
......
import math
f = open('unitary-blinn.data', 'w+')
# Generate the header of the file in the ALTA format
f.write("#DIM 1 1\n")
f.write("#PARAM_IN COS_TH\n")
f.write("#PARAM_OUT INV_STERADIAN\n")
def blinn(cost, sigma):
return math.pow(cost, sigma);
#endif
for i in range(0,99):
theta = i * 0.01
val = blinn(theta, 10);
f.write(str(theta) + "\t" + str(val) + "\n");
#end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment