qpbsvmlib.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef QPBSVMLIB_H__
00016 #define QPBSVMLIB_H__
00017
00018 #include <math.h>
00019 #include <limits.h>
00020
00021 #include "base/SGObject.h"
00022 #include "lib/io.h"
00023 #include "lib/config.h"
00024 #include "lib/common.h"
00025 #include "kernel/Kernel.h"
00026
00027 enum E_QPB_SOLVER
00028 {
00029 QPB_SOLVER_SCA,
00030 QPB_SOLVER_SCAS,
00031
00032 QPB_SOLVER_SCAMV,
00033 QPB_SOLVER_PRLOQO,
00034 QPB_SOLVER_CPLEX,
00035 QPB_SOLVER_GS,
00036 QPB_SOLVER_GRADDESC
00037 };
00038
00040 class CQPBSVMLib: public CSGObject
00041 {
00042 public:
00051 CQPBSVMLib(
00052 float64_t* H, int32_t n, float64_t* f, int32_t m, float64_t UB=1.0);
00053
00055 int32_t solve_qp(float64_t* result, int32_t len);
00056
00061 inline void set_solver(E_QPB_SOLVER solver)
00062 {
00063 m_solver=solver;
00064 }
00065
00066 ~CQPBSVMLib();
00067
00068 protected:
00074 inline float64_t* get_col(int32_t col)
00075 {
00076 return &m_H[m_dim*col];
00077 }
00078
00081 int32_t qpbsvm_sca(
00082 float64_t *x, float64_t *Nabla, int32_t *ptr_t,
00083 float64_t **ptr_History, int32_t verb);
00086 int32_t qpbsvm_scas(
00087 float64_t *x, float64_t *Nabla, int32_t *ptr_t,
00088 float64_t **ptr_History, int32_t verb);
00091 int32_t qpbsvm_scamv(
00092 float64_t *x, float64_t *Nabla, int32_t *ptr_t,
00093 float64_t **ptr_History, int32_t verb);
00096 int32_t qpbsvm_prloqo(
00097 float64_t *x, float64_t *Nabla, int32_t *ptr_t,
00098 float64_t **ptr_History, int32_t verb);
00101 int32_t qpbsvm_gauss_seidel(
00102 float64_t *x, float64_t *Nabla, int32_t *ptr_t,
00103 float64_t **ptr_History, int32_t verb);
00106 int32_t qpbsvm_gradient_descent(
00107 float64_t *x, float64_t *Nabla, int32_t *ptr_t,
00108 float64_t **ptr_History, int32_t verb);
00109 #ifdef USE_CPLEX
00110
00112 int32_t qpbsvm_cplex(
00113 float64_t *x, float64_t *Nabla, int32_t *ptr_t,
00114 float64_t **ptr_History, int32_t verb);
00115 #endif
00116
00117 protected:
00119 float64_t* m_H;
00121 float64_t* m_diag_H;
00123 int32_t m_dim;
00124
00126 float64_t* m_f;
00127
00129 float64_t m_UB;
00130
00132 int32_t m_tmax;
00134 float64_t m_tolabs;
00136 float64_t m_tolrel;
00138 float64_t m_tolKKT;
00140 E_QPB_SOLVER m_solver;
00141 };
00142 #endif //QPBSVMLIB_H__