1 #ifndef __TAO_BMRM_H 2 #define __TAO_BMRM_H 3 4 #include <petsc/private/taoimpl.h> 5 #include <petscmath.h> 6 7 #define BMRM_INFTY 1e30 /* single precision: ~\pm 10^{38.53}; PetscReal precision: ~\pm 10^{308.25} */ 8 #define ALPHA_MIN 1e-10 9 #define ALPHA_MAX 1e10 10 #define EPS_SV 1e-15 11 #define EPS 1e-20 12 #define TOL_LAM 1e-15 13 #define TOL_R 1e-10 14 #define INCRE_DIM 1000 15 16 /* Context for BMRM solver */ 17 typedef struct{ 18 VecScatter scatter; /* Scatter context */ 19 Vec local_w; 20 PetscReal lambda; 21 }TAO_BMRM; 22 23 typedef struct Vec_Chain{ 24 Vec V; 25 struct Vec_Chain *next; 26 }Vec_Chain; 27 28 29 /* Context for Dai-Fletcher solver */ 30 typedef struct{ 31 PetscInt maxProjIter; 32 PetscInt maxPGMIter; 33 PetscInt *ipt, *ipt2, *uv; 34 PetscReal *g, *y, *tempv, *d, *Qd, *t, *xplus, *tplus, *sk, *yk; 35 36 PetscInt dim; 37 38 PetscInt cur_num_cp; 39 40 /* Variables (i.e. Lagrangian multipliers) */ 41 PetscReal *x; 42 43 /* Linear part of the objective function */ 44 PetscReal *f; 45 46 /* Hessian of the QP */ 47 PetscReal **Q; 48 49 /* Constraint matrix */ 50 PetscReal *a; 51 52 /* RHS of the equality constraint */ 53 PetscReal b; 54 55 /* Lower bound vector for the variables */ 56 PetscReal *l; 57 58 /* Upper bound vector for the variables */ 59 PetscReal *u; 60 61 /* Tolerance for optimization error */ 62 PetscReal tol; 63 }TAO_DF; 64 65 66 67 68 69 #endif 70