Replies: 8 comments
-
How negative are the entries in the solution? If you are getting negative values on the order of If you are getting values that are so negative that they can't be explained by solver precision, then it's likely that either 1) there is a error in the problem setup or 2) the solver is reporting that the problem is infeasible, in which case the solution vector it returns has a different interpretation. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your quick answer. The smallest negative number in the solution is -0.01. With these settings: solver.settings()->setRho(0.1); |
Beta Was this translation helpful? Give feedback.
-
It is still hard to give a clear answer here I think. The solver terminates on a "relative accuracy" check, so whether or not it considers "-0.1" to be a large violation depends on what the norm of the solution |
Beta Was this translation helpful? Give feedback.
-
Thank you for your continued assistance
|
Beta Was this translation helpful? Give feedback.
-
The convergence criteria for the solver is in section 3.4 of the paper here. The problem you are having is that the convergence check compares the error residuals to the infinity norm of the product The solver is therefore satisfying the convergence test in (26) of the paper cited above, i.e. If you want higher accuracy, you will need to tighten |
Beta Was this translation helpful? Give feedback.
-
When I solve this optimization problem using the MATLAB function quadprog, I obtain a solution where none of the numbers are negative. In my problem, it is necessary to have non-negative numbers in the solution. Therefore, I have to change any negative values to zero. Does this alteration make a significant difference? When I set the relative tolerance and absolute tolerance to 1e-3, I observe fewer negative numbers, for example, 17. However, when I set them to 1e-5, I encounter 100 negative numbers. Furthermore, when I set the tolerances to 1e-7, I still get about 100 negative numbers, with the smallest negative number being -0.0001. If I set polish to True, I get the following result:
|
Beta Was this translation helpful? Give feedback.
-
There's no problem with rounding the values up to zero yourself. The issue is that the solver can't do that for you because it treats your constraint in a general If you have a collection of constraints -- Note that the number of constraint violations is not a metric used by the solver. It only uses the relative size of the residuals. So when you say:
that means that the solver has produced a valid solution according to its convergence criteria, assuming that the norm of Polishing would likely have resolved the issue for you if successful, but it doesn't always work. When it doesn't work, we just return the solution we computed prior to the polishing attempt. |
Beta Was this translation helpful? Give feedback.
-
Thank you |
Beta Was this translation helpful? Give feedback.
-
Hi everyone,
I hope you're all doing well. I'm reaching out because I've encountered an issue while working with the OSQP solver for a quadratic programming problem.
In brief, my problem involves minimizing a quadratic objective function subject to linear inequality constraints. To address this, I've integrated the OSQP solver with the Eigen library and OSQP-Eigen in C++.
Here's a quick overview of the problem components:
Objective Function: Quadratic, defined by matrix H and vector f.
Inequality Constraints: Defined by the sparse matrix Ac and vector dc.
Bounds: Lower bounds lb and upper bounds ub.
Non-Negativity Constraints: I've implemented constraints to ensure non-negativity for certain variables. To enforce this, I've constructed a diagonal matrix (identity matrix) and concatenated it with the inequality constraints matrix Ac.
However, after setting up the problem and solving it using OSQP, I'm encountering negative values in the solution for some variables. This is unexpected, as the problem explicitly requires non-negative solutions.
I've reviewed the problem setup, adjusted solver parameters, and examined the solution post-solve, but I haven't been able to identify the root cause of the negative values.
For those interested in diving into the code, I've shared the relevant snippets in the GitHub repository. Here's the link to the specific file.
Thank you all in advance for any insights or assistance you can provide.
Beta Was this translation helpful? Give feedback.
All reactions