xref: /petsc/src/tao/unconstrained/impls/bmrm/bmrm.h (revision ccb4e88a40f0b86eaeca07ff64c64e4de2fae686)
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 /* Context for Dai-Fletcher solver */
29 typedef struct{
30   PetscInt maxProjIter;
31   PetscInt maxPGMIter;
32   PetscInt *ipt, *ipt2, *uv;
33   PetscReal *g, *y, *tempv, *d, *Qd, *t, *xplus, *tplus, *sk, *yk;
34 
35   PetscInt dim;
36 
37   PetscInt cur_num_cp;
38 
39   /* Variables (i.e. Lagrangian multipliers) */
40   PetscReal *x;
41 
42   /* Linear part of the objective function  */
43   PetscReal *f;
44 
45   /* Hessian of the QP */
46   PetscReal **Q;
47 
48   /* Constraint matrix  */
49   PetscReal *a;
50 
51   /* RHS of the equality constraint */
52   PetscReal b;
53 
54   /* Lower bound vector for the variables */
55   PetscReal *l;
56 
57   /* Upper bound vector for the variables */
58   PetscReal *u;
59 
60   /* Tolerance for optimization error */
61   PetscReal tol;
62 }TAO_DF;
63 
64 #endif
65