Comments (4)
Update: I just tried the latest version (v0.7.1) in Python and I got a similar answer [0.9999668636034095, 3.313639612649994e-05]
P = sparse.csc_matrix([[2., 0.], [0., 4.]])
P = sparse.triu(P).tocsc()
q = np.array([-2., 0.])
A = sparse.csc_matrix(
[[1., 1.], # <-- LHS of equality constraint (lower bound)
[-1., 0.], # <-- LHS of inequality constraint (lower bound)
[0., -1.]]) # <-- LHS of inequality constraint (lower bound)
b = np.array([1., 0., 0.])
cones = [clarabel.ZeroConeT(1), clarabel.NonnegativeConeT(2)]
settings = clarabel.DefaultSettings()
solver = clarabel.DefaultSolver(P, q, A, b, cones, settings)
solution = solver.solve()
print(
f"Solver terminated with solution"
f"{dict(s=solution.s, x=solution.x, z=solution.z)}"
)
from clarabel.cpp.
I think that the issue is only in the interpretation of the error tolerances.
The primal and dual feasibility tolerances are checked against the residuals of the KKT conditions. In this case when I manually compute the dual residual dres
and pres
columns.
The primal objective function at the solution produced by the solver is also really close, i.e. gap
column and shows high accuracy.
The error you are computing is the distance between the (approximate) optimizer produced by the solver and the true optimizer. This is not one of the stopping criteria, and indeed really can't be because there is no obvious way to compute this distance when the true optimizer is not known.
Normally you would not expect to get a substantial inaccuracy in the optimizer like that anyway. The reason it happens in this case is because the unconstrained minimizer for the problem happens to be at the boundary of the feasible set. The solution is therefore quite insensitive to small variations around that point, and the solver has produced a solution that is at a nearby point on the boundary with very similar objective value.
Part of the issue is perhaps also one of method. A simplex based solver would be more likely to produce a very high accuracy optimizer for this problem because the true solution is right on a vertex.
A possible fix for this would be for us to implement a "polishing" post-processing step as we did in OSQP. That would only be directly applicable to LP / QP problems, although I am aware that there is at least some work out there on similar polishing methods for problems with other constraint types.
from clarabel.cpp.
Thank you so much for the quick response, @goulart-paul !
I agree with everything you said, and I had a suspicion it was related to the fact that the constraint for the second variable is only weakly active. The product of the slack variable and the multiplier is less than 1e-8, but that means that both the slack variable and the Lagrange multiplier are around 1e-4 even though they should both be zero in the optimal solution.
The solution becomes more accurate if I reduce the tolerance value for the duality gap, for example, I get [0.999999968991507, 3.1e-08] for an absolute and relative gap tolerance of 1e-14.
But I guess this could lead to numerical difficulties for other problems.
from clarabel.cpp.
Feel free to close this issue. Or you can leave it open if you think that such a "polishing" post-processing step could be implemented also for Clarabel.
from clarabel.cpp.
Related Issues (8)
- solution.obj_val is not set HOT 3
- release is missing rust submodule HOT 4
- unicode μ causes problems on older compilers HOT 5
- provide different header for C vs C++ interfaces HOT 5
- Unable to update P and A with different sparsity structures and must disable presolve to do partial update HOT 1
- Updating C++ wrapper for 0.8 - Happy to make a PR HOT 5
- Is it possible to change settings when reading model from json? HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clarabel.cpp.