quadprog++ and Eigen library test

Dependencies:   mbed Eigen FastPWM

Committer:
jsoh91
Date:
Tue Sep 24 00:20:12 2019 +0000
Revision:
2:e843c1b0b25c
QP and Eigen library test project;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jsoh91 2:e843c1b0b25c 1 /*
jsoh91 2:e843c1b0b25c 2 File $Id: QuadProg++.hh 232 2007-06-21 12:29:00Z digasper $
jsoh91 2:e843c1b0b25c 3
jsoh91 2:e843c1b0b25c 4 The quadprog_solve() function implements the algorithm of Goldfarb and Idnani
jsoh91 2:e843c1b0b25c 5 for the solution of a (convex) Quadratic Programming problem
jsoh91 2:e843c1b0b25c 6 by means of an active-set dual method.
jsoh91 2:e843c1b0b25c 7
jsoh91 2:e843c1b0b25c 8 The problem is in the form:
jsoh91 2:e843c1b0b25c 9
jsoh91 2:e843c1b0b25c 10 min 0.5 * x G x + g0 x
jsoh91 2:e843c1b0b25c 11 s.t.
jsoh91 2:e843c1b0b25c 12 CE^T x + ce0 = 0
jsoh91 2:e843c1b0b25c 13 CI^T x + ci0 >= 0
jsoh91 2:e843c1b0b25c 14
jsoh91 2:e843c1b0b25c 15 The matrix and vectors dimensions are as follows:
jsoh91 2:e843c1b0b25c 16 G: n * n
jsoh91 2:e843c1b0b25c 17 g0: n
jsoh91 2:e843c1b0b25c 18
jsoh91 2:e843c1b0b25c 19 CE: n * p
jsoh91 2:e843c1b0b25c 20 ce0: p
jsoh91 2:e843c1b0b25c 21
jsoh91 2:e843c1b0b25c 22 CI: n * m
jsoh91 2:e843c1b0b25c 23 ci0: m
jsoh91 2:e843c1b0b25c 24
jsoh91 2:e843c1b0b25c 25 x: n
jsoh91 2:e843c1b0b25c 26
jsoh91 2:e843c1b0b25c 27 The function will return the cost of the solution written in the x vector or
jsoh91 2:e843c1b0b25c 28 std::numeric_limits::infinity() if the problem is infeasible. In the latter case
jsoh91 2:e843c1b0b25c 29 the value of the x vector is not correct.
jsoh91 2:e843c1b0b25c 30
jsoh91 2:e843c1b0b25c 31 References: D. Goldfarb, A. Idnani. A numerically stable dual method for solving
jsoh91 2:e843c1b0b25c 32 strictly convex quadratic programs. Mathematical Programming 27 (1983) pp. 1-33.
jsoh91 2:e843c1b0b25c 33
jsoh91 2:e843c1b0b25c 34 Notes:
jsoh91 2:e843c1b0b25c 35 1. pay attention in setting up the vectors ce0 and ci0.
jsoh91 2:e843c1b0b25c 36 If the constraints of your problem are specified in the form
jsoh91 2:e843c1b0b25c 37 A^T x = b and C^T x >= d, then you should set ce0 = -b and ci0 = -d.
jsoh91 2:e843c1b0b25c 38 2. The matrices have column dimension equal to MATRIX_DIM,
jsoh91 2:e843c1b0b25c 39 a constant set to 20 in this file (by means of a #define macro).
jsoh91 2:e843c1b0b25c 40 If the matrices are bigger than 20 x 20 the limit could be
jsoh91 2:e843c1b0b25c 41 increased by means of a -DMATRIX_DIM=n on the compiler command line.
jsoh91 2:e843c1b0b25c 42 3. The matrix G is modified within the function since it is used to compute
jsoh91 2:e843c1b0b25c 43 the G = L^T L cholesky factorization for further computations inside the function.
jsoh91 2:e843c1b0b25c 44 If you need the original matrix G you should make a copy of it and pass the copy
jsoh91 2:e843c1b0b25c 45 to the function.
jsoh91 2:e843c1b0b25c 46
jsoh91 2:e843c1b0b25c 47 Author: Luca Di Gaspero
jsoh91 2:e843c1b0b25c 48 DIEGM - University of Udine, Italy
jsoh91 2:e843c1b0b25c 49 luca.digaspero@uniud.it
jsoh91 2:e843c1b0b25c 50 http://www.diegm.uniud.it/digaspero/
jsoh91 2:e843c1b0b25c 51
jsoh91 2:e843c1b0b25c 52 The author will be grateful if the researchers using this software will
jsoh91 2:e843c1b0b25c 53 acknowledge the contribution of this function in their research papers.
jsoh91 2:e843c1b0b25c 54
jsoh91 2:e843c1b0b25c 55 Copyright (c) 2007-2016 Luca Di Gaspero
jsoh91 2:e843c1b0b25c 56
jsoh91 2:e843c1b0b25c 57 This software may be modified and distributed under the terms
jsoh91 2:e843c1b0b25c 58 of the MIT license. See the LICENSE file for details.
jsoh91 2:e843c1b0b25c 59 */
jsoh91 2:e843c1b0b25c 60
jsoh91 2:e843c1b0b25c 61
jsoh91 2:e843c1b0b25c 62 #ifndef _QUADPROGPP
jsoh91 2:e843c1b0b25c 63 #define _QUADPROGPP
jsoh91 2:e843c1b0b25c 64
jsoh91 2:e843c1b0b25c 65 #include "Array.h"
jsoh91 2:e843c1b0b25c 66
jsoh91 2:e843c1b0b25c 67 namespace quadprogpp {
jsoh91 2:e843c1b0b25c 68
jsoh91 2:e843c1b0b25c 69 double solve_quadprog(Matrix<double>& G, Vector<double>& g0,
jsoh91 2:e843c1b0b25c 70 const Matrix<double>& CE, const Vector<double>& ce0,
jsoh91 2:e843c1b0b25c 71 const Matrix<double>& CI, const Vector<double>& ci0,
jsoh91 2:e843c1b0b25c 72 Vector<double>& x);
jsoh91 2:e843c1b0b25c 73
jsoh91 2:e843c1b0b25c 74 } // namespace quadprogpp
jsoh91 2:e843c1b0b25c 75
jsoh91 2:e843c1b0b25c 76 #endif // #define _QUADPROGPP