liuq / QuadProgpp

A C++ library for Quadratic Programming which implements the Goldfarb-Idnani active-set dual method.
MIT License
283 stars 88 forks source link

getting wrong result #11

Open MichealYu567 opened 6 years ago

MichealYu567 commented 6 years ago

some times i get the wrong result with quadprog++. to be specific, the result doesn't satisfy the inequality constraints.

through debug, i found that the reason may be as bellows: the checking code(line 246-250):

if (fabs(psi) <= m std::numeric_limits::epsilon() c1 c2 100.0) { / numerically there are not infeasibilities anymore / return f_value; }

when I got a matrix G whose c1c2 is very large, after add equality constraints, first run to the checking code, psi = -70, as c1c2 is very large, it directly returns the f_value. but the result doesn't satisfy the inequality constraints.

My question is why use "m std::numeric_limits::epsilon() c1 c2 100.0" as the threshold, instead of "m std::numeric_limits::epsilon()". In fact, we just want to check whether CI[i]X < 0 or not.

i add my data here, in case you want to debug it. input data.zip

AlanSixth commented 5 years ago

I think I have run into the same problem here where the solver returns an incorrect solution that disregards inequality constraints when there are equality constraints. Not sure what caused it.

alp66alp66 commented 3 years ago

I am having the same problem, the solution doesn't respect the inequality constraints. Anyone solved this bug?