Hello everyone,

we are currently trying to adapt osqp to our use case. However, setting the settings of the solver correctly seems to be difficult. I am attaching a problem instance showing the following behaviour:

Rho | Adaptive_rho | Polish | Scaling | Iterations | Objective value |
---|---|---|---|---|---|

0.01 | 1 | 0 | 1 | 975 | -2025.4739 |

0.01 | 0 | 0 | 0 | 1425 | -2059.2177 |

0.01 | 1 | 0 | 0 | 4075 | -1728.1199 |

0.01 | 1 | 0 | 1 | 5225 | -1942.6292 |

0.01 | 1 | 1 | 1 | 5225 | -1942.6292 |

0.01 | 0 | 1 | 1 | 1475 | -2042.4353 |

As you see, the objective value can vary quite a lot depending on the parameters set. Also, in all instances turning “polish” on yields “polish unsuccessful”.

There have already been a few discussions here about the sensitivity w.r.t. rho but I wasn’t able to find an optimal way to tune the parameters in order to get the right objective value. Any help would be appreciated.

Thanks!

```
c_float P_x[5] = {-0.0,-0.0,-0.0,-0.0,-0.0,};
c_int P_i[5] = {0,1,2,3,4,};
c_int P_p[6] = {0,1,2,3,4,5,};
c_float A_x[13] = {1.0,1.0,1.0,-1.0,1.0,-1.0,-13.820750661910893,1.0,1.0,-9.564788905220015,1.0,1.0,-1.0,};
c_int A_i[13] = {0,7,1,7,2,5,7,3,6,7,4,5,6,};
c_int A_p[6] = {0,2,4,7,10,13,};
c_float q[5] = {-1.0,1.0,1.0,0.2,2.0,};
c_float l[8] = {0.0,0.0,20.0,0.0,0.0,-OSQP_INFTY,0.0,-OSQP_INFTY,};
c_float u[8] = {OSQP_INFTY,OSQP_INFTY,100.0,100.0,OSQP_INFTY,0.0,0.0,0.0,};
c_int P_nnz = 5;
c_int A_nnz = 13;
c_int n = 5;
c_int m = 8;
OSQPWorkspace *work;
OSQPSettings *settings = (OSQPSettings *)c_malloc(sizeof(OSQPSettings));
OSQPData *data = (OSQPData *)c_malloc(sizeof(OSQPData));
// Populate data
if (data) {
data->n = n;
data->m = m;
data->P = csc_matrix(data->n, data->n, P_nnz, P_x, P_i, P_p);
data->q = q;
data->A = csc_matrix(data->m, data->n, A_nnz, A_x, A_i, A_p);
data->l = l;
data->u = u;
}
//c_print(data->u);
// Define solver settings as default
if (settings) osqp_set_default_settings(settings);
//settings->polish_refine_iter = 100;
settings->polish=1;
settings->max_iter = 10000;
settings->scaling=1;
settings->adaptive_rho=0;
settings->rho = 0.01;
// Setup workspace
exitflag = osqp_setup(&work, data, settings);
// Solve Problem
osqp_solve(work);
```