1 #include <../src/tao/bound/impls/bqnk/bqnk.h> 2 3 static PetscErrorCode TaoSetUp_BQNKTL(Tao tao) 4 { 5 TAO_BNK *bnk = (TAO_BNK*)tao->data; 6 PetscErrorCode ierr; 7 8 PetscFunctionBegin; 9 ierr = TaoSetUp_BQNK(tao);CHKERRQ(ierr); 10 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)"); 11 PetscFunctionReturn(0); 12 } 13 14 /*MC 15 TAOBQNKTL - Bounded Quasi-Newton-Krylov Trust-region with Line-search fallback, for nonlinear 16 minimization with bound constraints. This method approximates the Hessian-vector 17 product using a limited-memory quasi-Newton formula, and iteratively inverts the 18 Hessian with a Krylov solver. The quasi-Newton matrix and its settings can be 19 accessed via the prefix `-tao_bqnk_` 20 21 Options Database Keys: 22 + -tao_bqnk_max_cg_its - maximum number of bounded conjugate-gradient iterations taken in each Newton loop 23 . -tao_bqnk_init_type - trust radius initialization method ("constant", "direction", "interpolation") 24 . -tao_bqnk_update_type - trust radius update method ("step", "direction", "interpolation") 25 - -tao_bqnk_as_type - active-set estimation method ("none", "bertsekas") 26 27 Level: beginner 28 M*/ 29 PETSC_EXTERN PetscErrorCode TaoCreate_BQNKTL(Tao tao) 30 { 31 TAO_BNK *bnk; 32 TAO_BQNK *bqnk; 33 PetscErrorCode ierr; 34 35 PetscFunctionBegin; 36 ierr = TaoCreate_BQNK(tao);CHKERRQ(ierr); 37 tao->ops->setup = TaoSetUp_BQNKTL; 38 bnk = (TAO_BNK*)tao->data; 39 bqnk = (TAO_BQNK*)bnk->ctx; 40 bqnk->solve = TaoSolve_BNTL; 41 PetscFunctionReturn(0); 42 } 43