SHOGUN  3.2.1
 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/lib/config.h>
17 
18 #include <shogun/base/SGObject.h>
19 #include <shogun/lib/SGMatrix.h>
20 
21 #include <mosek.h>
22 
23 namespace shogun
24 {
25 
32 class CMosek : public CSGObject
33 {
34 
35  public:
37  CMosek();
38 
50  CMosek(int32_t num_con, int32_t num_var);
51 
53  ~CMosek();
54 
59  inline MSKrescodee get_rescode() const { return m_rescode; }
60 
68  static void MSKAPI print(void* handle, char str[]);
69 
86  MSKrescodee init_sosvm(int32_t M, int32_t N,
87  int32_t num_aux, int32_t num_aux_con,
88  SGMatrix< float64_t > C, SGVector< float64_t > lb,
89  SGVector< float64_t > ub, SGMatrix< float64_t > A,
90  SGVector< float64_t > b);
91 
104  MSKrescodee add_constraint_sosvm(SGVector< float64_t > dPsi,
105  index_t con_idx, index_t train_idx, int32_t num_aux,
106  float64_t bi);
107 
117  static MSKrescodee wrapper_putaveclist(MSKtask_t & task, SGMatrix< float64_t > A);
118 
128  static MSKrescodee wrapper_putboundlist(MSKtask_t & task, SGVector< float64_t > b);
129 
140  MSKrescodee wrapper_putqobj(SGMatrix< float64_t > Q0) const;
141 
148  MSKrescodee optimize(SGVector< float64_t > sol);
149 
151  void delete_problem();
152 
161  void display_problem();
162 
168  float64_t get_primal_objective_value() const;
169 
171  virtual const char* get_name() const { return "Mosek"; }
172 
173  private:
175  MSKenv_t m_env;
176 
178  MSKtask_t m_task;
179 
181  MSKrescodee m_rescode;
182 };
183 
184 } /* namespace shogun */
185 
186 #endif /* USE_MOSEK */
187 #endif /* _CMOSEK__H__ */

SHOGUN Machine Learning Toolbox - Documentation