quadprog_test, a Python code which calls quadprog() to solve problems in quadratic programming.
quadprog() solves quadratic programming problems of the form:
minimize 1/2 x' H x - f' x subject to: A' x >= b (inequality constraints)where H is a positive definite symmetric matrix, and the constraints are optional. The most common problems involve the addition of some inequality constraints, which makes this problem similar to typical linear programming problems. It is possible to add equality constraints if you can find the documentation.
In what might seem an attempt to drive users mad, the sign conventions for quadprog() are at odds with those of the corresponding MATLAB code. In particular, we subtract f' x, we multiply by A', and the inequality sign is greater than rather than less than. Of course, with only a minor loss of composure, it is possible to formulate the same problem with either MATLAB or Python.
The computer code and data files made available on this web page are distributed under the MIT license
quadprog_test is available in a MATLAB version and a Python version.