00001 /* 00002 00003 The quadprog_solve() function implements the algorithm of Goldfarb and Idnani 00004 for the solution of a (convex) Quadratic Programming problem 00005 by means of an active-set dual method. 00006 00007 The problem is in the form: 00008 00009 min 0.5 * x G x + g0 x 00010 s.t. 00011 CE^T x + ce0 = 0 00012 CI^T x + ci0 >= 0 00013 00014 The matrix and vectors dimensions are as follows: 00015 G: n * n 00016 g0: n 00017 00018 CE: n * p 00019 ce0: p 00020 00021 CI: n * m 00022 ci0: m 00023 00024 x: n 00025 00026 The function will return the cost of the solution written in the x vector or 00027 std::numeric_limits::infinity() if the problem is infeasible. In the latter case 00028 the value of the x vector is not correct. 00029 00030 References: D. Goldfarb, A. Idnani. A numerically stable dual method for solving 00031 strictly convex quadratic programs. Mathematical Programming 27 (1983) pp. 1-33. 00032 00033 Notes: 00034 1. pay attention in setting up the vectors ce0 and ci0. 00035 If the constraints of your problem are specified in the form 00036 A^T x = b and C^T x >= d, then you should set ce0 = -b and ci0 = -d. 00037 2. The matrix G is modified within the function since it is used to compute 00038 the G = L^T L cholesky factorization for further computations inside the function. 00039 If you need the original matrix G you should make a copy of it and pass the copy 00040 to the function. 00041 00042 Author: Luca Di Gaspero 00043 DIEGM - University of Udine, Italy 00044 l.digaspero@uniud.it 00045 http://www.diegm.uniud.it/digaspero/ 00046 00047 The author will be grateful if the researchers using this software will 00048 acknowledge the contribution of this function in their research papers. 00049 00050 LICENSE 00051 00052 This file is part of QuadProg++: a C++ library implementing 00053 the algorithm of Goldfarb and Idnani for the solution of a (convex) 00054 Quadratic Programming problem by means of an active-set dual method. 00055 Copyright (C) 2007-2009 Luca Di Gaspero. 00056 Copyright (C) 2009 Eric Moyer. 00057 00058 QuadProg++ is free software: you can redistribute it and/or modify 00059 it under the terms of the GNU Lesser General Public License as published by 00060 the Free Software Foundation, either version 3 of the License, or 00061 (at your option) any later version. 00062 00063 QuadProg++ is distributed in the hope that it will be useful, 00064 but WITHOUT ANY WARRANTY; without even the implied warranty of 00065 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00066 GNU Lesser General Public License for more details. 00067 00068 You should have received a copy of the GNU Lesser General Public License 00069 along with QuadProg++. If not, see <http://www.gnu.org/licenses/>. 00070 00071 */ 00072 00073 00074 #ifndef _QUADPROGPP 00075 #define _QUADPROGPP 00076 00077 #include "Array.h" 00078 #include "MitkDiffusionImagingExports.h" 00079 00080 namespace QuadProgPP{ 00081 00082 class MitkDiffusionImaging_EXPORT QuadProg 00083 { 00084 00085 public: 00086 00087 static double solve_quadprog(Matrix<double>& G, Vector<double>& g0, 00088 const Matrix<double>& CE, const Vector<double>& ce0, 00089 const Matrix<double>& CI, const Vector<double>& ci0, 00090 Vector<double>& x); 00091 00092 }; 00093 } 00094 00095 #endif // #define _QUADPROGPP