adherence to constraints

61 views
Skip to first unread message

green...@pobox.com

unread,
Jul 20, 2017, 5:09:24 PM7/20/17
to OSQP
Hi,

While each position of the variable array is constrained to be greater than or equal 0.0, I am seeing some of the variables go as low as -4.2753926199E-03
after a successful solve (status 1).
At default eps_abs, eps_rel, eps_prim_inf, eps_dual_inf that value was
-5.6254613607E-04
and after setting those four to 10x smaller than default, the value became
-4.2753926199E-03

What adjustment of settings to diminish how far these variables go outside constraints?

Thanks.

Bartolomeo Stellato

unread,
Jul 21, 2017, 12:20:10 PM7/21/17
to Joe Greenstone, OSQP
Hi,

Please make sure you have the latest version. We just updated a patch release with minor bugfixes.

Could you please provide a minimal working example? Which platform/interface are you using?

Bartolomeo

--
You received this message because you are subscribed to the Google Groups "OSQP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osqp+unsubscribe@googlegroups.com.
To post to this group, send email to os...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osqp/9f98804c-c9bd-4579-9cfb-f7c6a50db4ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

green...@pobox.com

unread,
Jul 24, 2017, 12:34:43 PM7/24/17
to OSQP, green...@pobox.com

> Could you please provide a minimal working example?

Sending a directory with the code (which is minimal anyway) and a test rig packaged as osqp_rep.tar.gz to Bartolomeo in a few minutes.
The A.gram.colmaj example input gives weights that adhere poorly to constraints, the P.gram.colmaj gives weights that are good in this regard.


> Please make sure you have the latest version.

    Done.

> Which platform/interface are you using?

    Using Linux, C++.


Bartolomeo Stellato

unread,
Jul 25, 2017, 1:53:23 PM7/25/17
to OSQP, green...@pobox.com
I have managed to run it obtaining these results for the problem "A.gram.colmaj": https://pastebin.com/gxkURngD
The polishing phase in that case is not successful, that's why the precision is not the same as the case for problem "P.gram.colmaj": https://pastebin.com/2wUtc7zM
I cannot match the values you wrote.

In your code you add the following lines to increase the precision

settings->eps_abs = 1.0e4;
settings
->eps_rel = 1.0e4;

This sets the tolerances to an incredibly high value! You should write this instead (if you want higher accuracy, I suggest you to increase also the maximum number of iterations):

settings->eps_abs = 1.0e-6;
settings
->eps_rel = 1.0e-6;
// settings->max_iter = 10000;  // Needed if you want higher precision!

Bartolomeo
Message has been deleted

green...@pobox.com

unread,
Jul 25, 2017, 2:35:22 PM7/25/17
to OSQP, green...@pobox.com



> The polishing phase in that case is not successful

Beyond setting eps_abs, eps_rel and max_iter, is there anything I need to do get polishing to work?


 > I cannot match the values you wrote.

What matching do you refer to?
 

> In your code you add the following lines to increase the precision

settings->eps_abs = 1.0e4;
settings
->eps_rel = 1.0e4;


The code did not have those lines. An experimental setting to different absurdly high values (e3) was commented out.


Will try setting to these values: 
settings->eps_abs = 1.0e-6;
settings
->eps_rel = 1.0e-6;
// settings->max_iter = 10000;  // Needed if you want higher precision

Thanks! 

Bartolomeo Stellato

unread,
Jul 26, 2017, 1:11:49 PM7/26/17
to OSQP, green...@pobox.com
Beyond setting eps_abs, eps_rel and max_iter, is there anything I need to do get polishing to work?

Polishing is a final step that we do to try to get a very high quality solution. It works by guessing the active constraints when the algorithm converges. 
However, for some problems like yours, it is not easy to identify which constraints are active because several constraints combinations give almost the same value of the objective function.
When polishing fails, the returned solution has lower accuracy, but it is still optimal up to the precision specified by eps values.

Increasing the accuracy (making eps smaller), increases the chances of making polishing work. Using the parameters
settings->eps_abs = 1.0e-8;
settings->eps_rel = 1.0e-8;
settings->max_iter = 20000;

makes polishing work for that problem and you get residuals in the order of 1e-16 precision. Keep in mind that OSQP is not supposed to return extremely high accuracy solutions in general.

Hope it helps!


Reply all
Reply to author
Forward
0 new messages