Comments (4)
If I replace the np.inf in h with something reasonable then I get the same solutions in osqp and piqp. This makes me think there's a bug on the piqp end.
from piqp.
Unfortunately, this is a limitation of interior-point methods in general. The inequality constraints are reformulated using slack variables, i.e., the constraints become
To deal with this issue, normally one would pre-filter the problems, i.e., remove the infinity/inactive inequality constraints. This is currently not happening internally in PIQP for general inequality constraints, only for box constraints. The reason for this is that I designed PIQP to be used for solving the same kind of problem over and over (control applications). PIQP allocates memory only ones in the setup step. If the active inequalities changed (e.g. one bound is changed from inf to something finite), the sparsity pattern would change, which would result in allocating new memory (which I try to avoid).
I have been thinking about this for a while, since it causes problems for people who don't know this (like you) and hence is not really user-friendly. I could add the preprocessing step internally, which can be disabled for people who really know what they are doing to get maximum performance and no subsequent allocations. This should fix the problem for the average user. What do you think?
In the meantime, try to avoid using inf constraints in the general inequalities...
Also, instead of passing a
A = np.zeros((0, 4))
b = np.zeros(0)
from piqp.
OK that makes sense! In that case I have a follow-up question. When I “update” the problem for solving something over and over again, which vectors can I update without allocating new memory? There’s c, h, b, x_lb and x_ub. You’re making me thing I can’t update h without new memory allocation?
from piqp.
You can update everything, but you should not change the sparsity pattern, i.e., only the values of sparse matrices are updated but not the structure. This means you can also update P, A and G as long as the sparsity pattern doesn't change. For example, if you want to update A, h, and x_ub you can do this using problem.update(P=None, c=None, A=A_new, b=None, G=None, h=h_new, x_lb=None, x_ub=x_ub_new)
. In the current version of PIQP there are no internal memory allocations for this operation, i.e., the memory is reused (also for the factorization).
But if I have to filter out inequality constraints based on the values in h, I have to remove/add rows from G internally which would change the sparsity pattern of the KKT matrix, requiring allocating new memory for the KKT matrix and its factorization.
from piqp.
Related Issues (6)
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 piqp.