24 : 
CSGObject(), env(NULL), lp(NULL), lp_initialized(false)
 
   40         env = CPXopenCPLEX (&status);
 
   45             SG_WARNING(
"Could not open CPLEX environment.\n")
 
   46             CPXgeterrorstring (
env, status, errmsg);
 
   48             SG_WARNING(
"retrying in %d seconds\n", timeout)
 
   55             status = CPXsetintparam (
env, CPX_PARAM_SCRIND, CPX_OFF);
 
   57                 SG_ERROR(
"Failure to turn off screen indicator, error %d.\n", status)
 
   60                 status = CPXsetintparam (
env, CPX_PARAM_DATACHECK, CPX_ON);
 
   62                     SG_ERROR(
"Failure to turn on data checking, error %d.\n", status)
 
   65                     lp = CPXcreateprob (
env, &status, 
"shogun");
 
   68                         SG_ERROR(
"Failed to create optimization problem.\n")
 
   70                         CPXchgobjsen (
env, 
lp, CPX_MIN);  
 
   73                         status = CPXsetintparam (
env, CPX_PARAM_QPMETHOD, 0);
 
   75                         status = CPXsetintparam (
env, CPX_PARAM_LPMETHOD, 0);
 
   77                         SG_ERROR(
"Failure to select dual lp/qp optimization, error %d.\n", status)
 
   84     return (
lp != NULL) && (
env != NULL);
 
   89     int32_t* idx_bound, int32_t num_bound, int32_t* w_zero, int32_t num_zero,
 
   90     float64_t* vee, int32_t num_dim, 
bool use_bias)
 
   92     const int cmatsize=10*1024*1024; 
 
   94     int32_t num_variables=num_dim + num_bound+num_zero; 
 
  103     char* sense = SG_MALLOC(
char, num_dim);
 
  104     int* cmatbeg=SG_MALLOC(
int, num_variables);
 
  105     int* cmatcnt=SG_MALLOC(
int, num_variables);
 
  106     int* cmatind=SG_MALLOC(
int, cmatsize);
 
  107     double* cmatval=SG_MALLOC(
double, cmatsize);
 
  109     for (int32_t i=0; i<num_variables; i++)
 
  126     for (int32_t i=0; i<num_variables; i++)
 
  138         else if (i<num_dim+num_zero) 
 
  142             cmatind[offs]=w_zero[i-num_dim];
 
  149             int32_t idx=idx_bound[i-num_dim-num_zero];
 
  159             float64_t val= -C*labels->get_confidence(idx);
 
  163                 for (int32_t j=0; j<vlen; j++)
 
  175                     cmatind[offs]=num_dim-1;
 
  186                     cmatind[offs]=num_dim-1;
 
  199     result = CPXcopylp(
env, 
lp, num_variables, num_dim, CPX_MIN,
 
  200             obj, vee, sense, cmatbeg, cmatcnt, cmatind, cmatval, lb, ub, NULL) == 0;
 
  217     int* qmatbeg=SG_MALLOC(
int, num_variables);
 
  218     int* qmatcnt=SG_MALLOC(
int, num_variables);
 
  219     int* qmatind=SG_MALLOC(
int, num_variables);
 
  220     double* qmatval=SG_MALLOC(
double, num_variables);
 
  224     for (int32_t i=0; i<num_variables; i++)
 
  245         result = CPXcopyquad(
env, 
lp, qmatbeg, qmatcnt, qmatind, qmatval) == 0;
 
  264     int32_t status = CPXsetintparam (
env, CPX_PARAM_LPMETHOD, 1); 
 
  266         SG_ERROR(
"Failure to select dual lp optimization, error %d.\n", status)
 
  268     double* obj=SG_MALLOC(
double, num_cols);
 
  269     double* lb=SG_MALLOC(
double, num_cols);
 
  270     double* ub=SG_MALLOC(
double, num_cols);
 
  272     for (int32_t i=0; i<num_cols; i++)
 
  279     status = CPXnewcols(
env, 
lp, num_cols, obj, lb, ub, NULL, NULL);
 
  283         CPXgeterrorstring (
env, status, errmsg);
 
  298     double amatval[len+1]; 
 
  306     for (int32_t i=0; i<len; i++)
 
  311         amatval[i]=label->get_confidence(idx)*val;
 
  314     int32_t status = CPXaddrows (
env, 
lp, 0, 1, len, rhs, sense, amatbeg, amatind, amatval, NULL, NULL);
 
  317         SG_ERROR(
"Failed to add the new row.\n")
 
  332     int32_t num_dims=1+2*num_feat+num_vec;
 
  333     int32_t num_constraints=num_vec;
 
  341     int64_t amatsize=((int64_t) num_vec)+nnz+nnz+num_vec;
 
  343     int* amatbeg=SG_MALLOC(
int, num_dims); 
 
  344     int* amatcnt=SG_MALLOC(
int, num_dims); 
 
  345     int* amatind=SG_MALLOC(
int, amatsize); 
 
  346     double* amatval= SG_MALLOC(
double, amatsize); 
 
  348     for (int32_t i=0; i<num_dims; i++)
 
  364         else if (i<2*num_feat+1) 
 
  378     for (int32_t i=0; i<num_constraints; i++)
 
  381     char* sense=SG_MALLOC(
char, num_constraints);
 
  382     memset(sense,
'L',
sizeof(
char)*num_constraints);
 
  391     for (int32_t i=0; i<num_vec; i++)
 
  394         amatval[offs]=-y->get_confidence(i);
 
  404     for (int32_t i=0; i<num_svec; i++)
 
  415             amatval[offs]=-y->get_confidence(row)*val;
 
  420     for (int32_t i=0; i<num_svec; i++)
 
  422         amatbeg[num_svec+i+1]=offs;
 
  431             amatval[offs]=y->get_confidence(row)*val;
 
  436     x->clean_tsparse(sfeat, num_svec);
 
  439     for (int32_t k=0; k<num_vec; k++)
 
  441         amatbeg[1+2*num_feat+k]=offs;
 
  442         amatcnt[1+2*num_feat+k]=1;
 
  448     int32_t status = CPXsetintparam (
env, CPX_PARAM_LPMETHOD, 1); 
 
  450         SG_ERROR(
"Failure to select barrier optimization, error %d.\n", status)
 
  451     CPXsetintparam (
env, CPX_PARAM_SCRIND, CPX_ON);
 
  453     bool result = CPXcopylp(
env, 
lp, num_dims, num_constraints, CPX_MIN,
 
  454             f, b, sense, amatbeg, amatcnt, amatind, amatval, lb, ub, NULL) == 0;
 
  475         int32_t status = CPXfreeprob(
env, &
lp);
 
  480             SG_WARNING(
"CPXfreeprob failed, error code %d.\n", status)
 
  487         int32_t status = CPXcloseCPLEX (&
env);
 
  493             SG_WARNING(
"Could not close CPLEX environment.\n")
 
  494             CPXgeterrorstring (
env, status, errmsg);
 
  504     float64_t* 
H, int32_t rows, int32_t cols, 
int* &qmatbeg, 
int* &qmatcnt,
 
  505     int* &qmatind, 
double* &qmatval)
 
  507     qmatbeg=SG_MALLOC(
int, cols);
 
  508     qmatcnt=SG_MALLOC(
int, cols);
 
  509     qmatind=SG_MALLOC(
int, cols*rows);
 
  512     if (!(qmatbeg && qmatcnt && qmatind))
 
  520     for (int32_t i=0; i<cols; i++)
 
  524         for (int32_t j=0; j<rows; j++)
 
  540     double* qmatval=NULL;
 
  544     if (constraints_mat==0)
 
  550         sense=SG_MALLOC(
char, rows);
 
  551         memset(sense,
'L',
sizeof(
char)*rows);
 
  552         constraints_mat=SG_MALLOC(
float64_t, cols);
 
  553         memset(constraints_mat, 0, 
sizeof(
float64_t)*cols);
 
  557         result = CPXcopylp(
env, 
lp, cols, rows, CPX_MIN,
 
  558                 objective, rhs, sense, qmatbeg, qmatcnt, qmatind, qmatval, lb, ub, NULL) == 0;
 
  559         SG_FREE(constraints_mat);
 
  563         sense=SG_MALLOC(
char, rows);
 
  564         memset(sense,
'L',
sizeof(
char)*rows);
 
  566         result = CPXcopylp(
env, 
lp, cols, rows, CPX_MIN,
 
  567                 objective, rhs, sense, qmatbeg, qmatcnt, qmatind, qmatval, lb, ub, NULL) == 0;
 
  586     double* qmatval=NULL;
 
  589         result = CPXcopyquad(
env, 
lp, qmatbeg, qmatcnt, qmatind, qmatval) == 0;
 
  608         status = CPXqpopt (
env, 
lp);
 
  610         status = CPXlpopt (
env, 
lp);
 
  615     status = CPXsolution (
env, 
lp, &solnstat, &objval, sol, lambda, NULL, NULL);
 
bool setup_qp(float64_t *H, int32_t dim)
bool init(E_PROB_TYPE t, int32_t timeout=60)
init cplex with problem type t and retry timeout 60 seconds 
virtual int32_t get_num_labels() const 
bool optimize(float64_t *sol, float64_t *lambda=NULL)
int64_t get_num_nonzero_entries()
bool setup_lpboost(float64_t C, int32_t num_cols)
bool dense_to_cplex_sparse(float64_t *H, int32_t rows, int32_t cols, int *&qmatbeg, int *&qmatcnt, int *&qmatind, double *&qmatval)
Class SGObject is the base class of all shogun objects. 
CSparseFeatures< ST > * get_transposed()
int32_t get_num_features() const 
bool add_lpboost_constraint(float64_t factor, SGSparseVectorEntry< float64_t > *h, int32_t len, int32_t ulen, CBinaryLabels *label)
bool setup_subgradientlpm_QP(float64_t C, CBinaryLabels *labels, CSparseFeatures< float64_t > *features, int32_t *idx_bound, int32_t num_bound, int32_t *w_zero, int32_t num_zero, float64_t *vee, int32_t num_dim, bool use_bias)
bool setup_lpm(float64_t C, CSparseFeatures< float64_t > *x, CBinaryLabels *y, bool use_bias)
void free_feature_vector(int32_t num)
SGSparseVectorEntry< T > * features
SGSparseVector< ST > get_sparse_feature_vector(int32_t num)
all of classes and functions are contained in the shogun namespace 
bool setup_lp(float64_t *objective, float64_t *constraints_mat, int32_t rows, int32_t cols, float64_t *rhs, float64_t *lb, float64_t *ub)
Binary Labels for binary classification.