xref: /petsc/src/tao/bound/impls/bqnk/bqnktr.c (revision 2f613bf53f46f9356e00a2ca2bd69453be72fc31)
1 #include <../src/tao/bound/impls/bqnk/bqnk.h>
2 #include <petscksp.h>
3 
4 static PetscErrorCode TaoSetUp_BQNKTR(Tao tao)
5 {
6   TAO_BNK         *bnk = (TAO_BNK*)tao->data;
7   PetscErrorCode ierr;
8 
9   PetscFunctionBegin;
10   ierr = TaoSetUp_BQNK(tao);CHKERRQ(ierr);
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   PetscFunctionReturn(0);
13 }
14 
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_`
21 
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")
27 
28   Level: beginner
29 M*/
30 PETSC_EXTERN PetscErrorCode TaoCreate_BQNKTR(Tao tao)
31 {
32   TAO_BNK        *bnk;
33   TAO_BQNK       *bqnk;
34   PetscErrorCode ierr;
35 
36   PetscFunctionBegin;
37   ierr = TaoCreate_BQNK(tao);CHKERRQ(ierr);
38   tao->ops->setup = TaoSetUp_BQNKTR;
39   bnk = (TAO_BNK*)tao->data;
40   bqnk = (TAO_BQNK*)bnk->ctx;
41   bqnk->solve = TaoSolve_BNTR;
42   PetscFunctionReturn(0);
43 }
44