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