Actual source code: petsctao.h

  1: #pragma once

  3: #include <petscsnes.h>

  5: /* SUBMANSEC = Tao */

  7: PETSC_EXTERN PetscErrorCode VecFischer(Vec, Vec, Vec, Vec, Vec);
  8: PETSC_EXTERN PetscErrorCode VecSFischer(Vec, Vec, Vec, Vec, PetscReal, Vec);
  9: PETSC_EXTERN PetscErrorCode MatDFischer(Mat, Vec, Vec, Vec, Vec, Vec, Vec, Vec, Vec);
 10: PETSC_EXTERN PetscErrorCode MatDSFischer(Mat, Vec, Vec, Vec, Vec, PetscReal, Vec, Vec, Vec, Vec, Vec);
 11: PETSC_EXTERN PetscErrorCode TaoSoftThreshold(Vec, PetscReal, PetscReal, Vec);

 13: /*E
 14:   TaoSubsetType - Type representing the way TAO handles active sets

 16:   Values:
 17: + `TAO_SUBSET_SUBVEC`     - Tao uses `MatCreateSubMatrix()` and `VecGetSubVector()`
 18: . `TAO_SUBSET_MASK`       - Matrices are zeroed out corresponding to active set entries
 19: - `TAO_SUBSET_MATRIXFREE` - Same as `TAO_SUBSET_MASK` but it can be applied to matrix-free operators

 21:   Options database Key:
 22: . -different_hessian - Tao will use a copy of the Hessian operator for masking.  By default TAO will directly alter the Hessian operator.

 24:   Level: intermediate

 26: .seealso: [](ch_tao), `TaoVecGetSubVec()`, `TaoMatGetSubMat()`, `Tao`, `TaoCreate()`, `TaoDestroy()`, `TaoSetType()`, `TaoType`
 27: E*/
 28: typedef enum {
 29:   TAO_SUBSET_SUBVEC,
 30:   TAO_SUBSET_MASK,
 31:   TAO_SUBSET_MATRIXFREE
 32: } TaoSubsetType;
 33: PETSC_EXTERN const char *const TaoSubsetTypes[];

 35: /*S
 36:    Tao - Abstract PETSc object that manages nonlinear optimization solves

 38:    Level: advanced

 40: .seealso: [](doc_taosolve), [](ch_tao), `TaoCreate()`, `TaoDestroy()`, `TaoSetType()`, `TaoType`
 41: S*/
 42: typedef struct _p_Tao *Tao;

 44: /*E
 45:   TaoADMMUpdateType - Determine spectral penalty update routine for Lagrange augmented term for `TAOADMM`.

 47:   Level: advanced

 49: .seealso: [](ch_tao), `Tao`, `TAOADMM`, `TaoADMMSetUpdateType()`
 50: E*/
 51: typedef enum {
 52:   TAO_ADMM_UPDATE_BASIC,
 53:   TAO_ADMM_UPDATE_ADAPTIVE,
 54:   TAO_ADMM_UPDATE_ADAPTIVE_RELAXED
 55: } TaoADMMUpdateType;
 56: PETSC_EXTERN const char *const TaoADMMUpdateTypes[];

 58: /*MC
 59:   TAO_ADMM_UPDATE_BASIC - Use same spectral penalty set at the beginning. No update

 61:   Level: advanced

 63:   Note:
 64:   Most basic implementation of `TAOADMM`. Generally slower than adaptive or adaptive relaxed version.

 66: .seealso: [](ch_tao), `Tao`, `TAOADMM`, `TaoADMMSetUpdateType()`, `TAO_ADMM_UPDATE_ADAPTIVE`, `TAO_ADMM_UPDATE_ADAPTIVE_RELAXED`
 67: M*/

 69: /*MC
 70:   TAO_ADMM_UPDATE_ADAPTIVE - Adaptively update spectral penalty

 72:   Level: advanced

 74:   Note:
 75:   Adaptively updates spectral penalty of `TAOADMM` by using both steepest descent and minimum gradient.

 77: .seealso: [](ch_tao), `Tao`, `TAOADMM`, `TaoADMMSetUpdateType()`, `TAO_ADMM_UPDATE_BASIC`, `TAO_ADMM_UPDATE_ADAPTIVE_RELAXED`
 78: M*/

 80: /*MC
 81:   ADMM_UPDATE_ADAPTIVE_RELAXED - Adaptively update spectral penalty, and relaxes parameter update

 83:   Level: advanced

 85:   Note:
 86:   With adaptive spectral penalty update, it also relaxes x vector update by a factor.

 88: .seealso: [](ch_tao), `Tao`, `TaoADMMSetUpdateType()`, `TAO_ADMM_UPDATE_BASIC`, `TAO_ADMM_UPDATE_ADAPTIVE`
 89: M*/

 91: /*E
 92:   TaoADMMRegularizerType - Determine regularizer routine - either user provided or soft threshold for `TAOADMM`

 94:   Level: advanced

 96: .seealso: [](ch_tao), `Tao`, `TAOADMM`, `TaoADMMSetRegularizerType()`
 97: E*/
 98: typedef enum {
 99:   TAO_ADMM_REGULARIZER_USER,
100:   TAO_ADMM_REGULARIZER_SOFT_THRESH
101: } TaoADMMRegularizerType;
102: PETSC_EXTERN const char *const TaoADMMRegularizerTypes[];

104: /*MC
105:   TAO_ADMM_REGULARIZER_USER - User provided routines for regularizer part of `TAOADMM`

107:   Level: advanced

109:   Note:
110:   User needs to provided appropriate routines and type for regularizer solver

112: .seealso: [](ch_tao), `Tao`, `TAOADMM`, `TaoADMMSetRegularizerType()`, `TAO_ADMM_REGULARIZER_SOFT_THRESH`
113: M*/

115: /*MC
116:   TAO_ADMM_REGULARIZER_SOFT_THRESH - Soft threshold to solve regularizer part of `TAOADMM`

118:   Level: advanced

120:   Note:
121:   Utilizes built-in SoftThreshold routines

123: .seealso: [](ch_tao), `Tao`, `TAOADMM`, `TaoSoftThreshold()`, `TaoADMMSetRegularizerObjectiveAndGradientRoutine()`,
124:           `TaoADMMSetRegularizerHessianRoutine()`, `TaoADMMSetRegularizerType()`, `TAO_ADMM_REGULARIZER_USER`
125: M*/

127: /*E
128:    TaoALMMType - Determine the augmented Lagrangian formulation used in the `TAOALMM` subproblem.

130:    Values:
131: +  `TAO_ALMM_CLASSIC` - classic augmented Lagrangian definition including slack variables for inequality constraints
132: -  `TAO_ALMM_PHR`     - Powell-Hestenes-Rockafellar formulation without slack variables, uses pointwise min() for inequalities

134:   Level: advanced

136: .seealso: [](ch_tao), `Tao`, `TAOALMM`, `TaoALMMSetType()`, `TaoALMMGetType()`
137: E*/
138: typedef enum {
139:   TAO_ALMM_CLASSIC,
140:   TAO_ALMM_PHR
141: } TaoALMMType;
142: PETSC_EXTERN const char *const TaoALMMTypes[];

144: /*E
145:   TaoBNCGType - Determine the conjugate gradient update formula used in the TAOBNCG algorithm.

147:   Values:
148: +  TAO_BNCG_GD         - basic gradient descent, no CG update
149: .  TAO_BNCG_PCGD       - preconditioned/scaled gradient descent
150: .  TAO_BNCG_HS         - Hestenes-Stiefel
151: .  TAO_BNCG_FR         - Fletcher-Reeves
152: .  TAO_BNCG_PRP        - Polak-Ribiere-Polyak (PRP)
153: .  TAO_BNCG_PRP_PLUS   - Polak-Ribiere-Polyak "plus" (PRP+)
154: .  TAO_BNCG_DY         - Dai-Yuan
155: .  TAO_BNCG_HZ         - Hager-Zhang (CG_DESCENT 5.3)
156: .  TAO_BNCG_DK         - Dai-Kou (2013)
157: .  TAO_BNCG_KD         - Kou-Dai (2015)
158: .  TAO_BNCG_SSML_BFGS  - Self-Scaling Memoryless BFGS (Perry-Shanno)
159: .  TAO_BNCG_SSML_DFP   - Self-Scaling Memoryless DFP
160: -  TAO_BNCG_SSML_BRDN  - Self-Scaling Memoryless (Symmetric) Broyden

162:   Level: advanced

164: .seealso: `Tao`, `TAOBNCG`, `TaoBNCGSetType()`, `TaoBNCGGetType()`
165: E*/

167: typedef enum {
168:   TAO_BNCG_GD,
169:   TAO_BNCG_PCGD,
170:   TAO_BNCG_HS,
171:   TAO_BNCG_FR,
172:   TAO_BNCG_PRP,
173:   TAO_BNCG_PRP_PLUS,
174:   TAO_BNCG_DY,
175:   TAO_BNCG_HZ,
176:   TAO_BNCG_DK,
177:   TAO_BNCG_KD,
178:   TAO_BNCG_SSML_BFGS,
179:   TAO_BNCG_SSML_DFP,
180:   TAO_BNCG_SSML_BRDN
181: } TaoBNCGType;
182: PETSC_EXTERN const char *const TaoBNCGTypes[];

184: /*J
185:   TaoType - String with the name of a `Tao` method

187:   Values:
188: + `TAONLS`      - nls Newton's method with line search for unconstrained minimization
189: . `TAONTR`      - ntr Newton's method with trust region for unconstrained minimization
190: . `TAONTL`      - ntl Newton's method with trust region, line search for unconstrained minimization
191: . `TAOLMVM`     - lmvm Limited memory variable metric method for unconstrained minimization
192: . `TAOCG`       - cg Nonlinear conjugate gradient method for unconstrained minimization
193: . `TAONM`       - nm Nelder-Mead algorithm for derivate-free unconstrained minimization
194: . `TAOTRON`     - tron Newton Trust Region method for bound constrained minimization
195: . `TAOGPCG`     - gpcg Newton Trust Region method for quadratic bound constrained minimization
196: . `TAOBLMVM`    - blmvm Limited memory variable metric method for bound constrained minimization
197: . `TAOLCL`      - lcl Linearly constrained Lagrangian method for pde-constrained minimization
198: - `TAOPOUNDERS` - Pounders Model-based algorithm for nonlinear least squares

200:   Level: beginner

202: .seealso: [](doc_taosolve), [](ch_tao), `Tao`, `TaoCreate()`, `TaoSetType()`
203: J*/
204: typedef const char *TaoType;
205: #define TAOLMVM     "lmvm"
206: #define TAONLS      "nls"
207: #define TAONTR      "ntr"
208: #define TAONTL      "ntl"
209: #define TAOCG       "cg"
210: #define TAOTRON     "tron"
211: #define TAOOWLQN    "owlqn"
212: #define TAOBMRM     "bmrm"
213: #define TAOBLMVM    "blmvm"
214: #define TAOBQNLS    "bqnls"
215: #define TAOBNCG     "bncg"
216: #define TAOBNLS     "bnls"
217: #define TAOBNTR     "bntr"
218: #define TAOBNTL     "bntl"
219: #define TAOBQNKLS   "bqnkls"
220: #define TAOBQNKTR   "bqnktr"
221: #define TAOBQNKTL   "bqnktl"
222: #define TAOBQPIP    "bqpip"
223: #define TAOGPCG     "gpcg"
224: #define TAONM       "nm"
225: #define TAOPOUNDERS "pounders"
226: #define TAOBRGN     "brgn"
227: #define TAOLCL      "lcl"
228: #define TAOSSILS    "ssils"
229: #define TAOSSFLS    "ssfls"
230: #define TAOASILS    "asils"
231: #define TAOASFLS    "asfls"
232: #define TAOIPM      "ipm"
233: #define TAOPDIPM    "pdipm"
234: #define TAOSHELL    "shell"
235: #define TAOADMM     "admm"
236: #define TAOALMM     "almm"
237: #define TAOPYTHON   "python"
238: #define TAOSNES     "snes"

240: PETSC_EXTERN PetscClassId      TAO_CLASSID;
241: PETSC_EXTERN PetscFunctionList TaoList;

243: /*E
244:     TaoConvergedReason - reason a `Tao` optimizer was said to have converged or diverged

246:    Values:
247: +  `TAO_CONVERGED_GATOL`       - $||g(X)|| < gatol$
248: .  `TAO_CONVERGED_GRTOL`       - $||g(X)|| / f(X)  < grtol$
249: .  `TAO_CONVERGED_GTTOL`       - $||g(X)|| / ||g(X0)|| < gttol$
250: .  `TAO_CONVERGED_STEPTOL`     - step size smaller than tolerance
251: .  `TAO_CONVERGED_MINF`        - $F < F_min$
252: .  `TAO_CONVERGED_USER`        - the user indicates the optimization has succeeded
253: .  `TAO_DIVERGED_MAXITS`       - the maximum number of iterations allowed has been achieved
254: .  `TAO_DIVERGED_NAN`          - not a number appeared in the computations
255: .  `TAO_DIVERGED_MAXFCN`       - the maximum number of function evaluations has been computed
256: .  `TAO_DIVERGED_LS_FAILURE`   - a linesearch failed
257: .  `TAO_DIVERGED_TR_REDUCTION` - trust region failure
258: .  `TAO_DIVERGED_USER`         - the user has indicated the optimization has failed
259: -  `TAO_CONTINUE_ITERATING`    - the optimization is still running, `TaoSolve()`

261:    where
262: +  X            - current solution
263: .  X0           - initial guess
264: .  f(X)         - current function value
265: .  f(X*)        - true solution (estimated)
266: .  g(X)         - current gradient
267: .  its          - current iterate number
268: .  maxits       - maximum number of iterates
269: .  fevals       - number of function evaluations
270: -  max_funcsals - maximum number of function evaluations

272:    Level: beginner

274:    Note:
275:    The two most common reasons for divergence are  an incorrectly coded or computed gradient or Hessian failure or lack of convergence
276:    in the linear system solve (in this case we recommend testing with `-pc_type lu` to eliminate the linear solver as the cause of the problem).

278:    Developer Note:
279:    The names in `KSPConvergedReason`, `SNESConvergedReason`, and `TaoConvergedReason` should be uniformized

281: .seealso: [](ch_tao), `Tao`, `TaoSolve()`, `TaoGetConvergedReason()`, `KSPConvergedReason`, `SNESConvergedReason`
282: E*/
283: typedef enum {               /* converged */
284:   TAO_CONVERGED_GATOL   = 3, /* ||g(X)|| < gatol */
285:   TAO_CONVERGED_GRTOL   = 4, /* ||g(X)|| / f(X)  < grtol */
286:   TAO_CONVERGED_GTTOL   = 5, /* ||g(X)|| / ||g(X0)|| < gttol */
287:   TAO_CONVERGED_STEPTOL = 6, /* step size small */
288:   TAO_CONVERGED_MINF    = 7, /* F < F_min */
289:   TAO_CONVERGED_USER    = 8, /* User defined */
290:   /* diverged */
291:   TAO_DIVERGED_MAXITS       = -2,
292:   TAO_DIVERGED_NAN          = -4,
293:   TAO_DIVERGED_MAXFCN       = -5,
294:   TAO_DIVERGED_LS_FAILURE   = -6,
295:   TAO_DIVERGED_TR_REDUCTION = -7,
296:   TAO_DIVERGED_USER         = -8, /* User defined */
297:   /* keep going */
298:   TAO_CONTINUE_ITERATING = 0
299: } TaoConvergedReason;

301: PETSC_EXTERN const char **TaoConvergedReasons;

303: PETSC_EXTERN PetscErrorCode TaoInitializePackage(void);
304: PETSC_EXTERN PetscErrorCode TaoFinalizePackage(void);
305: PETSC_EXTERN PetscErrorCode TaoCreate(MPI_Comm, Tao *);
306: PETSC_EXTERN PetscErrorCode TaoSetFromOptions(Tao);
307: PETSC_EXTERN PetscErrorCode TaoSetUp(Tao);
308: PETSC_EXTERN PetscErrorCode TaoSetType(Tao, TaoType);
309: PETSC_EXTERN PetscErrorCode TaoGetType(Tao, TaoType *);
310: PETSC_EXTERN PetscErrorCode TaoSetApplicationContext(Tao, void *);
311: PETSC_EXTERN PetscErrorCode TaoGetApplicationContext(Tao, void *);
312: PETSC_EXTERN PetscErrorCode TaoDestroy(Tao *);

314: PETSC_EXTERN PetscErrorCode TaoSetOptionsPrefix(Tao, const char[]);
315: PETSC_EXTERN PetscErrorCode TaoView(Tao, PetscViewer);
316: PETSC_EXTERN PetscErrorCode TaoViewFromOptions(Tao, PetscObject, const char[]);

318: PETSC_EXTERN PetscErrorCode TaoSolve(Tao);

320: PETSC_EXTERN PetscErrorCode TaoRegister(const char[], PetscErrorCode (*)(Tao));
321: PETSC_EXTERN PetscErrorCode TaoRegisterDestroy(void);

323: PETSC_EXTERN PetscErrorCode TaoGetConvergedReason(Tao, TaoConvergedReason *);
324: PETSC_EXTERN PetscErrorCode TaoGetSolutionStatus(Tao, PetscInt *, PetscReal *, PetscReal *, PetscReal *, PetscReal *, TaoConvergedReason *);
325: PETSC_EXTERN PetscErrorCode TaoSetConvergedReason(Tao, TaoConvergedReason);
326: PETSC_EXTERN PetscErrorCode TaoSetSolution(Tao, Vec);
327: PETSC_EXTERN PetscErrorCode TaoGetSolution(Tao, Vec *);

329: PETSC_EXTERN PetscErrorCode TaoSetObjective(Tao, PetscErrorCode (*)(Tao, Vec, PetscReal *, void *), void *);
330: PETSC_EXTERN PetscErrorCode TaoGetObjective(Tao, PetscErrorCode (**)(Tao, Vec, PetscReal *, void *), void **);
331: PETSC_EXTERN PetscErrorCode TaoSetGradient(Tao, Vec, PetscErrorCode (*)(Tao, Vec, Vec, void *), void *);
332: PETSC_EXTERN PetscErrorCode TaoGetGradient(Tao, Vec *, PetscErrorCode (**)(Tao, Vec, Vec, void *), void **);
333: PETSC_EXTERN PetscErrorCode TaoSetObjectiveAndGradient(Tao, Vec, PetscErrorCode (*)(Tao, Vec, PetscReal *, Vec, void *), void *);
334: PETSC_EXTERN PetscErrorCode TaoGetObjectiveAndGradient(Tao, Vec *, PetscErrorCode (**)(Tao, Vec, PetscReal *, Vec, void *), void **);
335: PETSC_EXTERN PetscErrorCode TaoSetHessian(Tao, Mat, Mat, PetscErrorCode (*)(Tao, Vec, Mat, Mat, void *), void *);
336: PETSC_EXTERN PetscErrorCode TaoGetHessian(Tao, Mat *, Mat *, PetscErrorCode (**)(Tao, Vec, Mat, Mat, void *), void **);

338: PETSC_EXTERN PetscErrorCode TaoSetGradientNorm(Tao, Mat);
339: PETSC_EXTERN PetscErrorCode TaoGetGradientNorm(Tao, Mat *);
340: PETSC_EXTERN PetscErrorCode TaoSetLMVMMatrix(Tao, Mat);
341: PETSC_EXTERN PetscErrorCode TaoGetLMVMMatrix(Tao, Mat *);
342: PETSC_EXTERN PetscErrorCode TaoSetRecycleHistory(Tao, PetscBool);
343: PETSC_EXTERN PetscErrorCode TaoGetRecycleHistory(Tao, PetscBool *);
344: PETSC_EXTERN PetscErrorCode TaoLMVMSetH0(Tao, Mat);
345: PETSC_EXTERN PetscErrorCode TaoLMVMGetH0(Tao, Mat *);
346: PETSC_EXTERN PetscErrorCode TaoLMVMGetH0KSP(Tao, KSP *);
347: PETSC_EXTERN PetscErrorCode TaoLMVMRecycle(Tao, PetscBool);
348: PETSC_EXTERN PetscErrorCode TaoSetResidualRoutine(Tao, Vec, PetscErrorCode (*)(Tao, Vec, Vec, void *), void *);
349: PETSC_EXTERN PetscErrorCode TaoSetResidualWeights(Tao, Vec, PetscInt, PetscInt *, PetscInt *, PetscReal *);
350: PETSC_EXTERN PetscErrorCode TaoSetConstraintsRoutine(Tao, Vec, PetscErrorCode (*)(Tao, Vec, Vec, void *), void *);
351: PETSC_EXTERN PetscErrorCode TaoSetInequalityConstraintsRoutine(Tao, Vec, PetscErrorCode (*)(Tao, Vec, Vec, void *), void *);
352: PETSC_EXTERN PetscErrorCode TaoSetEqualityConstraintsRoutine(Tao, Vec, PetscErrorCode (*)(Tao, Vec, Vec, void *), void *);
353: PETSC_EXTERN PetscErrorCode TaoSetJacobianResidualRoutine(Tao, Mat, Mat, PetscErrorCode (*)(Tao, Vec, Mat, Mat, void *), void *);
354: PETSC_EXTERN PetscErrorCode TaoSetJacobianRoutine(Tao, Mat, Mat, PetscErrorCode (*)(Tao, Vec, Mat, Mat, void *), void *);
355: PETSC_EXTERN PetscErrorCode TaoSetJacobianStateRoutine(Tao, Mat, Mat, Mat, PetscErrorCode (*)(Tao, Vec, Mat, Mat, Mat, void *), void *);
356: PETSC_EXTERN PetscErrorCode TaoSetJacobianDesignRoutine(Tao, Mat, PetscErrorCode (*)(Tao, Vec, Mat, void *), void *);
357: PETSC_EXTERN PetscErrorCode TaoSetJacobianInequalityRoutine(Tao, Mat, Mat, PetscErrorCode (*)(Tao, Vec, Mat, Mat, void *), void *);
358: PETSC_EXTERN PetscErrorCode TaoSetJacobianEqualityRoutine(Tao, Mat, Mat, PetscErrorCode (*)(Tao, Vec, Mat, Mat, void *), void *);

360: PETSC_EXTERN PetscErrorCode TaoPythonSetType(Tao, const char[]);
361: PETSC_EXTERN PetscErrorCode TaoPythonGetType(Tao, const char *[]);

363: PETSC_EXTERN PetscErrorCode TaoShellSetSolve(Tao, PetscErrorCode (*)(Tao));
364: PETSC_EXTERN PetscErrorCode TaoShellSetContext(Tao, void *);
365: PETSC_EXTERN PetscErrorCode TaoShellGetContext(Tao, void *);

367: PETSC_EXTERN PetscErrorCode TaoSetStateDesignIS(Tao, IS, IS);

369: PETSC_EXTERN PetscErrorCode TaoComputeObjective(Tao, Vec, PetscReal *);
370: PETSC_EXTERN PetscErrorCode TaoComputeResidual(Tao, Vec, Vec);
371: PETSC_EXTERN PetscErrorCode TaoTestGradient(Tao, Vec, Vec);
372: PETSC_EXTERN PetscErrorCode TaoComputeGradient(Tao, Vec, Vec);
373: PETSC_EXTERN PetscErrorCode TaoComputeObjectiveAndGradient(Tao, Vec, PetscReal *, Vec);
374: PETSC_EXTERN PetscErrorCode TaoComputeConstraints(Tao, Vec, Vec);
375: PETSC_EXTERN PetscErrorCode TaoComputeInequalityConstraints(Tao, Vec, Vec);
376: PETSC_EXTERN PetscErrorCode TaoComputeEqualityConstraints(Tao, Vec, Vec);
377: PETSC_EXTERN PetscErrorCode TaoDefaultComputeGradient(Tao, Vec, Vec, void *);
378: PETSC_EXTERN PetscErrorCode TaoIsObjectiveDefined(Tao, PetscBool *);
379: PETSC_EXTERN PetscErrorCode TaoIsGradientDefined(Tao, PetscBool *);
380: PETSC_EXTERN PetscErrorCode TaoIsObjectiveAndGradientDefined(Tao, PetscBool *);

382: PETSC_EXTERN PetscErrorCode TaoTestHessian(Tao);
383: PETSC_EXTERN PetscErrorCode TaoComputeHessian(Tao, Vec, Mat, Mat);
384: PETSC_EXTERN PetscErrorCode TaoComputeResidualJacobian(Tao, Vec, Mat, Mat);
385: PETSC_EXTERN PetscErrorCode TaoComputeJacobian(Tao, Vec, Mat, Mat);
386: PETSC_EXTERN PetscErrorCode TaoComputeJacobianState(Tao, Vec, Mat, Mat, Mat);
387: PETSC_EXTERN PetscErrorCode TaoComputeJacobianEquality(Tao, Vec, Mat, Mat);
388: PETSC_EXTERN PetscErrorCode TaoComputeJacobianInequality(Tao, Vec, Mat, Mat);
389: PETSC_EXTERN PetscErrorCode TaoComputeJacobianDesign(Tao, Vec, Mat);

391: PETSC_EXTERN PetscErrorCode TaoDefaultComputeHessian(Tao, Vec, Mat, Mat, void *);
392: PETSC_EXTERN PetscErrorCode TaoDefaultComputeHessianColor(Tao, Vec, Mat, Mat, void *);
393: PETSC_EXTERN PetscErrorCode TaoDefaultComputeHessianMFFD(Tao, Vec, Mat, Mat, void *);
394: PETSC_EXTERN PetscErrorCode TaoComputeDualVariables(Tao, Vec, Vec);
395: PETSC_EXTERN PetscErrorCode TaoSetVariableBounds(Tao, Vec, Vec);
396: PETSC_EXTERN PetscErrorCode TaoGetVariableBounds(Tao, Vec *, Vec *);
397: PETSC_EXTERN PetscErrorCode TaoGetDualVariables(Tao, Vec *, Vec *);
398: PETSC_EXTERN PetscErrorCode TaoSetInequalityBounds(Tao, Vec, Vec);
399: PETSC_EXTERN PetscErrorCode TaoGetInequalityBounds(Tao, Vec *, Vec *);
400: PETSC_EXTERN PetscErrorCode TaoSetVariableBoundsRoutine(Tao, PetscErrorCode (*)(Tao, Vec, Vec, void *), void *);
401: PETSC_EXTERN PetscErrorCode TaoComputeVariableBounds(Tao);

403: PETSC_EXTERN PetscErrorCode TaoGetTolerances(Tao, PetscReal *, PetscReal *, PetscReal *);
404: PETSC_EXTERN PetscErrorCode TaoSetTolerances(Tao, PetscReal, PetscReal, PetscReal);
405: PETSC_EXTERN PetscErrorCode TaoGetConstraintTolerances(Tao, PetscReal *, PetscReal *);
406: PETSC_EXTERN PetscErrorCode TaoSetConstraintTolerances(Tao, PetscReal, PetscReal);
407: PETSC_EXTERN PetscErrorCode TaoSetFunctionLowerBound(Tao, PetscReal);
408: PETSC_EXTERN PetscErrorCode TaoSetInitialTrustRegionRadius(Tao, PetscReal);
409: PETSC_EXTERN PetscErrorCode TaoSetMaximumIterations(Tao, PetscInt);
410: PETSC_EXTERN PetscErrorCode TaoSetMaximumFunctionEvaluations(Tao, PetscInt);
411: PETSC_EXTERN PetscErrorCode TaoGetFunctionLowerBound(Tao, PetscReal *);
412: PETSC_EXTERN PetscErrorCode TaoGetInitialTrustRegionRadius(Tao, PetscReal *);
413: PETSC_EXTERN PetscErrorCode TaoGetCurrentTrustRegionRadius(Tao, PetscReal *);
414: PETSC_EXTERN PetscErrorCode TaoGetMaximumIterations(Tao, PetscInt *);
415: PETSC_EXTERN PetscErrorCode TaoGetCurrentFunctionEvaluations(Tao, PetscInt *);
416: PETSC_EXTERN PetscErrorCode TaoGetMaximumFunctionEvaluations(Tao, PetscInt *);
417: PETSC_EXTERN PetscErrorCode TaoGetIterationNumber(Tao, PetscInt *);
418: PETSC_EXTERN PetscErrorCode TaoSetIterationNumber(Tao, PetscInt);
419: PETSC_EXTERN PetscErrorCode TaoGetTotalIterationNumber(Tao, PetscInt *);
420: PETSC_EXTERN PetscErrorCode TaoSetTotalIterationNumber(Tao, PetscInt);
421: PETSC_EXTERN PetscErrorCode TaoGetResidualNorm(Tao, PetscReal *);

423: PETSC_EXTERN PetscErrorCode TaoAppendOptionsPrefix(Tao, const char[]);
424: PETSC_EXTERN PetscErrorCode TaoGetOptionsPrefix(Tao, const char *[]);
425: PETSC_EXTERN PetscErrorCode TaoResetStatistics(Tao);
426: PETSC_EXTERN PetscErrorCode TaoSetUpdate(Tao, PetscErrorCode (*)(Tao, PetscInt, void *), void *);

428: PETSC_EXTERN PetscErrorCode TaoGetKSP(Tao, KSP *);
429: PETSC_EXTERN PetscErrorCode TaoGetLinearSolveIterations(Tao, PetscInt *);
430: PETSC_EXTERN PetscErrorCode TaoKSPSetUseEW(Tao, PetscBool);

432: #include <petsctaolinesearch.h>

434: PETSC_EXTERN PetscErrorCode TaoGetLineSearch(Tao, TaoLineSearch *);

436: PETSC_EXTERN PetscErrorCode TaoSetConvergenceHistory(Tao, PetscReal *, PetscReal *, PetscReal *, PetscInt *, PetscInt, PetscBool);
437: PETSC_EXTERN PetscErrorCode TaoGetConvergenceHistory(Tao, PetscReal **, PetscReal **, PetscReal **, PetscInt **, PetscInt *);
438: PETSC_EXTERN PetscErrorCode TaoMonitorSet(Tao, PetscErrorCode (*)(Tao, void *), void *, PetscErrorCode (*)(void **));
439: PETSC_EXTERN PetscErrorCode TaoMonitorCancel(Tao);
440: PETSC_EXTERN PetscErrorCode TaoMonitorDefault(Tao, void *);
441: PETSC_EXTERN PetscErrorCode TaoMonitorGlobalization(Tao, void *);
442: PETSC_EXTERN PetscErrorCode TaoMonitorDefaultShort(Tao, void *);
443: PETSC_EXTERN PetscErrorCode TaoMonitorConstraintNorm(Tao, void *);
444: PETSC_EXTERN PetscErrorCode TaoMonitorSolution(Tao, void *);
445: PETSC_EXTERN PetscErrorCode TaoMonitorResidual(Tao, void *);
446: PETSC_EXTERN PetscErrorCode TaoMonitorGradient(Tao, void *);
447: PETSC_EXTERN PetscErrorCode TaoMonitorStep(Tao, void *);
448: PETSC_EXTERN PetscErrorCode TaoMonitorSolutionDraw(Tao, void *);
449: PETSC_EXTERN PetscErrorCode TaoMonitorStepDraw(Tao, void *);
450: PETSC_EXTERN PetscErrorCode TaoMonitorGradientDraw(Tao, void *);
451: PETSC_EXTERN PetscErrorCode TaoAddLineSearchCounts(Tao);

453: PETSC_EXTERN PetscErrorCode TaoDefaultConvergenceTest(Tao, void *);
454: PETSC_EXTERN PetscErrorCode TaoSetConvergenceTest(Tao, PetscErrorCode (*)(Tao, void *), void *);

456: PETSC_EXTERN PetscErrorCode          TaoLCLSetStateDesignIS(Tao, IS, IS);
457: PETSC_EXTERN PetscErrorCode          TaoMonitor(Tao, PetscInt, PetscReal, PetscReal, PetscReal, PetscReal);
458: typedef struct _n_TaoMonitorDrawCtx *TaoMonitorDrawCtx;
459: PETSC_EXTERN PetscErrorCode          TaoMonitorDrawCtxCreate(MPI_Comm, const char[], const char[], int, int, int, int, PetscInt, TaoMonitorDrawCtx *);
460: PETSC_EXTERN PetscErrorCode          TaoMonitorDrawCtxDestroy(TaoMonitorDrawCtx *);

462: PETSC_EXTERN PetscErrorCode TaoBRGNGetSubsolver(Tao, Tao *);
463: PETSC_EXTERN PetscErrorCode TaoBRGNSetRegularizerObjectiveAndGradientRoutine(Tao, PetscErrorCode (*)(Tao, Vec, PetscReal *, Vec, void *), void *);
464: PETSC_EXTERN PetscErrorCode TaoBRGNSetRegularizerHessianRoutine(Tao, Mat, PetscErrorCode (*)(Tao, Vec, Mat, void *), void *);
465: PETSC_EXTERN PetscErrorCode TaoBRGNSetRegularizerWeight(Tao, PetscReal);
466: PETSC_EXTERN PetscErrorCode TaoBRGNSetL1SmoothEpsilon(Tao, PetscReal);
467: PETSC_EXTERN PetscErrorCode TaoBRGNSetDictionaryMatrix(Tao, Mat);
468: PETSC_EXTERN PetscErrorCode TaoBRGNGetDampingVector(Tao, Vec *);
469: PETSC_EXTERN PetscErrorCode TaoBNCGSetType(Tao, TaoBNCGType);
470: PETSC_EXTERN PetscErrorCode TaoBNCGGetType(Tao, TaoBNCGType *);

472: PETSC_EXTERN PetscErrorCode TaoADMMGetMisfitSubsolver(Tao, Tao *);
473: PETSC_EXTERN PetscErrorCode TaoADMMGetRegularizationSubsolver(Tao, Tao *);
474: PETSC_EXTERN PetscErrorCode TaoADMMGetDualVector(Tao, Vec *);
475: PETSC_EXTERN PetscErrorCode TaoADMMGetSpectralPenalty(Tao, PetscReal *);
476: PETSC_EXTERN PetscErrorCode TaoADMMSetSpectralPenalty(Tao, PetscReal);
477: PETSC_EXTERN PetscErrorCode TaoGetADMMParentTao(Tao, Tao *);
478: PETSC_EXTERN PetscErrorCode TaoADMMSetConstraintVectorRHS(Tao, Vec);
479: PETSC_EXTERN PetscErrorCode TaoADMMSetRegularizerCoefficient(Tao, PetscReal);
480: PETSC_EXTERN PetscErrorCode TaoADMMGetRegularizerCoefficient(Tao, PetscReal *);
481: PETSC_EXTERN PetscErrorCode TaoADMMSetMisfitConstraintJacobian(Tao, Mat, Mat, PetscErrorCode (*)(Tao, Vec, Mat, Mat, void *), void *);
482: PETSC_EXTERN PetscErrorCode TaoADMMSetRegularizerConstraintJacobian(Tao, Mat, Mat, PetscErrorCode (*)(Tao, Vec, Mat, Mat, void *), void *);
483: PETSC_EXTERN PetscErrorCode TaoADMMSetRegularizerHessianRoutine(Tao, Mat, Mat, PetscErrorCode (*)(Tao, Vec, Mat, Mat, void *), void *);
484: PETSC_EXTERN PetscErrorCode TaoADMMSetRegularizerObjectiveAndGradientRoutine(Tao, PetscErrorCode (*)(Tao, Vec, PetscReal *, Vec, void *), void *);
485: PETSC_EXTERN PetscErrorCode TaoADMMSetMisfitHessianRoutine(Tao, Mat, Mat, PetscErrorCode (*)(Tao, Vec, Mat, Mat, void *), void *);
486: PETSC_EXTERN PetscErrorCode TaoADMMSetMisfitObjectiveAndGradientRoutine(Tao, PetscErrorCode (*)(Tao, Vec, PetscReal *, Vec, void *), void *);
487: PETSC_EXTERN PetscErrorCode TaoADMMSetMisfitHessianChangeStatus(Tao, PetscBool);
488: PETSC_EXTERN PetscErrorCode TaoADMMSetRegHessianChangeStatus(Tao, PetscBool);
489: PETSC_EXTERN PetscErrorCode TaoADMMSetMinimumSpectralPenalty(Tao, PetscReal);
490: PETSC_EXTERN PetscErrorCode TaoADMMSetRegularizerType(Tao, TaoADMMRegularizerType);
491: PETSC_EXTERN PetscErrorCode TaoADMMGetRegularizerType(Tao, TaoADMMRegularizerType *);
492: PETSC_EXTERN PetscErrorCode TaoADMMSetUpdateType(Tao, TaoADMMUpdateType);
493: PETSC_EXTERN PetscErrorCode TaoADMMGetUpdateType(Tao, TaoADMMUpdateType *);

495: PETSC_EXTERN PetscErrorCode TaoALMMGetType(Tao, TaoALMMType *);
496: PETSC_EXTERN PetscErrorCode TaoALMMSetType(Tao, TaoALMMType);
497: PETSC_EXTERN PetscErrorCode TaoALMMGetSubsolver(Tao, Tao *);
498: PETSC_EXTERN PetscErrorCode TaoALMMSetSubsolver(Tao, Tao);
499: PETSC_EXTERN PetscErrorCode TaoALMMGetMultipliers(Tao, Vec *);
500: PETSC_EXTERN PetscErrorCode TaoALMMSetMultipliers(Tao, Vec);
501: PETSC_EXTERN PetscErrorCode TaoALMMGetPrimalIS(Tao, IS *, IS *);
502: PETSC_EXTERN PetscErrorCode TaoALMMGetDualIS(Tao, IS *, IS *);

504: PETSC_EXTERN PetscErrorCode TaoVecGetSubVec(Vec, IS, TaoSubsetType, PetscReal, Vec *);
505: PETSC_EXTERN PetscErrorCode TaoMatGetSubMat(Mat, IS, Vec, TaoSubsetType, Mat *);
506: PETSC_EXTERN PetscErrorCode TaoGradientNorm(Tao, Vec, NormType, PetscReal *);
507: PETSC_EXTERN PetscErrorCode TaoEstimateActiveBounds(Vec, Vec, Vec, Vec, Vec, Vec, PetscReal, PetscReal *, IS *, IS *, IS *, IS *, IS *);
508: PETSC_EXTERN PetscErrorCode TaoBoundStep(Vec, Vec, Vec, IS, IS, IS, PetscReal, Vec);
509: PETSC_EXTERN PetscErrorCode TaoBoundSolution(Vec, Vec, Vec, PetscReal, PetscInt *, Vec);

511: #include <petsctao_deprecations.h>