Tao (Optimization) - Low-level Interface
The Tao (Toolkit for Advanced Optimization) component provides methods for solving optimization problems, including unconstrained minimization, bound-constrained optimization, and constrained optimization.
Overview
Tao supports various optimization algorithms:
- Unconstrained: Conjugate gradient (CG), limited-memory BFGS (BLMVM), Nelder-Mead
- Bound-constrained: Bound-constrained BFGS (BNCG, BNLS, BNTL), active-set methods
- Constrained: Augmented Lagrangian methods (ALMM), interior point methods
- Least-squares: Gauss-Newton methods, Levenberg-Marquardt
- Complementarity: Semismooth methods for complementarity problems
- PDE-constrained: Methods suitable for PDE-constrained optimization
The Tao object manages the optimization process, line searches, convergence monitoring, and provides a unified interface across different optimization algorithms.
Basic Usage
using PETSc, MPI
# Initialize MPI and PETSc
MPI.Init()
petsclib = PETSc.getlib()
PETSc.initialize(petsclib)
# Create a Tao object
tao = LibPETSc.TaoCreate(petsclib, LibPETSc.PETSC_COMM_SELF)
# Set the optimization algorithm (e.g., LMVM, BLMVM, NLS)
LibPETSc.TaoSetType(petsclib, tao, "lmvm") # String convenience wrapper
# Set the objective function and gradient
# LibPETSc.TaoSetObjective(petsclib, tao, objective_function_ptr, C_NULL)
# LibPETSc.TaoSetGradient(petsclib, tao, C_NULL, gradient_function_ptr, C_NULL)
# For bound-constrained problems, set variable bounds
# LibPETSc.TaoSetVariableBounds(petsclib, tao, lower_bound_vec, upper_bound_vec)
# Set convergence tolerances
LibPETSc.TaoSetTolerances(petsclib, tao, 1e-8, 1e-8, 1e-8)
# Set maximum iterations
LibPETSc.TaoSetMaximumIterations(petsclib, tao, 1000)
# Set options from command line/options database
LibPETSc.TaoSetFromOptions(petsclib, tao)
# Set initial guess
# LibPETSc.TaoSetSolution(petsclib, tao, initial_vec)
# Solve the optimization problem
# LibPETSc.TaoSolve(petsclib, tao)
# Get solution information
reason = LibPETSc.TaoGetConvergedReason(petsclib, tao)
iter = LibPETSc.TaoGetIterationNumber(petsclib, tao)
println("Tao reason: $(reason), iterations: $(iter)")
# Cleanup
LibPETSc.TaoDestroy(petsclib, tao)
# Finalize PETSc and MPI
PETSc.finalize(petsclib)
MPI.Finalize()Common Workflow
- Create and configure Tao: Use
TaoCreate,TaoSetType - Define objective:
TaoSetObjective,TaoSetGradient, optionallyTaoSetHessian - Set constraints (if any):
TaoSetVariableBounds,TaoSetConstraints - Configure solver:
TaoSetTolerances,TaoSetMaximumIterations - Set initial guess:
TaoSetSolution - Solve:
TaoSolve - Retrieve solution:
TaoGetSolution,TaoGetConvergedReason
Optimization Algorithms
Available through TaoSetType:
Unconstrained:
TAOLMVM: Limited-memory variable metric (quasi-Newton)TAOCG: Conjugate gradient methodsTAONM: Nelder-Mead simplex methodTAONLS: Newton line searchTAONTL: Newton trust-region with line search
Bound-constrained:
TAOBLMVM: Bound-constrained limited-memory variable metricTAOBNCG: Bound-constrained conjugate gradientTAOBQNLS: Bound-constrained quasi-Newton line searchTAOBNTL: Bound-constrained Newton trust-regionTAOTRON: Trust-region Newton method
Constrained:
TAOALMM: Augmented Lagrangian multiplier methodTAOIPM: Interior point methodTAOPDIPM: Primal-dual interior point method
Least-squares:
TAOPOUNDERS: POUNDERs model-based methodTAOBRGN: Bounded regularized Gauss-Newton
Complementarity:
TAOSSLS: Semismooth least squaresTAOASLS: Active-set least squares
Convergence Criteria
Tao monitors several convergence criteria:
- Gradient tolerance:
||∇f|| < gatolor||∇f||/||f|| < grtol - Function tolerance:
|f - f_prev| < fatolor|f - f_prev|/|f| < frtol - Step tolerance:
||x - x_prev|| < steptol
Set using TaoSetTolerances(tao, gatol, grtol, gttol).
Hessian Options
For second-order methods:
- Exact Hessian: Provide via
TaoSetHessian - Finite-difference approximation: Use matrix-free approach
- Quasi-Newton approximation: LMVM methods build approximation automatically
Function Reference
PETSc.LibPETSc.TaoADMMGetDualVector — Method
TaoADMMGetDualVector(petsclib::PetscLibType,tao::Tao, Y::PetscVec)Returns the dual vector associated with the current TAOADMM state
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
Y- the current solution
Level: intermediate
-seealso: TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMGetDualVector
PETSc.LibPETSc.TaoADMMGetMisfitSubsolver — Method
TaoADMMGetMisfitSubsolver(petsclib::PetscLibType,tao::Tao, misfit::Tao)Get the pointer to the misfit subsolver inside TAOADMM
Collective
Input Parameter:
tao- theTaosolver context
Output Parameter:
misfit- theTaosubsolver context
Level: advanced
-seealso: TAOADMM, Tao
External Links
- PETSc Manual:
Tao/TaoADMMGetMisfitSubsolver
PETSc.LibPETSc.TaoADMMGetRegularizationSubsolver — Method
TaoADMMGetRegularizationSubsolver(petsclib::PetscLibType,tao::Tao, reg::Tao)Get the pointer to the regularization subsolver inside TAOADMM
Collective
Input Parameter:
tao- theTaosolver context
Output Parameter:
reg- theTaosubsolver context
Level: advanced
-seealso: TAOADMM, Tao
External Links
- PETSc Manual:
Tao/TaoADMMGetRegularizationSubsolver
PETSc.LibPETSc.TaoADMMGetRegularizerCoefficient — Method
lambda::PetscReal = TaoADMMGetRegularizerCoefficient(petsclib::PetscLibType,tao::Tao)Get the regularization coefficient lambda for L1 norm regularization case
Collective
Input Parameter:
tao- theTaosolver context
Output Parameter:
lambda- L1-norm regularizer coefficient
Level: advanced
-seealso: TaoADMMSetMisfitConstraintJacobian(), TaoADMMSetRegularizerConstraintJacobian(), TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMGetRegularizerCoefficient
PETSc.LibPETSc.TaoADMMGetRegularizerType — Method
type::TaoADMMRegularizerType = TaoADMMGetRegularizerType(petsclib::PetscLibType,tao::Tao)Gets the type of regularizer routine for TAOADMM
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
type- the type of regularizer
Level: intermediate
-seealso: TaoADMMSetRegularizerType(), TaoADMMRegularizerType, TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMGetRegularizerType
PETSc.LibPETSc.TaoADMMGetSpectralPenalty — Method
mu::PetscReal = TaoADMMGetSpectralPenalty(petsclib::PetscLibType,tao::Tao)Get the spectral penalty (mu) value
Collective
Input Parameter:
tao- theTaosolver context
Output Parameter:
mu- spectral penalty
Level: advanced
-seealso: TaoADMMSetMinimumSpectralPenalty(), TaoADMMSetSpectralPenalty(), TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMGetSpectralPenalty
PETSc.LibPETSc.TaoADMMGetUpdateType — Method
type::TaoADMMUpdateType = TaoADMMGetUpdateType(petsclib::PetscLibType,tao::Tao)Gets the type of spectral penalty update routine for TAOADMM
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
type- the type of spectral penalty update routine
Level: intermediate
-seealso: TaoADMMSetUpdateType(), TaoADMMUpdateType, TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMGetUpdateType
PETSc.LibPETSc.TaoADMMSetConstraintVectorRHS — Method
TaoADMMSetConstraintVectorRHS(petsclib::PetscLibType,tao::Tao, c::PetscVec)Set the RHS constraint vector for TAOADMM
Collective
Input Parameters:
tao- theTaosolver contextc- RHS vector
Level: advanced
-seealso: TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetConstraintVectorRHS
PETSc.LibPETSc.TaoADMMSetMinimumSpectralPenalty — Method
TaoADMMSetMinimumSpectralPenalty(petsclib::PetscLibType,tao::Tao, mu::PetscReal)Set the minimum value for the spectral penalty
Collective
Input Parameters:
tao- theTaosolver contextmu- minimum spectral penalty value
Level: advanced
-seealso: TaoADMMGetSpectralPenalty(), TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetMinimumSpectralPenalty
PETSc.LibPETSc.TaoADMMSetMisfitConstraintJacobian — Method
TaoADMMSetMisfitConstraintJacobian(petsclib::PetscLibType,tao::Tao, J::PetscMat, Jpre::PetscMat, func::external, ctx::Cvoid)Set the constraint matrix B for the TAOADMM algorithm. Matrix B constrains the z variable.
Collective
Input Parameters:
tao- the Tao solver contextJ- user-created regularizer constraint Jacobian matrixJpre- user-created regularizer Jacobian constraint matrix for constructing the preconditioner, often this isJfunc- function pointer for the regularizer constraint Jacobian update functionctx- user context for the regularizer Hessian
Level: advanced
-seealso: TaoADMMSetRegularizerCoefficient(), TaoADMMSetRegularizerConstraintJacobian(), TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetMisfitConstraintJacobian
PETSc.LibPETSc.TaoADMMSetMisfitHessianChangeStatus — Method
TaoADMMSetMisfitHessianChangeStatus(petsclib::PetscLibType,tao::Tao, b::PetscBool)Set boolean that determines whether Hessian matrix of misfit subsolver changes with respect to input vector.
Collective
Input Parameters:
tao- the Tao solver context.b- the Hessian matrix change status boolean,PETSC_FALSEwhen the Hessian matrix does not change,PETSC_TRUEotherwise.
Level: advanced
-seealso: TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetMisfitHessianChangeStatus
PETSc.LibPETSc.TaoADMMSetMisfitHessianRoutine — Method
TaoADMMSetMisfitHessianRoutine(petsclib::PetscLibType,tao::Tao, H::PetscMat, Hpre::PetscMat, func::external, ctx::Cvoid)Sets the user function into the algorithm, to be used for subsolverX.
Collective
Input Parameters:
tao- theTaocontextH- user-created matrix for the Hessian of the misfit termHpre- user-created matrix for the preconditioner of Hessian of the misfit termfunc- function pointer for the misfit Hessian evaluationctx- user context for the misfit Hessian
Level: advanced
-seealso: TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetMisfitHessianRoutine
PETSc.LibPETSc.TaoADMMSetMisfitObjectiveAndGradientRoutine — Method
TaoADMMSetMisfitObjectiveAndGradientRoutine(petsclib::PetscLibType,tao::Tao, func::external, ctx::Cvoid)Sets the user
Collective
Input Parameters:
tao- theTaocontextfunc- function pointer for the misfit value and gradient evaluationctx- user context for the misfit
Level: advanced
-seealso: TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetMisfitObjectiveAndGradientRoutine
PETSc.LibPETSc.TaoADMMSetRegHessianChangeStatus — Method
TaoADMMSetRegHessianChangeStatus(petsclib::PetscLibType,tao::Tao, b::PetscBool)Set boolean that determines whether Hessian matrix of regularization subsolver changes with respect to input vector.
Collective
Input Parameters:
tao- theTaosolver contextb- the Hessian matrix change status boolean,PETSC_FALSEwhen the Hessian matrix does not change,PETSC_TRUEotherwise.
Level: advanced
-seealso: TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetRegHessianChangeStatus
PETSc.LibPETSc.TaoADMMSetRegularizerCoefficient — Method
TaoADMMSetRegularizerCoefficient(petsclib::PetscLibType,tao::Tao, lambda::PetscReal)Set the regularization coefficient lambda for L1 norm regularization case
Collective
Input Parameters:
tao- theTaosolver contextlambda- L1-norm regularizer coefficient
Level: advanced
-seealso: TaoADMMSetMisfitConstraintJacobian(), TaoADMMSetRegularizerConstraintJacobian(), TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetRegularizerCoefficient
PETSc.LibPETSc.TaoADMMSetRegularizerConstraintJacobian — Method
TaoADMMSetRegularizerConstraintJacobian(petsclib::PetscLibType,tao::Tao, J::PetscMat, Jpre::PetscMat, func::external, ctx::Cvoid)Set the constraint matrix B for TAOADMM algorithm. Matrix B constraints z variable.
Collective
Input Parameters:
tao- theTaosolver contextJ- user-created regularizer constraint Jacobian matrixJpre- user-created regularizer Jacobian constraint matrix for constructing the preconditioner, often this isJfunc- function pointer for the regularizer constraint Jacobian update functionctx- user context for the regularizer Hessian
Level: advanced
-seealso: TaoADMMSetRegularizerCoefficient(), TaoADMMSetMisfitConstraintJacobian(), TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetRegularizerConstraintJacobian
PETSc.LibPETSc.TaoADMMSetRegularizerHessianRoutine — Method
TaoADMMSetRegularizerHessianRoutine(petsclib::PetscLibType,tao::Tao, H::PetscMat, Hpre::PetscMat, func::external, ctx::Cvoid)Sets the user function, to be used for subsolverZ.
Collective
Input Parameters:
tao- theTaocontextH- user-created matrix for the Hessian of the regularization termHpre- user-created matrix for the preconditioner of Hessian of the regularization termfunc- function pointer for the regularizer Hessian evaluationctx- user context for the regularizer Hessian
Level: advanced
-seealso: TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetRegularizerHessianRoutine
PETSc.LibPETSc.TaoADMMSetRegularizerObjectiveAndGradientRoutine — Method
TaoADMMSetRegularizerObjectiveAndGradientRoutine(petsclib::PetscLibType,tao::Tao, func::external, ctx::Cvoid)Sets the user
Collective
Input Parameters:
tao- the Tao contextfunc- function pointer for the regularizer value and gradient evaluationctx- user context for the regularizer
Level: advanced
-seealso: TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetRegularizerObjectiveAndGradientRoutine
PETSc.LibPETSc.TaoADMMSetRegularizerType — Method
TaoADMMSetRegularizerType(petsclib::PetscLibType,tao::Tao, type::TaoADMMRegularizerType)Set regularizer type for TAOADMM routine
Not Collective
Input Parameters:
tao- theTaocontexttype- regularizer type
Options Database Key:
-tao_admm_regularizer_type <admm_regularizer_user,admm_regularizer_soft_thresh>- select the regularizer
Level: intermediate
-seealso: TaoADMMGetRegularizerType(), TaoADMMRegularizerType, TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetRegularizerType
PETSc.LibPETSc.TaoADMMSetSpectralPenalty — Method
TaoADMMSetSpectralPenalty(petsclib::PetscLibType,tao::Tao, mu::PetscReal)Set the spectral penalty (mu) value
Collective
Input Parameters:
tao- theTaosolver contextmu- spectral penalty
Level: advanced
-seealso: TaoADMMSetMinimumSpectralPenalty(), TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetSpectralPenalty
PETSc.LibPETSc.TaoADMMSetUpdateType — Method
TaoADMMSetUpdateType(petsclib::PetscLibType,tao::Tao, type::TaoADMMUpdateType)Set update routine for TAOADMM routine
Not Collective
Input Parameters:
tao- theTaocontexttype- spectral parameter update type
Level: intermediate
-seealso: TaoADMMGetUpdateType(), TaoADMMUpdateType, TAOADMM
External Links
- PETSc Manual:
Tao/TaoADMMSetUpdateType
PETSc.LibPETSc.TaoALMMGetDualIS — Method
TaoALMMGetDualIS(petsclib::PetscLibType,tao::Tao, eq_is::IS, ineq_is::IS)Retrieve the index set that identifies equality and inequality constraint components of the dual vector returned by TaoALMMGetMultipliers().
Input Parameter:
tao- the Tao context for theTAOALMMsolver
Output Parameters:
eq_is- index set associated with the equality constraints (NULLif not needed)ineq_is- index set associated with the inequality constraints (NULLif not needed)
Level: advanced
-seealso: TAOALMM, Tao, TaoALMMGetMultipliers()
External Links
- PETSc Manual:
Tao/TaoALMMGetDualIS
PETSc.LibPETSc.TaoALMMGetMultipliers — Method
TaoALMMGetMultipliers(petsclib::PetscLibType,tao::Tao, Y::PetscVec)Retrieve a pointer to the Lagrange multipliers.
Input Parameter:
tao- theTaocontext for theTAOALMMsolver
Output Parameter:
Y- vector of Lagrange multipliers
Level: advanced
-seealso: TAOALMM, Tao, TaoALMMSetMultipliers(), TaoALMMGetDualIS()
External Links
- PETSc Manual:
Tao/TaoALMMGetMultipliers
PETSc.LibPETSc.TaoALMMGetPrimalIS — Method
TaoALMMGetPrimalIS(petsclib::PetscLibType,tao::Tao, opt_is::IS, slack_is::IS)Retrieve the index set that identifies optimization and slack variable components of the subsolver's solution vector.
Input Parameter:
tao- theTaocontext for theTAOALMMsolver
Output Parameters:
opt_is- index set associated with the optimization variables (NULLif not needed)slack_is- index set associated with the slack variables (NULLif not needed)
Level: advanced
-seealso: TAOALMM, Tao, IS, TaoALMMGetPrimalVector()
External Links
- PETSc Manual:
Tao/TaoALMMGetPrimalIS
PETSc.LibPETSc.TaoALMMGetSubsolver — Method
TaoALMMGetSubsolver(petsclib::PetscLibType,tao::Tao, subsolver::Tao)Retrieve the subsolver being used by TAOALMM.
Input Parameter:
tao- theTaocontext for theTAOALMMsolver
Output Parameter:
subsolver- theTaocontext for the subsolver
Level: advanced
-seealso: Tao, TAOALMM, TaoALMMSetSubsolver()
External Links
- PETSc Manual:
Tao/TaoALMMGetSubsolver
PETSc.LibPETSc.TaoALMMGetType — Method
type::TaoALMMType = TaoALMMGetType(petsclib::PetscLibType,tao::Tao)Retrieve the augmented Lagrangian formulation type for the subproblem.
Input Parameter:
tao- theTaocontext for theTAOALMMsolver
Output Parameter:
type- augmented Lagragrangian type
Level: advanced
-seealso: Tao, TAOALMM, TaoALMMSetType(), TaoALMMType
External Links
- PETSc Manual:
Tao/TaoALMMGetType
PETSc.LibPETSc.TaoALMMSetMultipliers — Method
TaoALMMSetMultipliers(petsclib::PetscLibType,tao::Tao, Y::PetscVec)Set user
Input Parameters:
tao- theTaocontext for theTAOALMMsolverY- vector of Lagrange multipliers
Level: advanced
-seealso: TAOALMM, Tao, TaoALMMGetMultipliers()
External Links
- PETSc Manual:
Tao/TaoALMMSetMultipliers
PETSc.LibPETSc.TaoALMMSetSubsolver — Method
TaoALMMSetSubsolver(petsclib::PetscLibType,tao::Tao, subsolver::Tao)Changes the subsolver inside TAOALMM with the user provided one.
Input Parameters:
tao- theTaocontext for theTAOALMMsolversubsolver- the Tao context for the subsolver
Level: advanced
-seealso: Tao, TAOALMM, TaoALMMGetSubsolver()
External Links
- PETSc Manual:
Tao/TaoALMMSetSubsolver
PETSc.LibPETSc.TaoALMMSetType — Method
TaoALMMSetType(petsclib::PetscLibType,tao::Tao, type::TaoALMMType)Determine the augmented Lagrangian formulation type for the subproblem.
Input Parameters:
tao- theTaocontext for theTAOALMMsolvertype- augmented Lagragrangian type
Level: advanced
-seealso: Tao, TAOALMM, TaoALMMGetType(), TaoALMMType
External Links
- PETSc Manual:
Tao/TaoALMMSetType
PETSc.LibPETSc.TaoAddLineSearchCounts — Method
TaoAddLineSearchCounts(petsclib::PetscLibType,tao::Tao)Adds the number of function evaluations spent in the line search to the running total.
Input Parameters:
tao- theTaosolver
Level: developer
-seealso: , Tao, TaoGetLineSearch(), TaoLineSearchApply()
External Links
- PETSc Manual:
Tao/TaoAddLineSearchCounts
PETSc.LibPETSc.TaoAppendOptionsPrefix — Method
TaoAppendOptionsPrefix(petsclib::PetscLibType,tao::Tao, p::String)Appends to the prefix used for searching for all Tao options in the database.
Logically Collective
Input Parameters:
tao- theTaosolver contextp- the prefix string to prepend to allTaooption requests
Level: advanced
-seealso: , Tao, TaoSetFromOptions(), TaoSetOptionsPrefix(), TaoGetOptionsPrefix()
External Links
- PETSc Manual:
Tao/TaoAppendOptionsPrefix
PETSc.LibPETSc.TaoBNCGGetType — Method
type::TaoBNCGType = TaoBNCGGetType(petsclib::PetscLibType,tao::Tao)Return the type for the TAOBNCG solver
Input Parameter:
tao- theTaosolver context
Output Parameter:
type-TAOBNCGtype
Level: advanced
-seealso: Tao, TAOBNCG, TaoBNCGSetType(), TaoBNCGType
External Links
- PETSc Manual:
Tao/TaoBNCGGetType
PETSc.LibPETSc.TaoBNCGSetType — Method
TaoBNCGSetType(petsclib::PetscLibType,tao::Tao, type::TaoBNCGType)Set the type for the TAOBNCG solver
Input Parameters:
tao- theTaosolver contexttype-TAOBNCGtype
Level: advanced
-seealso: Tao, TAOBNCG, TaoBNCGGetType(), TaoBNCGType
External Links
- PETSc Manual:
Tao/TaoBNCGSetType
PETSc.LibPETSc.TaoBRGNGetDampingVector — Method
TaoBRGNGetDampingVector(petsclib::PetscLibType,tao::Tao, d::PetscVec)Get the damping vector {diag}(J^T J) from a TAOBRGN with TAOBRGN_REGULARIZATION_LM regularization
Collective
Input Parameter:
tao- aTaoof typeTAOBRGNwithTAOBRGN_REGULARIZATION_LMregularization
Output Parameter:
d- the damping vector
Level: developer
-seealso: , Tao, TAOBRGN, TaoBRGNRegularzationTypes
External Links
- PETSc Manual:
Tao/TaoBRGNGetDampingVector
PETSc.LibPETSc.TaoBRGNGetRegularizationType — Method
type::TaoBRGNRegularizationType = TaoBRGNGetRegularizationType(petsclib::PetscLibType,tao::Tao)Get the TaoBRGNRegularizationType of a TAOBRGN
Not collective
Input Parameter:
tao- aTaoof typeTAOBRGN
Output Parameter:
type- theTaoBRGNRegularizationType
Level: advanced
-seealso: , Tao, TAOBRGN, TaoBRGNRegularizationType, TaoBRGNSetRegularizationType()
External Links
- PETSc Manual:
Tao/TaoBRGNGetRegularizationType
PETSc.LibPETSc.TaoBRGNGetSubsolver — Method
TaoBRGNGetSubsolver(petsclib::PetscLibType,tao::Tao, subsolver::Tao)Get the pointer to the subsolver inside a TAOBRGN
Collective
Input Parameters:
tao- the Tao solver contextsubsolver- theTaosub-solver context
Level: advanced
-seealso: Tao, Mat, TAOBRGN
External Links
- PETSc Manual:
Tao/TaoBRGNGetSubsolver
PETSc.LibPETSc.TaoBRGNSetDictionaryMatrix — Method
TaoBRGNSetDictionaryMatrix(petsclib::PetscLibType,tao::Tao, dict::PetscMat)bind the dictionary matrix from user application context to gn
Input Parameters:
tao- theTaocontextdict- the user specified dictionary matrix. We allow to set aNULLdictionary, which means identity matrix by default
Level: advanced
-seealso: Tao, Mat, TAOBRGN
External Links
- PETSc Manual:
Tao/TaoBRGNSetDictionaryMatrix
PETSc.LibPETSc.TaoBRGNSetL1SmoothEpsilon — Method
TaoBRGNSetL1SmoothEpsilon(petsclib::PetscLibType,tao::Tao, epsilon::PetscReal)Set the L1
Collective
Input Parameters:
tao- theTaosolver contextepsilon- L1-norm smooth approximation parameter
Level: advanced
-seealso: Tao, Mat, TAOBRGN
External Links
- PETSc Manual:
Tao/TaoBRGNSetL1SmoothEpsilon
PETSc.LibPETSc.TaoBRGNSetRegularizationType — Method
TaoBRGNSetRegularizationType(petsclib::PetscLibType,tao::Tao, type::TaoBRGNRegularizationType)Set the TaoBRGNRegularizationType of a TAOBRGN
Logically collective
Input Parameters:
tao- aTaoof typeTAOBRGNtype- theTaoBRGNRegularizationType
Level: advanced
-seealso: , Tao, TAOBRGN, TaoBRGNRegularizationType, TaoBRGNGetRegularizationType
External Links
- PETSc Manual:
Tao/TaoBRGNSetRegularizationType
PETSc.LibPETSc.TaoBRGNSetRegularizerHessianRoutine — Method
TaoBRGNSetRegularizerHessianRoutine(petsclib::PetscLibType,tao::Tao, Hreg::PetscMat, func::external, ctx::Cvoid)Sets the user function into the algorithm.
Input Parameters:
tao- theTaocontextHreg- user-created matrix for the Hessian of the regularization termfunc- function pointer for the regularizer Hessian evaluationctx- user context for the regularizer Hessian
Calling sequence:
tao- theTaocontextu- the location at which to compute the HessianHreg- user-created matrix for the Hessian of the regularization termctx- user context for the regularizer Hessian
Level: advanced
-seealso: Tao, Mat, TAOBRGN
External Links
- PETSc Manual:
Tao/TaoBRGNSetRegularizerHessianRoutine
PETSc.LibPETSc.TaoBRGNSetRegularizerObjectiveAndGradientRoutine — Method
TaoBRGNSetRegularizerObjectiveAndGradientRoutine(petsclib::PetscLibType,tao::Tao, func::external, ctx::Cvoid)Sets the user function into the algorithm.
Input Parameters:
tao- the Tao contextfunc- function pointer for the regularizer value and gradient evaluationctx- user context for the regularizer
Calling sequence:
tao- theTaocontextu- the location at which to compute the objective and gradientval- location to store objective function valueg- location to store gradientctx- user context for the regularizer Hessian
Level: advanced
-seealso: Tao, Mat, TAOBRGN
External Links
- PETSc Manual:
Tao/TaoBRGNSetRegularizerObjectiveAndGradientRoutine
PETSc.LibPETSc.TaoBRGNSetRegularizerWeight — Method
TaoBRGNSetRegularizerWeight(petsclib::PetscLibType,tao::Tao, lambda::PetscReal)Set the regularizer weight for the Gauss
Collective
Input Parameters:
tao- theTaosolver contextlambda- L1-norm regularizer weight
Level: beginner
-seealso: Tao, Mat, TAOBRGN
External Links
- PETSc Manual:
Tao/TaoBRGNSetRegularizerWeight
PETSc.LibPETSc.TaoBoundSolution — Method
nDiff::PetscInt = TaoBoundSolution(petsclib::PetscLibType,X::PetscVec, XL::PetscVec, XU::PetscVec, bound_tol::PetscReal, Xout::PetscVec)Ensures that the solution vector is snapped into the bounds within a given tolerance.
Collective
Input Parameters:
X- solution vectorXL- lower bound vectorXU- upper bound vectorbound_tol- absolute tolerance in enforcing the bound
Output Parameters:
nDiff- total number of vector entries that have been boundedXout- modified solution vector satisfying bounds tobound_tol
Level: developer
-seealso: TAOBNCG, TAOBNTL, TAOBNTR, TaoBoundStep()
External Links
- PETSc Manual:
Tao/TaoBoundSolution
PETSc.LibPETSc.TaoBoundStep — Method
TaoBoundStep(petsclib::PetscLibType,X::PetscVec, XL::PetscVec, XU::PetscVec, active_lower::IS, active_upper::IS, active_fixed::IS, scale::PetscReal, S::PetscVec)Ensures the correct zero or adjusted step direction values for active variables.
Input Parameters:
X- solution vectorXL- lower bound vectorXU- upper bound vectoractive_lower- index set for lower bounded active variablesactive_upper- index set for lower bounded active variablesactive_fixed- index set for fixed active variablesscale- amplification factor for the step that needs to be taken on actively bounded variables
Output Parameter:
S- step direction to be modified
Level: developer
-seealso: TAOBNCG, TAOBNTL, TAOBNTR, TaoBoundSolution()
External Links
- PETSc Manual:
Tao/TaoBoundStep
PETSc.LibPETSc.TaoComputeConstraints — Method
TaoComputeConstraints(petsclib::PetscLibType,tao::Tao, X::PetscVec, C::PetscVec)Compute the variable bounds using the routine set by TaoSetConstraintsRoutine().
Collective
Input Parameters:
tao- theTaocontextX- location to evaluate the constraints
Output Parameter:
C- the constraints
Level: developer
-seealso: , Tao, TaoSetConstraintsRoutine(), TaoComputeJacobian()
External Links
- PETSc Manual:
Tao/TaoComputeConstraints
PETSc.LibPETSc.TaoComputeDualVariables — Method
TaoComputeDualVariables(petsclib::PetscLibType,tao::Tao, DL::PetscVec, DU::PetscVec)Computes the dual vectors corresponding to the bounds of the variables
Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
DL- dual variable vector for the lower boundsDU- dual variable vector for the upper bounds
Level: advanced
-seealso: , Tao, TaoComputeObjective(), TaoSetVariableBounds()
External Links
- PETSc Manual:
Tao/TaoComputeDualVariables
PETSc.LibPETSc.TaoComputeEqualityConstraints — Method
TaoComputeEqualityConstraints(petsclib::PetscLibType,tao::Tao, X::PetscVec, CE::PetscVec)Compute the variable bounds using the routine set by TaoSetEqualityConstraintsRoutine().
Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
X- point the equality constraints were evaluated onCE- vector of equality constraints evaluated at X
Level: developer
-seealso: , Tao, TaoSetEqualityConstraintsRoutine(), TaoComputeJacobianEquality(), TaoComputeInequalityConstraints()
External Links
- PETSc Manual:
Tao/TaoComputeEqualityConstraints
PETSc.LibPETSc.TaoComputeGradient — Method
TaoComputeGradient(petsclib::PetscLibType,tao::Tao, X::PetscVec, G::PetscVec)Computes the gradient of the objective function
Collective
Input Parameters:
tao- theTaocontextX- input vector
Output Parameter:
G- gradient vector
Options Database Keys:
-tao_test_gradient- compare the user provided gradient with one compute via finite differences to check for errors-tao_test_gradient_view- display the user provided gradient, the finite difference gradient and the difference between them to help users detect the location of errors in the user provided gradient
Level: developer
-seealso: , TaoComputeObjective(), TaoComputeObjectiveAndGradient(), TaoSetGradient()
External Links
- PETSc Manual:
Tao/TaoComputeGradient
PETSc.LibPETSc.TaoComputeHessian — Method
TaoComputeHessian(petsclib::PetscLibType,tao::Tao, X::PetscVec, H::PetscMat, Hpre::PetscMat)Computes the Hessian matrix that has been set with TaoSetHessian().
Collective
Input Parameters:
tao- the Tao solver contextX- input vector
Output Parameters:
H- Hessian matrixHpre- matrix used to construct the preconditioner, usually the same asH
Options Database Keys:
-tao_test_hessian- compare the user provided Hessian with one compute via finite differences to check for errors-tao_test_hessian <numerical value>- display entries in the difference between the user provided Hessian and finite difference Hessian that are greater than a certain value to help users detect errors-tao_test_hessian_view- display the user provided Hessian, the finite difference Hessian and the difference between them to help users detect the location of errors in the user provided Hessian
Level: developer
-seealso: , Tao, TaoComputeObjective(), TaoComputeObjectiveAndGradient(), TaoSetHessian()
External Links
- PETSc Manual:
Tao/TaoComputeHessian
PETSc.LibPETSc.TaoComputeInequalityConstraints — Method
TaoComputeInequalityConstraints(petsclib::PetscLibType,tao::Tao, X::PetscVec, CI::PetscVec)Compute the variable bounds using the routine set by TaoSetInequalityConstraintsRoutine().
Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
X- point the inequality constraints were evaluated onCI- vector of inequality constraints evaluated at X
Level: developer
-seealso: , Tao, TaoSetInequalityConstraintsRoutine(), TaoComputeJacobianInequality(), TaoComputeEqualityConstraints()
External Links
- PETSc Manual:
Tao/TaoComputeInequalityConstraints
PETSc.LibPETSc.TaoComputeJacobian — Method
TaoComputeJacobian(petsclib::PetscLibType,tao::Tao, X::PetscVec, J::PetscMat, Jpre::PetscMat)Computes the Jacobian matrix that has been set with TaoSetJacobianRoutine().
Collective
Input Parameters:
tao- the Tao solver contextX- input vector
Output Parameters:
J- Jacobian matrixJpre- matrix used to compute the preconditioner, often the same asJ
Level: developer
-seealso: , TaoComputeObjective(), TaoComputeObjectiveAndGradient(), TaoSetJacobianRoutine()
External Links
- PETSc Manual:
Tao/TaoComputeJacobian
PETSc.LibPETSc.TaoComputeJacobianDesign — Method
TaoComputeJacobianDesign(petsclib::PetscLibType,tao::Tao, X::PetscVec, J::PetscMat)Computes the Jacobian matrix that has been set with TaoSetJacobianDesignRoutine().
Collective
Input Parameters:
tao- the Tao solver contextX- input vector
Output Parameter:
J- Jacobian matrix
Level: developer
-seealso: , Tao, TaoComputeObjective(), TaoComputeObjectiveAndGradient(), TaoSetJacobianDesignRoutine(), TaoSetStateDesignIS()
External Links
- PETSc Manual:
Tao/TaoComputeJacobianDesign
PETSc.LibPETSc.TaoComputeJacobianEquality — Method
TaoComputeJacobianEquality(petsclib::PetscLibType,tao::Tao, X::PetscVec, J::PetscMat, Jpre::PetscMat)Computes the Jacobian matrix that has been set with TaoSetJacobianEqualityRoutine().
Collective
Input Parameters:
tao- theTaosolver contextX- input vector
Output Parameters:
J- Jacobian matrixJpre- matrix used to construct the preconditioner, often the same asJ
Level: developer
-seealso: , TaoComputeObjective(), TaoComputeObjectiveAndGradient(), TaoSetJacobianStateRoutine(), TaoComputeJacobianDesign(), TaoSetStateDesignIS()
External Links
- PETSc Manual:
Tao/TaoComputeJacobianEquality
PETSc.LibPETSc.TaoComputeJacobianInequality — Method
TaoComputeJacobianInequality(petsclib::PetscLibType,tao::Tao, X::PetscVec, J::PetscMat, Jpre::PetscMat)Computes the Jacobian matrix that has been set with TaoSetJacobianInequalityRoutine().
Collective
Input Parameters:
tao- theTaosolver contextX- input vector
Output Parameters:
J- Jacobian matrixJpre- matrix used to construct the preconditioner
Level: developer
-seealso: , Tao, TaoComputeObjective(), TaoComputeObjectiveAndGradient(), TaoSetJacobianStateRoutine(), TaoComputeJacobianDesign(), TaoSetStateDesignIS()
External Links
- PETSc Manual:
Tao/TaoComputeJacobianInequality
PETSc.LibPETSc.TaoComputeJacobianState — Method
TaoComputeJacobianState(petsclib::PetscLibType,tao::Tao, X::PetscVec, J::PetscMat, Jpre::PetscMat, Jinv::PetscMat)Computes the Jacobian matrix that has been set with TaoSetJacobianStateRoutine().
Collective
Input Parameters:
tao- theTaosolver contextX- input vector
Output Parameters:
J- Jacobian matrixJpre- matrix used to construct the preconditioner, often the same asJJinv- unknown
Level: developer
-seealso: , Tao, TaoComputeObjective(), TaoComputeObjectiveAndGradient(), TaoSetJacobianStateRoutine(), TaoComputeJacobianDesign(), TaoSetStateDesignIS()
External Links
- PETSc Manual:
Tao/TaoComputeJacobianState
PETSc.LibPETSc.TaoComputeObjective — Method
f::PetscReal = TaoComputeObjective(petsclib::PetscLibType,tao::Tao, X::PetscVec)Computes the objective function value at a given point
Collective
Input Parameters:
tao- theTaocontextX- input vector
Output Parameter:
f- Objective value at X
Level: developer
-seealso: , Tao, TaoComputeGradient(), TaoComputeObjectiveAndGradient(), TaoSetObjective()
External Links
- PETSc Manual:
Tao/TaoComputeObjective
PETSc.LibPETSc.TaoComputeObjectiveAndGradient — Method
f::PetscReal = TaoComputeObjectiveAndGradient(petsclib::PetscLibType,tao::Tao, X::PetscVec, G::PetscVec)Computes the objective function value at a given point
Collective
Input Parameters:
tao- theTaocontextX- input vector
Output Parameters:
f- Objective value atXG- Gradient vector atX
Level: developer
-seealso: , TaoComputeGradient(), TaoSetObjective()
External Links
- PETSc Manual:
Tao/TaoComputeObjectiveAndGradient
PETSc.LibPETSc.TaoComputeResidual — Method
TaoComputeResidual(petsclib::PetscLibType,tao::Tao, X::PetscVec, F::PetscVec)Computes a least
Collective
Input Parameters:
tao- theTaocontextX- input vector
Output Parameter:
F- Objective vector atX
Level: advanced
-seealso: , Tao, TaoSetResidualRoutine()
External Links
- PETSc Manual:
Tao/TaoComputeResidual
PETSc.LibPETSc.TaoComputeResidualJacobian — Method
TaoComputeResidualJacobian(petsclib::PetscLibType,tao::Tao, X::PetscVec, J::PetscMat, Jpre::PetscMat)Computes the least set with TaoSetJacobianResidual().
Collective
Input Parameters:
tao- the Tao solver contextX- input vector
Output Parameters:
J- Jacobian matrixJpre- matrix used to compute the preconditioner, often the same asJ
Level: developer
-seealso: , Tao, TaoComputeResidual(), TaoSetJacobianResidual()
External Links
- PETSc Manual:
Tao/TaoComputeResidualJacobian
PETSc.LibPETSc.TaoComputeVariableBounds — Method
TaoComputeVariableBounds(petsclib::PetscLibType,tao::Tao)Compute the variable bounds using the routine set by TaoSetVariableBoundsRoutine().
Collective
Input Parameter:
tao- theTaocontext
Level: developer
-seealso: , Tao, TaoSetVariableBoundsRoutine(), TaoSetVariableBounds()
External Links
- PETSc Manual:
Tao/TaoComputeVariableBounds
PETSc.LibPETSc.TaoCreate — Method
newtao::Tao = TaoCreate(petsclib::PetscLibType,comm::MPI_Comm)Creates a Tao solver
Collective
Input Parameter:
comm- MPI communicator
Output Parameter:
newtao- the newTaocontext
Options Database Key:
-tao_type- select which method Tao should use
Level: beginner
-seealso: , Tao, TaoSolve(), TaoDestroy(), TaoSetFromOptions(), TaoSetType()
External Links
- PETSc Manual:
Tao/TaoCreate
PETSc.LibPETSc.TaoDefaultComputeGradient — Method
TaoDefaultComputeGradient(petsclib::PetscLibType,tao::Tao, Xin::PetscVec, G::PetscVec, dummy::Cvoid)computes the gradient using finite differences.
Collective
Input Parameters:
tao- the Tao contextXin- compute gradient at this pointdummy- not used
Output Parameter:
G- Gradient Vector
Options Database Key:
-tao_fd_gradient- activates TaoDefaultComputeGradient()-tao_fd_delta <delta>- change in X used to calculate finite differences
Level: advanced
-seealso: Tao, TaoSetGradient()
External Links
- PETSc Manual:
Tao/TaoDefaultComputeGradient
PETSc.LibPETSc.TaoDefaultComputeHessian — Method
TaoDefaultComputeHessian(petsclib::PetscLibType,tao::Tao, V::PetscVec, H::PetscMat, B::PetscMat, dummy::Cvoid)Computes the Hessian using finite differences.
Collective
Input Parameters:
tao- the Tao contextV- compute Hessian at this pointdummy- not used
Output Parameters:
H- Hessian matrix (not altered in this routine)B- newly computed Hessian matrix to use with preconditioner (generally the same as H)
Options Database Key:
-tao_fd_hessian- activates TaoDefaultComputeHessian()
Level: advanced
-seealso: Tao, TaoSetHessian(), TaoDefaultComputeHessianColor(), SNESComputeJacobianDefault(), TaoSetGradient(), TaoDefaultComputeGradient()
External Links
- PETSc Manual:
Tao/TaoDefaultComputeHessian
PETSc.LibPETSc.TaoDefaultComputeHessianColor — Method
TaoDefaultComputeHessianColor(petsclib::PetscLibType,tao::Tao, V::PetscVec, H::PetscMat, B::PetscMat, ctx::Cvoid)Computes the Hessian using colored finite differences.
Collective
Input Parameters:
tao- the Tao contextV- compute Hessian at this pointctx- the color object of typeMatFDColoring
Output Parameters:
H- Hessian matrix (not altered in this routine)B- newly computed Hessian matrix to use with preconditioner (generally the same as H)
Level: advanced
-seealso: Tao, MatColoring, TaoSetHessian(), TaoDefaultComputeHessian(), SNESComputeJacobianDefaultColor(), TaoSetGradient()
External Links
- PETSc Manual:
Tao/TaoDefaultComputeHessianColor
PETSc.LibPETSc.TaoDefaultComputeHessianMFFD — Method
TaoDefaultComputeHessianMFFD(petsclib::PetscLibType,tao::Tao, X::PetscVec, H::PetscMat, B::PetscMat, ctx::Cvoid)External Links
- PETSc Manual:
Tao/TaoDefaultComputeHessianMFFD
PETSc.LibPETSc.TaoDefaultConvergenceTest — Method
TaoDefaultConvergenceTest(petsclib::PetscLibType,tao::Tao, dummy::Cvoid)Determines whether the solver should continue iterating or terminate.
Collective
Input Parameters:
tao- theTaocontextdummy- unused dummy context
Level: developer
-seealso: , Tao, TaoSetTolerances(), TaoGetConvergedReason(), TaoSetConvergedReason()
External Links
- PETSc Manual:
Tao/TaoDefaultConvergenceTest
PETSc.LibPETSc.TaoDestroy — Method
TaoDestroy(petsclib::PetscLibType,tao::Tao)Destroys the Tao context that was created with TaoCreate()
Collective
Input Parameter:
tao- theTaocontext
Level: beginner
-seealso: , Tao, TaoCreate(), TaoSolve()
External Links
- PETSc Manual:
Tao/TaoDestroy
PETSc.LibPETSc.TaoEstimateActiveBounds — Method
bound_tol::PetscReal = TaoEstimateActiveBounds(petsclib::PetscLibType,X::PetscVec, XL::PetscVec, XU::PetscVec, G::PetscVec, S::PetscVec, W::PetscVec, steplen::PetscReal, active_lower::IS, active_upper::IS, active_fixed::IS, active::IS, inactive::IS)Generates index sets for variables at the lower and upper bounds, as well as fixed variables where lower and upper bounds equal each other.
Input Parameters:
X- solution vectorXL- lower bound vectorXU- upper bound vectorG- unprojected gradientS- step direction with which the active bounds will be estimatedW- work vector of type and size ofXsteplen- the step length at which the active bounds will be estimated (needs to be conservative)
Output Parameters:
bound_tol- tolerance for the bound estimationactive_lower- index set for active variables at the lower boundactive_upper- index set for active variables at the upper boundactive_fixed- index set for fixed variablesactive- index set for all active variablesinactive- complementary index set for inactive variables
Level: developer
-seealso: TAOBNCG, TAOBNTL, TAOBNTR, TaoBoundSolution()
External Links
- PETSc Manual:
Tao/TaoEstimateActiveBounds
PETSc.LibPETSc.TaoFinalizePackage — Method
TaoFinalizePackage(petsclib::PetscLibType)This function destroys everything in the PETSc/Tao interface to the Tao package. It is called from PetscFinalize().
Level: developer
-seealso: TaoInitializePackage(), PetscFinalize(), TaoRegister(), TaoRegisterAll()
External Links
- PETSc Manual:
Tao/TaoFinalizePackage
PETSc.LibPETSc.TaoGetADMMParentTao — Method
TaoGetADMMParentTao(petsclib::PetscLibType,tao::Tao, admm_tao::Tao)Gets pointer to parent TAOADMM, used by inner subsolver.
Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
admm_tao- the parentTaocontext
Level: advanced
-seealso: TAOADMM
External Links
- PETSc Manual:
Tao/TaoGetADMMParentTao
PETSc.LibPETSc.TaoGetApplicationContext — Method
TaoGetApplicationContext(petsclib::PetscLibType,tao::Tao, ctx::PeCtx)Gets the user
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
ctx- a pointer to the user context
Level: intermediate
-seealso: , Tao, TaoSetApplicationContext()
External Links
- PETSc Manual:
Tao/TaoGetApplicationContext
PETSc.LibPETSc.TaoGetConstraintTolerances — Method
catol::PetscReal,crtol::PetscReal = TaoGetConstraintTolerances(petsclib::PetscLibType,tao::Tao)Gets constraint tolerance parameters used in TaoSolve() convergence tests
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
catol- absolute constraint tolerance, constraint norm must be less thancatolfor used forgatolconvergence criteriacrtol- relative constraint tolerance, constraint norm must be less thancrtolfor used forgatol,gttolconvergence criteria
Level: intermediate
-seealso: , Tao, TaoConvergedReasons,TaoGetTolerances(), TaoSetTolerances(), TaoSetConstraintTolerances()
External Links
- PETSc Manual:
Tao/TaoGetConstraintTolerances
PETSc.LibPETSc.TaoGetConvergedReason — Method
TaoGetConvergedReason(petsclib::PetscLibType,tao::Tao, reason::TaoConvergedReason)Gets the reason the TaoSolve() was stopped.
Not Collective
Input Parameter:
tao- theTaosolver context
Output Parameter:
reason- value ofTaoConvergedReason
Level: intermediate
-seealso: , Tao, TaoConvergedReason, TaoSetConvergenceTest(), TaoSetTolerances()
External Links
- PETSc Manual:
Tao/TaoGetConvergedReason
PETSc.LibPETSc.TaoGetConvergenceHistory — Method
obj::PetscReal,resid::PetscReal,cnorm::PetscReal,lits::PetscInt,nhist::PetscInt = TaoGetConvergenceHistory(petsclib::PetscLibType,tao::Tao)Gets the arrays used that hold the convergence history.
Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
obj- array used to hold objective value historyresid- array used to hold residual historycnorm- array used to hold constraint violation historylits- integer array used to hold linear solver iteration countnhist- size ofobj,resid,cnorm, andlits
Level: advanced
-seealso: , Tao, TaoSolve(), TaoSetConvergenceHistory()
External Links
- PETSc Manual:
Tao/TaoGetConvergenceHistory
PETSc.LibPETSc.TaoGetCurrentFunctionEvaluations — Method
nfuncs::PetscInt = TaoGetCurrentFunctionEvaluations(petsclib::PetscLibType,tao::Tao)Get current number of function evaluations used by a Tao object
Not Collective
Input Parameter:
tao- theTaosolver context
Output Parameter:
nfuncs- the current number of function evaluations (maximum between gradient and function evaluations)
Level: intermediate
-seealso: , Tao, TaoSetMaximumFunctionEvaluations(), TaoGetMaximumFunctionEvaluations(), TaoGetMaximumIterations()
External Links
- PETSc Manual:
Tao/TaoGetCurrentFunctionEvaluations
PETSc.LibPETSc.TaoGetCurrentTrustRegionRadius — Method
radius::PetscReal = TaoGetCurrentTrustRegionRadius(petsclib::PetscLibType,tao::Tao)Gets the current trust region radius.
Not Collective
Input Parameter:
tao- aTaooptimization solver
Output Parameter:
radius- the trust region radius
Level: intermediate
-seealso: , Tao, TaoSetInitialTrustRegionRadius(), TaoGetInitialTrustRegionRadius(), TAONTR
External Links
- PETSc Manual:
Tao/TaoGetCurrentTrustRegionRadius
PETSc.LibPETSc.TaoGetDualVariables — Method
TaoGetDualVariables(petsclib::PetscLibType,tao::Tao, DE::PetscVec, DI::PetscVec)Gets the dual vectors
Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
DE- dual variable vector for the lower boundsDI- dual variable vector for the upper bounds
Level: advanced
-seealso: , Tao, TaoComputeDualVariables()
External Links
- PETSc Manual:
Tao/TaoGetDualVariables
PETSc.LibPETSc.TaoGetFunctionLowerBound — Method
fmin::PetscReal = TaoGetFunctionLowerBound(petsclib::PetscLibType,tao::Tao)Gets the bound on the solution objective value. When an approximate solution with an objective value below this number has been found, the solver will terminate.
Not Collective
Input Parameter:
tao- theTaosolver context
Output Parameter:
fmin- the minimum function value
Level: intermediate
-seealso: , Tao, TaoConvergedReason, TaoSetFunctionLowerBound()
External Links
- PETSc Manual:
Tao/TaoGetFunctionLowerBound
PETSc.LibPETSc.TaoGetGradientNorm — Method
TaoGetGradientNorm(petsclib::PetscLibType,tao::Tao, M::PetscMat)Returns the matrix used to define the norm used for measuring the size of the gradient in some of the Tao algorithms
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
M- gradient norm
Level: beginner
-seealso: , Tao, TaoSetGradientNorm(), TaoGradientNorm()
External Links
- PETSc Manual:
Tao/TaoGetGradientNorm
PETSc.LibPETSc.TaoGetInequalityBounds — Method
TaoGetInequalityBounds(petsclib::PetscLibType,tao::Tao, IL::PetscVec, IU::PetscVec)Gets the upper and lower bounds set via TaoSetInequalityBounds()
Logically Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
IL- vector of lower boundsIU- vector of upper bounds
Level: beginner
-seealso: , TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoSetInequalityBounds()
External Links
- PETSc Manual:
Tao/TaoGetInequalityBounds
PETSc.LibPETSc.TaoGetInitialTrustRegionRadius — Method
radius::PetscReal = TaoGetInitialTrustRegionRadius(petsclib::PetscLibType,tao::Tao)Gets the initial trust region radius.
Not Collective
Input Parameter:
tao- aTaooptimization solver
Output Parameter:
radius- the trust region radius
Level: intermediate
-seealso: , Tao, TaoSetInitialTrustRegionRadius(), TaoGetCurrentTrustRegionRadius(), TAONTR
External Links
- PETSc Manual:
Tao/TaoGetInitialTrustRegionRadius
PETSc.LibPETSc.TaoGetIterationNumber — Method
iter::PetscInt = TaoGetIterationNumber(petsclib::PetscLibType,tao::Tao)Gets the number of TaoSolve() iterations completed at this time.
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
iter- iteration number
-seealso: , Tao, TaoGetLinearSolveIterations(), TaoGetResidualNorm(), TaoGetObjective()
External Links
- PETSc Manual:
Tao/TaoGetIterationNumber
PETSc.LibPETSc.TaoGetKSP — Method
TaoGetKSP(petsclib::PetscLibType,tao::Tao, ksp::PetscKSP)Gets the linear solver used by the optimization solver.
Not Collective
Input Parameter:
tao- theTaosolver
Output Parameter:
ksp- theKSPlinear solver used in the optimization solver
Level: intermediate
External Links
- PETSc Manual:
Tao/TaoGetKSP
PETSc.LibPETSc.TaoGetLMVMMatrix — Method
TaoGetLMVMMatrix(petsclib::PetscLibType,tao::Tao, B::PetscMat)Returns a pointer to the internal LMVM matrix. Valid only for quasi-Newton family of methods.
Input Parameter:
tao-Taosolver context
Output Parameter:
B- LMVM matrix
Level: advanced
-seealso: TAOBQNLS, TAOBQNKLS, TAOBQNKTL, TAOBQNKTR, MATLMVM, TaoSetLMVMMatrix()
External Links
- PETSc Manual:
Tao/TaoGetLMVMMatrix
PETSc.LibPETSc.TaoGetLineSearch — Method
TaoGetLineSearch(petsclib::PetscLibType,tao::Tao, ls::TaoLineSearch)Gets the line search used by the optimization solver.
Not Collective
Input Parameter:
tao- theTaosolver
Output Parameter:
ls- the line search used in the optimization solver
Level: intermediate
-seealso: , Tao, TaoLineSearch, TaoLineSearchType
External Links
- PETSc Manual:
Tao/TaoGetLineSearch
PETSc.LibPETSc.TaoGetLinearSolveIterations — Method
lits::PetscInt = TaoGetLinearSolveIterations(petsclib::PetscLibType,tao::Tao)Gets the total number of linear iterations used by the Tao solver
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
lits- number of linear iterations
Level: intermediate
External Links
- PETSc Manual:
Tao/TaoGetLinearSolveIterations
PETSc.LibPETSc.TaoGetMaximumFunctionEvaluations — Method
nfcn::PetscInt = TaoGetMaximumFunctionEvaluations(petsclib::PetscLibType,tao::Tao)Gets a maximum number of function evaluations allowed for a TaoSolve()
Logically Collective
Input Parameter:
tao- theTaosolver context
Output Parameter:
nfcn- the maximum number of function evaluations
Level: intermediate
-seealso: , Tao, TaoSetMaximumFunctionEvaluations(), TaoGetMaximumIterations()
External Links
- PETSc Manual:
Tao/TaoGetMaximumFunctionEvaluations
PETSc.LibPETSc.TaoGetMaximumIterations — Method
maxits::PetscInt = TaoGetMaximumIterations(petsclib::PetscLibType,tao::Tao)Gets a maximum number of iterates that will be used
Not Collective
Input Parameter:
tao- theTaosolver context
Output Parameter:
maxits- the maximum number of iterates
Level: intermediate
-seealso: , Tao, TaoSetMaximumIterations(), TaoGetMaximumFunctionEvaluations()
External Links
- PETSc Manual:
Tao/TaoGetMaximumIterations
PETSc.LibPETSc.TaoGetOptionsPrefix — Method
TaoGetOptionsPrefix(petsclib::PetscLibType,tao::Tao, p::String)Gets the prefix used for searching for all Tao options in the database
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
p- pointer to the prefix string used is returned
Level: advanced
-seealso: , Tao, TaoSetFromOptions(), TaoSetOptionsPrefix(), TaoAppendOptionsPrefix()
External Links
- PETSc Manual:
Tao/TaoGetOptionsPrefix
PETSc.LibPETSc.TaoGetRecycleHistory — Method
recycle::PetscBool = TaoGetRecycleHistory(petsclib::PetscLibType,tao::Tao)Retrieve the boolean flag for re from the previous TaoSolve(). This feature is disabled by default.
Logically Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
recycle- boolean flag
Level: intermediate
-seealso: , Tao, TaoSetRecycleHistory(), TAOBNCG, TAOBQNLS, TAOBQNKLS, TAOBQNKTR, TAOBQNKTL
External Links
- PETSc Manual:
Tao/TaoGetRecycleHistory
PETSc.LibPETSc.TaoGetResidualNorm — Method
value::PetscReal = TaoGetResidualNorm(petsclib::PetscLibType,tao::Tao)Gets the current value of the norm of the residual (gradient) at this time.
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
value- the current value
Level: intermediate
-seealso: , Tao, TaoGetLinearSolveIterations(), TaoGetIterationNumber(), TaoGetObjective()
External Links
- PETSc Manual:
Tao/TaoGetResidualNorm
PETSc.LibPETSc.TaoGetSolution — Method
TaoGetSolution(petsclib::PetscLibType,tao::Tao, X::PetscVec)Returns the vector with the current solution from the Tao object
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
X- the current solution
Level: intermediate
-seealso: , Tao, TaoSetSolution(), TaoSolve()
External Links
- PETSc Manual:
Tao/TaoGetSolution
PETSc.LibPETSc.TaoGetSolutionStatus — Method
its::PetscInt,f::PetscReal,gnorm::PetscReal,cnorm::PetscReal,xdiff::PetscReal = TaoGetSolutionStatus(petsclib::PetscLibType,tao::Tao, reason::TaoConvergedReason)Get the current iterate, objective value, residual, infeasibility, and termination from a Tao object
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
its- the current iterate number (>=0)f- the current function valuegnorm- the square of the gradient norm, duality gap, or other measure indicating distance from optimality.cnorm- the infeasibility of the current solution with regard to the constraints.xdiff- the step length or trust region radius of the most recent iterate.reason- The termination reason, which can equalTAO_CONTINUE_ITERATING
Level: intermediate
-seealso: , TaoMonitor(), TaoGetConvergedReason()
External Links
- PETSc Manual:
Tao/TaoGetSolutionStatus
PETSc.LibPETSc.TaoGetTolerances — Method
gatol::PetscReal,grtol::PetscReal,gttol::PetscReal = TaoGetTolerances(petsclib::PetscLibType,tao::Tao)gets the current values of some tolerances used for the convergence testing of TaoSolve()
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
gatol- stop if norm of gradient is less than thisgrtol- stop if relative norm of gradient is less than thisgttol- stop if norm of gradient is reduced by a this factor
Level: intermediate
-seealso: , Tao, TaoSetTolerances()
External Links
- PETSc Manual:
Tao/TaoGetTolerances
PETSc.LibPETSc.TaoGetTotalIterationNumber — Method
iter::PetscInt = TaoGetTotalIterationNumber(petsclib::PetscLibType,tao::Tao)Gets the total number of TaoSolve() iterations completed. This number keeps accumulating if multiple solves are called with the Tao object.
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
iter- number of iterations
Level: intermediate
-seealso: , Tao, TaoGetLinearSolveIterations()
External Links
- PETSc Manual:
Tao/TaoGetTotalIterationNumber
PETSc.LibPETSc.TaoGetType — Method
type::TaoType = TaoGetType(petsclib::PetscLibType,tao::Tao)Gets the current TaoType being used in the Tao object
Not Collective
Input Parameter:
tao- theTaosolver context
Output Parameter:
type- theTaoType
Level: intermediate
-seealso: , Tao, TaoType, TaoSetType()
External Links
- PETSc Manual:
Tao/TaoGetType
PETSc.LibPETSc.TaoGetVariableBounds — Method
TaoGetVariableBounds(petsclib::PetscLibType,tao::Tao, XL::PetscVec, XU::PetscVec)Gets the upper and lower bounds vectors set with TaoSetVariableBounds()
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameters:
XL- vector of lower boundsXU- vector of upper bounds
Level: beginner
-seealso: , Tao, TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoSetVariableBounds()
External Links
- PETSc Manual:
Tao/TaoGetVariableBounds
PETSc.LibPETSc.TaoGradientNorm — Method
gnorm::PetscReal = TaoGradientNorm(petsclib::PetscLibType,tao::Tao, gradient::PetscVec, type::NormType)Compute the norm using the NormType, the user has selected
Collective
Input Parameters:
tao- theTaocontextgradient- the gradienttype- the norm type
Output Parameter:
gnorm- the gradient norm
Level: advanced
-seealso: , Tao, TaoSetGradientNorm(), TaoGetGradientNorm()
External Links
- PETSc Manual:
Tao/TaoGradientNorm
PETSc.LibPETSc.TaoInitializePackage — Method
TaoInitializePackage(petsclib::PetscLibType)This function sets up PETSc to use the Tao package. When using static or shared libraries, this function is called from the first entry to TaoCreate(); when using shared or static libraries, it is called from PetscDLLibraryRegister_tao()
Level: developer
-seealso: TaoCreate(), TaoFinalizePackage(), TaoRegister(), TaoRegisterAll()
External Links
- PETSc Manual:
Tao/TaoInitializePackage
PETSc.LibPETSc.TaoIsGradientDefined — Method
flg::PetscBool = TaoIsGradientDefined(petsclib::PetscLibType,tao::Tao)Checks to see if the user has declared an objective-only routine. Useful for determining when it is appropriate to call TaoComputeGradient() or TaoComputeGradientAndGradient()
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
flg-PETSC_TRUEif function routine is set by user,PETSC_FALSEotherwise
Level: developer
-seealso: , TaoSetGradient(), TaoIsObjectiveDefined(), TaoIsObjectiveAndGradientDefined()
External Links
- PETSc Manual:
Tao/TaoIsGradientDefined
PETSc.LibPETSc.TaoIsObjectiveAndGradientDefined — Method
flg::PetscBool = TaoIsObjectiveAndGradientDefined(petsclib::PetscLibType,tao::Tao)Checks to see if the user has declared a joint objective/gradient routine. Useful for determining when it is appropriate to call TaoComputeObjective() or TaoComputeObjectiveAndGradient()
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
flg-PETSC_TRUEif function routine is set by user,PETSC_FALSEotherwise
Level: developer
-seealso: , TaoSetObjectiveAndGradient(), TaoIsObjectiveDefined(), TaoIsGradientDefined()
External Links
- PETSc Manual:
Tao/TaoIsObjectiveAndGradientDefined
PETSc.LibPETSc.TaoIsObjectiveDefined — Method
flg::PetscBool = TaoIsObjectiveDefined(petsclib::PetscLibType,tao::Tao)Checks to see if the user has declared an objective-only routine. Useful for determining when it is appropriate to call TaoComputeObjective() or TaoComputeObjectiveAndGradient()
Not Collective
Input Parameter:
tao- theTaocontext
Output Parameter:
flg-PETSC_TRUEif function routine is set by user,PETSC_FALSEotherwise
Level: developer
-seealso: , Tao, TaoSetObjective(), TaoIsGradientDefined(), TaoIsObjectiveAndGradientDefined()
External Links
- PETSc Manual:
Tao/TaoIsObjectiveDefined
PETSc.LibPETSc.TaoKSPSetUseEW — Method
TaoKSPSetUseEW(petsclib::PetscLibType,tao::Tao, flag::PetscBool)Sets SNES to use Eisenstat
Logically Collective
Input Parameters:
tao- Tao contextflag-PETSC_TRUEorPETSC_FALSE
Level: advanced
-seealso: , Tao, SNESKSPSetUseEW()
External Links
- PETSc Manual:
Tao/TaoKSPSetUseEW
PETSc.LibPETSc.TaoLMVMGetH0 — Method
TaoLMVMGetH0(petsclib::PetscLibType,tao::Tao, H0::PetscMat)Get the matrix object for the QN initial Hessian
Input Parameter:
tao- theTaosolver context
Output Parameter:
H0-Matobject for the initial Hessian
Level: advanced
-seealso: Tao, TAOLMVM, TAOBLMVM, TaoLMVMSetH0(), TaoLMVMGetH0KSP()
External Links
- PETSc Manual:
Tao/TaoLMVMGetH0
PETSc.LibPETSc.TaoLMVMGetH0KSP — Method
TaoLMVMGetH0KSP(petsclib::PetscLibType,tao::Tao, ksp::PetscKSP)Get the iterative solver for applying the inverse of the QN initial Hessian
Input Parameter:
tao- theTaosolver context
Output Parameter:
ksp-KSPsolver context for the initial Hessian
Level: advanced
-seealso: Tao, TAOLMVM, TAOBLMVM, TaoLMVMGetH0()
External Links
- PETSc Manual:
Tao/TaoLMVMGetH0KSP
PETSc.LibPETSc.TaoLMVMRecycle — Method
TaoLMVMRecycle(petsclib::PetscLibType,tao::Tao, flg::PetscBool)Enable/disable recycling of the QN history between subsequent TaoSolve() calls.
Input Parameters:
tao- theTaosolver contextflg- Boolean flag for recycling (PETSC_TRUEorPETSC_FALSE)
Level: intermediate
-seealso: Tao, TAOLMVM, TAOBLMVM
External Links
- PETSc Manual:
Tao/TaoLMVMRecycle
PETSc.LibPETSc.TaoLMVMSetH0 — Method
TaoLMVMSetH0(petsclib::PetscLibType,tao::Tao, H0::PetscMat)Set the initial Hessian for the QN approximation
Input Parameters:
tao- theTaosolver contextH0-Matobject for the initial Hessian
Level: advanced
-seealso: Tao, TAOLMVM, TAOBLMVM, TaoLMVMGetH0(), TaoLMVMGetH0KSP()
External Links
- PETSc Manual:
Tao/TaoLMVMSetH0
PETSc.LibPETSc.TaoMatGetSubMat — Method
TaoMatGetSubMat(petsclib::PetscLibType,M::PetscMat, is::IS, v1::PetscVec, subset_type::TaoSubsetType, Msub::PetscMat)Gets a submatrix using the IS
Input Parameters:
M- the full matrix (n x n)is- the index set for the submatrix (both row and column index sets need to be the same)v1- work vector of dimension n, needed forTAO_SUBSET_MASKoptionsubset_type- the methodTaois using for subsetting
Output Parameter:
Msub- the submatrix
Level: developer
-seealso: TaoVecGetSubVec(), TaoSubsetType
External Links
- PETSc Manual:
Tao/TaoMatGetSubMat
PETSc.LibPETSc.TaoMonitor — Method
TaoMonitor(petsclib::PetscLibType,tao::Tao, its::PetscInt, f::PetscReal, res::PetscReal, cnorm::PetscReal, steplength::PetscReal)Monitor the solver and the current solution. This routine will record the iteration number and residual statistics, and call any monitors specified by the user.
Input Parameters:
tao- theTaocontextits- the current iterate number (>=0)f- the current objective function valueres- the gradient norm, square root of the duality gap, or other measure indicating distance from optimality. This measure will be recorded and
used for some termination tests.
cnorm- the infeasibility of the current solution with regard to the constraints.steplength- multiple of the step direction added to the previous iterate.
Options Database Key:
-tao_monitor- Use the default monitor, which prints statistics to standard output
Level: developer
-seealso: , Tao, TaoGetConvergedReason(), TaoMonitorDefault(), TaoMonitorSet()
External Links
- PETSc Manual:
Tao/TaoMonitor
PETSc.LibPETSc.TaoMonitorCancel — Method
TaoMonitorCancel(petsclib::PetscLibType,tao::Tao)Clears all the monitor functions for a Tao object.
Logically Collective
Input Parameter:
tao- theTaosolver context
Options Database Key:
-tao_monitor_cancel- cancels all monitors that have been hardwired
into a code by calls to TaoMonitorSet(), but does not cancel those set via the options database
Level: advanced
-seealso: , Tao, TaoMonitorDefault(), TaoMonitorSet()
External Links
- PETSc Manual:
Tao/TaoMonitorCancel
PETSc.LibPETSc.TaoMonitorConstraintNorm — Method
TaoMonitorConstraintNorm(petsclib::PetscLibType,tao::Tao, ctx::Cvoid)same as TaoMonitorDefault() except it prints the norm of the constraint function.
Collective
Input Parameters:
tao- theTaocontextctx-PetscViewercontext orNULL
Options Database Key:
-tao_monitor_constraint_norm- monitor the constraints
Level: advanced
-seealso: , Tao, TaoMonitorDefault(), TaoMonitorSet()
External Links
- PETSc Manual:
Tao/TaoMonitorConstraintNorm
PETSc.LibPETSc.TaoMonitorDefault — Method
TaoMonitorDefault(petsclib::PetscLibType,tao::Tao, ctx::Cvoid)Default routine for monitoring progress of TaoSolve()
Collective
Input Parameters:
tao- theTaocontextctx-PetscViewercontext orNULL
Options Database Key:
-tao_monitor- turn on default monitoring
Level: advanced
-seealso: , Tao, TaoMonitorDefaultShort(), TaoMonitorSet()
External Links
- PETSc Manual:
Tao/TaoMonitorDefault
PETSc.LibPETSc.TaoMonitorDefaultShort — Method
TaoMonitorDefaultShort(petsclib::PetscLibType,tao::Tao, ctx::Cvoid)Routine for monitoring progress of TaoSolve() that displays fewer digits than TaoMonitorDefault()
Collective
Input Parameters:
tao- theTaocontextctx-PetscViewercontext of typePETSCVIEWERASCII
Options Database Key:
-tao_monitor_short- turn on default short monitoring
Level: advanced
-seealso: , Tao, TaoMonitorDefault(), TaoMonitorSet()
External Links
- PETSc Manual:
Tao/TaoMonitorDefaultShort
PETSc.LibPETSc.TaoMonitorGlobalization — Method
TaoMonitorGlobalization(petsclib::PetscLibType,tao::Tao, ctx::Cvoid)Default routine for monitoring progress of TaoSolve() with extra detail on the globalization method.
Collective
Input Parameters:
tao- theTaocontextctx-PetscViewercontext orNULL
Options Database Key:
-tao_monitor_globalization- turn on monitoring with globalization information
Level: advanced
-seealso: , Tao, TaoMonitorDefaultShort(), TaoMonitorSet()
External Links
- PETSc Manual:
Tao/TaoMonitorGlobalization
PETSc.LibPETSc.TaoMonitorGradient — Method
TaoMonitorGradient(petsclib::PetscLibType,tao::Tao, ctx::Cvoid)Views the gradient at each iteration of TaoSolve()
Collective
Input Parameters:
tao- theTaocontextctx-PetscViewercontext orNULL
Options Database Key:
-tao_monitor_gradient- view the gradient at each iteration
Level: advanced
-seealso: , Tao, TaoMonitorDefaultShort(), TaoMonitorSet()
External Links
- PETSc Manual:
Tao/TaoMonitorGradient
PETSc.LibPETSc.TaoMonitorGradientDraw — Method
TaoMonitorGradientDraw(petsclib::PetscLibType,tao::Tao, ctx::Cvoid)Plots the gradient at each iteration of TaoSolve()
Collective
Input Parameters:
tao- theTaocontextctx-PetscViewercontext
Options Database Key:
-tao_monitor_gradient_draw- draw the gradient at each iteration
Level: advanced
-seealso: , Tao, TaoMonitorGradient(), TaoMonitorSet(), TaoMonitorSolutionDraw()
External Links
- PETSc Manual:
Tao/TaoMonitorGradientDraw
PETSc.LibPETSc.TaoMonitorResidual — Method
TaoMonitorResidual(petsclib::PetscLibType,tao::Tao, ctx::Cvoid)Views the least
Collective
Input Parameters:
tao- theTaocontextctx- thePetscViewercontext orNULL
Options Database Key:
-tao_monitor_ls_residual- view the residual at each iteration
Level: advanced
-seealso: , Tao, TaoMonitorDefaultShort(), TaoMonitorSet()
External Links
- PETSc Manual:
Tao/TaoMonitorResidual
PETSc.LibPETSc.TaoMonitorSet — Method
TaoMonitorSet(petsclib::PetscLibType,tao::Tao, func::external, ctx::Cvoid, dest::PetscCtxDestroyFn)Sets an additional function that is to be used at every iteration of the solver to display the iteration's progress.
Logically Collective
Input Parameters:
tao- theTaosolver contextfunc- monitoring routinectx- [optional] user-defined context for private data for the monitor routine (may beNULL)dest- [optional] function to destroy the context when theTaois destroyed, seePetscCtxDestroyFnfor the calling sequence
Calling sequence of func:
tao- theTaosolver contextctx- [optional] monitoring context
Level: intermediate
-seealso: , Tao, TaoSolve(), TaoMonitorDefault(), TaoMonitorCancel(), TaoSetDestroyRoutine(), TaoView(), PetscCtxDestroyFn
External Links
- PETSc Manual:
Tao/TaoMonitorSet
PETSc.LibPETSc.TaoMonitorSolution — Method
TaoMonitorSolution(petsclib::PetscLibType,tao::Tao, ctx::Cvoid)Views the solution at each iteration of TaoSolve()
Collective
Input Parameters:
tao- theTaocontextctx-PetscViewercontext orNULL
Options Database Key:
-tao_monitor_solution- view the solution
Level: advanced
-seealso: , Tao, TaoMonitorDefaultShort(), TaoMonitorSet()
External Links
- PETSc Manual:
Tao/TaoMonitorSolution
PETSc.LibPETSc.TaoMonitorSolutionDraw — Method
TaoMonitorSolutionDraw(petsclib::PetscLibType,tao::Tao, ctx::Cvoid)Plots the solution at each iteration of TaoSolve()
Collective
Input Parameters:
tao- theTaocontextctx-TaoMonitorDrawcontext
Options Database Key:
-tao_monitor_solution_draw- draw the solution at each iteration
Level: advanced
-seealso: , Tao, TaoMonitorSolution(), TaoMonitorSet(), TaoMonitorGradientDraw(), TaoMonitorDrawCtxCreate(), TaoMonitorDrawCtxDestroy()
External Links
- PETSc Manual:
Tao/TaoMonitorSolutionDraw
PETSc.LibPETSc.TaoMonitorStep — Method
TaoMonitorStep(petsclib::PetscLibType,tao::Tao, ctx::Cvoid)Views the step
Collective
Input Parameters:
tao- theTaocontextctx-PetscViewercontext orNULL
Options Database Key:
-tao_monitor_step- view the step vector at each iteration
Level: advanced
-seealso: , Tao, TaoMonitorDefaultShort(), TaoMonitorSet()
External Links
- PETSc Manual:
Tao/TaoMonitorStep
PETSc.LibPETSc.TaoMonitorStepDraw — Method
TaoMonitorStepDraw(petsclib::PetscLibType,tao::Tao, ctx::Cvoid)Plots the step direction at each iteration of TaoSolve()
Collective
Input Parameters:
tao- theTaocontextctx- thePetscViewercontext
Options Database Key:
-tao_monitor_step_draw- draw the step direction at each iteration
Level: advanced
-seealso: , Tao, TaoMonitorSet(), TaoMonitorSolutionDraw
External Links
- PETSc Manual:
Tao/TaoMonitorStepDraw
PETSc.LibPETSc.TaoParametersInitialize — Method
TaoParametersInitialize(petsclib::PetscLibType,tao::Tao)Sets all the parameters in tao to their default value (when TaoCreate() was called) if they currently contain default values. Default values are the parameter values when the object's type is set.
Collective
Input Parameter:
tao- theTaoobject
Level: developer
-seealso: , Tao, TaoSolve(), TaoDestroy(), PetscObjectParameterSetDefault()
External Links
- PETSc Manual:
Tao/TaoParametersInitialize
PETSc.LibPETSc.TaoPythonGetType — Method
pyname::String = TaoPythonGetType(petsclib::PetscLibType,tao::Tao)Get the type of a Tao object implemented in Python.
Not Collective
Input Parameter:
tao- the optimization solver (Tao) context.
Output Parameter:
pyname- full dotted Python name [package].module[.{class|function}]
Level: intermediate
-seealso: TaoCreate(), TaoSetType(), TaoPYTHON, PetscPythonInitialize(), TaoPythonSetType()
External Links
- PETSc Manual:
Tao/TaoPythonGetType
PETSc.LibPETSc.TaoPythonSetType — Method
TaoPythonSetType(petsclib::PetscLibType,tao::Tao, pyname::String)Initialize a Tao object implemented in Python.
Collective
Input Parameters:
tao- the optimization solver (Tao) context.pyname- full dotted Python name [package].module[.{class|function}]
Options Database Key:
-tao_python_type <pyname>- python class
Level: intermediate
-seealso: TaoCreate(), TaoSetType(), TAOPYTHON, PetscPythonInitialize()
External Links
- PETSc Manual:
Tao/TaoPythonSetType
PETSc.LibPETSc.TaoRegister — Method
TaoRegister(petsclib::PetscLibType,sname::String, func::external)Adds a method to the Tao package for minimization.
Not Collective, No Fortran Support
Input Parameters:
sname- name of a new user-defined solverfunc- routine to Create method context
-seealso: , Tao, TaoSetType(), TaoRegisterAll(), TaoRegisterDestroy()
External Links
- PETSc Manual:
Tao/TaoRegister
PETSc.LibPETSc.TaoRegisterDestroy — Method
TaoRegisterDestroy(petsclib::PetscLibType)Frees the list of minimization solvers that were registered by TaoRegister().
Not Collective
Level: advanced
-seealso: , Tao, TaoRegisterAll(), TaoRegister()
External Links
- PETSc Manual:
Tao/TaoRegisterDestroy
PETSc.LibPETSc.TaoResetStatistics — Method
TaoResetStatistics(petsclib::PetscLibType,tao::Tao)Initialize the statistics collected by the Tao object. These statistics include the iteration number, residual norms, and convergence status. This routine gets called before solving each optimization problem.
Collective
Input Parameter:
tao- theTaocontext
Level: developer
-seealso: , Tao, TaoCreate(), TaoSolve()
External Links
- PETSc Manual:
Tao/TaoResetStatistics
PETSc.LibPETSc.TaoSetApplicationContext — Method
TaoSetApplicationContext(petsclib::PetscLibType,tao::Tao, ctx::Cvoid)Sets the optional user Tao callback functions with TaoGetApplicationContext()
Logically Collective
Input Parameters:
tao- theTaocontextctx- the user context
Level: intermediate
-seealso: , Tao, TaoGetApplicationContext()
External Links
- PETSc Manual:
Tao/TaoSetApplicationContext
PETSc.LibPETSc.TaoSetConstraintTolerances — Method
TaoSetConstraintTolerances(petsclib::PetscLibType,tao::Tao, catol::PetscReal, crtol::PetscReal)Sets constraint tolerance parameters used in TaoSolve() convergence tests
Logically Collective
Input Parameters:
tao- theTaocontextcatol- absolute constraint tolerance, constraint norm must be less thancatolfor used forgatolconvergence criteriacrtol- relative constraint tolerance, constraint norm must be less thancrtolfor used forgatol,gttolconvergence criteria
Options Database Keys:
-tao_catol <catol>- Sets catol-tao_crtol <crtol>- Sets crtol
Level: intermediate
-seealso: , Tao, TaoConvergedReason, TaoGetTolerances(), TaoGetConstraintTolerances(), TaoSetTolerances()
External Links
- PETSc Manual:
Tao/TaoSetConstraintTolerances
PETSc.LibPETSc.TaoSetConstraintsRoutine — Method
TaoSetConstraintsRoutine(petsclib::PetscLibType,tao::Tao, c::PetscVec, func::external, ctx::Cvoid)Sets a function to be used to compute constraints. Tao only handles constraints under certain conditions, see for details
Logically Collective
Input Parameters:
tao- theTaocontextc- A vector that will be used to store constraint evaluationfunc- the bounds computation routinectx- [optional] user-defined context for private data for the constraints computation (may beNULL)
Calling sequence of func:
tao- theTaosolverx- point to evaluate constraintsc- vector constraints evaluated atxctx- the (optional) user-defined function context
Level: intermediate
-seealso: , Tao, TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoSetVariablevBounds()
External Links
- PETSc Manual:
Tao/TaoSetConstraintsRoutine
PETSc.LibPETSc.TaoSetConvergedReason — Method
TaoSetConvergedReason(petsclib::PetscLibType,tao::Tao, reason::TaoConvergedReason)Sets the termination flag on a Tao object
Logically Collective
Input Parameters:
tao- theTaocontextreason- theTaoConvergedReason
Level: intermediate
-seealso: , Tao, TaoConvergedReason
External Links
- PETSc Manual:
Tao/TaoSetConvergedReason
PETSc.LibPETSc.TaoSetConvergenceHistory — Method
TaoSetConvergenceHistory(petsclib::PetscLibType,tao::Tao, obj::Vector{PetscReal}, resid::Vector{PetscReal}, cnorm::Vector{PetscReal}, lits::Vector{PetscInt}, na::PetscInt, reset::PetscBool)Sets the array used to hold the convergence history.
Logically Collective
Input Parameters:
tao- theTaosolver contextobj- array to hold objective value historyresid- array to hold residual historycnorm- array to hold constraint violation historylits- integer array holds the number of linear iterations for each Tao iterationna- size ofobj,resid, andcnormreset-PETSC_TRUEindicates each new minimization resets the history counter to zero,
else it continues storing new values for new minimizations after the old ones
Level: intermediate
-seealso: , TaoGetConvergenceHistory()
External Links
- PETSc Manual:
Tao/TaoSetConvergenceHistory
PETSc.LibPETSc.TaoSetConvergenceTest — Method
TaoSetConvergenceTest(petsclib::PetscLibType,tao::Tao, conv::external, ctx::Cvoid)Sets the function that is to be used to test for convergence of the iterative minimization solution. The new convergence testing routine will replace Tao's default convergence test.
Logically Collective
Input Parameters:
tao- theTaoobjectconv- the routine to test for convergencectx- [optional] context for private data for the convergence routine
(may be NULL)
Calling sequence of conv:
tao- theTaoobjectctx- [optional] convergence context
Level: advanced
-seealso: , Tao, TaoSolve(), TaoSetConvergedReason(), TaoGetSolutionStatus(), TaoGetTolerances(), TaoMonitorSet()
External Links
- PETSc Manual:
Tao/TaoSetConvergenceTest
PETSc.LibPETSc.TaoSetEqualityConstraintsRoutine — Method
TaoSetEqualityConstraintsRoutine(petsclib::PetscLibType,tao::Tao, ce::PetscVec, func::external, ctx::Cvoid)Sets a function to be used to compute constraints. Tao only handles constraints under certain conditions, see for details
Logically Collective
Input Parameters:
tao- theTaocontextce- A vector that will be used to store equality constraint evaluationfunc- the bounds computation routinectx- [optional] user-defined context for private data for the equality constraints computation (may beNULL)
Calling sequence of func:
tao- theTaosolverx- point to evaluate equality constraintsce- vector of equality constraints evaluated at xctx- the (optional) user-defined function context
Level: intermediate
-seealso: , Tao, TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoSetVariableBounds()
External Links
- PETSc Manual:
Tao/TaoSetEqualityConstraintsRoutine
PETSc.LibPETSc.TaoSetFromOptions — Method
TaoSetFromOptions(petsclib::PetscLibType,tao::Tao)Sets various Tao parameters from the options database
Collective
Input Parameter:
tao- theTaosolver context
Options Database Keys:
-tao_type <type>- The algorithm that Tao uses (lmvm, nls, etc.)-tao_gatol <gatol>- absolute error tolerance for ||gradient||-tao_grtol <grtol>- relative error tolerance for ||gradient||-tao_gttol <gttol>- reduction of ||gradient|| relative to initial gradient-tao_max_it <max>- sets maximum number of iterations-tao_max_funcs <max>- sets maximum number of function evaluations-tao_fmin <fmin>- stop if function value reaches fmin-tao_steptol <tol>- stop if trust region radius less than <tol>-tao_trust0 <t>- initial trust region radius-tao_view_solution- view the solution at the end of the optimization process-tao_monitor- prints function value and residual norm at each iteration-tao_monitor_short- same as-tao_monitor, but truncates very small values-tao_monitor_constraint_norm- prints objective value, gradient, and constraint norm at each iteration-tao_monitor_globalization- prints information about the globalization at each iteration-tao_monitor_solution- prints solution vector at each iteration-tao_monitor_ls_residual- prints least-squares residual vector at each iteration-tao_monitor_step- prints step vector at each iteration-tao_monitor_gradient- prints gradient vector at each iteration-tao_monitor_solution_draw- graphically view solution vector at each iteration-tao_monitor_step_draw- graphically view step vector at each iteration-tao_monitor_gradient_draw- graphically view gradient at each iteration-tao_monitor_cancel- cancels all monitors (except those set with command line)-tao_fd_gradient- use gradient computed with finite differences-tao_fd_hessian- use hessian computed with finite differences-tao_mf_hessian- use matrix-free Hessian computed with finite differences-tao_view- prints information about the Tao after solving-tao_converged_reason- prints the reason Tao stopped iterating
Level: beginner
-seealso: , Tao, TaoCreate(), TaoSolve()
External Links
- PETSc Manual:
Tao/TaoSetFromOptions
PETSc.LibPETSc.TaoSetFunctionLowerBound — Method
TaoSetFunctionLowerBound(petsclib::PetscLibType,tao::Tao, fmin::PetscReal)Sets a bound on the solution objective value. When an approximate solution with an objective value below this number has been found, the solver will terminate.
Logically Collective
Input Parameters:
tao- the Tao solver contextfmin- the tolerance
Options Database Key:
-tao_fmin <fmin>- sets the minimum function value
Level: intermediate
-seealso: , Tao, TaoConvergedReason, TaoSetTolerances()
External Links
- PETSc Manual:
Tao/TaoSetFunctionLowerBound
PETSc.LibPETSc.TaoSetGradient — Method
TaoSetGradient(petsclib::PetscLibType,tao::Tao, g::PetscVec, func::external, ctx::Cvoid)Sets the gradient evaluation routine for the function to be optimized
Logically Collective
Input Parameters:
tao- theTaocontextg- [optional] the vector to internally hold the gradient computationfunc- the gradient functionctx- [optional] user-defined context for private data for the gradient evaluation
routine (may be NULL)
Calling sequence of func:
tao- the optimization solverx- input vectorg- gradient value (output)ctx- [optional] user-defined function context
Level: beginner
-seealso: , Tao, TaoSolve(), TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoGetGradient()
External Links
- PETSc Manual:
Tao/TaoSetGradient
PETSc.LibPETSc.TaoSetGradientNorm — Method
TaoSetGradientNorm(petsclib::PetscLibType,tao::Tao, M::PetscMat)Sets the matrix used to define the norm that measures the size of the gradient in some of the Tao algorithms
Collective
Input Parameters:
tao- theTaocontextM- matrix that defines the norm
Level: beginner
-seealso: , Tao, TaoGetGradientNorm(), TaoGradientNorm()
External Links
- PETSc Manual:
Tao/TaoSetGradientNorm
PETSc.LibPETSc.TaoSetHessian — Method
TaoSetHessian(petsclib::PetscLibType,tao::Tao, H::PetscMat, Hpre::PetscMat, func::external, ctx::Cvoid)Sets the function to compute the Hessian as well as the location to store the matrix.
Logically Collective
Input Parameters:
tao- theTaocontextH- Matrix used for the hessianHpre- Matrix that will be used to construct the preconditioner, can be same asHfunc- Hessian evaluation routinectx- [optional] user-defined context for private data for the
Hessian evaluation routine (may be NULL)
Calling sequence of func:
tao- theTaocontextx- input vectorH- Hessian matrixHpre- matrix used to construct the preconditioner, usually the same asHctx- [optional] user-defined Hessian context
Level: beginner
-seealso: , Tao, TaoTypes, TaoSetObjective(), TaoSetGradient(), TaoSetObjectiveAndGradient(), TaoGetHessian()
External Links
- PETSc Manual:
Tao/TaoSetHessian
PETSc.LibPETSc.TaoSetInequalityBounds — Method
TaoSetInequalityBounds(petsclib::PetscLibType,tao::Tao, IL::PetscVec, IU::PetscVec)Sets the upper and lower bounds
Logically Collective
Input Parameters:
tao- theTaocontextIL- vector of lower boundsIU- vector of upper bounds
Level: beginner
-seealso: , Tao, TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoGetInequalityBounds()
External Links
- PETSc Manual:
Tao/TaoSetInequalityBounds
PETSc.LibPETSc.TaoSetInequalityConstraintsRoutine — Method
TaoSetInequalityConstraintsRoutine(petsclib::PetscLibType,tao::Tao, ci::PetscVec, func::external, ctx::Cvoid)Sets a function to be used to compute constraints. Tao only handles constraints under certain conditions, see for details
Logically Collective
Input Parameters:
tao- theTaocontextci- A vector that will be used to store inequality constraint evaluationfunc- the bounds computation routinectx- [optional] user-defined context for private data for the inequality constraints computation (may beNULL)
Calling sequence of func:
tao- theTaosolverx- point to evaluate inequality constraintsci- vector of inequality constraints evaluated at xctx- the (optional) user-defined function context
Level: intermediate
-seealso: , Tao, TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoSetVariableBounds()
External Links
- PETSc Manual:
Tao/TaoSetInequalityConstraintsRoutine
PETSc.LibPETSc.TaoSetInitialTrustRegionRadius — Method
TaoSetInitialTrustRegionRadius(petsclib::PetscLibType,tao::Tao, radius::PetscReal)Sets the initial trust region radius.
Logically Collective
Input Parameters:
tao- aTaooptimization solverradius- the trust region radius
Options Database Key:
-tao_trust0 <t0>- sets initial trust region radius
Level: intermediate
-seealso: , Tao, TaoGetTrustRegionRadius(), TaoSetTrustRegionTolerance(), TAONTR
External Links
- PETSc Manual:
Tao/TaoSetInitialTrustRegionRadius
PETSc.LibPETSc.TaoSetIterationNumber — Method
TaoSetIterationNumber(petsclib::PetscLibType,tao::Tao, iter::PetscInt)Sets the current iteration number.
Logically Collective
Input Parameters:
tao- theTaocontextiter- iteration number
Level: developer
-seealso: , Tao, TaoGetLinearSolveIterations()
External Links
- PETSc Manual:
Tao/TaoSetIterationNumber
PETSc.LibPETSc.TaoSetJacobianDesignRoutine — Method
TaoSetJacobianDesignRoutine(petsclib::PetscLibType,tao::Tao, J::PetscMat, func::external, ctx::Cvoid)Sets the function to compute the Jacobian of the constraint function with respect to the design variables. Used only for PDE-constrained optimization.
Logically Collective
Input Parameters:
tao- theTaocontextJ- Matrix used for the Jacobianfunc- Jacobian evaluation routinectx- [optional] user-defined context for private data for the
Jacobian evaluation routine (may be NULL)
Calling sequence of func:
tao- theTaocontextx- input vectorJ- Jacobian matrixctx- [optional] user-defined Jacobian context
Level: intermediate
-seealso: , Tao, TaoComputeJacobianDesign(), TaoSetJacobianStateRoutine(), TaoSetStateDesignIS()
External Links
- PETSc Manual:
Tao/TaoSetJacobianDesignRoutine
PETSc.LibPETSc.TaoSetJacobianEqualityRoutine — Method
TaoSetJacobianEqualityRoutine(petsclib::PetscLibType,tao::Tao, J::PetscMat, Jpre::PetscMat, func::external, ctx::Cvoid)Sets the function to compute the Jacobian (and its inverse) of the constraint function with respect to the equality variables. Used only for PDE-constrained optimization.
Logically Collective
Input Parameters:
tao- theTaocontextJ- Matrix used for the JacobianJpre- Matrix that will be used to construct the preconditioner, can be same asJ.func- Jacobian evaluation routinectx- [optional] user-defined context for private data for the
Jacobian evaluation routine (may be NULL)
Calling sequence of func:
tao- theTaocontextx- input vectorJ- Jacobian matrixJpre- matrix used to construct the preconditioner, usually the same asJctx- [optional] user-defined Jacobian context
Level: intermediate
-seealso: , Tao, TaoComputeJacobianEquality(), TaoSetJacobianDesignRoutine(), TaoSetEqualityDesignIS()
External Links
- PETSc Manual:
Tao/TaoSetJacobianEqualityRoutine
PETSc.LibPETSc.TaoSetJacobianInequalityRoutine — Method
TaoSetJacobianInequalityRoutine(petsclib::PetscLibType,tao::Tao, J::PetscMat, Jpre::PetscMat, func::external, ctx::Cvoid)Sets the function to compute the Jacobian (and its inverse) of the constraint function with respect to the inequality variables. Used only for PDE-constrained optimization.
Logically Collective
Input Parameters:
tao- theTaocontextJ- Matrix used for the JacobianJpre- Matrix that will be used to construct the preconditioner, can be same asJ.func- Jacobian evaluation routinectx- [optional] user-defined context for private data for the
Jacobian evaluation routine (may be NULL)
Calling sequence of func:
tao- theTaocontextx- input vectorJ- Jacobian matrixJpre- matrix used to construct the preconditioner, usually the same asJctx- [optional] user-defined Jacobian context
Level: intermediate
-seealso: , Tao, TaoComputeJacobianInequality(), TaoSetJacobianDesignRoutine(), TaoSetInequalityDesignIS()
External Links
- PETSc Manual:
Tao/TaoSetJacobianInequalityRoutine
PETSc.LibPETSc.TaoSetJacobianResidualRoutine — Method
TaoSetJacobianResidualRoutine(petsclib::PetscLibType,tao::Tao, J::PetscMat, Jpre::PetscMat, func::external, ctx::Cvoid)Sets the function to compute the least location to store the matrix.
Logically Collective
Input Parameters:
tao- theTaocontextJ- Matrix used for the jacobianJpre- Matrix that will be used to construct the preconditioner, can be same asJfunc- Jacobian evaluation routinectx- [optional] user-defined context for private data for the
Jacobian evaluation routine (may be NULL)
Calling sequence of func:
tao- theTaocontextx- input vectorJ- Jacobian matrixJpre- matrix used to construct the preconditioner, usually the same asJctx- [optional] user-defined Jacobian context
Level: intermediate
-seealso: , Tao, TaoSetGradient(), TaoSetObjective()
External Links
- PETSc Manual:
Tao/TaoSetJacobianResidualRoutine
PETSc.LibPETSc.TaoSetJacobianRoutine — Method
TaoSetJacobianRoutine(petsclib::PetscLibType,tao::Tao, J::PetscMat, Jpre::PetscMat, func::external, ctx::Cvoid)Sets the function to compute the Jacobian as well as the location to store the matrix.
Logically Collective
Input Parameters:
tao- theTaocontextJ- Matrix used for the JacobianJpre- Matrix that will be used to construct the preconditioner, can be same asJfunc- Jacobian evaluation routinectx- [optional] user-defined context for private data for the
Jacobian evaluation routine (may be NULL)
Calling sequence of func:
tao- theTaocontextx- input vectorJ- Jacobian matrixJpre- matrix used to construct the preconditioner, usually the same asJctx- [optional] user-defined Jacobian context
Level: intermediate
-seealso: , Tao, TaoSetGradient(), TaoSetObjective()
External Links
- PETSc Manual:
Tao/TaoSetJacobianRoutine
PETSc.LibPETSc.TaoSetJacobianStateRoutine — Method
TaoSetJacobianStateRoutine(petsclib::PetscLibType,tao::Tao, J::PetscMat, Jpre::PetscMat, Jinv::PetscMat, func::external, ctx::Cvoid)Sets the function to compute the Jacobian (and its inverse) of the constraint function with respect to the state variables. Used only for PDE-constrained optimization.
Logically Collective
Input Parameters:
tao- theTaocontextJ- Matrix used for the JacobianJpre- Matrix that will be used to construct the preconditioner, can be same asJ. Only used ifJinvisNULLJinv- [optional] Matrix used to apply the inverse of the state Jacobian. UseNULLto default to PETScKSPsolvers to apply the inverse.func- Jacobian evaluation routinectx- [optional] user-defined context for private data for the
Jacobian evaluation routine (may be NULL)
Calling sequence of func:
tao- theTaocontextx- input vectorJ- Jacobian matrixJpre- matrix used to construct the preconditioner, usually the same asJJinv- inverse ofJctx- [optional] user-defined Jacobian context
Level: intermediate
-seealso: , Tao, TaoComputeJacobianState(), TaoSetJacobianDesignRoutine(), TaoSetStateDesignIS()
External Links
- PETSc Manual:
Tao/TaoSetJacobianStateRoutine
PETSc.LibPETSc.TaoSetLMVMMatrix — Method
TaoSetLMVMMatrix(petsclib::PetscLibType,tao::Tao, B::PetscMat)Sets an external LMVM matrix into the Tao solver. Valid only for quasi-Newton family of methods.
QN family of methods create their own LMVM matrices and users who wish to manipulate this matrix should use TaoGetLMVMMatrix() instead.
Input Parameters:
tao- Tao solver contextB- LMVM matrix
Level: advanced
-seealso: TAOBQNLS, TAOBQNKLS, TAOBQNKTL, TAOBQNKTR, MATLMVM, TaoGetLMVMMatrix()
External Links
- PETSc Manual:
Tao/TaoSetLMVMMatrix
PETSc.LibPETSc.TaoSetMaximumFunctionEvaluations — Method
TaoSetMaximumFunctionEvaluations(petsclib::PetscLibType,tao::Tao, nfcn::PetscInt)Sets a maximum number of function evaluations allowed for a TaoSolve().
Logically Collective
Input Parameters:
tao- theTaosolver contextnfcn- the maximum number of function evaluations (>=0), usePETSC_UNLIMITEDto have no bound
Options Database Key:
-tao_max_funcs <nfcn>- sets the maximum number of function evaluations
Level: intermediate
-seealso: , Tao, TaoSetTolerances(), TaoSetMaximumIterations()
External Links
- PETSc Manual:
Tao/TaoSetMaximumFunctionEvaluations
PETSc.LibPETSc.TaoSetMaximumIterations — Method
TaoSetMaximumIterations(petsclib::PetscLibType,tao::Tao, maxits::PetscInt)Sets a maximum number of iterates to be used in TaoSolve()
Logically Collective
Input Parameters:
tao- theTaosolver contextmaxits- the maximum number of iterates (>=0), usePETSC_UNLIMITEDto have no bound
Options Database Key:
-tao_max_it <its>- sets the maximum number of iterations
Level: intermediate
-seealso: , Tao, TaoSetTolerances(), TaoSetMaximumFunctionEvaluations()
External Links
- PETSc Manual:
Tao/TaoSetMaximumIterations
PETSc.LibPETSc.TaoSetObjective — Method
TaoSetObjective(petsclib::PetscLibType,tao::Tao, func::external, ctx::Cvoid)Sets the function evaluation routine for minimization
Logically Collective
Input Parameters:
tao- theTaocontextfunc- the objective functionctx- [optional] user-defined context for private data for the function evaluation
routine (may be NULL)
Calling sequence of func:
tao- the optimizerx- input vectorf- function valuectx- [optional] user-defined function context
Level: beginner
-seealso: , TaoSetGradient(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoGetObjective()
External Links
- PETSc Manual:
Tao/TaoSetObjective
PETSc.LibPETSc.TaoSetObjectiveAndGradient — Method
TaoSetObjectiveAndGradient(petsclib::PetscLibType,tao::Tao, g::PetscVec, func::external, ctx::Cvoid)Sets a combined objective function and gradient evaluation routine for the function to be optimized
Logically Collective
Input Parameters:
tao- theTaocontextg- [optional] the vector to internally hold the gradient computationfunc- the gradient functionctx- [optional] user-defined context for private data for the gradient evaluation
routine (may be NULL)
Calling sequence of func:
tao- the optimization objectx- input vectorf- objective value (output)g- gradient value (output)ctx- [optional] user-defined function context
Level: beginner
-seealso: , Tao, TaoSolve(), TaoSetObjective(), TaoSetHessian(), TaoSetGradient(), TaoGetObjectiveAndGradient()
External Links
- PETSc Manual:
Tao/TaoSetObjectiveAndGradient
PETSc.LibPETSc.TaoSetOptionsPrefix — Method
TaoSetOptionsPrefix(petsclib::PetscLibType,tao::Tao, p::String)Sets the prefix used for searching for all Tao options in the database.
Logically Collective
Input Parameters:
tao- theTaocontextp- the prefix string to prepend to all Tao option requests
Level: advanced
-seealso: , Tao, TaoSetFromOptions(), TaoAppendOptionsPrefix(), TaoGetOptionsPrefix()
External Links
- PETSc Manual:
Tao/TaoSetOptionsPrefix
PETSc.LibPETSc.TaoSetRecycleHistory — Method
TaoSetRecycleHistory(petsclib::PetscLibType,tao::Tao, recycle::PetscBool)Sets the boolean flag to enable/disable re iterate information from the previous TaoSolve(). This feature is disabled by default.
Logically Collective
Input Parameters:
tao- theTaocontextrecycle- boolean flag
Options Database Key:
-tao_recycle_history <true,false>- reuse the history
Level: intermediate
-seealso: , Tao, TaoGetRecycleHistory(), TAOBNCG, TAOBQNLS, TAOBQNKLS, TAOBQNKTR, TAOBQNKTL
External Links
- PETSc Manual:
Tao/TaoSetRecycleHistory
PETSc.LibPETSc.TaoSetResidualRoutine — Method
TaoSetResidualRoutine(petsclib::PetscLibType,tao::Tao, res::PetscVec, func::external, ctx::Cvoid)Sets the residual evaluation routine for least
Logically Collective
Input Parameters:
tao- theTaocontextres- the residual vectorfunc- the residual evaluation routinectx- [optional] user-defined context for private data for the function evaluation
routine (may be NULL)
Calling sequence of func:
tao- the optimizerx- input vectorres- function value vectorctx- [optional] user-defined function context
Level: beginner
-seealso: , Tao, TaoSetObjective(), TaoSetJacobianRoutine()
External Links
- PETSc Manual:
Tao/TaoSetResidualRoutine
PETSc.LibPETSc.TaoSetResidualWeights — Method
TaoSetResidualWeights(petsclib::PetscLibType,tao::Tao, sigma_v::PetscVec, n::PetscInt, rows::PetscInt, cols::PetscInt, vals::PetscReal)Give weights for the residual values. A vector can be used if only diagonal terms are used, otherwise a matrix can be give.
Collective
Input Parameters:
tao- theTaocontextsigma_v- vector of weights (diagonal terms only)n- the number of weights (if using off-diagonal)rows- index list of rows forsigma_vcols- index list of columns forsigma_vvals- array of weights
Level: intermediate
-seealso: , Tao, TaoSetResidualRoutine()
External Links
- PETSc Manual:
Tao/TaoSetResidualWeights
PETSc.LibPETSc.TaoSetSolution — Method
TaoSetSolution(petsclib::PetscLibType,tao::Tao, x0::PetscVec)Sets the vector holding the initial guess for the solve
Logically Collective
Input Parameters:
tao- theTaocontextx0- the initial guess
Level: beginner
-seealso: , Tao, TaoCreate(), TaoSolve(), TaoGetSolution()
External Links
- PETSc Manual:
Tao/TaoSetSolution
PETSc.LibPETSc.TaoSetStateDesignIS — Method
TaoSetStateDesignIS(petsclib::PetscLibType,tao::Tao, s_is::IS, d_is::IS)Indicate to the Tao object which variables in the solution vector are state variables and which are design. Only applies to PDE-constrained optimization.
Logically Collective
Input Parameters:
tao- TheTaocontexts_is- the index set corresponding to the state variablesd_is- the index set corresponding to the design variables
Level: intermediate
-seealso: , Tao, TaoSetJacobianStateRoutine(), TaoSetJacobianDesignRoutine()
External Links
- PETSc Manual:
Tao/TaoSetStateDesignIS
PETSc.LibPETSc.TaoSetTolerances — Method
TaoSetTolerances(petsclib::PetscLibType,tao::Tao, gatol::PetscReal, grtol::PetscReal, gttol::PetscReal)Sets parameters used in TaoSolve() convergence tests
Logically Collective
Input Parameters:
tao- theTaocontextgatol- stop if norm of gradient is less than thisgrtol- stop if relative norm of gradient is less than thisgttol- stop if norm of gradient is reduced by this factor
Options Database Keys:
-tao_gatol <gatol>- Sets gatol-tao_grtol <grtol>- Sets grtol-tao_gttol <gttol>- Sets gttol
Stopping Criteria: -seealso: , Tao, TaoConvergedReason, TaoGetTolerances()
External Links
- PETSc Manual:
Tao/TaoSetTolerances
PETSc.LibPETSc.TaoSetTotalIterationNumber — Method
TaoSetTotalIterationNumber(petsclib::PetscLibType,tao::Tao, iter::PetscInt)Sets the current total iteration number.
Logically Collective
Input Parameters:
tao- theTaocontextiter- the iteration number
Level: developer
-seealso: , Tao, TaoGetLinearSolveIterations()
External Links
- PETSc Manual:
Tao/TaoSetTotalIterationNumber
PETSc.LibPETSc.TaoSetType — Method
TaoSetType(petsclib::PetscLibType,tao::Tao, type::TaoType)Sets the TaoType for the minimization solver.
Collective
Input Parameters:
tao- theTaosolver contexttype- a known method
Options Database Key:
-tao_type <type>- Sets the method; use -help for a list
of available methods (for instance, "-taotype lmvm" or "-taotype tron")
Level: intermediate
-seealso: , Tao, TaoCreate(), TaoGetType(), TaoType
External Links
- PETSc Manual:
Tao/TaoSetType
PETSc.LibPETSc.TaoSetUp — Method
TaoSetUp(petsclib::PetscLibType,tao::Tao)Sets up the internal data structures for the later use of a Tao solver
Collective
Input Parameter:
tao- theTaocontext
Level: advanced
-seealso: , Tao, TaoCreate(), TaoSolve()
External Links
- PETSc Manual:
Tao/TaoSetUp
PETSc.LibPETSc.TaoSetUpdate — Method
TaoSetUpdate(petsclib::PetscLibType,tao::Tao, func::external, ctx::Cvoid)Sets the general at the beginning of every iteration of the optimization algorithm. Called after the new solution and the gradient is determined, but before the Hessian is computed (if applicable).
Logically Collective
Input Parameters:
tao- TheTaosolverfunc- The functionctx- The update function context
Calling sequence of func:
tao- The optimizer contextit- The current iteration indexctx- The update context
Level: advanced
External Links
- PETSc Manual:
Tao/TaoSetUpdate
PETSc.LibPETSc.TaoSetVariableBounds — Method
TaoSetVariableBounds(petsclib::PetscLibType,tao::Tao, XL::PetscVec, XU::PetscVec)Sets the upper and lower bounds for the optimization problem
Logically Collective
Input Parameters:
tao- theTaocontextXL- vector of lower boundsXU- vector of upper bounds
Level: beginner
-seealso: , Tao, TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoGetVariableBounds()
External Links
- PETSc Manual:
Tao/TaoSetVariableBounds
PETSc.LibPETSc.TaoSetVariableBoundsRoutine — Method
TaoSetVariableBoundsRoutine(petsclib::PetscLibType,tao::Tao, func::external, ctx::Cvoid)Sets a function to be used to compute lower and upper variable bounds for the optimization
Logically Collective
Input Parameters:
tao- theTaocontextfunc- the bounds computation routinectx- [optional] user-defined context for private data for the bounds computation (may beNULL)
Calling sequence of func:
tao- theTaosolverxl- vector of lower boundsxu- vector of upper boundsctx- the (optional) user-defined function context
Level: beginner
-seealso: , Tao, TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoSetVariableBounds()
External Links
- PETSc Manual:
Tao/TaoSetVariableBoundsRoutine
PETSc.LibPETSc.TaoShellGetContext — Method
TaoShellGetContext(petsclib::PetscLibType,tao::Tao, ctx::Cvoid)Returns the user
Not Collective
Input Parameter:
tao- should have been created withTaoSetType(tao,TAOSHELL);
Output Parameter:
ctx- the user provided context
Level: advanced
-seealso: Tao, TAOSHELL, TaoShellSetContext()
External Links
- PETSc Manual:
Tao/TaoShellGetContext
PETSc.LibPETSc.TaoShellSetContext — Method
TaoShellSetContext(petsclib::PetscLibType,tao::Tao, ctx::Cvoid)sets the context for a TAOSHELL
Logically Collective
Input Parameters:
tao- the shell Taoctx- the context
Level: advanced
-seealso: Tao, TAOSHELL, TaoShellGetContext()
External Links
- PETSc Manual:
Tao/TaoShellSetContext
PETSc.LibPETSc.TaoShellSetSolve — Method
TaoShellSetSolve(petsclib::PetscLibType,tao::Tao, solve::external)Sets routine to apply as solver
Logically Collective
Input Parameters:
tao- the nonlinear solver contextsolve- the application-provided solver routine
Calling sequence of solve:
tao- the optimizer, get the application context withTaoShellGetContext()
Level: advanced
-seealso: Tao, TAOSHELL, TaoShellSetContext(), TaoShellGetContext()
External Links
- PETSc Manual:
Tao/TaoShellSetSolve
PETSc.LibPETSc.TaoSoftThreshold — Method
TaoSoftThreshold(petsclib::PetscLibType,in::PetscVec, lb::PetscReal, ub::PetscReal, out::PetscVec)Calculates soft thresholding routine with input vector and given lower and upper bound and returns it to output vector.
Input Parameters:
in- input vector to be thresholdedlb- lower boundub- upper bound
Output Parameter:
out- Soft thresholded output vector
-seealso: Tao, Vec
External Links
- PETSc Manual:
Tao/TaoSoftThreshold
PETSc.LibPETSc.TaoSolve — Method
TaoSolve(petsclib::PetscLibType,tao::Tao)Solves an optimization problem min F(x) s.t. l <= x <= u
Collective
Input Parameter:
tao- theTaocontext
Level: beginner
-seealso: , Tao, TaoCreate(), TaoSetObjective(), TaoSetGradient(), TaoSetHessian(), TaoGetConvergedReason(), TaoSetUp()
External Links
- PETSc Manual:
Tao/TaoSolve
PETSc.LibPETSc.TaoTestGradient — Method
TaoTestGradient(petsclib::PetscLibType,tao::Tao, x::PetscVec, g1::PetscVec)External Links
- PETSc Manual:
Tao/TaoTestGradient
PETSc.LibPETSc.TaoTestHessian — Method
PETSc.LibPETSc.TaoVecGetSubVec — Method
TaoVecGetSubVec(petsclib::PetscLibType,vfull::PetscVec, is::IS, reduced_type::TaoSubsetType, maskvalue::PetscReal, vreduced::PetscVec)Gets a subvector using the IS
Input Parameters:
vfull- the full matrixis- the index set for the subvectorreduced_type- the methodTaois using for subsettingmaskvalue- the value to set the unused vector elements to (forTAO_SUBSET_MASKorTAO_SUBSET_MATRIXFREE)
Output Parameter:
vreduced- the subvector
Level: developer
-seealso: TaoMatGetSubMat(), TaoSubsetType
External Links
- PETSc Manual:
Tao/TaoVecGetSubVec
PETSc.LibPETSc.TaoView — Method
TaoView(petsclib::PetscLibType,tao::Tao, viewer::PetscViewer)Prints information about the Tao object
Collective
Input Parameters:
tao- theTaocontextviewer- visualization context
Options Database Key:
-tao_view- CallsTaoView()at the end ofTaoSolve()
Level: beginner
-seealso: , Tao, PetscViewerASCIIOpen()
External Links
- PETSc Manual:
Tao/TaoView
PETSc.LibPETSc.TaoViewFromOptions — Method
TaoViewFromOptions(petsclib::PetscLibType,A::Tao, obj::PetscObject, name::String)View a Tao object based on values in the options database
Collective
Input Parameters:
A- theTaocontextobj- Optional object that provides the prefix for the options databasename- command line option
Level: intermediate
-seealso: , Tao, TaoView, PetscObjectViewFromOptions(), TaoCreate()
External Links
- PETSc Manual:
Tao/TaoViewFromOptions
Tao Add-ons
Additional Tao utilities and helper functions:
PETSc.LibPETSc.TaoLineSearchAppendOptionsPrefix — Method
TaoLineSearchAppendOptionsPrefix(petsclib::PetscLibType,ls::TaoLineSearch, p::String)Appends to the prefix used for searching for all TaoLineSearch options in the database.
Collective
Input Parameters:
ls- theTaoLineSearchsolver contextp- the prefix string to prepend to all line search requests
Level: advanced
-seealso: , Tao, TaoLineSearch, TaoLineSearchSetOptionsPrefix(), TaoLineSearchGetOptionsPrefix()
External Links
- PETSc Manual:
Tao/TaoLineSearchAppendOptionsPrefix
PETSc.LibPETSc.TaoLineSearchApply — Method
f::PetscReal,steplength::PetscReal = TaoLineSearchApply(petsclib::PetscLibType,ls::TaoLineSearch, x::PetscVec, g::PetscVec, s::PetscVec, reason::TaoLineSearchConvergedReason)Performs a line Criteria for acceptable step length depends on the line-search algorithm chosen
Collective
Input Parameters:
ls- theTaoLineSearchcontexts- search direction
Output Parameters:
x- On input the current solution, on outputxcontains the new solution determined by the line searchf- On input the objective function value at current solution, on output contains the objective function value at new solutiong- On input the gradient evaluated atx, on output contains the gradient at new solutionsteplength- scalar multiplier of s used ( x = x0 + steplength * x)reason-TaoLineSearchConvergedReasonreason why the line-search stopped
Level: advanced
-seealso: , Tao, TaoLineSearchConvergedReason, TaoLineSearch, TaoLineSearchCreate(), TaoLineSearchSetType(), TaoLineSearchSetInitialStepLength(), TaoAddLineSearchCounts()
External Links
- PETSc Manual:
Tao/TaoLineSearchApply
PETSc.LibPETSc.TaoLineSearchComputeGradient — Method
TaoLineSearchComputeGradient(petsclib::PetscLibType,ls::TaoLineSearch, x::PetscVec, g::PetscVec)Computes the gradient of the objective function
Collective
Input Parameters:
ls- theTaoLineSearchcontextx- input vector
Output Parameter:
g- gradient vector
Level: developer
-seealso: , Tao, TaoLineSearch, TaoLineSearchComputeObjective(), TaoLineSearchComputeObjectiveAndGradient(), TaoLineSearchSetGradient()
External Links
- PETSc Manual:
Tao/TaoLineSearchComputeGradient
PETSc.LibPETSc.TaoLineSearchComputeObjective — Method
f::PetscReal = TaoLineSearchComputeObjective(petsclib::PetscLibType,ls::TaoLineSearch, x::PetscVec)Computes the objective function value at a given point
Collective
Input Parameters:
ls- theTaoLineSearchcontextx- input vector
Output Parameter:
f- Objective value atx
Level: developer
-seealso: , Tao, TaoLineSearch, TaoLineSearchComputeGradient(), TaoLineSearchComputeObjectiveAndGradient(), TaoLineSearchSetObjectiveRoutine()
External Links
- PETSc Manual:
Tao/TaoLineSearchComputeObjective
PETSc.LibPETSc.TaoLineSearchComputeObjectiveAndGTS — Method
f::PetscReal,gts::PetscReal = TaoLineSearchComputeObjectiveAndGTS(petsclib::PetscLibType,ls::TaoLineSearch, x::PetscVec)Computes the objective function value and inner product of gradient and step direction at a given point
Collective
Input Parameters:
ls- theTaoLineSearchcontextx- input vector
Output Parameters:
f- Objective value atxgts- inner product of gradient and step direction atx
Level: developer
-seealso: , Tao, TaoLineSearch, TaoLineSearchComputeGradient(), TaoLineSearchComputeObjectiveAndGradient(), TaoLineSearchSetObjectiveRoutine()
External Links
- PETSc Manual:
Tao/TaoLineSearchComputeObjectiveAndGTS
PETSc.LibPETSc.TaoLineSearchComputeObjectiveAndGradient — Method
f::PetscReal = TaoLineSearchComputeObjectiveAndGradient(petsclib::PetscLibType,ls::TaoLineSearch, x::PetscVec, g::PetscVec)Computes the objective function value at a given point
Collective
Input Parameters:
ls- theTaoLineSearchcontextx- input vector
Output Parameters:
f- Objective value atxg- Gradient vector atx
Level: developer
-seealso: , Tao, TaoLineSearch, TaoLineSearchComputeGradient(), TaoLineSearchSetObjectiveRoutine()
External Links
- PETSc Manual:
Tao/TaoLineSearchComputeObjectiveAndGradient
PETSc.LibPETSc.TaoLineSearchCreate — Method
newls::TaoLineSearch = TaoLineSearchCreate(petsclib::PetscLibType,comm::MPI_Comm)Creates a TaoLineSearch object. Algorithms in Tao that use line-searches will automatically create one so this all is rarely needed
Collective
Input Parameter:
comm- MPI communicator
Output Parameter:
newls- the newTaoLineSearchcontext
Options Database Key:
-tao_ls_type- select which methodTaoshould use
Level: developer
-seealso: , Tao, TaoLineSearch, TaoLineSearchType, TaoLineSearchSetType(), TaoLineSearchApply(), TaoLineSearchDestroy()
External Links
- PETSc Manual:
Tao/TaoLineSearchCreate
PETSc.LibPETSc.TaoLineSearchDestroy — Method
TaoLineSearchDestroy(petsclib::PetscLibType,ls::TaoLineSearch)Destroys the TaoLineSearch context that was created with TaoLineSearchCreate()
Collective
Input Parameter:
ls- theTaoLineSearchcontext
Level: developer
-seealso: TaoLineSearchCreate(), TaoLineSearchSolve()
External Links
- PETSc Manual:
Tao/TaoLineSearchDestroy
PETSc.LibPETSc.TaoLineSearchFinalizePackage — Method
TaoLineSearchFinalizePackage(petsclib::PetscLibType)This function destroys everything in the TaoLineSearch package. It is called from PetscFinalize().
Level: developer
-seealso: Tao, TaoLineSearch
External Links
- PETSc Manual:
Tao/TaoLineSearchFinalizePackage
PETSc.LibPETSc.TaoLineSearchGetFullStepObjective — Method
f_fullstep::PetscReal = TaoLineSearchGetFullStepObjective(petsclib::PetscLibType,ls::TaoLineSearch)Returns the objective function value at the full step. Useful for some minimization algorithms.
Not Collective
Input Parameter:
ls- theTaoLineSearchcontext
Output Parameter:
f_fullstep- the objective value at the full step length
Level: developer
-seealso: TaoLineSearchGetSolution(), TaoLineSearchGetStartingVector(), TaoLineSearchGetStepDirection()
External Links
- PETSc Manual:
Tao/TaoLineSearchGetFullStepObjective
PETSc.LibPETSc.TaoLineSearchGetNumberFunctionEvaluations — Method
nfeval::PetscInt,ngeval::PetscInt,nfgeval::PetscInt = TaoLineSearchGetNumberFunctionEvaluations(petsclib::PetscLibType,ls::TaoLineSearch)Gets the number of function and gradient evaluation routines used by the line search in last application (not cumulative).
Not Collective
Input Parameter:
ls- theTaoLineSearchcontext
Output Parameters:
nfeval- number of function evaluationsngeval- number of gradient evaluationsnfgeval- number of function/gradient evaluations
Level: intermediate
-seealso: TaoLineSearch
External Links
- PETSc Manual:
Tao/TaoLineSearchGetNumberFunctionEvaluations
PETSc.LibPETSc.TaoLineSearchGetOptionsPrefix — Method
TaoLineSearchGetOptionsPrefix(petsclib::PetscLibType,ls::TaoLineSearch, p::String)Gets the prefix used for searching for all TaoLineSearch options in the database
Not Collective
Input Parameter:
ls- theTaoLineSearchcontext
Output Parameter:
p- pointer to the prefix string used is returned
Level: advanced
-seealso: , Tao, TaoLineSearch, TaoLineSearchSetOptionsPrefix(), TaoLineSearchAppendOptionsPrefix()
External Links
- PETSc Manual:
Tao/TaoLineSearchGetOptionsPrefix
PETSc.LibPETSc.TaoLineSearchGetSolution — Method
f::PetscReal,steplength::PetscReal = TaoLineSearchGetSolution(petsclib::PetscLibType,ls::TaoLineSearch, x::PetscVec, g::PetscVec, reason::TaoLineSearchConvergedReason)Returns the solution to the line search
Collective
Input Parameter:
ls- theTaoLineSearchcontext
Output Parameters:
x- the new solutionf- the objective function value atxg- the gradient atxsteplength- the multiple of the step direction taken by the line searchreason- the reason why the line search terminated
Level: developer
-seealso: TaoLineSearchGetStartingVector(), TaoLineSearchGetStepDirection()
External Links
- PETSc Manual:
Tao/TaoLineSearchGetSolution
PETSc.LibPETSc.TaoLineSearchGetStartingVector — Method
TaoLineSearchGetStartingVector(petsclib::PetscLibType,ls::TaoLineSearch, x::PetscVec)Gets a the initial point of the line search.
Not Collective
Input Parameter:
ls- theTaoLineSearchcontext
Output Parameter:
x- The initial point of the line search
Level: advanced
-seealso: TaoLineSearchGetSolution(), TaoLineSearchGetStepDirection()
External Links
- PETSc Manual:
Tao/TaoLineSearchGetStartingVector
PETSc.LibPETSc.TaoLineSearchGetStepDirection — Method
TaoLineSearchGetStepDirection(petsclib::PetscLibType,ls::TaoLineSearch, s::PetscVec)Gets the step direction of the line search.
Not Collective
Input Parameter:
ls- theTaoLineSearchcontext
Output Parameter:
s- the step direction of the line search
Level: advanced
-seealso: TaoLineSearchGetSolution(), TaoLineSearchGetStartingVector()
External Links
- PETSc Manual:
Tao/TaoLineSearchGetStepDirection
PETSc.LibPETSc.TaoLineSearchGetStepLength — Method
s::PetscReal = TaoLineSearchGetStepLength(petsclib::PetscLibType,ls::TaoLineSearch)Get the current step length
Not Collective
Input Parameter:
ls- theTaoLineSearchcontext
Output Parameter:
s- the current step length
Level: intermediate
-seealso: , Tao, TaoLineSearch, TaoLineSearchSetInitialStepLength(), TaoLineSearchApply()
External Links
- PETSc Manual:
Tao/TaoLineSearchGetStepLength
PETSc.LibPETSc.TaoLineSearchGetType — Method
type::TaoLineSearchType = TaoLineSearchGetType(petsclib::PetscLibType,ls::TaoLineSearch)Gets the current line search algorithm
Not Collective
Input Parameter:
ls- theTaoLineSearchcontext
Output Parameter:
type- the line search algorithm in effect
Level: developer
-seealso: TaoLineSearch
External Links
- PETSc Manual:
Tao/TaoLineSearchGetType
PETSc.LibPETSc.TaoLineSearchInitializePackage — Method
TaoLineSearchInitializePackage(petsclib::PetscLibType)This function registers the line algorithms in Tao. When using shared or static libraries, this function is called from the first entry to TaoCreate(); when using dynamic, it is called from PetscDLLibraryRegister_tao()
Level: developer
-seealso: Tao, TaoLineSearch, TaoLineSearchCreate()
External Links
- PETSc Manual:
Tao/TaoLineSearchInitializePackage
PETSc.LibPETSc.TaoLineSearchIsUsingTaoRoutines — Method
flg::PetscBool = TaoLineSearchIsUsingTaoRoutines(petsclib::PetscLibType,ls::TaoLineSearch)Checks whether the line search is using the standard Tao evaluation routines.
Not Collective
Input Parameter:
ls- theTaoLineSearchcontext
Output Parameter:
flg-PETSC_TRUEif the line search is usingTaoevaluation routines,
otherwise PETSC_FALSE
Level: developer
-seealso: TaoLineSearch
External Links
- PETSc Manual:
Tao/TaoLineSearchIsUsingTaoRoutines
PETSc.LibPETSc.TaoLineSearchMonitor — Method
TaoLineSearchMonitor(petsclib::PetscLibType,ls::TaoLineSearch, its::PetscInt, f::PetscReal, step::PetscReal)Monitor the line search steps. This routine will output the iteration number, step length, and function value before calling the implementation specific monitor.
Input Parameters:
ls- theTaoLineSearchcontextits- the current iterate number (>=0)f- the current objective function valuestep- the step length
Options Database Key:
-tao_ls_monitor- Use the default monitor, which prints statistics to standard output
Level: developer
-seealso: TaoLineSearch
External Links
- PETSc Manual:
Tao/TaoLineSearchMonitor
PETSc.LibPETSc.TaoLineSearchRegister — Method
TaoLineSearchRegister(petsclib::PetscLibType,sname::String, func::external)Adds a line
Not Collective, No Fortran Support
Input Parameters:
sname- name of a new user-defined solverfunc- routine to Create method context
-seealso: , Tao, TaoLineSearch
External Links
- PETSc Manual:
Tao/TaoLineSearchRegister
PETSc.LibPETSc.TaoLineSearchReset — Method
TaoLineSearchReset(petsclib::PetscLibType,ls::TaoLineSearch)Some line searches may carry state information from one TaoLineSearchApply() to the next. This function resets this state information.
Collective
Input Parameter:
ls- theTaoLineSearchcontext
Level: developer
-seealso: , Tao, TaoLineSearch, TaoLineSearchCreate(), TaoLineSearchApply()
External Links
- PETSc Manual:
Tao/TaoLineSearchReset
PETSc.LibPETSc.TaoLineSearchSetFromOptions — Method
TaoLineSearchSetFromOptions(petsclib::PetscLibType,ls::TaoLineSearch)Sets various TaoLineSearch parameters from user options.
Collective
Input Parameter:
ls- theTaoLineSearchcontext
Options Database Keys:
-tao_ls_type <type>- The algorithm thatTaoLineSearchuses (more-thuente, gpcg, unit)-tao_ls_ftol <tol>- tolerance for sufficient decrease-tao_ls_gtol <tol>- tolerance for curvature condition-tao_ls_rtol <tol>- relative tolerance for acceptable step-tao_ls_stepinit <step>- initial steplength allowed-tao_ls_stepmin <step>- minimum steplength allowed-tao_ls_stepmax <step>- maximum steplength allowed-tao_ls_max_funcs <n>- maximum number of function evaluations allowed-tao_ls_view- display line-search results to standard output
Level: beginner
-seealso: TaoLineSearch
External Links
- PETSc Manual:
Tao/TaoLineSearchSetFromOptions
PETSc.LibPETSc.TaoLineSearchSetGradientRoutine — Method
TaoLineSearchSetGradientRoutine(petsclib::PetscLibType,ls::TaoLineSearch, func::external, ctx::Cvoid)Sets the gradient evaluation routine for the line search
Logically Collective
Input Parameters:
ls- theTaoLineSearchcontextfunc- the gradient evaluation routinectx- the (optional) user-defined context for private data
Calling sequence of func:
ls- the linesearch objectx- input vectorg- gradient vectorctx- (optional) user-defined context
Level: beginner
-seealso: , Tao, TaoLineSearch, TaoLineSearchCreate(), TaoLineSearchSetObjectiveRoutine(), TaoLineSearchSetObjectiveAndGradientRoutine(), TaoLineSearchUseTaoRoutines()
External Links
- PETSc Manual:
Tao/TaoLineSearchSetGradientRoutine
PETSc.LibPETSc.TaoLineSearchSetInitialStepLength — Method
TaoLineSearchSetInitialStepLength(petsclib::PetscLibType,ls::TaoLineSearch, s::PetscReal)Sets the initial step length of a line search. If this value is not set then 1.0 is assumed.
Logically Collective
Input Parameters:
ls- theTaoLineSearchcontexts- the initial step size
Level: intermediate
-seealso: , Tao, TaoLineSearch, TaoLineSearchGetStepLength(), TaoLineSearchApply()
External Links
- PETSc Manual:
Tao/TaoLineSearchSetInitialStepLength
PETSc.LibPETSc.TaoLineSearchSetObjectiveAndGTSRoutine — Method
TaoLineSearchSetObjectiveAndGTSRoutine(petsclib::PetscLibType,ls::TaoLineSearch, func::external, ctx::Cvoid)Sets the objective and (gradient'*stepdirection) evaluation routine for the line search.
Logically Collective
Input Parameters:
ls- theTaoLineSearchcontextfunc- the objective and gradient evaluation routinectx- the (optional) user-defined context for private data
Calling sequence of func:
ls- the linesearch contextx- input vectors- step directionf- function valuegts- inner product of gradient and step direction vectorsctx- (optional) user-defined context
Level: advanced
-seealso: , Tao, TaoLineSearch, TaoLineSearchCreate(), TaoLineSearchSetObjective(), TaoLineSearchSetGradient(), TaoLineSearchUseTaoRoutines()
External Links
- PETSc Manual:
Tao/TaoLineSearchSetObjectiveAndGTSRoutine
PETSc.LibPETSc.TaoLineSearchSetObjectiveAndGradientRoutine — Method
TaoLineSearchSetObjectiveAndGradientRoutine(petsclib::PetscLibType,ls::TaoLineSearch, func::external, ctx::Cvoid)Sets the objective/gradient evaluation routine for the line search
Logically Collective
Input Parameters:
ls- theTaoLineSearchcontextfunc- the objective and gradient evaluation routinectx- the (optional) user-defined context for private data
Calling sequence of func:
ls- the linesearch objectx- input vectorf- function valueg- gradient vectorctx- (optional) user-defined context
Level: beginner
-seealso: , Tao, TaoLineSearch, TaoLineSearchCreate(), TaoLineSearchSetObjectiveRoutine(), TaoLineSearchSetGradientRoutine(), TaoLineSearchUseTaoRoutines()
External Links
- PETSc Manual:
Tao/TaoLineSearchSetObjectiveAndGradientRoutine
PETSc.LibPETSc.TaoLineSearchSetObjectiveRoutine — Method
TaoLineSearchSetObjectiveRoutine(petsclib::PetscLibType,ls::TaoLineSearch, func::external, ctx::Cvoid)Sets the function evaluation routine for the line search
Logically Collective
Input Parameters:
ls- theTaoLineSearchcontextfunc- the objective function evaluation routinectx- the (optional) user-defined context for private data
Calling sequence of func:
ls- the line search contextx- input vectorf- function valuectx- (optional) user-defined context
Level: advanced
-seealso: , Tao, TaoLineSearch, TaoLineSearchCreate(), TaoLineSearchSetGradientRoutine(), TaoLineSearchSetObjectiveAndGradientRoutine(), TaoLineSearchUseTaoRoutines()
External Links
- PETSc Manual:
Tao/TaoLineSearchSetObjectiveRoutine
PETSc.LibPETSc.TaoLineSearchSetOptionsPrefix — Method
TaoLineSearchSetOptionsPrefix(petsclib::PetscLibType,ls::TaoLineSearch, p::String)Sets the prefix used for searching for all TaoLineSearch options in the database.
Logically Collective
Input Parameters:
ls- theTaoLineSearchcontextp- the prefix string to prepend to alllsoption requests
Level: advanced
-seealso: , Tao, TaoLineSearch, TaoLineSearchAppendOptionsPrefix(), TaoLineSearchGetOptionsPrefix()
External Links
- PETSc Manual:
Tao/TaoLineSearchSetOptionsPrefix
PETSc.LibPETSc.TaoLineSearchSetType — Method
TaoLineSearchSetType(petsclib::PetscLibType,ls::TaoLineSearch, type::TaoLineSearchType)Sets the algorithm used in a line search
Collective
Input Parameters:
ls- theTaoLineSearchcontexttype- theTaoLineSearchTypeselection
Options Database Key:
-tao_ls_type <type>- select which method Tao should use at runtime
Level: beginner
-seealso: , Tao, TaoLineSearch, TaoLineSearchType, TaoLineSearchCreate(), TaoLineSearchGetType(), TaoLineSearchApply()
External Links
- PETSc Manual:
Tao/TaoLineSearchSetType
PETSc.LibPETSc.TaoLineSearchSetUp — Method
TaoLineSearchSetUp(petsclib::PetscLibType,ls::TaoLineSearch)Sets up the internal data structures for the later use of a TaoLineSearch
Collective
Input Parameter:
ls- theTaoLineSearchcontext
Level: developer
-seealso: , Tao, TaoLineSearch, TaoLineSearchCreate(), TaoLineSearchApply()
External Links
- PETSc Manual:
Tao/TaoLineSearchSetUp
PETSc.LibPETSc.TaoLineSearchSetVariableBounds — Method
TaoLineSearchSetVariableBounds(petsclib::PetscLibType,ls::TaoLineSearch, xl::PetscVec, xu::PetscVec)Sets the upper and lower bounds for a bounded line search
Logically Collective
Input Parameters:
ls- theTaoLineSearchcontextxl- vector of lower boundsxu- vector of upper bounds
Level: beginner
-seealso: , Tao, TaoLineSearch, TaoSetVariableBounds(), TaoLineSearchCreate()
External Links
- PETSc Manual:
Tao/TaoLineSearchSetVariableBounds
PETSc.LibPETSc.TaoLineSearchUseTaoRoutines — Method
TaoLineSearchUseTaoRoutines(petsclib::PetscLibType,ls::TaoLineSearch, ts::Tao)Informs the TaoLineSearch to use the objective and gradient evaluation routines from the given Tao object. The default.
Logically Collective
Input Parameters:
ls- theTaoLineSearchcontextts- theTaocontext with defined objective/gradient evaluation routines
Level: developer
-seealso: , Tao, TaoLineSearch, TaoLineSearchCreate()
External Links
- PETSc Manual:
Tao/TaoLineSearchUseTaoRoutines
PETSc.LibPETSc.TaoLineSearchView — Method
TaoLineSearchView(petsclib::PetscLibType,ls::TaoLineSearch, viewer::PetscViewer)Prints information about the TaoLineSearch
Collective
Input Parameters:
ls- theTaoLineSearchcontextviewer- visualization context
Options Database Key:
-tao_ls_view- CallsTaoLineSearchView()at the end of each line search
Level: beginner
-seealso: , Tao, TaoLineSearch, PetscViewerASCIIOpen(), TaoLineSearchViewFromOptions()
External Links
- PETSc Manual:
Tao/TaoLineSearchView
PETSc.LibPETSc.TaoLineSearchViewFromOptions — Method
TaoLineSearchViewFromOptions(petsclib::PetscLibType,A::TaoLineSearch, obj::PetscObject, name::String)View a TaoLineSearch object based on values in the options database
Collective
Input Parameters:
A- theTaocontextobj- Optional objectname- command line option
Level: intermediate
-seealso: , Tao, TaoLineSearch, TaoLineSearchView(), PetscObjectViewFromOptions(), TaoLineSearchCreate()
External Links
- PETSc Manual:
Tao/TaoLineSearchViewFromOptions
PETSc.LibPETSc.TaoMonitorDrawCtxCreate — Method
ctx::TaoMonitorDrawCtx = TaoMonitorDrawCtxCreate(petsclib::PetscLibType,comm::MPI_Comm, host::String, label::String, x::Cint, y::Cint, m::Cint, n::Cint, howoften::PetscInt)Creates the monitor context for TaoMonitorSolutionDraw()
Collective
Input Parameters:
comm- the communicator to share the contexthost- the name of the X Windows host that will display the monitorlabel- the label to put at the top of the display windowx- the horizontal coordinate of the lower left corner of the window to openy- the vertical coordinate of the lower left corner of the window to openm- the width of the windown- the height of the windowhowoften- how manyTaoiterations between displaying the monitor information
Output Parameter:
ctx- the monitor context
Options Database Keys:
-tao_monitor_solution_draw- useTaoMonitorSolutionDraw()to monitor the solution-tao_draw_solution_initial- show initial guess as well as current solution
Level: intermediate
-seealso: , Tao, TaoMonitorSet(), TaoMonitorDefault(), VecView(), TaoMonitorDrawCtx()
External Links
- PETSc Manual:
Tao/TaoMonitorDrawCtxCreate
PETSc.LibPETSc.TaoMonitorDrawCtxDestroy — Method
TaoMonitorDrawCtxDestroy(petsclib::PetscLibType,ictx::TaoMonitorDrawCtx)Destroys the monitor context for TaoMonitorSolutionDraw()
Collective
Input Parameter:
ictx- the monitor context
Level: intermediate
-seealso: , Tao, TaoMonitorSet(), TaoMonitorDefault(), VecView(), TaoMonitorSolutionDraw()
External Links
- PETSc Manual:
Tao/TaoMonitorDrawCtxDestroy