Commit 233ab13c authored by Laurent Belcour's avatar Laurent Belcour
Browse files

Working QuadProg plugin, but horribly slow \!

parent e16673e5
......@@ -80,8 +80,8 @@ bool rational_fitter_quadprog::fit_data(const data* dat, int np, int nq, functio
QuadProgPP::Vector<double> g (0.0, np+nq) ;
QuadProgPP::Matrix<double> CI(0.0, np+nq, 2*d->size()) ;
QuadProgPP::Vector<double> ci(0.0, 2*d->size()) ;
QuadProgPP::Matrix<double> CE(0.0, np+nq, 2*d->size()) ;
QuadProgPP::Vector<double> ce(0.0, 2*d->size()) ;
QuadProgPP::Matrix<double> CE(0.0, np+nq, 0) ;
QuadProgPP::Vector<double> ce(0.0, 0) ;
Eigen::MatrixXd eCI(np+nq, 2*d->size()) ;
......@@ -253,7 +253,7 @@ bool rational_fitter_quadprog::fit_data(const data* dat, int np, int nq, functio
double cost = QuadProgPP::solve_quadprog(G, g, CE, ce, CI, ci, x);
bool solves_qp = !cost == std::numeric_limits<double>::infinity();
bool solves_qp = !(cost == std::numeric_limits<double>::infinity());
for(int i=0; i<np+nq; ++i)
{
const double v = x[i];
......
......@@ -71,10 +71,10 @@ int main(int argc, char** argv)
#endif
if(args.is_defined("fitter") && loader.fileName().toStdString().find(args["fitter"]) == std::string::npos)
{
std::cout << loader.fileName().toStdString() << std::endl ;
continue ;
}
std::cout << "<<INFO>> using " << loader.fileName().toStdString() << std::endl ;
fitters.push_back(dynamic_cast<fitter*>(plugin)) ;
}
......@@ -127,9 +127,13 @@ int main(int argc, char** argv)
std::cout << x << "\t" << f->value(vx)[0] << std::endl ;
}
/*/
f->save(args["output"], args) ;
std::ofstream file("temp.gnuplot", std::ios_base::trunc);
size_t n = args["output"].find('.') ;
std::string gnuplot_filename = args["output"].substr(0,n);
gnuplot_filename.append(".gnuplot") ;
std::ofstream file(gnuplot_filename.c_str(), std::ios_base::trunc);
for(int i=0; i<d->size(); ++i)
{
vec v = d->get(i) ;
......@@ -146,7 +150,9 @@ int main(int argc, char** argv)
file << std::endl ;
}
std::ofstream efile("error.gnuplot", std::ios_base::trunc);
std::string error_filename = args["output"].substr(0,n);
error_filename.append(".errorplot") ;
std::ofstream efile(error_filename.c_str(), std::ios_base::trunc);
for(int i=0; i<d->size(); ++i)
{
vec v = d->get(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