00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 3 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * Purpose: solves quadratic programming problem for pattern recognition 00008 * for support vectors 00009 * 00010 * Written (W) 1997-1998 Alex J. Smola 00011 * Written (W) 1999-2009 Soeren Sonnenburg 00012 * Written (W) 1999-2008 Gunnar Raetsch 00013 * Copyright (C) 1997-2009 Fraunhofer Institute FIRST and Max-Planck-Society 00014 */ 00015 00016 namespace shogun 00017 { 00018 /* verbosity levels */ 00019 00020 #define QUIET 0 00021 #define STATUS 1 00022 #define FLOOD 2 00023 00024 /* status outputs */ 00025 00026 #define STILL_RUNNING 0 00027 #define OPTIMAL_SOLUTION 1 00028 #define SUBOPTIMAL_SOLUTION 2 00029 #define ITERATION_LIMIT 3 00030 #define PRIMAL_INFEASIBLE 4 00031 #define DUAL_INFEASIBLE 5 00032 #define PRIMAL_AND_DUAL_INFEASIBLE 6 00033 #define INCONSISTENT 7 00034 #define PRIMAL_UNBOUNDED 8 00035 #define DUAL_UNBOUNDED 9 00036 #define TIME_LIMIT 10 00037 00038 /* 00039 * solve the quadratic programming problem 00040 * 00041 * minimize c' * x + 1/2 x' * H * x 00042 * subject to A*x = b 00043 * l <= x <= u 00044 * 00045 * for a documentation see R. Vanderbei, LOQO: an Interior Point Code 00046 * for Quadratic Programming 00047 */ 00048 00049 /* 00050 * n : number of primal variables 00051 * m : number of constraints (typically 1) 00052 * h_x : dot product matrix (n.n) 00053 * a : constraint matrix (n.m) 00054 * b : constant term (m) 00055 * l : lower bound (n) 00056 * u : upper bound (m) 00057 * 00058 * primal : workspace for primal variables, has to be of size 3 n 00059 * 00060 * x = primal; n 00061 * g = x + n; n 00062 * t = g + n; n 00063 * 00064 * dual : workspace for dual variables, has to be of size m + 2 n 00065 * 00066 * y = dual; m 00067 * z = y + m; n 00068 * s = z + n; n 00069 * 00070 * verb : verbosity level 00071 * sigfig_max : number of significant digits 00072 * counter_max: stopping criterion 00073 * restart : 1 if restart desired 00074 * 00075 */ 00076 00077 int32_t pr_loqo( 00078 int32_t n, int32_t m, float64_t c[], float64_t h_x[], float64_t a[], 00079 float64_t b[], float64_t l[], float64_t u[], float64_t primal[], 00080 float64_t dual[], int32_t verb, float64_t sigfig_max, int32_t counter_max, 00081 float64_t margin, float64_t bound, int32_t restart); 00082 }