Date: 2025-03-29T05:58:47+00:00

Actual source code: almm.h

      1: #pragma once
      2: #include <petsc/private/taoimpl.h>

      4: typedef struct {
      5:   Tao subsolver, parent;          /* subsolver for aug-lag subproblem */
      6:   PetscErrorCode (*sub_obj)(Tao); /* subsolver objective function */
      7:   TaoALMMType type;               /* subsolver objective type */

      9:   IS         *Pis, *Yis;           /* index sets to separate primal and dual vector spaces */
     10:   VecScatter *Pscatter, *Yscatter; /* scatter objects to write into combined vector spaces */

     12:   Mat  Ae, Ai;                              /* aliased constraint Jacobians (do not destroy!) */
     13:   Vec  Px, LgradX, Ce, Ci, G;               /* aliased vectors (do not destroy!) */
     14:   Vec  Ps, LgradS, Yi, Ye;                  /* sub-vectors for primal variables */
     15:   Vec *Parr, P, PL, PU, *Yarr, Y, C;        /* arrays and vectors for combined vector spaces */
     16:   Vec  Psub, Xwork, Cework, Ciwork, Cizero; /* work vectors */

     18:   PetscReal Lval, fval, gnorm, cnorm, cenorm, cinorm, cnorm_old; /* scalar variables */
     19:   PetscReal mu0, mu, mu_fac, mu_pow_good, mu_pow_bad;            /* penalty parameters */
     20:   PetscReal ytol0, ytol, gtol0, gtol;                            /* convergence parameters */
     21:   PetscReal mu_max, ye_min, yi_min, ye_max, yi_max;              /* parameter safeguards */

     23:   PetscBool info;
     24: } TAO_ALMM;

     26: PETSC_INTERN PetscErrorCode TaoALMMGetType_Private(Tao, TaoALMMType *);
     27: PETSC_INTERN PetscErrorCode TaoALMMSetType_Private(Tao, TaoALMMType);
     28: PETSC_INTERN PetscErrorCode TaoALMMGetSubsolver_Private(Tao, Tao *);
     29: PETSC_INTERN PetscErrorCode TaoALMMSetSubsolver_Private(Tao, Tao);
     30: PETSC_INTERN PetscErrorCode TaoALMMGetMultipliers_Private(Tao, Vec *);
     31: PETSC_INTERN PetscErrorCode TaoALMMSetMultipliers_Private(Tao, Vec);
     32: PETSC_INTERN PetscErrorCode TaoALMMGetPrimalIS_Private(Tao, IS *, IS *);
     33: PETSC_INTERN PetscErrorCode TaoALMMGetDualIS_Private(Tao, IS *, IS *);
     34: PETSC_INTERN PetscErrorCode TaoALMMSubsolverObjective_Private(Tao, Vec, PetscReal *, void *);
     35: PETSC_INTERN PetscErrorCode TaoALMMSubsolverObjectiveAndGradient_Private(Tao, Vec, PetscReal *, Vec, void *);