SHOGUN  v3.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Mosek.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2012 Fernando José Iglesias García
8  * Copyright (C) 2012 Fernando José Iglesias García
9  */
10 
11 #ifndef _CMOSEK__H__
12 #define _CMOSEK__H__
13 
14 #ifdef USE_MOSEK
15 
16 #include <shogun/base/SGObject.h>
17 #include <shogun/lib/SGMatrix.h>
18 
19 #include <mosek.h>
20 
21 namespace shogun
22 {
23 
30 class CMosek : public CSGObject
31 {
32 
33  public:
35  CMosek();
36 
48  CMosek(int32_t num_con, int32_t num_var);
49 
51  ~CMosek();
52 
57  inline MSKrescodee get_rescode() const { return m_rescode; }
58 
66  static void MSKAPI print(void* handle, char str[]);
67 
84  MSKrescodee init_sosvm(int32_t M, int32_t N,
85  int32_t num_aux, int32_t num_aux_con,
86  SGMatrix< float64_t > C, SGVector< float64_t > lb,
87  SGVector< float64_t > ub, SGMatrix< float64_t > A,
88  SGVector< float64_t > b);
89 
102  MSKrescodee add_constraint_sosvm(SGVector< float64_t > dPsi,
103  index_t con_idx, index_t train_idx, int32_t num_aux,
104  float64_t bi);
105 
115  static MSKrescodee wrapper_putaveclist(MSKtask_t & task, SGMatrix< float64_t > A);
116 
126  static MSKrescodee wrapper_putboundlist(MSKtask_t & task, SGVector< float64_t > b);
127 
138  MSKrescodee wrapper_putqobj(SGMatrix< float64_t > Q0) const;
139 
146  MSKrescodee optimize(SGVector< float64_t > sol);
147 
149  void delete_problem();
150 
159  void display_problem();
160 
166  float64_t get_primal_objective_value() const;
167 
169  virtual const char* get_name() const { return "Mosek"; }
170 
171  private:
173  MSKenv_t m_env;
174 
176  MSKtask_t m_task;
177 
179  MSKrescodee m_rescode;
180 };
181 
182 } /* namespace shogun */
183 
184 #endif /* USE_MOSEK */
185 #endif /* _CMOSEK__H__ */

SHOGUN Machine Learning Toolbox - Documentation