Une MAJ de sécurité est nécessaire sur notre version actuelle. Elle sera effectuée lundi 02/08 entre 12h30 et 13h. L'interruption de service devrait durer quelques minutes (probablement moins de 5 minutes).

Commit db8cc8f5 authored by Laurent Belcour's avatar Laurent Belcour
Browse files

Adding bounds to the LM search of Eigen. Adding boundaries to the CERES

solver too. It doesn't produce better fits though.
parent 2b45651f
......@@ -30,6 +30,18 @@ class CeresFunctor : public ceres::CostFunction
virtual bool Evaluate(double const* const* x, double* y, double** dy) const
{
// Check that the parameters used are within the bounds defined
// by the function
vec p_min = _f->getParametersMin();
vec p_max = _f->getParametersMax();
for(int i=0; i<_f->nbParameters(); ++i)
{
if(x[0][i] < p_min[i] || x[0][i] > p_max[i])
{
return false;
}
}
// Update the parameters vector
vec _p(_f->nbParameters());
for(int i=0; i<_f->nbParameters(); ++i) { _p[i] = x[0][i]; }
......
......@@ -35,6 +35,18 @@ struct EigenFunctor: Eigen::DenseFunctor<double>
#ifdef DEBUG
std::cout << "parameters:" << std::endl << x << std::endl << std::endl ;
#endif
// Check that the parameters used are within the bounds defined
// by the function
vec p_min = _f->getParametersMin();
vec p_max = _f->getParametersMax();
for(int i=0; i<_f->nbParameters(); ++i)
{
if(x[i] < p_min[i] || x[i] > p_max[i])
{
return -1;
}
}
// Update the parameters vector
vec _p(inputs());
......@@ -324,6 +336,11 @@ bool nonlinear_fitter_eigen::fit_data(const data* d, function* fit, const argume
std::cerr << "<<ERROR>> incorrect parameters" << std::endl;
return false;
}
else if(info == Eigen::LevenbergMarquardtSpace::UserAsked)
{
std::cerr << "<<ERROR>> the search is using improper parameters: stopping" << std::endl;
return false;
}
// Update the vector of parameters
for(int i=0; i<f->nbParameters(); ++i)
......@@ -357,6 +374,11 @@ bool nonlinear_fitter_eigen::fit_data(const data* d, function* fit, const argume
std::cerr << "<<ERROR>> incorrect parameters" << std::endl;
return false;
}
else if(info == Eigen::LevenbergMarquardtSpace::UserAsked)
{
std::cerr << "<<ERROR>> the search is using improper parameters: stopping" << std::endl;
return false;
}
for(int i=0; i<nf->nbParameters(); ++i)
{
......
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