Commit 1a739dc7 authored by Laurent Belcour's avatar Laurent Belcour
Browse files

Checking if the solution is not global optimum in the matlab solver

parent 2175800f
......@@ -199,8 +199,10 @@ bool rational_fitter_matlab::fit_data(const vertical_segment* d, int np, int nq,
ci(2*i+0) = -sqrt(a0_norm) ;
ci(2*i+1) = -sqrt(a1_norm) ;
#ifdef REMOVE
if(std::abs(a0_sum) < 1.0E-2) { std::cout << "Constraint " << 2*i+0 << " has a low sum: " << a0_sum << std::endl; }
if(std::abs(a1_sum) < 1.0E-2) { std::cout << "Constraint " << 2*i+1 << " has a low sum: " << a1_sum << std::endl; }
#endif
}
// Update the ci column with the delta parameter
......@@ -222,7 +224,7 @@ bool rational_fitter_matlab::fit_data(const vertical_segment* d, int np, int nq,
#endif
return false ;
}
else if(delta < 1.0E-6)
else if(delta < 1.0E-06)
{
delta = 1.0 ;
}
......@@ -312,16 +314,22 @@ bool rational_fitter_matlab::fit_data(const vertical_segment* d, int np, int nq,
{
if(flag != NULL)
{
if(mxGetScalar(flag) != 1)
const double flag_val = mxGetScalar(flag);
if(flag_val < 0)
{
mxDestroyArray(x);
mxDestroyArray(flag);
#ifdef DEBUG
std::cerr << "<<ERROR>> flag is not equal to 1" << std::endl ;
std::cerr << "<<ERROR>> flag is an error flag with no solution" << std::endl ;
#endif
return false ;
}
else if(flag_val != 0)
{
std::cout << "<<INFO>> the solution might not be the optimal solution, this might be" << std::endl;
std::cout << "<<INFO>> caused by local min, or under precision steps" << std::endl;
}
double* val = (double*)mxGetData(x) ;
vec a(np), b(nq);
......
Supports Markdown
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