106 enum TYPE_PROBLEM {LINEAR, QUADRATIC, NONLINEAR};
107 enum TYPE_COMP_DY {CHOL_PWRS_PCG, FULL_CHOL, HYBRID_PCG, CHOL_THETA0_PCG};
109 enum TYPE_DIRECTION {NEWTON,SECOND_ORDER,AUTOMATIC};
110 enum TYPE_START_POINT {SIMPLE, QUAD_EQCONS_PROB};
113 enum TYPE_REG {NO_REG, QUAD_REG, PROX_REG};
114 enum OUTPUT {NONE, SCREEN, FILE, BOTH};
119 static constexpr
double INF= 1.0e128;
120 static const int M_PW_PREC= 1;
121 static constexpr
double SIGMA= 0.1;
122 static constexpr
double RHO= 0.995;
123 static constexpr
double OPTIM_GAP= 1.0e-6;
124 static constexpr
double OPTIM_GAP_SAFEGUARD= 1.0e-5;
125 static constexpr
double OPTIM_PFEAS= 1.0e-6;
126 static constexpr
double OPTIM_DFEAS= 1.0e-6;
127 static const int OUTPUT_FREQ= 1;
128 static const int MAXITER= 200;
129 static constexpr
double PCG_TOL_LIN= 1.0e-2;
130 static constexpr
double PCG_TOL_QUAD= 1.0e-3;
131 static constexpr
double MIN_PCGTOL= 1.0e-8;
132 static constexpr
double RED_PCGTOL= 0.95;
133 static const TYPE_COMP_DY TYPE_COMP_DY_DEFAULT= CHOL_PWRS_PCG;
134 static const TYPE_DIRECTION TYPE_DIRECTION_DEFAULT= AUTOMATIC;
135 static const TYPE_START_POINT TYPE_START_POINT_DEFAULT= SIMPLE;
136 static const TYPE_REG TYPE_REG_DEFAULT= NO_REG;
137 static constexpr
double FACTOR_REG_DEFAULT= 1.0e-6;
138 static const bool DEACTIVATELNK=
true;
169 void (*fobj) (
int n,
double x[],
double &fx,
double Gx[],
double Hx[],
void *params);
225 TYPE_START_POINT type_start_point;
229 double *
x, *y, *z, *w, *s;
230 double *rb, *rc, *rxz, *
rsw;
235 double *dx, *dy, *dz, *
dw;
241 double *Ax, *Aty, *r, *rhsdy, *rhspcg, *Cvaux, *
Cvaux2;
244 double *valpha, *vbeta;
287 BlockIP(TYPE_PROBLEM type_objective,
double* &cost,
double* &qcost,
void (*fobj) (
int n,
double x[],
double &fx,
double Gx[],
double Hx[],
void *params),
void *params,
double* &ub,
double* &rhs,
int numBlocks,
bool sameN,
MatrixBlockIP N[],
bool sameL,
MatrixBlockIP L[]);
290 BlockIP(TYPE_PROBLEM type_objective,
double* &cost,
double* &qcost,
void (*fobj) (
int n,
double x[],
double &fx,
double Gx[],
double Hx[],
void *params),
void *params,
double* &lb,
double* &ub,
double* &lhs,
double* &rhs,
int numBlocks,
bool sameN,
MatrixBlockIP N[],
bool sameL,
MatrixBlockIP L[]);
301 void create_problem(TYPE_PROBLEM type_objective,
double* &cost,
double* &qcost,
void (*fobj) (
int n,
double x[],
double &fx,
double Gx[],
double Hx[],
void *params),
void *params,
double* &ub,
double* &rhs,
int numBlocks,
bool sameN,
MatrixBlockIP N[],
bool sameL,
MatrixBlockIP L[]);
304 void create_problem(TYPE_PROBLEM type_objective,
double* &cost,
double* &qcost,
void (*fobj) (
int n,
double x[],
double &fx,
double Gx[],
double Hx[],
void *params),
void *params,
double* &lb,
double* &ub,
double* &lhs,
double* &rhs,
int numBlocks,
bool sameN,
MatrixBlockIP N[],
bool sameL,
MatrixBlockIP L[]);
313 void convert_to_standard();
316 void check_input_problem_and_compute_dimensions();
324 void set_defaults_minimize();
342 void set_inf(
double inf= INF);
348 void set_m_pw_prec(
int m_pw_prec=M_PW_PREC);
354 void set_sigma(
double sigma=SIGMA);
360 void set_rho(
double rho=RHO);
366 void set_optim_gap(
double optim_gap=OPTIM_GAP);
369 double get_optim_gap();
372 void set_optim_pfeas(
double optim_pfeas=OPTIM_PFEAS);
375 double get_optim_pfeas();
378 void set_optim_dfeas(
double optim_dfeas=OPTIM_DFEAS);
381 double get_optim_dfeas();
384 void set_output_freq(
int output_freq=OUTPUT_FREQ);
387 int get_output_freq();
390 void set_output(OUTPUT output=SCREEN);
396 void set_maxiter(
int maxiter=MAXITER);
402 void set_init_pcgtol(
double init_pcgtol);
405 double get_init_pcgtol();
408 void set_min_pcgtol(
double min_pcgtol=MIN_PCGTOL);
411 double get_min_pcgtol();
414 void set_maxit_pcg(
double maxit_pcg=0);
417 double get_maxit_pcg();
420 void set_red_pcgtol(
double red_pcgtol=RED_PCGTOL);
423 double get_red_pcgtol();
426 void set_show_specrad(
bool show_specrad=
false);
429 bool get_show_specrad();
432 void set_type_comp_dy(TYPE_COMP_DY type_comp_dy=TYPE_COMP_DY_DEFAULT);
435 TYPE_COMP_DY get_type_comp_dy();
438 void set_type_direction(TYPE_DIRECTION type_direction=TYPE_DIRECTION_DEFAULT);
441 TYPE_DIRECTION get_type_direction();
444 void set_type_start_point(TYPE_START_POINT type_start_point=TYPE_START_POINT_DEFAULT);
447 TYPE_START_POINT get_type_start_point();
450 void set_type_reg(TYPE_REG type_reg=TYPE_REG_DEFAULT);
453 TYPE_REG get_type_reg();
456 void set_factor_reg(
double factor_reg=FACTOR_REG_DEFAULT);
459 double get_factor_reg();
462 void set_deactivateLnk(
bool deactivateLnk=DEACTIVATELNK);
465 bool get_deactivateLnk();
492 void set_whoperm(WHO_PERMUTES whoperm_=CHOLESKY);
495 WHO_PERMUTES get_whoperm();
498 const double* get_x();
501 const double* get_y();
504 const double* get_z();
507 const double* get_w();
522 int min_PCG_Hv(
int nn,
double *v,
double *Hv);
523 int min_PCG_Hz_eq_r(
int nn,
double *zz,
double *rr);
524 int min_PCG_Theta0z_eq_r(
int nn,
double *zz,
double *rr);
527 void set_constant_fobj(
double constant);
530 double get_constant_fobj();
533 void set_names(
string *blockNames,
string *varNames,
string *consNames,
bool copy_vectors=
true);
536 void get_names(
const string* &blockNames,
const string* &varNames,
const string* &consNames);
539 void convert_to_std_and_write_mps(
const char *filename);
542 void write_mps(
const char *filename);
545 void write_mps(
const char *filename, TYPE_PROBLEM type_objective,
double cost[],
double qcost[],
double lb[],
double ub[],
double lhs[],
double rhs[],
int numBlocks,
bool sameN,
MatrixBlockIP N[],
bool sameL,
MatrixBlockIP L[],
string *blockNames=NULL,
string *varNames=NULL,
string *consNames=NULL,
double constantFObj=0);
548 void read_mps(
const char *filename);
551 void write_BlockIP_format(
const char *filename);
554 void read_BlockIP_format(
const char *filename);
557 void write_problem(
const char *filename);
560 StdForm* get_std_form(
bool keepStdFormAfterDelete=
false);
566 string* get_full_var_names();
569 string* get_full_cons_names();
572 void min_initializations();
573 void min_preprocess();
574 void min_normb_normc();
575 void min_Ax(
double *Ax,
const double *x);
576 void min_Aty(
double *Aty,
const double *y);
577 void min_compute_s();
578 void min_compute_mu();
579 void min_compute_sigma_psi();
580 void min_update_inactivelnk();
581 void min_KKT_residuals();
582 void min_starting_point();
583 void min_objective_functions_nonlin();
584 void min_objective_functions_linquad();
585 void eval_fobj(
double x[],
double &fx,
double Gx[],
double Hx[]);
586 void min_write_problem_information();
587 void min_write_current_point_info();
588 void min_steplengths(
double &talpha_p,
double &talpha_d,
double tdx[],
double tdz[],
double tdw[]);
590 void min_compute_Theta();
591 void min_compute_Theta0();
592 void min_compute_direction();
593 void min_Newton_direction();
594 void min_second_order_predictor_corrector_direction();
595 void min_update_newpoint();
596 void min_test_newpoint();
597 void min_backup_inactive(
int lnk);
598 void min_restore_inactive(
int lnk);
599 void min_compute_dy_cholpcg(
double *dy,
double *rhsdy,
bool only_solve=
false);
600 void min_compute_dy_fullchol(
double *dy,
double *rhsdy,
bool only_solve=
false);
601 void min_free_memory();
602 void min_check_Newton_direction_is_correct();
603 void min_check_predictor_direction_is_correct();
604 void min_check_predictor_corrector_direction_is_correct();
605 void min_solve_NThetaNt(
double *v);
606 void min_Ctv(
double *v,
double *Ctv);
607 void min_Cv(
double *v,
double *Cv);
608 void min_debug_write_variables();
609 void min_debug_variables_of_inactivelnk();
610 void min_debug_variables_without_ub();
611 void min_update_qreg();
629 this->m_pw_prec= m_pw_prec;
665 this->optim_gap= optim_gap;
677 this->optim_pfeas= optim_pfeas;
689 this->optim_dfeas= optim_dfeas;
701 this->output_freq= output_freq;
713 this->output= output;
725 this->maxiter= maxiter;
737 this->init_pcgtol= init_pcgtol;
749 this->min_pcgtol= min_pcgtol;
761 this->maxit_pcg= maxit_pcg;
773 this->red_pcgtol= red_pcgtol;
785 this->show_specrad= show_specrad;
797 this->type_comp_dy= type_comp_dy;
809 this->type_direction= type_direction;
815 return type_direction;
821 this->type_start_point= type_start_point;
827 return type_start_point;
833 this->type_reg= type_reg;
845 this->factor_reg= factor_reg;
857 this->deactivateLnk= deactivateLnk;
863 return deactivateLnk;
927 return stdForm->numOrigVars;
939 return m_cons + stdForm->deletedRows->size();
960 return stdForm->xOrig;
969 return stdForm->yOrig;
978 return stdForm->zOrig;
987 return stdForm->wOrig;
996 return stdForm->xOrig[i];
1005 return stdForm->yOrig[i];
1014 return stdForm->zOrig[i];
1023 return stdForm->wOrig[i];
1046 return fx + stdForm->constantFObj;
1055 return dobj + stdForm->constantFObj;
1069 this->keepStdFormAfterDelete = keepStdFormAfterDelete;
1076 constantFObj = constant;
1082 return constantFObj;
1085 inline void BlockIP::eval_fobj(
double x[],
double &fx,
double Gx[],
double Hx[])
1088 stdForm->fobj_stdform(n_vars, x, fx, Gx, Hx, params);
1090 fobj(n_vars, x, fx, Gx, Hx, params);