Mosek.h

Go to the documentation of this file.
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  * Written (W) 2012 Fernando José Iglesias García
00008  * Copyright (C) 2012 Fernando José Iglesias García
00009  */
00010 
00011 #ifndef _CMOSEK__H__
00012 #define _CMOSEK__H__
00013 
00014 #ifdef USE_MOSEK
00015 
00016 #include <shogun/base/SGObject.h>
00017 #include <shogun/lib/SGMatrix.h>
00018 
00019 #include <mosek.h>
00020 
00021 namespace shogun
00022 {
00023 
00030 class CMosek : public CSGObject
00031 {
00032 
00033     public:
00035         CMosek();
00036 
00048         CMosek(int32_t num_con, int32_t num_var);
00049 
00051         ~CMosek();
00052 
00057         inline MSKrescodee get_rescode() const { return m_rescode; }
00058 
00066         static void MSKAPI print(void* handle, char str[]);
00067 
00084         MSKrescodee init_sosvm(int32_t M, int32_t N,
00085                 int32_t num_aux, int32_t num_aux_con,
00086                 SGMatrix< float64_t > C, SGVector< float64_t > lb,
00087                 SGVector< float64_t > ub, SGMatrix< float64_t > A,
00088                 SGVector< float64_t > b);
00089 
00102         MSKrescodee add_constraint_sosvm(SGVector< float64_t > dPsi,
00103                 index_t con_idx, index_t train_idx, int32_t num_aux,
00104                 float64_t bi);
00105 
00115         static MSKrescodee wrapper_putaveclist(MSKtask_t & task, SGMatrix< float64_t > A);
00116 
00126         static MSKrescodee wrapper_putboundlist(MSKtask_t & task, SGVector< float64_t > b);
00127 
00138         MSKrescodee wrapper_putqobj(SGMatrix< float64_t > Q0) const;
00139 
00146         MSKrescodee optimize(SGVector< float64_t > sol);
00147 
00149         void delete_problem();
00150 
00159         void display_problem();
00160 
00166         float64_t get_primal_objective_value() const;
00167 
00169         virtual const char* get_name() const { return "Mosek"; }
00170 
00171     private:
00173         MSKenv_t m_env;
00174 
00176         MSKtask_t m_task;
00177 
00179         MSKrescodee m_rescode;
00180 };
00181 
00182 } /* namespace shogun */
00183 
00184 #endif /* USE_MOSEK */
00185 #endif /* _CMOSEK__H__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation