summaryrefslogtreecommitdiff
path: root/numlib/quadprog.h
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2017-12-01 10:32:14 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2017-12-01 10:32:14 +0100
commit4097e27114d227692d53c5d28487e12a3833cd24 (patch)
treed5c2a62c4db97de94f92150340612c64d3997669 /numlib/quadprog.h
parentf8a0a4e1c775a90c313cb83201eec4cea4e9a7da (diff)
parent5514d94483c98e3320b202b1bb882023a7d12027 (diff)
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'numlib/quadprog.h')
-rwxr-xr-xnumlib/quadprog.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/numlib/quadprog.h b/numlib/quadprog.h
new file mode 100755
index 0000000..7d28ec8
--- /dev/null
+++ b/numlib/quadprog.h
@@ -0,0 +1,67 @@
+
+#ifndef QUADPROG_H
+#define QUADPROG_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/*
+ Quadradic Programming solution.
+
+ Based on Luca Di Gaspero's QuadProgpp++, made available under the MIT license.
+
+ Translation to C by Graeme W. Gill, Copyright 2017, also licensed under the
+ MIT license.
+*/
+
+/*
+
+ The quadprog_solve() function implements the algorithm of Goldfarb and Idnani
+ for the solution of a (convex) Quadratic Programming problem
+ by means of an active-set dual method.
+
+The problem is in the form:
+
+min 0.5 * x G x + g0 x
+s.t.
+ CE^T x + ce0 = 0
+ CI^T x + ci0 >= 0
+
+ The matrix and vectors dimensions are as follows:
+ G: n * n
+ g0: n
+
+ CE: n * p
+ ce0: p
+
+ CI: n * m
+ ci0: m
+
+ x: n
+
+ References: D. Goldfarb, A. Idnani. A numerically stable dual method for solving
+ strictly convex quadratic programs. Mathematical Programming 27 (1983) pp. 1-33.
+
+*/
+
+#define QP_INFEASIBLE 1.0E300
+
+double quadprog( /* Return solution cost, QP_INFEASIBLE if infeasible/error */
+ double *x, /* Return x[n] value */
+ double **G, /* G[n][n] Quadratic combination matrix - modified */
+ double *g0, /* g0[n] Direct vector */
+ double **CE, /* CE[n][p] Equality constraint matrix */
+ double *ce0, /* ce0[p] Equality constraing constants */
+ double **CI, /* CI[n][m] Constraint matrix */
+ double *ci0, /* cie[m] Constraint constants */
+ int n, /* Number of variables */
+ int p, /* Number of equalities */
+ int m /* Number of constraints */
+);
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /*define QUADPROG_H */