predict-epfl / piqp Goto Github PK
View Code? Open in Web Editor NEWAn Proximal Interior Point Quadratic Programming solver
Home Page: https://predict-epfl.github.io/piqp/
License: BSD 2-Clause "Simplified" License
An Proximal Interior Point Quadratic Programming solver
Home Page: https://predict-epfl.github.io/piqp/
License: BSD 2-Clause "Simplified" License
Hi there,
Thanks for this optimiser - in my tests on large scale sparse problems (upwards of 5k variables) it performs very well, better than SQOPT which was previously the best for my use case. One edge that SQOPT has though, is that I can provide initial weights (or a guess), and if these are close to the optimal solution it reduces the runtime dramatically (for my particular use case it was a factor of 10!).
The current python interface doesn't provide a way to provide initial weights - is this something that is possible given the design? I see there is the ability to do an update, but in this case (portfolio optimisation over time) all the inputs have changed (including their dimensions), but the solution will not be far from the initial weights given deliberate friction in the objective.
Thanks!
Charles
I wrote an R interface for piqp that is now available. I will publish it on CRAN as soon as they return from the summer break.
https://bnaras.github.io/piqp/index.html
Thank you.
First of all, I wanted to say big congratulations on your new amazing solver, it's the fastest one I have ever tried!
Could you please also publish it to conda forge as a package? Thank you very much in advance.
Hi, I tried using the library and am getting infeasibility, so I got things down to a small working example. I can't understand why this solution is yielding infeasibility. Any help would be greatly appreciated. Here's the code I have:
import numpy as np
import osqp # type: ignore
import piqp # type: ignore
from scipy import sparse # type: ignore
P = np.array(
[
[1.0, 0.0, 0.0, 0.0],
[0.0, 1.0, 0.0, 0.0],
[0.0, 0.0, 1.0, 0.0],
[0.0, 0.0, 0.0, 1.0],
]
)
c = np.array([1.0, 1.0, 1.0, 1.0])
A = np.array([[0.0, 0.0, 0.0, 0.0]])
b = np.array([0.0])
G = np.array(
[
[1.0, 0.0, 0.0, 0.0],
[1.0, 0.0, -1.0, 0.0],
[-1.0, 0.0, -1.0, 0.0],
[-1.0, 0.0, 0.0, 0.0],
[-1.0, 0.0, 1.0, 0.0],
[1.0, 0.0, 1.0, 0.0],
]
)
h = np.array([1.0, 1.0, 1.0, 1.0, np.inf, np.inf])
problem = piqp.DenseSolver()
problem.settings.verbose = True
problem.settings.compute_timings = True
problem.setup(
P=P,
c=c,
A=A,
b=b,
G=G,
h=h,
)
problem.solve()
x = problem.result.x
easy_answer = np.array([0.0, 0.0, 0.0, 0.0])
assert A @ easy_answer == b
assert (G @ easy_answer <= h).all()
def loss(answer: np.ndarray) -> float:
return 0.5 * answer.T @ P @ answer + c.T @ answer
print("easy loss", loss(easy_answer))
print("solved loss", loss(x))
print("x", x)
problem = osqp.OSQP()
lower = np.array([-np.inf, -np.inf, -np.inf, -np.inf, -np.inf, -np.inf])
problem.setup(sparse.csc_matrix(P), c, sparse.csc_matrix(G), lower, h)
r = problem.solve()
print("x", r.x)
See the description of the MATLAB build tool here:
https://www.mathworks.com/help/matlab/build-automation.html?s_tid=CRUX_lftnav
I see this project has its own "make" script for the MATLAB interface. Consider transitioning to the build tool for standardization, ease of use, and incremental build benefits, and also consider leveraging the run-build GitHub action.
I can see 8 CPU cores in use while solving using PIQP. I was wondering where that parallelism is coming from and is it possible to control it? E.g. use more than 8 threads to improve performance?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.