Actual source code: bqnktr.c
1: #include <../src/tao/bound/impls/bqnk/bqnk.h>
2: #include <petscksp.h>
4: static PetscErrorCode TaoSetUp_BQNKTR(Tao tao)
5: {
6: TAO_BNK *bnk = (TAO_BNK*)tao->data;
10: TaoSetUp_BQNK(tao);
11: if (!bnk->is_nash && !bnk->is_stcg && !bnk->is_gltr) SETERRQ(PetscObjectComm((PetscObject)tao),PETSC_ERR_SUP,"Must use a trust-region CG method for KSP (KSPNASH, KSPSTCG, KSPGLTR)");
12: return(0);
13: }
15: /*MC
16: TAOBQNKTR - Bounded Quasi-Newton-Krylov Trust Region method for nonlinear minimization with
17: bound constraints. This method approximates the Hessian-vector product using a
18: limited-memory quasi-Newton formula, and iteratively inverts the Hessian with a
19: Krylov solver. The quasi-Newton matrix and its settings can be accessed via the
20: prefix `-tao_bqnk_`
22: Options Database Keys:
23: + -tao_bqnk_max_cg_its - maximum number of bounded conjugate-gradient iterations taken in each Newton loop
24: . -tao_bqnk_init_type - trust radius initialization method ("constant", "direction", "interpolation")
25: . -tao_bqnk_update_type - trust radius update method ("step", "direction", "interpolation")
26: - -tao_bqnk_as_type - active-set estimation method ("none", "bertsekas")
28: Level: beginner
29: M*/
30: PETSC_EXTERN PetscErrorCode TaoCreate_BQNKTR(Tao tao)
31: {
32: TAO_BNK *bnk;
33: TAO_BQNK *bqnk;
37: TaoCreate_BQNK(tao);
38: tao->ops->setup = TaoSetUp_BQNKTR;
39: bnk = (TAO_BNK*)tao->data;
40: bqnk = (TAO_BQNK*)bnk->ctx;
41: bqnk->solve = TaoSolve_BNTR;
42: return(0);
43: }