Lines Matching refs:bnk

13   TAO_BNK *bnk = (TAO_BNK *)tao->data;  in TaoBNKComputeSubHessian()  local
16 PetscCall(MatDestroy(&bnk->Hpre_inactive)); in TaoBNKComputeSubHessian()
17 PetscCall(MatDestroy(&bnk->H_inactive)); in TaoBNKComputeSubHessian()
18 if (bnk->active_idx) { in TaoBNKComputeSubHessian()
19 …PetscCall(MatCreateSubMatrix(tao->hessian, bnk->inactive_idx, bnk->inactive_idx, MAT_INITIAL_MATRI… in TaoBNKComputeSubHessian()
21 PetscCall(PetscObjectReference((PetscObject)bnk->H_inactive)); in TaoBNKComputeSubHessian()
22 bnk->Hpre_inactive = bnk->H_inactive; in TaoBNKComputeSubHessian()
24 …tscCall(MatCreateSubMatrix(tao->hessian_pre, bnk->inactive_idx, bnk->inactive_idx, MAT_INITIAL_MAT… in TaoBNKComputeSubHessian()
26 if (bnk->bfgs_pre) PetscCall(PCLMVMSetIS(bnk->bfgs_pre, bnk->inactive_idx)); in TaoBNKComputeSubHessian()
29 bnk->H_inactive = tao->hessian; in TaoBNKComputeSubHessian()
31 bnk->Hpre_inactive = tao->hessian_pre; in TaoBNKComputeSubHessian()
32 if (bnk->bfgs_pre) PetscCall(PCLMVMClearIS(bnk->bfgs_pre)); in TaoBNKComputeSubHessian()
41 TAO_BNK *bnk = (TAO_BNK *)tao->data; in TaoBNKInitialize() local
55 PetscCall(TaoSetVariableBounds(bnk->bncg, tao->XL, tao->XU)); in TaoBNKInitialize()
62 PetscCall(TaoComputeObjectiveAndGradient(tao, tao->solution, &bnk->f, bnk->unprojected_gradient)); in TaoBNKInitialize()
63 PetscCall(TaoBNKEstimateActiveSet(tao, bnk->as_type)); in TaoBNKInitialize()
64 PetscCall(VecCopy(bnk->unprojected_gradient, tao->gradient)); in TaoBNKInitialize()
65 if (bnk->active_idx) PetscCall(VecISSet(tao->gradient, bnk->active_idx, 0.0)); in TaoBNKInitialize()
66 PetscCall(TaoGradientNorm(tao, tao->gradient, NORM_2, &bnk->gnorm)); in TaoBNKInitialize()
69 PetscCall(VecFischer(tao->solution, bnk->unprojected_gradient, tao->XL, tao->XU, bnk->W)); in TaoBNKInitialize()
70 PetscCall(VecNorm(bnk->W, NORM_2, &resnorm)); in TaoBNKInitialize()
71 …PetscCheck(!PetscIsInfOrNanReal(bnk->f) && !PetscIsInfOrNanReal(resnorm), PetscObjectComm((PetscOb… in TaoBNKInitialize()
72 PetscCall(TaoLogConvergenceHistory(tao, bnk->f, resnorm, 0.0, tao->ksp_its)); in TaoBNKInitialize()
73 PetscCall(TaoMonitor(tao, tao->niter, bnk->f, resnorm, 0.0, 1.0)); in TaoBNKInitialize()
78 bnk->ksp_atol = 0; in TaoBNKInitialize()
79 bnk->ksp_rtol = 0; in TaoBNKInitialize()
80 bnk->ksp_dtol = 0; in TaoBNKInitialize()
81 bnk->ksp_ctol = 0; in TaoBNKInitialize()
82 bnk->ksp_negc = 0; in TaoBNKInitialize()
83 bnk->ksp_iter = 0; in TaoBNKInitialize()
84 bnk->ksp_othr = 0; in TaoBNKInitialize()
87 bnk->tot_cg_its = 0; in TaoBNKInitialize()
88 bnk->newt = 0; in TaoBNKInitialize()
89 bnk->bfgs = 0; in TaoBNKInitialize()
90 bnk->sgrad = 0; in TaoBNKInitialize()
91 bnk->grad = 0; in TaoBNKInitialize()
94 bnk->pert = bnk->sval; in TaoBNKInitialize()
104 bnk->bfgs_pre = pc; in TaoBNKInitialize()
105 PetscCall(PCLMVMGetMatLMVM(bnk->bfgs_pre, &bnk->M)); in TaoBNKInitialize()
108 PetscCall(MatSetSizes(bnk->M, n, n, N, N)); in TaoBNKInitialize()
109 PetscCall(MatLMVMAllocate(bnk->M, tao->solution, bnk->unprojected_gradient)); in TaoBNKInitialize()
110 PetscCall(MatIsSymmetricKnown(bnk->M, &sym_set, &is_symmetric)); in TaoBNKInitialize()
115 PetscCall(VecSet(bnk->Diag_min, bnk->dmin)); in TaoBNKInitialize()
116 PetscCall(VecSet(bnk->Diag_max, bnk->dmax)); in TaoBNKInitialize()
134 f_min = bnk->f; in TaoBNKInitialize()
139 PetscCall((*bnk->computehessian)(tao)); in TaoBNKInitialize()
147 PetscCall(VecCopy(tao->solution, bnk->Xold)); in TaoBNKInitialize()
148 PetscCall(VecAXPY(tao->solution, -tao->trust / bnk->gnorm, tao->gradient)); in TaoBNKInitialize()
151 PetscCall(VecCopy(tao->solution, bnk->W)); in TaoBNKInitialize()
152 PetscCall(VecAXPY(bnk->W, -1.0, bnk->Xold)); in TaoBNKInitialize()
155 …PetscCheck(!PetscIsInfOrNanReal(bnk->f), PetscObjectComm((PetscObject)tao), PETSC_ERR_USER, "User … in TaoBNKInitialize()
156 PetscCall(VecCopy(bnk->Xold, tao->solution)); in TaoBNKInitialize()
158 tau = bnk->gamma1_i; in TaoBNKInitialize()
162 sigma = -tao->trust / bnk->gnorm; in TaoBNKInitialize()
166 if (bnk->active_idx) { in TaoBNKInitialize()
167 PetscCall(VecGetSubVector(bnk->W, bnk->inactive_idx, &bnk->X_inactive)); in TaoBNKInitialize()
168 PetscCall(VecGetSubVector(bnk->Xwork, bnk->inactive_idx, &bnk->inactive_work)); in TaoBNKInitialize()
170 bnk->X_inactive = bnk->W; in TaoBNKInitialize()
171 bnk->inactive_work = bnk->Xwork; in TaoBNKInitialize()
173 PetscCall(MatMult(bnk->H_inactive, bnk->X_inactive, bnk->inactive_work)); in TaoBNKInitialize()
174 PetscCall(VecDot(bnk->X_inactive, bnk->inactive_work, &prered)); in TaoBNKInitialize()
175 if (bnk->active_idx) { in TaoBNKInitialize()
176 PetscCall(VecRestoreSubVector(bnk->W, bnk->inactive_idx, &bnk->X_inactive)); in TaoBNKInitialize()
177 PetscCall(VecRestoreSubVector(bnk->Xwork, bnk->inactive_idx, &bnk->inactive_work)); in TaoBNKInitialize()
179 … prered = tao->trust * (bnk->gnorm - 0.5 * tao->trust * prered / (bnk->gnorm * bnk->gnorm)); in TaoBNKInitialize()
180 actred = bnk->f - ftrial; in TaoBNKInitialize()
181 … if ((PetscAbsScalar(actred) <= bnk->epsilon) && (PetscAbsScalar(prered) <= bnk->epsilon)) { in TaoBNKInitialize()
187 …tau_1 = bnk->theta_i * bnk->gnorm * tao->trust / (bnk->theta_i * bnk->gnorm * tao->trust + (1.0 … in TaoBNKInitialize()
188 …tau_2 = bnk->theta_i * bnk->gnorm * tao->trust / (bnk->theta_i * bnk->gnorm * tao->trust - (1.0 … in TaoBNKInitialize()
192 if (PetscAbsScalar(kappa - (PetscReal)1.0) <= bnk->mu1_i) { in TaoBNKInitialize()
197 tau = bnk->gamma3_i; in TaoBNKInitialize()
198 } else if (tau_max > bnk->gamma4_i) { in TaoBNKInitialize()
199 tau = bnk->gamma4_i; in TaoBNKInitialize()
203 } else if (PetscAbsScalar(kappa - (PetscReal)1.0) <= bnk->mu2_i) { in TaoBNKInitialize()
207 if (tau_max < bnk->gamma2_i) { in TaoBNKInitialize()
208 tau = bnk->gamma2_i; in TaoBNKInitialize()
209 } else if (tau_max > bnk->gamma3_i) { in TaoBNKInitialize()
210 tau = bnk->gamma3_i; in TaoBNKInitialize()
217 tau = bnk->gamma2_i; in TaoBNKInitialize()
218 } else if (tau_max < bnk->gamma1_i) { in TaoBNKInitialize()
219 tau = bnk->gamma1_i; in TaoBNKInitialize()
220 } else if ((tau_min < bnk->gamma1_i) && (tau_max >= 1.0)) { in TaoBNKInitialize()
221 tau = bnk->gamma1_i; in TaoBNKInitialize()
222 …} else if ((tau_1 >= bnk->gamma1_i) && (tau_1 < 1.0) && ((tau_2 < bnk->gamma1_i) || (tau_2 >= 1.0)… in TaoBNKInitialize()
224 …} else if ((tau_2 >= bnk->gamma1_i) && (tau_2 < 1.0) && ((tau_1 < bnk->gamma1_i) || (tau_2 >= 1.0)… in TaoBNKInitialize()
234 if (f_min < bnk->f) { in TaoBNKInitialize()
236 bnk->f = f_min; in TaoBNKInitialize()
237 PetscCall(VecCopy(tao->solution, bnk->Xold)); in TaoBNKInitialize()
241 PetscCall(VecAXPY(tao->stepdirection, -1.0, bnk->Xold)); in TaoBNKInitialize()
242 PetscCall(TaoComputeGradient(tao, tao->solution, bnk->unprojected_gradient)); in TaoBNKInitialize()
243 PetscCall(TaoBNKEstimateActiveSet(tao, bnk->as_type)); in TaoBNKInitialize()
244 PetscCall(VecCopy(bnk->unprojected_gradient, tao->gradient)); in TaoBNKInitialize()
245 if (bnk->active_idx) PetscCall(VecISSet(tao->gradient, bnk->active_idx, 0.0)); in TaoBNKInitialize()
247 PetscCall(TaoGradientNorm(tao, tao->gradient, NORM_2, &bnk->gnorm)); in TaoBNKInitialize()
250 PetscCall(VecFischer(tao->solution, bnk->unprojected_gradient, tao->XL, tao->XU, bnk->W)); in TaoBNKInitialize()
251 PetscCall(VecNorm(bnk->W, NORM_2, &resnorm)); in TaoBNKInitialize()
253 PetscCall(TaoLogConvergenceHistory(tao, bnk->f, resnorm, 0.0, tao->ksp_its)); in TaoBNKInitialize()
254 PetscCall(TaoMonitor(tao, tao->niter, bnk->f, resnorm, 0.0, 1.0)); in TaoBNKInitialize()
258 PetscCall(TaoSetRecycleHistory(bnk->bncg, PETSC_TRUE)); in TaoBNKInitialize()
264 tao->trust = PetscMax(tao->trust, bnk->min_radius); in TaoBNKInitialize()
265 tao->trust = PetscMin(tao->trust, bnk->max_radius); in TaoBNKInitialize()
281 TAO_BNK *bnk = (TAO_BNK *)tao->data; in TaoBNKComputeHessian() local
287 if (bnk->M) PetscCall(MatLMVMUpdate(bnk->M, tao->solution, bnk->unprojected_gradient)); in TaoBNKComputeHessian()
297 TAO_BNK *bnk = (TAO_BNK *)tao->data; in TaoBNKEstimateActiveSet() local
301 hadactive = bnk->active_idx ? PETSC_TRUE : PETSC_FALSE; in TaoBNKEstimateActiveSet()
304 PetscCall(ISDestroy(&bnk->inactive_idx)); in TaoBNKEstimateActiveSet()
305 …etscCall(VecWhichInactive(tao->XL, tao->solution, bnk->unprojected_gradient, tao->XU, PETSC_TRUE, … in TaoBNKEstimateActiveSet()
306 PetscCall(ISDestroy(&bnk->active_idx)); in TaoBNKEstimateActiveSet()
307 PetscCall(ISComplementVec(bnk->inactive_idx, tao->solution, &bnk->active_idx)); in TaoBNKEstimateActiveSet()
312 if (bnk->M) { in TaoBNKEstimateActiveSet()
314 PetscCall(MatSolve(bnk->M, bnk->unprojected_gradient, bnk->W)); in TaoBNKEstimateActiveSet()
321 PetscCall(MatGetDiagonal(tao->hessian, bnk->Xwork)); in TaoBNKEstimateActiveSet()
322 PetscCall(VecAbs(bnk->Xwork)); in TaoBNKEstimateActiveSet()
323 PetscCall(VecMedian(bnk->Diag_min, bnk->Xwork, bnk->Diag_max, bnk->Xwork)); in TaoBNKEstimateActiveSet()
324 PetscCall(VecReciprocal(bnk->Xwork)); in TaoBNKEstimateActiveSet()
325 PetscCall(VecPointwiseMult(bnk->W, bnk->Xwork, bnk->unprojected_gradient)); in TaoBNKEstimateActiveSet()
328 PetscCall(VecCopy(bnk->unprojected_gradient, bnk->W)); in TaoBNKEstimateActiveSet()
331 PetscCall(VecScale(bnk->W, -1.0)); in TaoBNKEstimateActiveSet()
332bnk->unprojected_gradient, bnk->W, bnk->Xwork, bnk->as_step, &bnk->as_tol, &bnk->active_lower, &bn… in TaoBNKEstimateActiveSet()
338bnk->resetksp = (PetscBool)(bnk->active_idx || hadactive); /* inactive Hessian size may have chang… in TaoBNKEstimateActiveSet()
346 TAO_BNK *bnk = (TAO_BNK *)tao->data; in TaoBNKBoundStep() local
351 if (bnk->active_idx) PetscCall(VecISSet(step, bnk->active_idx, 0.0)); in TaoBNKBoundStep()
354 …PetscCall(TaoBoundStep(tao->solution, tao->XL, tao->XU, bnk->active_lower, bnk->active_upper, bnk-… in TaoBNKBoundStep()
371 TAO_BNK *bnk = (TAO_BNK *)tao->data; in TaoBNKTakeCGSteps() local
375 if (bnk->max_cg_its > 0) { in TaoBNKTakeCGSteps()
377 bnk->bncg_ctx->f = bnk->f; in TaoBNKTakeCGSteps()
379 PetscCall(TaoSolve(bnk->bncg)); in TaoBNKTakeCGSteps()
381 tao->nfuncs += bnk->bncg->nfuncs; in TaoBNKTakeCGSteps()
382 tao->nfuncgrads += bnk->bncg->nfuncgrads; in TaoBNKTakeCGSteps()
383 tao->ngrads += bnk->bncg->ngrads; in TaoBNKTakeCGSteps()
384 tao->nhess += bnk->bncg->nhess; in TaoBNKTakeCGSteps()
385 bnk->tot_cg_its += bnk->bncg->niter; in TaoBNKTakeCGSteps()
387 bnk->f = bnk->bncg_ctx->f; in TaoBNKTakeCGSteps()
388 …if (bnk->bncg->reason == TAO_CONVERGED_GATOL || bnk->bncg->reason == TAO_CONVERGED_GRTOL || bnk->b… in TaoBNKTakeCGSteps()
391 PetscCall(TaoBNKEstimateActiveSet(tao, bnk->as_type)); in TaoBNKTakeCGSteps()
401 TAO_BNK *bnk = (TAO_BNK *)tao->data; in TaoBNKComputeStep() local
410 if (!bnk->inactive_idx) { in TaoBNKComputeStep()
412 PetscCall(TaoBNKBoundStep(tao, bnk->as_type, tao->stepdirection)); in TaoBNKComputeStep()
417 if (shift && bnk->pert > 0) { in TaoBNKComputeStep()
420 PetscCall(MatShift(tao->hessian, bnk->pert)); in TaoBNKComputeStep()
422 PetscCall(MatShift(bnk->H_inactive, bnk->pert)); in TaoBNKComputeStep()
423 if (bnk->H_inactive != bnk->Hpre_inactive) PetscCall(MatShift(bnk->Hpre_inactive, bnk->pert)); in TaoBNKComputeStep()
430 if (bnk->resetksp) { in TaoBNKComputeStep()
433 bnk->resetksp = PETSC_FALSE; in TaoBNKComputeStep()
435 PetscCall(KSPSetOperators(tao->ksp, bnk->H_inactive, bnk->Hpre_inactive)); in TaoBNKComputeStep()
436 PetscCall(VecCopy(bnk->unprojected_gradient, bnk->Gwork)); in TaoBNKComputeStep()
437 if (bnk->active_idx) { in TaoBNKComputeStep()
438 PetscCall(VecGetSubVector(bnk->Gwork, bnk->inactive_idx, &bnk->G_inactive)); in TaoBNKComputeStep()
439 PetscCall(VecGetSubVector(tao->stepdirection, bnk->inactive_idx, &bnk->X_inactive)); in TaoBNKComputeStep()
441 bnk->G_inactive = bnk->unprojected_gradient; in TaoBNKComputeStep()
442 bnk->X_inactive = tao->stepdirection; in TaoBNKComputeStep()
445 PetscCall(KSPSolve(tao->ksp, bnk->G_inactive, bnk->X_inactive)); in TaoBNKComputeStep()
451 PetscCall(KSPCGGetNormD(tao->ksp, &bnk->dnorm)); in TaoBNKComputeStep()
455 if (bnk->dnorm > 0.0) { in TaoBNKComputeStep()
456 tao->trust = bnk->dnorm; in TaoBNKComputeStep()
459 tao->trust = PetscMax(tao->trust, bnk->min_radius); in TaoBNKComputeStep()
460 tao->trust = PetscMin(tao->trust, bnk->max_radius); in TaoBNKComputeStep()
467 tao->trust = PetscMax(tao->trust, bnk->min_radius); in TaoBNKComputeStep()
468 tao->trust = PetscMin(tao->trust, bnk->max_radius); in TaoBNKComputeStep()
471 PetscCall(KSPSolve(tao->ksp, bnk->G_inactive, bnk->X_inactive)); in TaoBNKComputeStep()
475 PetscCall(KSPCGGetNormD(tao->ksp, &bnk->dnorm)); in TaoBNKComputeStep()
477 …PetscCheck(bnk->dnorm != 0.0, PetscObjectComm((PetscObject)tao), PETSC_ERR_PLIB, "Initial directio… in TaoBNKComputeStep()
482 if (bnk->active_idx) { in TaoBNKComputeStep()
483 PetscCall(VecRestoreSubVector(bnk->Gwork, bnk->inactive_idx, &bnk->G_inactive)); in TaoBNKComputeStep()
484 PetscCall(VecRestoreSubVector(tao->stepdirection, bnk->inactive_idx, &bnk->X_inactive)); in TaoBNKComputeStep()
488 PetscCall(TaoBNKBoundStep(tao, bnk->as_type, tao->stepdirection)); in TaoBNKComputeStep()
493 ++bnk->ksp_atol; in TaoBNKComputeStep()
495 ++bnk->ksp_rtol; in TaoBNKComputeStep()
497 ++bnk->ksp_ctol; in TaoBNKComputeStep()
499 ++bnk->ksp_negc; in TaoBNKComputeStep()
501 ++bnk->ksp_dtol; in TaoBNKComputeStep()
503 ++bnk->ksp_iter; in TaoBNKComputeStep()
505 ++bnk->ksp_othr; in TaoBNKComputeStep()
509 if (bnk->M) { in TaoBNKComputeStep()
510 PetscCall(MatLMVMGetUpdateCount(bnk->M, &bfgsUpdates)); in TaoBNKComputeStep()
513 PetscCall(MatLMVMReset(bnk->M, PETSC_FALSE)); in TaoBNKComputeStep()
514 PetscCall(MatLMVMUpdate(bnk->M, tao->solution, bnk->unprojected_gradient)); in TaoBNKComputeStep()
525 TAO_BNK *bnk = (TAO_BNK *)tao->data; in TaoBNKRecomputePred() local
529 if (bnk->active_idx) { in TaoBNKRecomputePred()
530 PetscCall(VecGetSubVector(tao->stepdirection, bnk->inactive_idx, &bnk->X_inactive)); in TaoBNKRecomputePred()
531 PetscCall(VecGetSubVector(bnk->Xwork, bnk->inactive_idx, &bnk->inactive_work)); in TaoBNKRecomputePred()
532 PetscCall(VecGetSubVector(bnk->Gwork, bnk->inactive_idx, &bnk->G_inactive)); in TaoBNKRecomputePred()
534 bnk->X_inactive = tao->stepdirection; in TaoBNKRecomputePred()
535 bnk->inactive_work = bnk->Xwork; in TaoBNKRecomputePred()
536 bnk->G_inactive = bnk->Gwork; in TaoBNKRecomputePred()
539 PetscCall(MatMult(bnk->H_inactive, bnk->X_inactive, bnk->inactive_work)); in TaoBNKRecomputePred()
540 PetscCall(VecAYPX(bnk->inactive_work, -0.5, bnk->G_inactive)); in TaoBNKRecomputePred()
541 PetscCall(VecDot(bnk->inactive_work, bnk->X_inactive, prered)); in TaoBNKRecomputePred()
543 if (bnk->active_idx) { in TaoBNKRecomputePred()
544 PetscCall(VecRestoreSubVector(tao->stepdirection, bnk->inactive_idx, &bnk->X_inactive)); in TaoBNKRecomputePred()
545 PetscCall(VecRestoreSubVector(bnk->Xwork, bnk->inactive_idx, &bnk->inactive_work)); in TaoBNKRecomputePred()
546 PetscCall(VecRestoreSubVector(bnk->Gwork, bnk->inactive_idx, &bnk->G_inactive)); in TaoBNKRecomputePred()
559 TAO_BNK *bnk = (TAO_BNK *)tao->data; in TaoBNKSafeguardStep() local
570 if (bnk->pert <= 0.0) { in TaoBNKSafeguardStep()
574 bnk->pert = PetscMin(bnk->imax, PetscMax(bnk->imin, bnk->imfac * bnk->gnorm)); in TaoBNKSafeguardStep()
578 bnk->pert = PetscMax(bnk->pert, -e_min); in TaoBNKSafeguardStep()
582 bnk->pert = PetscMin(bnk->pmax, PetscMax(bnk->pgfac * bnk->pert, bnk->pmgfac * bnk->gnorm)); in TaoBNKSafeguardStep()
585 if (!bnk->M) { in TaoBNKSafeguardStep()
592 PetscCall(MatSolve(bnk->M, bnk->unprojected_gradient, tao->stepdirection)); in TaoBNKSafeguardStep()
605 PetscCall(MatLMVMReset(bnk->M, PETSC_FALSE)); in TaoBNKSafeguardStep()
606 PetscCall(MatLMVMUpdate(bnk->M, tao->solution, bnk->unprojected_gradient)); in TaoBNKSafeguardStep()
607 PetscCall(MatSolve(bnk->M, bnk->unprojected_gradient, tao->stepdirection)); in TaoBNKSafeguardStep()
611 PetscCall(MatLMVMGetUpdateCount(bnk->M, &bfgsUpdates)); in TaoBNKSafeguardStep()
622 PetscCall(TaoBNKBoundStep(tao, bnk->as_type, tao->stepdirection)); in TaoBNKSafeguardStep()
632 if (bnk->pert <= 0.0) { in TaoBNKSafeguardStep()
636 bnk->pert = PetscMin(bnk->imax, PetscMax(bnk->imin, bnk->imfac * bnk->gnorm)); in TaoBNKSafeguardStep()
640 bnk->pert = PetscMax(bnk->pert, -e_min); in TaoBNKSafeguardStep()
644bnk->pert = PetscMin(bnk->pmax, PetscMax(bnk->pgfac * bnk->pert, bnk->pmgfac * bnk->gnorm)); in TaoBNKSafeguardStep()
650 bnk->pert = PetscMin(bnk->psfac * bnk->pert, bnk->pmsfac * bnk->gnorm); in TaoBNKSafeguardStep()
651 if (bnk->pert < bnk->pmin) bnk->pert = 0.0; in TaoBNKSafeguardStep()
664 PetscCall(MatLMVMReset(bnk->M, PETSC_FALSE)); in TaoBNKSafeguardStep()
665 PetscCall(MatLMVMUpdate(bnk->M, tao->solution, bnk->unprojected_gradient)); in TaoBNKSafeguardStep()
666 PetscCall(MatSolve(bnk->M, tao->gradient, tao->stepdirection)); in TaoBNKSafeguardStep()
668 PetscCall(TaoBNKBoundStep(tao, bnk->as_type, tao->stepdirection)); in TaoBNKSafeguardStep()
692 TAO_BNK *bnk = (TAO_BNK *)tao->data; in TaoBNKPerformLineSearch() local
699 …PetscCall(TaoLineSearchApply(tao->linesearch, tao->solution, &bnk->f, bnk->unprojected_gradient, t… in TaoBNKPerformLineSearch()
704 bnk->f = bnk->fold; in TaoBNKPerformLineSearch()
705 PetscCall(VecCopy(bnk->Xold, tao->solution)); in TaoBNKPerformLineSearch()
706 PetscCall(VecCopy(bnk->unprojected_gradient_old, bnk->unprojected_gradient)); in TaoBNKPerformLineSearch()
712 if (bnk->pert <= 0.0) { in TaoBNKPerformLineSearch()
716 bnk->pert = PetscMin(bnk->imax, PetscMax(bnk->imin, bnk->imfac * bnk->gnorm)); in TaoBNKPerformLineSearch()
720 bnk->pert = PetscMax(bnk->pert, -e_min); in TaoBNKPerformLineSearch()
724 bnk->pert = PetscMin(bnk->pmax, PetscMax(bnk->pgfac * bnk->pert, bnk->pmgfac * bnk->gnorm)); in TaoBNKPerformLineSearch()
727 if (!bnk->M) { in TaoBNKPerformLineSearch()
730 PetscCall(VecCopy(bnk->unprojected_gradient, tao->stepdirection)); in TaoBNKPerformLineSearch()
734 PetscCall(MatSolve(bnk->M, bnk->unprojected_gradient, tao->stepdirection)); in TaoBNKPerformLineSearch()
742 PetscCall(MatLMVMReset(bnk->M, PETSC_FALSE)); in TaoBNKPerformLineSearch()
743 PetscCall(MatLMVMUpdate(bnk->M, tao->solution, bnk->unprojected_gradient)); in TaoBNKPerformLineSearch()
744 PetscCall(MatSolve(bnk->M, bnk->unprojected_gradient, tao->stepdirection)); in TaoBNKPerformLineSearch()
749 PetscCall(MatLMVMGetUpdateCount(bnk->M, &bfgsUpdates)); in TaoBNKPerformLineSearch()
764 PetscCall(MatLMVMReset(bnk->M, PETSC_FALSE)); in TaoBNKPerformLineSearch()
765 PetscCall(MatLMVMUpdate(bnk->M, tao->solution, bnk->unprojected_gradient)); in TaoBNKPerformLineSearch()
766 PetscCall(MatSolve(bnk->M, bnk->unprojected_gradient, tao->stepdirection)); in TaoBNKPerformLineSearch()
774 PetscCall(TaoBNKBoundStep(tao, bnk->as_type, tao->stepdirection)); in TaoBNKPerformLineSearch()
777 …PetscCall(TaoLineSearchApply(tao->linesearch, tao->solution, &bnk->f, bnk->unprojected_gradient, t… in TaoBNKPerformLineSearch()
794 TAO_BNK *bnk = (TAO_BNK *)tao->data; in TaoBNKUpdateTrustRadius() local
807 if (step < bnk->nu1) { in TaoBNKUpdateTrustRadius()
809 tao->trust = bnk->omega1 * PetscMin(bnk->dnorm, tao->trust); in TaoBNKUpdateTrustRadius()
810 } else if (step < bnk->nu2) { in TaoBNKUpdateTrustRadius()
812 tao->trust = bnk->omega2 * PetscMin(bnk->dnorm, tao->trust); in TaoBNKUpdateTrustRadius()
813 } else if (step < bnk->nu3) { in TaoBNKUpdateTrustRadius()
815 if (bnk->omega3 < 1.0) { in TaoBNKUpdateTrustRadius()
816 tao->trust = bnk->omega3 * PetscMin(bnk->dnorm, tao->trust); in TaoBNKUpdateTrustRadius()
817 } else if (bnk->omega3 > 1.0) { in TaoBNKUpdateTrustRadius()
818 tao->trust = PetscMax(bnk->omega3 * bnk->dnorm, tao->trust); in TaoBNKUpdateTrustRadius()
820 } else if (step < bnk->nu4) { in TaoBNKUpdateTrustRadius()
822 tao->trust = PetscMax(bnk->omega4 * bnk->dnorm, tao->trust); in TaoBNKUpdateTrustRadius()
825 tao->trust = PetscMax(bnk->omega5 * bnk->dnorm, tao->trust); in TaoBNKUpdateTrustRadius()
829 tao->trust = bnk->omega1 * PetscMin(bnk->dnorm, tao->trust); in TaoBNKUpdateTrustRadius()
839 tao->trust = bnk->alpha1 * PetscMin(tao->trust, bnk->dnorm); in TaoBNKUpdateTrustRadius()
842 tao->trust = bnk->alpha1 * PetscMin(tao->trust, bnk->dnorm); in TaoBNKUpdateTrustRadius()
844 …tscMax(1.0, PetscAbsScalar(bnk->f)) * bnk->epsilon) && (PetscAbsScalar(prered) <= PetscMax(1.0, Pe… in TaoBNKUpdateTrustRadius()
850 if (kappa < bnk->eta1) { in TaoBNKUpdateTrustRadius()
852 tao->trust = bnk->alpha1 * PetscMin(tao->trust, bnk->dnorm); in TaoBNKUpdateTrustRadius()
857 if (bnk->dnorm == tao->trust) { in TaoBNKUpdateTrustRadius()
858 if (kappa < bnk->eta2) { in TaoBNKUpdateTrustRadius()
860 tao->trust = bnk->alpha2 * tao->trust; in TaoBNKUpdateTrustRadius()
861 } else if (kappa < bnk->eta3) { in TaoBNKUpdateTrustRadius()
863 tao->trust = bnk->alpha3 * tao->trust; in TaoBNKUpdateTrustRadius()
864 } else if (kappa < bnk->eta4) { in TaoBNKUpdateTrustRadius()
866 tao->trust = bnk->alpha4 * tao->trust; in TaoBNKUpdateTrustRadius()
869 tao->trust = bnk->alpha5 * tao->trust; in TaoBNKUpdateTrustRadius()
877 tao->trust = bnk->alpha1 * PetscMin(bnk->dnorm, tao->trust); in TaoBNKUpdateTrustRadius()
887 tao->trust = bnk->gamma1 * PetscMin(tao->trust, bnk->dnorm); in TaoBNKUpdateTrustRadius()
890 tao->trust = bnk->gamma1 * PetscMin(tao->trust, bnk->dnorm); in TaoBNKUpdateTrustRadius()
892 … if ((PetscAbsScalar(actred) <= bnk->epsilon) && (PetscAbsScalar(prered) <= bnk->epsilon)) { in TaoBNKUpdateTrustRadius()
899 tau_1 = bnk->theta * gdx / (bnk->theta * gdx - (1.0 - bnk->theta) * prered + actred); in TaoBNKUpdateTrustRadius()
900 tau_2 = bnk->theta * gdx / (bnk->theta * gdx + (1.0 + bnk->theta) * prered - actred); in TaoBNKUpdateTrustRadius()
904 if (kappa >= 1.0 - bnk->mu1) { in TaoBNKUpdateTrustRadius()
908 tao->trust = PetscMax(tao->trust, bnk->gamma3 * bnk->dnorm); in TaoBNKUpdateTrustRadius()
909 } else if (tau_max > bnk->gamma4) { in TaoBNKUpdateTrustRadius()
910 tao->trust = PetscMax(tao->trust, bnk->gamma4 * bnk->dnorm); in TaoBNKUpdateTrustRadius()
912 tao->trust = PetscMax(tao->trust, tau_max * bnk->dnorm); in TaoBNKUpdateTrustRadius()
914 } else if (kappa >= 1.0 - bnk->mu2) { in TaoBNKUpdateTrustRadius()
917 if (tau_max < bnk->gamma2) { in TaoBNKUpdateTrustRadius()
918 tao->trust = bnk->gamma2 * PetscMin(tao->trust, bnk->dnorm); in TaoBNKUpdateTrustRadius()
919 } else if (tau_max > bnk->gamma3) { in TaoBNKUpdateTrustRadius()
920 tao->trust = PetscMax(tao->trust, bnk->gamma3 * bnk->dnorm); in TaoBNKUpdateTrustRadius()
922 tao->trust = tau_max * PetscMin(tao->trust, bnk->dnorm); in TaoBNKUpdateTrustRadius()
924 tao->trust = PetscMax(tao->trust, tau_max * bnk->dnorm); in TaoBNKUpdateTrustRadius()
929 tao->trust = bnk->gamma2 * PetscMin(tao->trust, bnk->dnorm); in TaoBNKUpdateTrustRadius()
930 } else if (tau_max < bnk->gamma1) { in TaoBNKUpdateTrustRadius()
931 tao->trust = bnk->gamma1 * PetscMin(tao->trust, bnk->dnorm); in TaoBNKUpdateTrustRadius()
932 } else if ((tau_min < bnk->gamma1) && (tau_max >= 1.0)) { in TaoBNKUpdateTrustRadius()
933 tao->trust = bnk->gamma1 * PetscMin(tao->trust, bnk->dnorm); in TaoBNKUpdateTrustRadius()
934 … } else if ((tau_1 >= bnk->gamma1) && (tau_1 < 1.0) && ((tau_2 < bnk->gamma1) || (tau_2 >= 1.0))) { in TaoBNKUpdateTrustRadius()
935 tao->trust = tau_1 * PetscMin(tao->trust, bnk->dnorm); in TaoBNKUpdateTrustRadius()
936 … } else if ((tau_2 >= bnk->gamma1) && (tau_2 < 1.0) && ((tau_1 < bnk->gamma1) || (tau_2 >= 1.0))) { in TaoBNKUpdateTrustRadius()
937 tao->trust = tau_2 * PetscMin(tao->trust, bnk->dnorm); in TaoBNKUpdateTrustRadius()
939 tao->trust = tau_max * PetscMin(tao->trust, bnk->dnorm); in TaoBNKUpdateTrustRadius()
946 tao->trust = bnk->gamma1 * PetscMin(bnk->dnorm, tao->trust); in TaoBNKUpdateTrustRadius()
951 tao->trust = PetscMin(tao->trust, bnk->max_radius); in TaoBNKUpdateTrustRadius()
952 tao->trust = PetscMax(tao->trust, bnk->min_radius); in TaoBNKUpdateTrustRadius()
958 TAO_BNK *bnk = (TAO_BNK *)tao->data; in TaoBNKAddStepCounts() local
963 ++bnk->newt; in TaoBNKAddStepCounts()
966 ++bnk->bfgs; in TaoBNKAddStepCounts()
969 ++bnk->sgrad; in TaoBNKAddStepCounts()
972 ++bnk->grad; in TaoBNKAddStepCounts()
982 TAO_BNK *bnk = (TAO_BNK *)tao->data; in TaoSetUp_BNK() local
987 if (!bnk->W) PetscCall(VecDuplicate(tao->solution, &bnk->W)); in TaoSetUp_BNK()
988 if (!bnk->Xold) PetscCall(VecDuplicate(tao->solution, &bnk->Xold)); in TaoSetUp_BNK()
989 if (!bnk->Gold) PetscCall(VecDuplicate(tao->solution, &bnk->Gold)); in TaoSetUp_BNK()
990 if (!bnk->Xwork) PetscCall(VecDuplicate(tao->solution, &bnk->Xwork)); in TaoSetUp_BNK()
991 if (!bnk->Gwork) PetscCall(VecDuplicate(tao->solution, &bnk->Gwork)); in TaoSetUp_BNK()
992 …if (!bnk->unprojected_gradient) PetscCall(VecDuplicate(tao->solution, &bnk->unprojected_gradient)); in TaoSetUp_BNK()
993 …if (!bnk->unprojected_gradient_old) PetscCall(VecDuplicate(tao->solution, &bnk->unprojected_gradie… in TaoSetUp_BNK()
994 if (!bnk->Diag_min) PetscCall(VecDuplicate(tao->solution, &bnk->Diag_min)); in TaoSetUp_BNK()
995 if (!bnk->Diag_max) PetscCall(VecDuplicate(tao->solution, &bnk->Diag_max)); in TaoSetUp_BNK()
996 if (bnk->max_cg_its > 0) { in TaoSetUp_BNK()
998 bnk->bncg_ctx = (TAO_BNCG *)bnk->bncg->data; in TaoSetUp_BNK()
999 PetscCall(PetscObjectReference((PetscObject)bnk->unprojected_gradient_old)); in TaoSetUp_BNK()
1000 PetscCall(VecDestroy(&bnk->bncg_ctx->unprojected_gradient_old)); in TaoSetUp_BNK()
1001 bnk->bncg_ctx->unprojected_gradient_old = bnk->unprojected_gradient_old; in TaoSetUp_BNK()
1002 PetscCall(PetscObjectReference((PetscObject)bnk->unprojected_gradient)); in TaoSetUp_BNK()
1003 PetscCall(VecDestroy(&bnk->bncg_ctx->unprojected_gradient)); in TaoSetUp_BNK()
1004 bnk->bncg_ctx->unprojected_gradient = bnk->unprojected_gradient; in TaoSetUp_BNK()
1005 PetscCall(PetscObjectReference((PetscObject)bnk->Gold)); in TaoSetUp_BNK()
1006 PetscCall(VecDestroy(&bnk->bncg_ctx->G_old)); in TaoSetUp_BNK()
1007 bnk->bncg_ctx->G_old = bnk->Gold; in TaoSetUp_BNK()
1009 PetscCall(VecDestroy(&bnk->bncg->gradient)); in TaoSetUp_BNK()
1010 bnk->bncg->gradient = tao->gradient; in TaoSetUp_BNK()
1012 PetscCall(VecDestroy(&bnk->bncg->stepdirection)); in TaoSetUp_BNK()
1013 bnk->bncg->stepdirection = tao->stepdirection; in TaoSetUp_BNK()
1014 PetscCall(TaoSetSolution(bnk->bncg, tao->solution)); in TaoSetUp_BNK()
1016 PetscCall(TaoSetMaximumIterations(bnk->bncg, bnk->max_cg_its)); in TaoSetUp_BNK()
1017 PetscCall(TaoSetTolerances(bnk->bncg, tao->gatol, tao->grtol, tao->gttol)); in TaoSetUp_BNK()
1018 PetscCall(TaoSetFunctionLowerBound(bnk->bncg, tao->fmin)); in TaoSetUp_BNK()
1019 PetscCall(TaoSetConvergenceTest(bnk->bncg, tao->ops->convergencetest, tao->cnvP)); in TaoSetUp_BNK()
1020 PetscCall(TaoSetObjective(bnk->bncg, tao->ops->computeobjective, tao->user_objP)); in TaoSetUp_BNK()
1021 PetscCall(TaoSetGradient(bnk->bncg, NULL, tao->ops->computegradient, tao->user_gradP)); in TaoSetUp_BNK()
1022 …PetscCall(TaoSetObjectiveAndGradient(bnk->bncg, NULL, tao->ops->computeobjectiveandgradient, tao->… in TaoSetUp_BNK()
1023 PetscCall(PetscObjectCopyFortranFunctionPointers((PetscObject)tao, (PetscObject)bnk->bncg)); in TaoSetUp_BNK()
1025 bnk->X_inactive = NULL; in TaoSetUp_BNK()
1026 bnk->G_inactive = NULL; in TaoSetUp_BNK()
1027 bnk->inactive_work = NULL; in TaoSetUp_BNK()
1028 bnk->active_work = NULL; in TaoSetUp_BNK()
1029 bnk->inactive_idx = NULL; in TaoSetUp_BNK()
1030 bnk->active_idx = NULL; in TaoSetUp_BNK()
1031 bnk->active_lower = NULL; in TaoSetUp_BNK()
1032 bnk->active_upper = NULL; in TaoSetUp_BNK()
1033 bnk->active_fixed = NULL; in TaoSetUp_BNK()
1034 bnk->M = NULL; in TaoSetUp_BNK()
1035 bnk->H_inactive = NULL; in TaoSetUp_BNK()
1036 bnk->Hpre_inactive = NULL; in TaoSetUp_BNK()
1042 TAO_BNK *bnk = (TAO_BNK *)tao->data; in TaoDestroy_BNK() local
1045 PetscCall(VecDestroy(&bnk->W)); in TaoDestroy_BNK()
1046 PetscCall(VecDestroy(&bnk->Xold)); in TaoDestroy_BNK()
1047 PetscCall(VecDestroy(&bnk->Gold)); in TaoDestroy_BNK()
1048 PetscCall(VecDestroy(&bnk->Xwork)); in TaoDestroy_BNK()
1049 PetscCall(VecDestroy(&bnk->Gwork)); in TaoDestroy_BNK()
1050 PetscCall(VecDestroy(&bnk->unprojected_gradient)); in TaoDestroy_BNK()
1051 PetscCall(VecDestroy(&bnk->unprojected_gradient_old)); in TaoDestroy_BNK()
1052 PetscCall(VecDestroy(&bnk->Diag_min)); in TaoDestroy_BNK()
1053 PetscCall(VecDestroy(&bnk->Diag_max)); in TaoDestroy_BNK()
1054 PetscCall(ISDestroy(&bnk->active_lower)); in TaoDestroy_BNK()
1055 PetscCall(ISDestroy(&bnk->active_upper)); in TaoDestroy_BNK()
1056 PetscCall(ISDestroy(&bnk->active_fixed)); in TaoDestroy_BNK()
1057 PetscCall(ISDestroy(&bnk->active_idx)); in TaoDestroy_BNK()
1058 PetscCall(ISDestroy(&bnk->inactive_idx)); in TaoDestroy_BNK()
1059 PetscCall(MatDestroy(&bnk->Hpre_inactive)); in TaoDestroy_BNK()
1060 PetscCall(MatDestroy(&bnk->H_inactive)); in TaoDestroy_BNK()
1061 PetscCall(TaoDestroy(&bnk->bncg)); in TaoDestroy_BNK()
1069 TAO_BNK *bnk = (TAO_BNK *)tao->data; in TaoSetFromOptions_BNK() local
1073 …dius initialization type", "", BNK_INIT, BNK_INIT_TYPES, BNK_INIT[bnk->init_type], &bnk->init_type… in TaoSetFromOptions_BNK()
1074 …adius update type", "", BNK_UPDATE, BNK_UPDATE_TYPES, BNK_UPDATE[bnk->update_type], &bnk->update_t… in TaoSetFromOptions_BNK()
1075 …, "active set estimation method", "", BNK_AS, BNK_AS_TYPES, BNK_AS[bnk->as_type], &bnk->as_type, N… in TaoSetFromOptions_BNK()
1076 …ao_bnk_sval", "(developer) Hessian perturbation starting value", "", bnk->sval, &bnk->sval, NULL)); in TaoSetFromOptions_BNK()
1077 …o_bnk_imin", "(developer) minimum initial Hessian perturbation", "", bnk->imin, &bnk->imin, NULL)); in TaoSetFromOptions_BNK()
1078 …o_bnk_imax", "(developer) maximum initial Hessian perturbation", "", bnk->imax, &bnk->imax, NULL)); in TaoSetFromOptions_BNK()
1079 …", "(developer) initial merit factor for Hessian perturbation", "", bnk->imfac, &bnk->imfac, NULL)… in TaoSetFromOptions_BNK()
1080 …eal("-tao_bnk_pmin", "(developer) minimum Hessian perturbation", "", bnk->pmin, &bnk->pmin, NULL)); in TaoSetFromOptions_BNK()
1081 …eal("-tao_bnk_pmax", "(developer) maximum Hessian perturbation", "", bnk->pmax, &bnk->pmax, NULL)); in TaoSetFromOptions_BNK()
1082 …o_bnk_pgfac", "(developer) Hessian perturbation growth factor", "", bnk->pgfac, &bnk->pgfac, NULL)… in TaoSetFromOptions_BNK()
1083 …o_bnk_psfac", "(developer) Hessian perturbation shrink factor", "", bnk->psfac, &bnk->psfac, NULL)… in TaoSetFromOptions_BNK()
1084 …c", "(developer) merit growth factor for Hessian perturbation", "", bnk->pmgfac, &bnk->pmgfac, NUL… in TaoSetFromOptions_BNK()
1085 …c", "(developer) merit shrink factor for Hessian perturbation", "", bnk->pmsfac, &bnk->pmsfac, NUL… in TaoSetFromOptions_BNK()
1086 … threshold for rejecting step (-tao_bnk_update_type reduction)", "", bnk->eta1, &bnk->eta1, NULL)); in TaoSetFromOptions_BNK()
1087 …d for accepting marginal step (-tao_bnk_update_type reduction)", "", bnk->eta2, &bnk->eta2, NULL)); in TaoSetFromOptions_BNK()
1088 …for accepting reasonable step (-tao_bnk_update_type reduction)", "", bnk->eta3, &bnk->eta3, NULL)); in TaoSetFromOptions_BNK()
1089 …shold for accepting good step (-tao_bnk_update_type reduction)", "", bnk->eta4, &bnk->eta4, NULL)); in TaoSetFromOptions_BNK()
1090 …ion factor for rejected step (-tao_bnk_update_type reduction)", "", bnk->alpha1, &bnk->alpha1, NUL… in TaoSetFromOptions_BNK()
1091 …marginally accepted bad step (-tao_bnk_update_type reduction)", "", bnk->alpha2, &bnk->alpha2, NUL… in TaoSetFromOptions_BNK()
1092 …for reasonable accepted step (-tao_bnk_update_type reduction)", "", bnk->alpha3, &bnk->alpha3, NUL… in TaoSetFromOptions_BNK()
1093 …actor for good accepted step (-tao_bnk_update_type reduction)", "", bnk->alpha4, &bnk->alpha4, NUL… in TaoSetFromOptions_BNK()
1094 … for very good accepted step (-tao_bnk_update_type reduction)", "", bnk->alpha5, &bnk->alpha5, NUL… in TaoSetFromOptions_BNK()
1095 …ld for small line-search step length (-tao_bnk_update_type step)", "", bnk->nu1, &bnk->nu1, NULL)); in TaoSetFromOptions_BNK()
1096 …r reasonable line-search step length (-tao_bnk_update_type step)", "", bnk->nu2, &bnk->nu2, NULL)); in TaoSetFromOptions_BNK()
1097 …ld for large line-search step length (-tao_bnk_update_type step)", "", bnk->nu3, &bnk->nu3, NULL)); in TaoSetFromOptions_BNK()
1098 …r very large line-search step length (-tao_bnk_update_type step)", "", bnk->nu4, &bnk->nu4, NULL)); in TaoSetFromOptions_BNK()
1099 …ery small line-search step length (-tao_bnk_update_type step)", "", bnk->omega1, &bnk->omega1, NUL… in TaoSetFromOptions_BNK()
1100 …for small line-search step length (-tao_bnk_update_type step)", "", bnk->omega2, &bnk->omega2, NUL… in TaoSetFromOptions_BNK()
1101 …or decent line-search step length (-tao_bnk_update_type step)", "", bnk->omega3, &bnk->omega3, NUL… in TaoSetFromOptions_BNK()
1102 …for large line-search step length (-tao_bnk_update_type step)", "", bnk->omega4, &bnk->omega4, NUL… in TaoSetFromOptions_BNK()
1103 …ery large line-search step length (-tao_bnk_update_type step)", "", bnk->omega5, &bnk->omega5, NUL… in TaoSetFromOptions_BNK()
1104 …r accepting very good step (-tao_bnk_init_type interpolation)", "", bnk->mu1_i, &bnk->mu1_i, NULL)… in TaoSetFromOptions_BNK()
1105 …ld for accepting good step (-tao_bnk_init_type interpolation)", "", bnk->mu2_i, &bnk->mu2_i, NULL)… in TaoSetFromOptions_BNK()
1106 …or rejected very bad step (-tao_bnk_init_type interpolation)", "", bnk->gamma1_i, &bnk->gamma1_i, … in TaoSetFromOptions_BNK()
1107 …tor for rejected bad step (-tao_bnk_init_type interpolation)", "", bnk->gamma2_i, &bnk->gamma2_i, … in TaoSetFromOptions_BNK()
1108 …or for accepted good step (-tao_bnk_init_type interpolation)", "", bnk->gamma3_i, &bnk->gamma3_i, … in TaoSetFromOptions_BNK()
1109 …r accepted very good step (-tao_bnk_init_type interpolation)", "", bnk->gamma4_i, &bnk->gamma4_i, … in TaoSetFromOptions_BNK()
1110 …gion interpolation factor (-tao_bnk_init_type interpolation)", "", bnk->theta_i, &bnk->theta_i, NU… in TaoSetFromOptions_BNK()
1111 …or accepting very good step (-tao_bnk_update_type interpolation)", "", bnk->mu1, &bnk->mu1, NULL)); in TaoSetFromOptions_BNK()
1112 …old for accepting good step (-tao_bnk_update_type interpolation)", "", bnk->mu2, &bnk->mu2, NULL)); in TaoSetFromOptions_BNK()
1113 …r rejected very bad step (-tao_bnk_update_type interpolation)", "", bnk->gamma1, &bnk->gamma1, NUL… in TaoSetFromOptions_BNK()
1114 …or for rejected bad step (-tao_bnk_update_type interpolation)", "", bnk->gamma2, &bnk->gamma2, NUL… in TaoSetFromOptions_BNK()
1115 …r for accepted good step (-tao_bnk_update_type interpolation)", "", bnk->gamma3, &bnk->gamma3, NUL… in TaoSetFromOptions_BNK()
1116 … accepted very good step (-tao_bnk_update_type interpolation)", "", bnk->gamma4, &bnk->gamma4, NUL… in TaoSetFromOptions_BNK()
1117 …ion interpolation factor (-tao_bnk_update_type interpolation)", "", bnk->theta, &bnk->theta, NULL)… in TaoSetFromOptions_BNK()
1118 …bnk_min_radius", "(developer) lower bound on initial radius", "", bnk->min_radius, &bnk->min_radiu… in TaoSetFromOptions_BNK()
1119 …l("-tao_bnk_max_radius", "(developer) upper bound on radius", "", bnk->max_radius, &bnk->max_radiu… in TaoSetFromOptions_BNK()
1120 …tolerance used when computing actual and predicted reduction", "", bnk->epsilon, &bnk->epsilon, NU… in TaoSetFromOptions_BNK()
1121 …ial tolerance used when estimating actively bounded variables", "", bnk->as_tol, &bnk->as_tol, NUL… in TaoSetFromOptions_BNK()
1122 … step length used when estimating actively bounded variables", "", bnk->as_step, &bnk->as_step, NU… in TaoSetFromOptions_BNK()
1123 …s", "number of BNCG iterations to take for each Newton step", "", bnk->max_cg_its, &bnk->max_cg_it… in TaoSetFromOptions_BNK()
1126 PetscCall(TaoSetOptionsPrefix(bnk->bncg, ((PetscObject)tao)->prefix)); in TaoSetFromOptions_BNK()
1127 PetscCall(TaoAppendOptionsPrefix(bnk->bncg, "tao_bnk_cg_")); in TaoSetFromOptions_BNK()
1128 PetscCall(TaoSetFromOptions(bnk->bncg)); in TaoSetFromOptions_BNK()
1138 TAO_BNK *bnk = (TAO_BNK *)tao->data; in TaoView_BNK() local
1146 PetscCall(TaoView(bnk->bncg, viewer)); in TaoView_BNK()
1147 if (bnk->M) { in TaoView_BNK()
1148 PetscCall(MatLMVMGetRejectCount(bnk->M, &nrejects)); in TaoView_BNK()
1151 PetscCall(PetscViewerASCIIPrintf(viewer, "CG steps: %" PetscInt_FMT "\n", bnk->tot_cg_its)); in TaoView_BNK()
1152 PetscCall(PetscViewerASCIIPrintf(viewer, "Newton steps: %" PetscInt_FMT "\n", bnk->newt)); in TaoView_BNK()
1153 …if (bnk->M) PetscCall(PetscViewerASCIIPrintf(viewer, "BFGS steps: %" PetscInt_FMT "\n", bnk->bfgs)… in TaoView_BNK()
1154 …PetscCall(PetscViewerASCIIPrintf(viewer, "Scaled gradient steps: %" PetscInt_FMT "\n", bnk->sgrad)… in TaoView_BNK()
1155 PetscCall(PetscViewerASCIIPrintf(viewer, "Gradient steps: %" PetscInt_FMT "\n", bnk->grad)); in TaoView_BNK()
1157 PetscCall(PetscViewerASCIIPrintf(viewer, " atol: %" PetscInt_FMT "\n", bnk->ksp_atol)); in TaoView_BNK()
1158 PetscCall(PetscViewerASCIIPrintf(viewer, " rtol: %" PetscInt_FMT "\n", bnk->ksp_rtol)); in TaoView_BNK()
1159 PetscCall(PetscViewerASCIIPrintf(viewer, " ctol: %" PetscInt_FMT "\n", bnk->ksp_ctol)); in TaoView_BNK()
1160 PetscCall(PetscViewerASCIIPrintf(viewer, " negc: %" PetscInt_FMT "\n", bnk->ksp_negc)); in TaoView_BNK()
1161 PetscCall(PetscViewerASCIIPrintf(viewer, " dtol: %" PetscInt_FMT "\n", bnk->ksp_dtol)); in TaoView_BNK()
1162 PetscCall(PetscViewerASCIIPrintf(viewer, " iter: %" PetscInt_FMT "\n", bnk->ksp_iter)); in TaoView_BNK()
1163 PetscCall(PetscViewerASCIIPrintf(viewer, " othr: %" PetscInt_FMT "\n", bnk->ksp_othr)); in TaoView_BNK()
1233 TAO_BNK *bnk; in TaoCreate_BNK() local
1237 PetscCall(PetscNew(&bnk)); in TaoCreate_BNK()
1249 tao->data = (void *)bnk; in TaoCreate_BNK()
1252 bnk->computehessian = TaoBNKComputeHessian; in TaoCreate_BNK()
1253 bnk->computestep = TaoBNKComputeStep; in TaoCreate_BNK()
1255 bnk->sval = 0.0; in TaoCreate_BNK()
1256 bnk->imin = 1.0e-4; in TaoCreate_BNK()
1257 bnk->imax = 1.0e+2; in TaoCreate_BNK()
1258 bnk->imfac = 1.0e-1; in TaoCreate_BNK()
1260 bnk->pmin = 1.0e-12; in TaoCreate_BNK()
1261 bnk->pmax = 1.0e+2; in TaoCreate_BNK()
1262 bnk->pgfac = 1.0e+1; in TaoCreate_BNK()
1263 bnk->psfac = 4.0e-1; in TaoCreate_BNK()
1264 bnk->pmgfac = 1.0e-1; in TaoCreate_BNK()
1265 bnk->pmsfac = 1.0e-1; in TaoCreate_BNK()
1268 bnk->nu1 = 0.25; in TaoCreate_BNK()
1269 bnk->nu2 = 0.50; in TaoCreate_BNK()
1270 bnk->nu3 = 1.00; in TaoCreate_BNK()
1271 bnk->nu4 = 1.25; in TaoCreate_BNK()
1273 bnk->omega1 = 0.25; in TaoCreate_BNK()
1274 bnk->omega2 = 0.50; in TaoCreate_BNK()
1275 bnk->omega3 = 1.00; in TaoCreate_BNK()
1276 bnk->omega4 = 2.00; in TaoCreate_BNK()
1277 bnk->omega5 = 4.00; in TaoCreate_BNK()
1280 bnk->eta1 = 1.0e-4; in TaoCreate_BNK()
1281 bnk->eta2 = 0.25; in TaoCreate_BNK()
1282 bnk->eta3 = 0.50; in TaoCreate_BNK()
1283 bnk->eta4 = 0.90; in TaoCreate_BNK()
1285 bnk->alpha1 = 0.25; in TaoCreate_BNK()
1286 bnk->alpha2 = 0.50; in TaoCreate_BNK()
1287 bnk->alpha3 = 1.00; in TaoCreate_BNK()
1288 bnk->alpha4 = 2.00; in TaoCreate_BNK()
1289 bnk->alpha5 = 4.00; in TaoCreate_BNK()
1292 bnk->mu1 = 0.10; in TaoCreate_BNK()
1293 bnk->mu2 = 0.50; in TaoCreate_BNK()
1295 bnk->gamma1 = 0.25; in TaoCreate_BNK()
1296 bnk->gamma2 = 0.50; in TaoCreate_BNK()
1297 bnk->gamma3 = 2.00; in TaoCreate_BNK()
1298 bnk->gamma4 = 4.00; in TaoCreate_BNK()
1300 bnk->theta = 0.05; in TaoCreate_BNK()
1303 bnk->mu1_i = 0.35; in TaoCreate_BNK()
1304 bnk->mu2_i = 0.50; in TaoCreate_BNK()
1306 bnk->gamma1_i = 0.0625; in TaoCreate_BNK()
1307 bnk->gamma2_i = 0.5; in TaoCreate_BNK()
1308 bnk->gamma3_i = 2.0; in TaoCreate_BNK()
1309 bnk->gamma4_i = 5.0; in TaoCreate_BNK()
1311 bnk->theta_i = 0.25; in TaoCreate_BNK()
1314 bnk->max_cg_its = 0; in TaoCreate_BNK()
1315 bnk->min_radius = 1.0e-10; in TaoCreate_BNK()
1316 bnk->max_radius = 1.0e10; in TaoCreate_BNK()
1317 bnk->epsilon = PetscPowReal(PETSC_MACHINE_EPSILON, 2.0 / 3.0); in TaoCreate_BNK()
1318 bnk->as_tol = 1.0e-3; in TaoCreate_BNK()
1319 bnk->as_step = 1.0e-3; in TaoCreate_BNK()
1320 bnk->dmin = 1.0e-6; in TaoCreate_BNK()
1321 bnk->dmax = 1.0e6; in TaoCreate_BNK()
1323 bnk->M = NULL; in TaoCreate_BNK()
1324 bnk->bfgs_pre = NULL; in TaoCreate_BNK()
1325 bnk->init_type = BNK_INIT_INTERPOLATION; in TaoCreate_BNK()
1326 bnk->update_type = BNK_UPDATE_REDUCTION; in TaoCreate_BNK()
1327 bnk->as_type = BNK_AS_BERTSEKAS; in TaoCreate_BNK()
1330 PetscCall(TaoCreate(PetscObjectComm((PetscObject)tao), &bnk->bncg)); in TaoCreate_BNK()
1331 PetscCall(PetscObjectIncrementTabLevel((PetscObject)bnk->bncg, (PetscObject)tao, 1)); in TaoCreate_BNK()
1332 PetscCall(TaoSetType(bnk->bncg, TAOBNCG)); in TaoCreate_BNK()