xref: /petsc/src/tao/constrained/impls/admm/admm.h (revision ccb4e88a40f0b86eaeca07ff64c64e4de2fae686)
1 #if !defined(TAOADMM_H)
2 #define TAOADMM_H
3 #include <petsc/private/taoimpl.h>
4 
5 typedef struct _TaoADMMOps *TaoADMMOps;
6 
7 struct _TaoADMMOps {
8   PetscErrorCode (*misfitobjgrad)(Tao, Vec, PetscReal*, Vec, void*);
9   PetscErrorCode (*misfithess)(Tao, Vec, Mat, Mat,  void*);
10   PetscErrorCode (*misfitjac)(Tao, Vec, Mat, Mat,  void*);
11   PetscErrorCode (*regobjgrad)(Tao, Vec, PetscReal*, Vec, void*);
12   PetscErrorCode (*reghess)(Tao, Vec, Mat, Mat,  void*);
13   PetscErrorCode (*regjac)(Tao, Vec, Mat, Mat,  void*);
14 };
15 
16 typedef struct {
17   PETSCHEADER(struct _TaoADMMOps);
18   Tao                    subsolverX, subsolverZ, parent;
19   Vec                    residual,y,yold,y0,yhat,yhatold,constraint;
20   Vec                    z,zold,Ax,Bz,Axold,Bzold,Bz0;
21   Vec                    workLeft,workJacobianRight,workJacobianRight2; /*Ax,Bz,y,constraint are workJacobianRight sized. workLeft is solution sized */
22   Mat                    Hx,Hxpre,Hz,Hzpre,ATA,BTB,JA,JApre,JB,JBpre;
23   void*                  regobjgradP;
24   void*                  reghessP;
25   void*                  regjacobianP;
26   void*                  misfitobjgradP;
27   void*                  misfithessP;
28   void*                  misfitjacobianP;
29   PetscReal              gamma,last_misfit_val,last_reg_val,l1epsilon;
30   PetscReal              lambda,mu,muold,orthval,mueps,tol,mumin;
31   PetscReal              Bzdiffnorm,dualres,resnorm,const_norm;
32   PetscReal              gatol_admm,catol_admm;
33   PetscInt               T;                                             /* adaptive iteration cutoff */
34   PetscBool              xJI, zJI;                                      /* Bool to check whether A,B Jacobians are NULL-set identity */
35   PetscBool              Hxchange, Hzchange;                            /* Bool to check whether Hx,Hz change wrt to x and z */
36   PetscBool              Hxbool, Hzbool;                                /* Bool to make sure Hessian gets updated only once for Hchange False case */
37   TaoADMMUpdateType      update;                                        /* update policy for mu */
38   TaoADMMRegularizerType regswitch;                                     /* regularization policy */
39 } TAO_ADMM;
40 
41 #endif
42