If we want to solve the equation:
min xT Q x + cT x st A x <= b
Then the following example solves it
const qp = require('quadprog-js'); const Q = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]; const c = [0, -5, 0]; const A = [[-4, -3, 0], [ 2, 1, 0], [ 0, -2, 1]]; const b = [-8, 2, 0]; res = qp(Q, c, A, b)
Base test cases are in json formatted files with the name
These can be passed into
solve.R to create the standard R results for solveQP with the name
The standard usage is
Rscript solve.R *-data.json, but you may wish to only create result files for specific tests.
The combination of these files is then used by
To add a new test simply create a file called
<name>-data.json in the test directory, and then call
Rscript solve.R <name>-data.json and commit the results.