quadprog-js

Module for solving quadratic programming problems

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
quadprog-js
100.1.35 years ago5 years agoMinified + gzip package size for quadprog-js in KB

Readme

Quadprog-JS =========== Build Status This module contains routines for solving quadratic programming problems, written in JavaScript. It is a strict fork of this library that's been refactored to use modern array routines when they don't impact performance, use zero indexed arrays, and fit the standard formulation of a quadratic program, instead of the weird formulation that R uses. Example ======== 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) ``` Testing ======= Base test cases are in json formatted files with the name <name>-data.json. These can be passed into solve.R to create the standard R results for solveQP with the name <name>-result.json. 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 solution-test.js and bench.js. Adding Tests ------------ 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.