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

  1. Create and configure Tao: Use TaoCreate, TaoSetType
  2. Define objective: TaoSetObjective, TaoSetGradient, optionally TaoSetHessian
  3. Set constraints (if any): TaoSetVariableBounds, TaoSetConstraints
  4. Configure solver: TaoSetTolerances, TaoSetMaximumIterations
  5. Set initial guess: TaoSetSolution
  6. Solve: TaoSolve
  7. Retrieve solution: TaoGetSolution, TaoGetConvergedReason

Optimization Algorithms

Available through TaoSetType:

  • Unconstrained:

    • TAOLMVM: Limited-memory variable metric (quasi-Newton)
    • TAOCG: Conjugate gradient methods
    • TAONM: Nelder-Mead simplex method
    • TAONLS: Newton line search
    • TAONTL: Newton trust-region with line search
  • Bound-constrained:

    • TAOBLMVM: Bound-constrained limited-memory variable metric
    • TAOBNCG: Bound-constrained conjugate gradient
    • TAOBQNLS: Bound-constrained quasi-Newton line search
    • TAOBNTL: Bound-constrained Newton trust-region
    • TAOTRON: Trust-region Newton method
  • Constrained:

    • TAOALMM: Augmented Lagrangian multiplier method
    • TAOIPM: Interior point method
    • TAOPDIPM: Primal-dual interior point method
  • Least-squares:

    • TAOPOUNDERS: POUNDERs model-based method
    • TAOBRGN: Bounded regularized Gauss-Newton
  • Complementarity:

    • TAOSSLS: Semismooth least squares
    • TAOASLS: Active-set least squares

Convergence Criteria

Tao monitors several convergence criteria:

  • Gradient tolerance: ||∇f|| < gatol or ||∇f||/||f|| < grtol
  • Function tolerance: |f - f_prev| < fatol or |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.TaoADMMGetDualVectorMethod
TaoADMMGetDualVector(petsclib::PetscLibType,tao::Tao, Y::PetscVec)

Returns the dual vector associated with the current TAOADMM state

Not Collective

Input Parameter:

  • tao - the Tao context

Output Parameter:

  • Y - the current solution

Level: intermediate

-seealso: TAOADMM

External Links

source
PETSc.LibPETSc.TaoADMMGetMisfitSubsolverMethod
TaoADMMGetMisfitSubsolver(petsclib::PetscLibType,tao::Tao, misfit::Tao)

Get the pointer to the misfit subsolver inside TAOADMM

Collective

Input Parameter:

  • tao - the Tao solver context

Output Parameter:

  • misfit - the Tao subsolver context

Level: advanced

-seealso: TAOADMM, Tao

External Links

source
PETSc.LibPETSc.TaoADMMGetRegularizerCoefficientMethod
lambda::PetscReal = TaoADMMGetRegularizerCoefficient(petsclib::PetscLibType,tao::Tao)

Get the regularization coefficient lambda for L1 norm regularization case

Collective

Input Parameter:

  • tao - the Tao solver context

Output Parameter:

  • lambda - L1-norm regularizer coefficient

Level: advanced

-seealso: TaoADMMSetMisfitConstraintJacobian(), TaoADMMSetRegularizerConstraintJacobian(), TAOADMM

External Links

source
PETSc.LibPETSc.TaoADMMGetRegularizerTypeMethod
type::TaoADMMRegularizerType = TaoADMMGetRegularizerType(petsclib::PetscLibType,tao::Tao)

Gets the type of regularizer routine for TAOADMM

Not Collective

Input Parameter:

  • tao - the Tao context

Output Parameter:

  • type - the type of regularizer

Level: intermediate

-seealso: TaoADMMSetRegularizerType(), TaoADMMRegularizerType, TAOADMM

External Links

source
PETSc.LibPETSc.TaoADMMGetSpectralPenaltyMethod
mu::PetscReal = TaoADMMGetSpectralPenalty(petsclib::PetscLibType,tao::Tao)

Get the spectral penalty (mu) value

Collective

Input Parameter:

  • tao - the Tao solver context

Output Parameter:

  • mu - spectral penalty

Level: advanced

-seealso: TaoADMMSetMinimumSpectralPenalty(), TaoADMMSetSpectralPenalty(), TAOADMM

External Links

source
PETSc.LibPETSc.TaoADMMGetUpdateTypeMethod
type::TaoADMMUpdateType = TaoADMMGetUpdateType(petsclib::PetscLibType,tao::Tao)

Gets the type of spectral penalty update routine for TAOADMM

Not Collective

Input Parameter:

  • tao - the Tao context

Output Parameter:

  • type - the type of spectral penalty update routine

Level: intermediate

-seealso: TaoADMMSetUpdateType(), TaoADMMUpdateType, TAOADMM

External Links

source
PETSc.LibPETSc.TaoADMMSetMisfitConstraintJacobianMethod
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 context
  • J - user-created regularizer constraint Jacobian matrix
  • Jpre - user-created regularizer Jacobian constraint matrix for constructing the preconditioner, often this is J
  • func - function pointer for the regularizer constraint Jacobian update function
  • ctx - user context for the regularizer Hessian

Level: advanced

-seealso: TaoADMMSetRegularizerCoefficient(), TaoADMMSetRegularizerConstraintJacobian(), TAOADMM

External Links

source
PETSc.LibPETSc.TaoADMMSetMisfitHessianChangeStatusMethod
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_FALSE when the Hessian matrix does not change, PETSC_TRUE otherwise.

Level: advanced

-seealso: TAOADMM

External Links

source
PETSc.LibPETSc.TaoADMMSetMisfitHessianRoutineMethod
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 - the Tao context
  • H - user-created matrix for the Hessian of the misfit term
  • Hpre - user-created matrix for the preconditioner of Hessian of the misfit term
  • func - function pointer for the misfit Hessian evaluation
  • ctx - user context for the misfit Hessian

Level: advanced

-seealso: TAOADMM

External Links

source
PETSc.LibPETSc.TaoADMMSetRegHessianChangeStatusMethod
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 - the Tao solver context
  • b - the Hessian matrix change status boolean, PETSC_FALSE when the Hessian matrix does not change, PETSC_TRUE otherwise.

Level: advanced

-seealso: TAOADMM

External Links

source
PETSc.LibPETSc.TaoADMMSetRegularizerCoefficientMethod
TaoADMMSetRegularizerCoefficient(petsclib::PetscLibType,tao::Tao, lambda::PetscReal)

Set the regularization coefficient lambda for L1 norm regularization case

Collective

Input Parameters:

  • tao - the Tao solver context
  • lambda - L1-norm regularizer coefficient

Level: advanced

-seealso: TaoADMMSetMisfitConstraintJacobian(), TaoADMMSetRegularizerConstraintJacobian(), TAOADMM

External Links

source
PETSc.LibPETSc.TaoADMMSetRegularizerConstraintJacobianMethod
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 - the Tao solver context
  • J - user-created regularizer constraint Jacobian matrix
  • Jpre - user-created regularizer Jacobian constraint matrix for constructing the preconditioner, often this is J
  • func - function pointer for the regularizer constraint Jacobian update function
  • ctx - user context for the regularizer Hessian

Level: advanced

-seealso: TaoADMMSetRegularizerCoefficient(), TaoADMMSetMisfitConstraintJacobian(), TAOADMM

External Links

source
PETSc.LibPETSc.TaoADMMSetRegularizerHessianRoutineMethod
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 - the Tao context
  • H - user-created matrix for the Hessian of the regularization term
  • Hpre - user-created matrix for the preconditioner of Hessian of the regularization term
  • func - function pointer for the regularizer Hessian evaluation
  • ctx - user context for the regularizer Hessian

Level: advanced

-seealso: TAOADMM

External Links

source
PETSc.LibPETSc.TaoADMMSetRegularizerTypeMethod
TaoADMMSetRegularizerType(petsclib::PetscLibType,tao::Tao, type::TaoADMMRegularizerType)

Set regularizer type for TAOADMM routine

Not Collective

Input Parameters:

  • tao - the Tao context
  • type - 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

source
PETSc.LibPETSc.TaoADMMSetUpdateTypeMethod
TaoADMMSetUpdateType(petsclib::PetscLibType,tao::Tao, type::TaoADMMUpdateType)

Set update routine for TAOADMM routine

Not Collective

Input Parameters:

  • tao - the Tao context
  • type - spectral parameter update type

Level: intermediate

-seealso: TaoADMMGetUpdateType(), TaoADMMUpdateType, TAOADMM

External Links

source
PETSc.LibPETSc.TaoALMMGetDualISMethod
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 the TAOALMM solver

Output Parameters:

  • eq_is - index set associated with the equality constraints (NULL if not needed)
  • ineq_is - index set associated with the inequality constraints (NULL if not needed)

Level: advanced

-seealso: TAOALMM, Tao, TaoALMMGetMultipliers()

External Links

source
PETSc.LibPETSc.TaoALMMGetMultipliersMethod
TaoALMMGetMultipliers(petsclib::PetscLibType,tao::Tao, Y::PetscVec)

Retrieve a pointer to the Lagrange multipliers.

Input Parameter:

  • tao - the Tao context for the TAOALMM solver

Output Parameter:

  • Y - vector of Lagrange multipliers

Level: advanced

-seealso: TAOALMM, Tao, TaoALMMSetMultipliers(), TaoALMMGetDualIS()

External Links

source
PETSc.LibPETSc.TaoALMMGetPrimalISMethod
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 - the Tao context for the TAOALMM solver

Output Parameters:

  • opt_is - index set associated with the optimization variables (NULL if not needed)
  • slack_is - index set associated with the slack variables (NULL if not needed)

Level: advanced

-seealso: TAOALMM, Tao, IS, TaoALMMGetPrimalVector()

External Links

source
PETSc.LibPETSc.TaoALMMGetSubsolverMethod
TaoALMMGetSubsolver(petsclib::PetscLibType,tao::Tao, subsolver::Tao)

Retrieve the subsolver being used by TAOALMM.

Input Parameter:

  • tao - the Tao context for the TAOALMM solver

Output Parameter:

  • subsolver - the Tao context for the subsolver

Level: advanced

-seealso: Tao, TAOALMM, TaoALMMSetSubsolver()

External Links

source
PETSc.LibPETSc.TaoALMMGetTypeMethod
type::TaoALMMType = TaoALMMGetType(petsclib::PetscLibType,tao::Tao)

Retrieve the augmented Lagrangian formulation type for the subproblem.

Input Parameter:

  • tao - the Tao context for the TAOALMM solver

Output Parameter:

  • type - augmented Lagragrangian type

Level: advanced

-seealso: Tao, TAOALMM, TaoALMMSetType(), TaoALMMType

External Links

source
PETSc.LibPETSc.TaoALMMSetMultipliersMethod
TaoALMMSetMultipliers(petsclib::PetscLibType,tao::Tao, Y::PetscVec)

Set user

Input Parameters:

  • tao - the Tao context for the TAOALMM solver
  • Y - vector of Lagrange multipliers

Level: advanced

-seealso: TAOALMM, Tao, TaoALMMGetMultipliers()

External Links

source
PETSc.LibPETSc.TaoALMMSetSubsolverMethod
TaoALMMSetSubsolver(petsclib::PetscLibType,tao::Tao, subsolver::Tao)

Changes the subsolver inside TAOALMM with the user provided one.

Input Parameters:

  • tao - the Tao context for the TAOALMM solver
  • subsolver - the Tao context for the subsolver

Level: advanced

-seealso: Tao, TAOALMM, TaoALMMGetSubsolver()

External Links

source
PETSc.LibPETSc.TaoALMMSetTypeMethod
TaoALMMSetType(petsclib::PetscLibType,tao::Tao, type::TaoALMMType)

Determine the augmented Lagrangian formulation type for the subproblem.

Input Parameters:

  • tao - the Tao context for the TAOALMM solver
  • type - augmented Lagragrangian type

Level: advanced

-seealso: Tao, TAOALMM, TaoALMMGetType(), TaoALMMType

External Links

source
PETSc.LibPETSc.TaoAddLineSearchCountsMethod
TaoAddLineSearchCounts(petsclib::PetscLibType,tao::Tao)

Adds the number of function evaluations spent in the line search to the running total.

Input Parameters:

  • tao - the Tao solver

Level: developer

-seealso: , Tao, TaoGetLineSearch(), TaoLineSearchApply()

External Links

source
PETSc.LibPETSc.TaoAppendOptionsPrefixMethod
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 - the Tao solver context
  • p - the prefix string to prepend to all Tao option requests

Level: advanced

-seealso: , Tao, TaoSetFromOptions(), TaoSetOptionsPrefix(), TaoGetOptionsPrefix()

External Links

source
PETSc.LibPETSc.TaoBNCGGetTypeMethod
type::TaoBNCGType = TaoBNCGGetType(petsclib::PetscLibType,tao::Tao)

Return the type for the TAOBNCG solver

Input Parameter:

  • tao - the Tao solver context

Output Parameter:

  • type - TAOBNCG type

Level: advanced

-seealso: Tao, TAOBNCG, TaoBNCGSetType(), TaoBNCGType

External Links

source
PETSc.LibPETSc.TaoBNCGSetTypeMethod
TaoBNCGSetType(petsclib::PetscLibType,tao::Tao, type::TaoBNCGType)

Set the type for the TAOBNCG solver

Input Parameters:

  • tao - the Tao solver context
  • type - TAOBNCG type

Level: advanced

-seealso: Tao, TAOBNCG, TaoBNCGGetType(), TaoBNCGType

External Links

source
PETSc.LibPETSc.TaoBRGNGetDampingVectorMethod
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 - a Tao of type TAOBRGN with TAOBRGN_REGULARIZATION_LM regularization

Output Parameter:

  • d - the damping vector

Level: developer

-seealso: , Tao, TAOBRGN, TaoBRGNRegularzationTypes

External Links

source
PETSc.LibPETSc.TaoBRGNGetRegularizationTypeMethod
type::TaoBRGNRegularizationType = TaoBRGNGetRegularizationType(petsclib::PetscLibType,tao::Tao)

Get the TaoBRGNRegularizationType of a TAOBRGN

Not collective

Input Parameter:

  • tao - a Tao of type TAOBRGN

Output Parameter:

  • type - the TaoBRGNRegularizationType

Level: advanced

-seealso: , Tao, TAOBRGN, TaoBRGNRegularizationType, TaoBRGNSetRegularizationType()

External Links

source
PETSc.LibPETSc.TaoBRGNGetSubsolverMethod
TaoBRGNGetSubsolver(petsclib::PetscLibType,tao::Tao, subsolver::Tao)

Get the pointer to the subsolver inside a TAOBRGN

Collective

Input Parameters:

  • tao - the Tao solver context
  • subsolver - the Tao sub-solver context

Level: advanced

-seealso: Tao, Mat, TAOBRGN

External Links

source
PETSc.LibPETSc.TaoBRGNSetDictionaryMatrixMethod
TaoBRGNSetDictionaryMatrix(petsclib::PetscLibType,tao::Tao, dict::PetscMat)

bind the dictionary matrix from user application context to gn

Input Parameters:

  • tao - the Tao context
  • dict - the user specified dictionary matrix. We allow to set a NULL dictionary, which means identity matrix by default

Level: advanced

-seealso: Tao, Mat, TAOBRGN

External Links

source
PETSc.LibPETSc.TaoBRGNSetRegularizationTypeMethod
TaoBRGNSetRegularizationType(petsclib::PetscLibType,tao::Tao, type::TaoBRGNRegularizationType)

Set the TaoBRGNRegularizationType of a TAOBRGN

Logically collective

Input Parameters:

  • tao - a Tao of type TAOBRGN
  • type - the TaoBRGNRegularizationType

Level: advanced

-seealso: , Tao, TAOBRGN, TaoBRGNRegularizationType, TaoBRGNGetRegularizationType

External Links

source
PETSc.LibPETSc.TaoBRGNSetRegularizerHessianRoutineMethod
TaoBRGNSetRegularizerHessianRoutine(petsclib::PetscLibType,tao::Tao, Hreg::PetscMat, func::external, ctx::Cvoid)

Sets the user function into the algorithm.

Input Parameters:

  • tao - the Tao context
  • Hreg - user-created matrix for the Hessian of the regularization term
  • func - function pointer for the regularizer Hessian evaluation
  • ctx - user context for the regularizer Hessian

Calling sequence:

  • tao - the Tao context
  • u - the location at which to compute the Hessian
  • Hreg - user-created matrix for the Hessian of the regularization term
  • ctx - user context for the regularizer Hessian

Level: advanced

-seealso: Tao, Mat, TAOBRGN

External Links

source
PETSc.LibPETSc.TaoBRGNSetRegularizerObjectiveAndGradientRoutineMethod
TaoBRGNSetRegularizerObjectiveAndGradientRoutine(petsclib::PetscLibType,tao::Tao, func::external, ctx::Cvoid)

Sets the user function into the algorithm.

Input Parameters:

  • tao - the Tao context
  • func - function pointer for the regularizer value and gradient evaluation
  • ctx - user context for the regularizer

Calling sequence:

  • tao - the Tao context
  • u - the location at which to compute the objective and gradient
  • val - location to store objective function value
  • g - location to store gradient
  • ctx - user context for the regularizer Hessian

Level: advanced

-seealso: Tao, Mat, TAOBRGN

External Links

source
PETSc.LibPETSc.TaoBoundSolutionMethod
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 vector
  • XL - lower bound vector
  • XU - upper bound vector
  • bound_tol - absolute tolerance in enforcing the bound

Output Parameters:

  • nDiff - total number of vector entries that have been bounded
  • Xout - modified solution vector satisfying bounds to bound_tol

Level: developer

-seealso: TAOBNCG, TAOBNTL, TAOBNTR, TaoBoundStep()

External Links

source
PETSc.LibPETSc.TaoBoundStepMethod
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 vector
  • XL - lower bound vector
  • XU - upper bound vector
  • active_lower - index set for lower bounded active variables
  • active_upper - index set for lower bounded active variables
  • active_fixed - index set for fixed active variables
  • scale - 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

source
PETSc.LibPETSc.TaoComputeConstraintsMethod
TaoComputeConstraints(petsclib::PetscLibType,tao::Tao, X::PetscVec, C::PetscVec)

Compute the variable bounds using the routine set by TaoSetConstraintsRoutine().

Collective

Input Parameters:

  • tao - the Tao context
  • X - location to evaluate the constraints

Output Parameter:

  • C - the constraints

Level: developer

-seealso: , Tao, TaoSetConstraintsRoutine(), TaoComputeJacobian()

External Links

source
PETSc.LibPETSc.TaoComputeDualVariablesMethod
TaoComputeDualVariables(petsclib::PetscLibType,tao::Tao, DL::PetscVec, DU::PetscVec)

Computes the dual vectors corresponding to the bounds of the variables

Collective

Input Parameter:

  • tao - the Tao context

Output Parameters:

  • DL - dual variable vector for the lower bounds
  • DU - dual variable vector for the upper bounds

Level: advanced

-seealso: , Tao, TaoComputeObjective(), TaoSetVariableBounds()

External Links

source
PETSc.LibPETSc.TaoComputeEqualityConstraintsMethod
TaoComputeEqualityConstraints(petsclib::PetscLibType,tao::Tao, X::PetscVec, CE::PetscVec)

Compute the variable bounds using the routine set by TaoSetEqualityConstraintsRoutine().

Collective

Input Parameter:

  • tao - the Tao context

Output Parameters:

  • X - point the equality constraints were evaluated on
  • CE - vector of equality constraints evaluated at X

Level: developer

-seealso: , Tao, TaoSetEqualityConstraintsRoutine(), TaoComputeJacobianEquality(), TaoComputeInequalityConstraints()

External Links

source
PETSc.LibPETSc.TaoComputeGradientMethod
TaoComputeGradient(petsclib::PetscLibType,tao::Tao, X::PetscVec, G::PetscVec)

Computes the gradient of the objective function

Collective

Input Parameters:

  • tao - the Tao context
  • X - 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

source
PETSc.LibPETSc.TaoComputeHessianMethod
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 context
  • X - input vector

Output Parameters:

  • H - Hessian matrix
  • Hpre - matrix used to construct the preconditioner, usually the same as H

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

source
PETSc.LibPETSc.TaoComputeInequalityConstraintsMethod
TaoComputeInequalityConstraints(petsclib::PetscLibType,tao::Tao, X::PetscVec, CI::PetscVec)

Compute the variable bounds using the routine set by TaoSetInequalityConstraintsRoutine().

Collective

Input Parameter:

  • tao - the Tao context

Output Parameters:

  • X - point the inequality constraints were evaluated on
  • CI - vector of inequality constraints evaluated at X

Level: developer

-seealso: , Tao, TaoSetInequalityConstraintsRoutine(), TaoComputeJacobianInequality(), TaoComputeEqualityConstraints()

External Links

source
PETSc.LibPETSc.TaoComputeJacobianMethod
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 context
  • X - input vector

Output Parameters:

  • J - Jacobian matrix
  • Jpre - matrix used to compute the preconditioner, often the same as J

Level: developer

-seealso: , TaoComputeObjective(), TaoComputeObjectiveAndGradient(), TaoSetJacobianRoutine()

External Links

source
PETSc.LibPETSc.TaoComputeJacobianDesignMethod
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 context
  • X - input vector

Output Parameter:

  • J - Jacobian matrix

Level: developer

-seealso: , Tao, TaoComputeObjective(), TaoComputeObjectiveAndGradient(), TaoSetJacobianDesignRoutine(), TaoSetStateDesignIS()

External Links

source
PETSc.LibPETSc.TaoComputeJacobianEqualityMethod
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 - the Tao solver context
  • X - input vector

Output Parameters:

  • J - Jacobian matrix
  • Jpre - matrix used to construct the preconditioner, often the same as J

Level: developer

-seealso: , TaoComputeObjective(), TaoComputeObjectiveAndGradient(), TaoSetJacobianStateRoutine(), TaoComputeJacobianDesign(), TaoSetStateDesignIS()

External Links

source
PETSc.LibPETSc.TaoComputeJacobianInequalityMethod
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 - the Tao solver context
  • X - input vector

Output Parameters:

  • J - Jacobian matrix
  • Jpre - matrix used to construct the preconditioner

Level: developer

-seealso: , Tao, TaoComputeObjective(), TaoComputeObjectiveAndGradient(), TaoSetJacobianStateRoutine(), TaoComputeJacobianDesign(), TaoSetStateDesignIS()

External Links

source
PETSc.LibPETSc.TaoComputeJacobianStateMethod
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 - the Tao solver context
  • X - input vector

Output Parameters:

  • J - Jacobian matrix
  • Jpre - matrix used to construct the preconditioner, often the same as J
  • Jinv - unknown

Level: developer

-seealso: , Tao, TaoComputeObjective(), TaoComputeObjectiveAndGradient(), TaoSetJacobianStateRoutine(), TaoComputeJacobianDesign(), TaoSetStateDesignIS()

External Links

source
PETSc.LibPETSc.TaoComputeObjectiveMethod
f::PetscReal = TaoComputeObjective(petsclib::PetscLibType,tao::Tao, X::PetscVec)

Computes the objective function value at a given point

Collective

Input Parameters:

  • tao - the Tao context
  • X - input vector

Output Parameter:

  • f - Objective value at X

Level: developer

-seealso: , Tao, TaoComputeGradient(), TaoComputeObjectiveAndGradient(), TaoSetObjective()

External Links

source
PETSc.LibPETSc.TaoComputeObjectiveAndGradientMethod
f::PetscReal = TaoComputeObjectiveAndGradient(petsclib::PetscLibType,tao::Tao, X::PetscVec, G::PetscVec)

Computes the objective function value at a given point

Collective

Input Parameters:

  • tao - the Tao context
  • X - input vector

Output Parameters:

  • f - Objective value at X
  • G - Gradient vector at X

Level: developer

-seealso: , TaoComputeGradient(), TaoSetObjective()

External Links

source
PETSc.LibPETSc.TaoComputeResidualMethod
TaoComputeResidual(petsclib::PetscLibType,tao::Tao, X::PetscVec, F::PetscVec)

Computes a least

Collective

Input Parameters:

  • tao - the Tao context
  • X - input vector

Output Parameter:

  • F - Objective vector at X

Level: advanced

-seealso: , Tao, TaoSetResidualRoutine()

External Links

source
PETSc.LibPETSc.TaoComputeResidualJacobianMethod
TaoComputeResidualJacobian(petsclib::PetscLibType,tao::Tao, X::PetscVec, J::PetscMat, Jpre::PetscMat)

Computes the least set with TaoSetJacobianResidual().

Collective

Input Parameters:

  • tao - the Tao solver context
  • X - input vector

Output Parameters:

  • J - Jacobian matrix
  • Jpre - matrix used to compute the preconditioner, often the same as J

Level: developer

-seealso: , Tao, TaoComputeResidual(), TaoSetJacobianResidual()

External Links

source
PETSc.LibPETSc.TaoComputeVariableBoundsMethod
TaoComputeVariableBounds(petsclib::PetscLibType,tao::Tao)

Compute the variable bounds using the routine set by TaoSetVariableBoundsRoutine().

Collective

Input Parameter:

  • tao - the Tao context

Level: developer

-seealso: , Tao, TaoSetVariableBoundsRoutine(), TaoSetVariableBounds()

External Links

source
PETSc.LibPETSc.TaoCreateMethod
newtao::Tao = TaoCreate(petsclib::PetscLibType,comm::MPI_Comm)

Creates a Tao solver

Collective

Input Parameter:

  • comm - MPI communicator

Output Parameter:

  • newtao - the new Tao context

Options Database Key:

  • -tao_type - select which method Tao should use

Level: beginner

-seealso: , Tao, TaoSolve(), TaoDestroy(), TaoSetFromOptions(), TaoSetType()

External Links

source
PETSc.LibPETSc.TaoDefaultComputeGradientMethod
TaoDefaultComputeGradient(petsclib::PetscLibType,tao::Tao, Xin::PetscVec, G::PetscVec, dummy::Cvoid)

computes the gradient using finite differences.

Collective

Input Parameters:

  • tao - the Tao context
  • Xin - compute gradient at this point
  • dummy - 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

source
PETSc.LibPETSc.TaoDefaultComputeHessianMethod
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 context
  • V - compute Hessian at this point
  • dummy - 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

source
PETSc.LibPETSc.TaoDefaultComputeHessianColorMethod
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 context
  • V - compute Hessian at this point
  • ctx - the color object of type MatFDColoring

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

source
PETSc.LibPETSc.TaoDefaultConvergenceTestMethod
TaoDefaultConvergenceTest(petsclib::PetscLibType,tao::Tao, dummy::Cvoid)

Determines whether the solver should continue iterating or terminate.

Collective

Input Parameters:

  • tao - the Tao context
  • dummy - unused dummy context

Level: developer

-seealso: , Tao, TaoSetTolerances(), TaoGetConvergedReason(), TaoSetConvergedReason()

External Links

source
PETSc.LibPETSc.TaoDestroyMethod
TaoDestroy(petsclib::PetscLibType,tao::Tao)

Destroys the Tao context that was created with TaoCreate()

Collective

Input Parameter:

  • tao - the Tao context

Level: beginner

-seealso: , Tao, TaoCreate(), TaoSolve()

External Links

source
PETSc.LibPETSc.TaoEstimateActiveBoundsMethod
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 vector
  • XL - lower bound vector
  • XU - upper bound vector
  • G - unprojected gradient
  • S - step direction with which the active bounds will be estimated
  • W - work vector of type and size of X
  • steplen - the step length at which the active bounds will be estimated (needs to be conservative)

Output Parameters:

  • bound_tol - tolerance for the bound estimation
  • active_lower - index set for active variables at the lower bound
  • active_upper - index set for active variables at the upper bound
  • active_fixed - index set for fixed variables
  • active - index set for all active variables
  • inactive - complementary index set for inactive variables

Level: developer

-seealso: TAOBNCG, TAOBNTL, TAOBNTR, TaoBoundSolution()

External Links

source
PETSc.LibPETSc.TaoFinalizePackageMethod
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

source
PETSc.LibPETSc.TaoGetADMMParentTaoMethod
TaoGetADMMParentTao(petsclib::PetscLibType,tao::Tao, admm_tao::Tao)

Gets pointer to parent TAOADMM, used by inner subsolver.

Collective

Input Parameter:

  • tao - the Tao context

Output Parameter:

  • admm_tao - the parent Tao context

Level: advanced

-seealso: TAOADMM

External Links

source
PETSc.LibPETSc.TaoGetConstraintTolerancesMethod
catol::PetscReal,crtol::PetscReal = TaoGetConstraintTolerances(petsclib::PetscLibType,tao::Tao)

Gets constraint tolerance parameters used in TaoSolve() convergence tests

Not Collective

Input Parameter:

  • tao - the Tao context

Output Parameters:

  • catol - absolute constraint tolerance, constraint norm must be less than catol for used for gatol convergence criteria
  • crtol - relative constraint tolerance, constraint norm must be less than crtol for used for gatol, gttol convergence criteria

Level: intermediate

-seealso: , Tao, TaoConvergedReasons,TaoGetTolerances(), TaoSetTolerances(), TaoSetConstraintTolerances()

External Links

source
PETSc.LibPETSc.TaoGetConvergedReasonMethod
TaoGetConvergedReason(petsclib::PetscLibType,tao::Tao, reason::TaoConvergedReason)

Gets the reason the TaoSolve() was stopped.

Not Collective

Input Parameter:

  • tao - the Tao solver context

Output Parameter:

  • reason - value of TaoConvergedReason

Level: intermediate

-seealso: , Tao, TaoConvergedReason, TaoSetConvergenceTest(), TaoSetTolerances()

External Links

source
PETSc.LibPETSc.TaoGetConvergenceHistoryMethod
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 - the Tao context

Output Parameters:

  • obj - array used to hold objective value history
  • resid - array used to hold residual history
  • cnorm - array used to hold constraint violation history
  • lits - integer array used to hold linear solver iteration count
  • nhist - size of obj, resid, cnorm, and lits

Level: advanced

-seealso: , Tao, TaoSolve(), TaoSetConvergenceHistory()

External Links

source
PETSc.LibPETSc.TaoGetCurrentFunctionEvaluationsMethod
nfuncs::PetscInt = TaoGetCurrentFunctionEvaluations(petsclib::PetscLibType,tao::Tao)

Get current number of function evaluations used by a Tao object

Not Collective

Input Parameter:

  • tao - the Tao solver 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

source
PETSc.LibPETSc.TaoGetCurrentTrustRegionRadiusMethod
radius::PetscReal = TaoGetCurrentTrustRegionRadius(petsclib::PetscLibType,tao::Tao)

Gets the current trust region radius.

Not Collective

Input Parameter:

  • tao - a Tao optimization solver

Output Parameter:

  • radius - the trust region radius

Level: intermediate

-seealso: , Tao, TaoSetInitialTrustRegionRadius(), TaoGetInitialTrustRegionRadius(), TAONTR

External Links

source
PETSc.LibPETSc.TaoGetDualVariablesMethod
TaoGetDualVariables(petsclib::PetscLibType,tao::Tao, DE::PetscVec, DI::PetscVec)

Gets the dual vectors

Collective

Input Parameter:

  • tao - the Tao context

Output Parameters:

  • DE - dual variable vector for the lower bounds
  • DI - dual variable vector for the upper bounds

Level: advanced

-seealso: , Tao, TaoComputeDualVariables()

External Links

source
PETSc.LibPETSc.TaoGetFunctionLowerBoundMethod
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 - the Tao solver context

Output Parameter:

  • fmin - the minimum function value

Level: intermediate

-seealso: , Tao, TaoConvergedReason, TaoSetFunctionLowerBound()

External Links

source
PETSc.LibPETSc.TaoGetGradientNormMethod
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 - the Tao context

Output Parameter:

  • M - gradient norm

Level: beginner

-seealso: , Tao, TaoSetGradientNorm(), TaoGradientNorm()

External Links

source
PETSc.LibPETSc.TaoGetInequalityBoundsMethod
TaoGetInequalityBounds(petsclib::PetscLibType,tao::Tao, IL::PetscVec, IU::PetscVec)

Gets the upper and lower bounds set via TaoSetInequalityBounds()

Logically Collective

Input Parameter:

  • tao - the Tao context

Output Parameters:

  • IL - vector of lower bounds
  • IU - vector of upper bounds

Level: beginner

-seealso: , TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoSetInequalityBounds()

External Links

source
PETSc.LibPETSc.TaoGetInitialTrustRegionRadiusMethod
radius::PetscReal = TaoGetInitialTrustRegionRadius(petsclib::PetscLibType,tao::Tao)

Gets the initial trust region radius.

Not Collective

Input Parameter:

  • tao - a Tao optimization solver

Output Parameter:

  • radius - the trust region radius

Level: intermediate

-seealso: , Tao, TaoSetInitialTrustRegionRadius(), TaoGetCurrentTrustRegionRadius(), TAONTR

External Links

source
PETSc.LibPETSc.TaoGetIterationNumberMethod
iter::PetscInt = TaoGetIterationNumber(petsclib::PetscLibType,tao::Tao)

Gets the number of TaoSolve() iterations completed at this time.

Not Collective

Input Parameter:

  • tao - the Tao context

Output Parameter:

  • iter - iteration number

-seealso: , Tao, TaoGetLinearSolveIterations(), TaoGetResidualNorm(), TaoGetObjective()

External Links

source
PETSc.LibPETSc.TaoGetKSPMethod
TaoGetKSP(petsclib::PetscLibType,tao::Tao, ksp::PetscKSP)

Gets the linear solver used by the optimization solver.

Not Collective

Input Parameter:

  • tao - the Tao solver

Output Parameter:

  • ksp - the KSP linear solver used in the optimization solver

Level: intermediate

-seealso: , Tao, KSP

External Links

source
PETSc.LibPETSc.TaoGetLMVMMatrixMethod
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 - Tao solver context

Output Parameter:

  • B - LMVM matrix

Level: advanced

-seealso: TAOBQNLS, TAOBQNKLS, TAOBQNKTL, TAOBQNKTR, MATLMVM, TaoSetLMVMMatrix()

External Links

source
PETSc.LibPETSc.TaoGetLineSearchMethod
TaoGetLineSearch(petsclib::PetscLibType,tao::Tao, ls::TaoLineSearch)

Gets the line search used by the optimization solver.

Not Collective

Input Parameter:

  • tao - the Tao solver

Output Parameter:

  • ls - the line search used in the optimization solver

Level: intermediate

-seealso: , Tao, TaoLineSearch, TaoLineSearchType

External Links

source
PETSc.LibPETSc.TaoGetLinearSolveIterationsMethod
lits::PetscInt = TaoGetLinearSolveIterations(petsclib::PetscLibType,tao::Tao)

Gets the total number of linear iterations used by the Tao solver

Not Collective

Input Parameter:

  • tao - the Tao context

Output Parameter:

  • lits - number of linear iterations

Level: intermediate

-seealso: , Tao, TaoGetKSP()

External Links

source
PETSc.LibPETSc.TaoGetMaximumFunctionEvaluationsMethod
nfcn::PetscInt = TaoGetMaximumFunctionEvaluations(petsclib::PetscLibType,tao::Tao)

Gets a maximum number of function evaluations allowed for a TaoSolve()

Logically Collective

Input Parameter:

  • tao - the Tao solver context

Output Parameter:

  • nfcn - the maximum number of function evaluations

Level: intermediate

-seealso: , Tao, TaoSetMaximumFunctionEvaluations(), TaoGetMaximumIterations()

External Links

source
PETSc.LibPETSc.TaoGetMaximumIterationsMethod
maxits::PetscInt = TaoGetMaximumIterations(petsclib::PetscLibType,tao::Tao)

Gets a maximum number of iterates that will be used

Not Collective

Input Parameter:

  • tao - the Tao solver context

Output Parameter:

  • maxits - the maximum number of iterates

Level: intermediate

-seealso: , Tao, TaoSetMaximumIterations(), TaoGetMaximumFunctionEvaluations()

External Links

source
PETSc.LibPETSc.TaoGetOptionsPrefixMethod
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 - the Tao context

Output Parameter:

  • p - pointer to the prefix string used is returned

Level: advanced

-seealso: , Tao, TaoSetFromOptions(), TaoSetOptionsPrefix(), TaoAppendOptionsPrefix()

External Links

source
PETSc.LibPETSc.TaoGetRecycleHistoryMethod
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 - the Tao context

Output Parameter:

  • recycle - boolean flag

Level: intermediate

-seealso: , Tao, TaoSetRecycleHistory(), TAOBNCG, TAOBQNLS, TAOBQNKLS, TAOBQNKTR, TAOBQNKTL

External Links

source
PETSc.LibPETSc.TaoGetResidualNormMethod
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 - the Tao context

Output Parameter:

  • value - the current value

Level: intermediate

-seealso: , Tao, TaoGetLinearSolveIterations(), TaoGetIterationNumber(), TaoGetObjective()

External Links

source
PETSc.LibPETSc.TaoGetSolutionMethod
TaoGetSolution(petsclib::PetscLibType,tao::Tao, X::PetscVec)

Returns the vector with the current solution from the Tao object

Not Collective

Input Parameter:

  • tao - the Tao context

Output Parameter:

  • X - the current solution

Level: intermediate

-seealso: , Tao, TaoSetSolution(), TaoSolve()

External Links

source
PETSc.LibPETSc.TaoGetSolutionStatusMethod
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 - the Tao context

Output Parameters:

  • its - the current iterate number (>=0)
  • f - the current function value
  • gnorm - 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 equal TAO_CONTINUE_ITERATING

Level: intermediate

-seealso: , TaoMonitor(), TaoGetConvergedReason()

External Links

source
PETSc.LibPETSc.TaoGetTolerancesMethod
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 - the Tao context

Output Parameters:

  • gatol - stop if norm of gradient is less than this
  • grtol - stop if relative norm of gradient is less than this
  • gttol - stop if norm of gradient is reduced by a this factor

Level: intermediate

-seealso: , Tao, TaoSetTolerances()

External Links

source
PETSc.LibPETSc.TaoGetTotalIterationNumberMethod
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 - the Tao context

Output Parameter:

  • iter - number of iterations

Level: intermediate

-seealso: , Tao, TaoGetLinearSolveIterations()

External Links

source
PETSc.LibPETSc.TaoGetTypeMethod
type::TaoType = TaoGetType(petsclib::PetscLibType,tao::Tao)

Gets the current TaoType being used in the Tao object

Not Collective

Input Parameter:

  • tao - the Tao solver context

Output Parameter:

  • type - the TaoType

Level: intermediate

-seealso: , Tao, TaoType, TaoSetType()

External Links

source
PETSc.LibPETSc.TaoGetVariableBoundsMethod
TaoGetVariableBounds(petsclib::PetscLibType,tao::Tao, XL::PetscVec, XU::PetscVec)

Gets the upper and lower bounds vectors set with TaoSetVariableBounds()

Not Collective

Input Parameter:

  • tao - the Tao context

Output Parameters:

  • XL - vector of lower bounds
  • XU - vector of upper bounds

Level: beginner

-seealso: , Tao, TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoSetVariableBounds()

External Links

source
PETSc.LibPETSc.TaoGradientNormMethod
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 - the Tao context
  • gradient - the gradient
  • type - the norm type

Output Parameter:

  • gnorm - the gradient norm

Level: advanced

-seealso: , Tao, TaoSetGradientNorm(), TaoGetGradientNorm()

External Links

source
PETSc.LibPETSc.TaoInitializePackageMethod
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

source
PETSc.LibPETSc.TaoIsGradientDefinedMethod
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 - the Tao context

Output Parameter:

  • flg - PETSC_TRUE if function routine is set by user, PETSC_FALSE otherwise

Level: developer

-seealso: , TaoSetGradient(), TaoIsObjectiveDefined(), TaoIsObjectiveAndGradientDefined()

External Links

source
PETSc.LibPETSc.TaoIsObjectiveAndGradientDefinedMethod
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 - the Tao context

Output Parameter:

  • flg - PETSC_TRUE if function routine is set by user, PETSC_FALSE otherwise

Level: developer

-seealso: , TaoSetObjectiveAndGradient(), TaoIsObjectiveDefined(), TaoIsGradientDefined()

External Links

source
PETSc.LibPETSc.TaoIsObjectiveDefinedMethod
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 - the Tao context

Output Parameter:

  • flg - PETSC_TRUE if function routine is set by user, PETSC_FALSE otherwise

Level: developer

-seealso: , Tao, TaoSetObjective(), TaoIsGradientDefined(), TaoIsObjectiveAndGradientDefined()

External Links

source
PETSc.LibPETSc.TaoKSPSetUseEWMethod
TaoKSPSetUseEW(petsclib::PetscLibType,tao::Tao, flag::PetscBool)

Sets SNES to use Eisenstat

Logically Collective

Input Parameters:

  • tao - Tao context
  • flag - PETSC_TRUE or PETSC_FALSE

Level: advanced

-seealso: , Tao, SNESKSPSetUseEW()

External Links

source
PETSc.LibPETSc.TaoLMVMGetH0Method
TaoLMVMGetH0(petsclib::PetscLibType,tao::Tao, H0::PetscMat)

Get the matrix object for the QN initial Hessian

Input Parameter:

  • tao - the Tao solver context

Output Parameter:

  • H0 - Mat object for the initial Hessian

Level: advanced

-seealso: Tao, TAOLMVM, TAOBLMVM, TaoLMVMSetH0(), TaoLMVMGetH0KSP()

External Links

source
PETSc.LibPETSc.TaoLMVMGetH0KSPMethod
TaoLMVMGetH0KSP(petsclib::PetscLibType,tao::Tao, ksp::PetscKSP)

Get the iterative solver for applying the inverse of the QN initial Hessian

Input Parameter:

  • tao - the Tao solver context

Output Parameter:

  • ksp - KSP solver context for the initial Hessian

Level: advanced

-seealso: Tao, TAOLMVM, TAOBLMVM, TaoLMVMGetH0()

External Links

source
PETSc.LibPETSc.TaoLMVMRecycleMethod
TaoLMVMRecycle(petsclib::PetscLibType,tao::Tao, flg::PetscBool)

Enable/disable recycling of the QN history between subsequent TaoSolve() calls.

Input Parameters:

  • tao - the Tao solver context
  • flg - Boolean flag for recycling (PETSC_TRUE or PETSC_FALSE)

Level: intermediate

-seealso: Tao, TAOLMVM, TAOBLMVM

External Links

source
PETSc.LibPETSc.TaoLMVMSetH0Method
TaoLMVMSetH0(petsclib::PetscLibType,tao::Tao, H0::PetscMat)

Set the initial Hessian for the QN approximation

Input Parameters:

  • tao - the Tao solver context
  • H0 - Mat object for the initial Hessian

Level: advanced

-seealso: Tao, TAOLMVM, TAOBLMVM, TaoLMVMGetH0(), TaoLMVMGetH0KSP()

External Links

source
PETSc.LibPETSc.TaoMatGetSubMatMethod
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 for TAO_SUBSET_MASK option
  • subset_type - the method Tao is using for subsetting

Output Parameter:

  • Msub - the submatrix

Level: developer

-seealso: TaoVecGetSubVec(), TaoSubsetType

External Links

source
PETSc.LibPETSc.TaoMonitorMethod
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 - the Tao context
  • its - the current iterate number (>=0)
  • f - the current objective function value
  • res - 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

source
PETSc.LibPETSc.TaoMonitorCancelMethod
TaoMonitorCancel(petsclib::PetscLibType,tao::Tao)

Clears all the monitor functions for a Tao object.

Logically Collective

Input Parameter:

  • tao - the Tao solver 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

source
PETSc.LibPETSc.TaoMonitorConstraintNormMethod
TaoMonitorConstraintNorm(petsclib::PetscLibType,tao::Tao, ctx::Cvoid)

same as TaoMonitorDefault() except it prints the norm of the constraint function.

Collective

Input Parameters:

  • tao - the Tao context
  • ctx - PetscViewer context or NULL

Options Database Key:

  • -tao_monitor_constraint_norm - monitor the constraints

Level: advanced

-seealso: , Tao, TaoMonitorDefault(), TaoMonitorSet()

External Links

source
PETSc.LibPETSc.TaoMonitorDefaultMethod
TaoMonitorDefault(petsclib::PetscLibType,tao::Tao, ctx::Cvoid)

Default routine for monitoring progress of TaoSolve()

Collective

Input Parameters:

  • tao - the Tao context
  • ctx - PetscViewer context or NULL

Options Database Key:

  • -tao_monitor - turn on default monitoring

Level: advanced

-seealso: , Tao, TaoMonitorDefaultShort(), TaoMonitorSet()

External Links

source
PETSc.LibPETSc.TaoMonitorDefaultShortMethod
TaoMonitorDefaultShort(petsclib::PetscLibType,tao::Tao, ctx::Cvoid)

Routine for monitoring progress of TaoSolve() that displays fewer digits than TaoMonitorDefault()

Collective

Input Parameters:

  • tao - the Tao context
  • ctx - PetscViewer context of type PETSCVIEWERASCII

Options Database Key:

  • -tao_monitor_short - turn on default short monitoring

Level: advanced

-seealso: , Tao, TaoMonitorDefault(), TaoMonitorSet()

External Links

source
PETSc.LibPETSc.TaoMonitorGlobalizationMethod
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 - the Tao context
  • ctx - PetscViewer context or NULL

Options Database Key:

  • -tao_monitor_globalization - turn on monitoring with globalization information

Level: advanced

-seealso: , Tao, TaoMonitorDefaultShort(), TaoMonitorSet()

External Links

source
PETSc.LibPETSc.TaoMonitorGradientMethod
TaoMonitorGradient(petsclib::PetscLibType,tao::Tao, ctx::Cvoid)

Views the gradient at each iteration of TaoSolve()

Collective

Input Parameters:

  • tao - the Tao context
  • ctx - PetscViewer context or NULL

Options Database Key:

  • -tao_monitor_gradient - view the gradient at each iteration

Level: advanced

-seealso: , Tao, TaoMonitorDefaultShort(), TaoMonitorSet()

External Links

source
PETSc.LibPETSc.TaoMonitorGradientDrawMethod
TaoMonitorGradientDraw(petsclib::PetscLibType,tao::Tao, ctx::Cvoid)

Plots the gradient at each iteration of TaoSolve()

Collective

Input Parameters:

  • tao - the Tao context
  • ctx - PetscViewer context

Options Database Key:

  • -tao_monitor_gradient_draw - draw the gradient at each iteration

Level: advanced

-seealso: , Tao, TaoMonitorGradient(), TaoMonitorSet(), TaoMonitorSolutionDraw()

External Links

source
PETSc.LibPETSc.TaoMonitorResidualMethod
TaoMonitorResidual(petsclib::PetscLibType,tao::Tao, ctx::Cvoid)

Views the least

Collective

Input Parameters:

  • tao - the Tao context
  • ctx - the PetscViewer context or NULL

Options Database Key:

  • -tao_monitor_ls_residual - view the residual at each iteration

Level: advanced

-seealso: , Tao, TaoMonitorDefaultShort(), TaoMonitorSet()

External Links

source
PETSc.LibPETSc.TaoMonitorSetMethod
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 - the Tao solver context
  • func - monitoring routine
  • ctx - [optional] user-defined context for private data for the monitor routine (may be NULL)
  • dest - [optional] function to destroy the context when the Tao is destroyed, see PetscCtxDestroyFn for the calling sequence

Calling sequence of func:

  • tao - the Tao solver context
  • ctx - [optional] monitoring context

Level: intermediate

-seealso: , Tao, TaoSolve(), TaoMonitorDefault(), TaoMonitorCancel(), TaoSetDestroyRoutine(), TaoView(), PetscCtxDestroyFn

External Links

source
PETSc.LibPETSc.TaoMonitorSolutionMethod
TaoMonitorSolution(petsclib::PetscLibType,tao::Tao, ctx::Cvoid)

Views the solution at each iteration of TaoSolve()

Collective

Input Parameters:

  • tao - the Tao context
  • ctx - PetscViewer context or NULL

Options Database Key:

  • -tao_monitor_solution - view the solution

Level: advanced

-seealso: , Tao, TaoMonitorDefaultShort(), TaoMonitorSet()

External Links

source
PETSc.LibPETSc.TaoMonitorSolutionDrawMethod
TaoMonitorSolutionDraw(petsclib::PetscLibType,tao::Tao, ctx::Cvoid)

Plots the solution at each iteration of TaoSolve()

Collective

Input Parameters:

  • tao - the Tao context
  • ctx - TaoMonitorDraw context

Options Database Key:

  • -tao_monitor_solution_draw - draw the solution at each iteration

Level: advanced

-seealso: , Tao, TaoMonitorSolution(), TaoMonitorSet(), TaoMonitorGradientDraw(), TaoMonitorDrawCtxCreate(), TaoMonitorDrawCtxDestroy()

External Links

source
PETSc.LibPETSc.TaoMonitorStepMethod
TaoMonitorStep(petsclib::PetscLibType,tao::Tao, ctx::Cvoid)

Views the step

Collective

Input Parameters:

  • tao - the Tao context
  • ctx - PetscViewer context or NULL

Options Database Key:

  • -tao_monitor_step - view the step vector at each iteration

Level: advanced

-seealso: , Tao, TaoMonitorDefaultShort(), TaoMonitorSet()

External Links

source
PETSc.LibPETSc.TaoMonitorStepDrawMethod
TaoMonitorStepDraw(petsclib::PetscLibType,tao::Tao, ctx::Cvoid)

Plots the step direction at each iteration of TaoSolve()

Collective

Input Parameters:

  • tao - the Tao context
  • ctx - the PetscViewer context

Options Database Key:

  • -tao_monitor_step_draw - draw the step direction at each iteration

Level: advanced

-seealso: , Tao, TaoMonitorSet(), TaoMonitorSolutionDraw

External Links

source
PETSc.LibPETSc.TaoParametersInitializeMethod
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 - the Tao object

Level: developer

-seealso: , Tao, TaoSolve(), TaoDestroy(), PetscObjectParameterSetDefault()

External Links

source
PETSc.LibPETSc.TaoPythonGetTypeMethod
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

source
PETSc.LibPETSc.TaoPythonSetTypeMethod
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

source
PETSc.LibPETSc.TaoRegisterMethod
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 solver
  • func - routine to Create method context

-seealso: , Tao, TaoSetType(), TaoRegisterAll(), TaoRegisterDestroy()

External Links

source
PETSc.LibPETSc.TaoResetStatisticsMethod
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 - the Tao context

Level: developer

-seealso: , Tao, TaoCreate(), TaoSolve()

External Links

source
PETSc.LibPETSc.TaoSetApplicationContextMethod
TaoSetApplicationContext(petsclib::PetscLibType,tao::Tao, ctx::Cvoid)

Sets the optional user Tao callback functions with TaoGetApplicationContext()

Logically Collective

Input Parameters:

  • tao - the Tao context
  • ctx - the user context

Level: intermediate

-seealso: , Tao, TaoGetApplicationContext()

External Links

source
PETSc.LibPETSc.TaoSetConstraintTolerancesMethod
TaoSetConstraintTolerances(petsclib::PetscLibType,tao::Tao, catol::PetscReal, crtol::PetscReal)

Sets constraint tolerance parameters used in TaoSolve() convergence tests

Logically Collective

Input Parameters:

  • tao - the Tao context
  • catol - absolute constraint tolerance, constraint norm must be less than catol for used for gatol convergence criteria
  • crtol - relative constraint tolerance, constraint norm must be less than crtol for used for gatol, gttol convergence criteria

Options Database Keys:

  • -tao_catol <catol> - Sets catol
  • -tao_crtol <crtol> - Sets crtol

Level: intermediate

-seealso: , Tao, TaoConvergedReason, TaoGetTolerances(), TaoGetConstraintTolerances(), TaoSetTolerances()

External Links

source
PETSc.LibPETSc.TaoSetConstraintsRoutineMethod
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 - the Tao context
  • c - A vector that will be used to store constraint evaluation
  • func - the bounds computation routine
  • ctx - [optional] user-defined context for private data for the constraints computation (may be NULL)

Calling sequence of func:

  • tao - the Tao solver
  • x - point to evaluate constraints
  • c - vector constraints evaluated at x
  • ctx - the (optional) user-defined function context

Level: intermediate

-seealso: , Tao, TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoSetVariablevBounds()

External Links

source
PETSc.LibPETSc.TaoSetConvergedReasonMethod
TaoSetConvergedReason(petsclib::PetscLibType,tao::Tao, reason::TaoConvergedReason)

Sets the termination flag on a Tao object

Logically Collective

Input Parameters:

  • tao - the Tao context
  • reason - the TaoConvergedReason

Level: intermediate

-seealso: , Tao, TaoConvergedReason

External Links

source
PETSc.LibPETSc.TaoSetConvergenceHistoryMethod
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 - the Tao solver context
  • obj - array to hold objective value history
  • resid - array to hold residual history
  • cnorm - array to hold constraint violation history
  • lits - integer array holds the number of linear iterations for each Tao iteration
  • na - size of obj, resid, and cnorm
  • reset - PETSC_TRUE indicates 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

source
PETSc.LibPETSc.TaoSetConvergenceTestMethod
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 - the Tao object
  • conv - the routine to test for convergence
  • ctx - [optional] context for private data for the convergence routine

(may be NULL)

Calling sequence of conv:

  • tao - the Tao object
  • ctx - [optional] convergence context

Level: advanced

-seealso: , Tao, TaoSolve(), TaoSetConvergedReason(), TaoGetSolutionStatus(), TaoGetTolerances(), TaoMonitorSet()

External Links

source
PETSc.LibPETSc.TaoSetEqualityConstraintsRoutineMethod
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 - the Tao context
  • ce - A vector that will be used to store equality constraint evaluation
  • func - the bounds computation routine
  • ctx - [optional] user-defined context for private data for the equality constraints computation (may be NULL)

Calling sequence of func:

  • tao - the Tao solver
  • x - point to evaluate equality constraints
  • ce - vector of equality constraints evaluated at x
  • ctx - the (optional) user-defined function context

Level: intermediate

-seealso: , Tao, TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoSetVariableBounds()

External Links

source
PETSc.LibPETSc.TaoSetFromOptionsMethod
TaoSetFromOptions(petsclib::PetscLibType,tao::Tao)

Sets various Tao parameters from the options database

Collective

Input Parameter:

  • tao - the Tao solver 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

source
PETSc.LibPETSc.TaoSetFunctionLowerBoundMethod
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 context
  • fmin - the tolerance

Options Database Key:

  • -tao_fmin <fmin> - sets the minimum function value

Level: intermediate

-seealso: , Tao, TaoConvergedReason, TaoSetTolerances()

External Links

source
PETSc.LibPETSc.TaoSetGradientMethod
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 - the Tao context
  • g - [optional] the vector to internally hold the gradient computation
  • func - the gradient function
  • ctx - [optional] user-defined context for private data for the gradient evaluation

routine (may be NULL)

Calling sequence of func:

  • tao - the optimization solver
  • x - input vector
  • g - gradient value (output)
  • ctx - [optional] user-defined function context

Level: beginner

-seealso: , Tao, TaoSolve(), TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoGetGradient()

External Links

source
PETSc.LibPETSc.TaoSetGradientNormMethod
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 - the Tao context
  • M - matrix that defines the norm

Level: beginner

-seealso: , Tao, TaoGetGradientNorm(), TaoGradientNorm()

External Links

source
PETSc.LibPETSc.TaoSetHessianMethod
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 - the Tao context
  • H - Matrix used for the hessian
  • Hpre - Matrix that will be used to construct the preconditioner, can be same as H
  • func - Hessian evaluation routine
  • ctx - [optional] user-defined context for private data for the

Hessian evaluation routine (may be NULL)

Calling sequence of func:

  • tao - the Tao context
  • x - input vector
  • H - Hessian matrix
  • Hpre - matrix used to construct the preconditioner, usually the same as H
  • ctx - [optional] user-defined Hessian context

Level: beginner

-seealso: , Tao, TaoTypes, TaoSetObjective(), TaoSetGradient(), TaoSetObjectiveAndGradient(), TaoGetHessian()

External Links

source
PETSc.LibPETSc.TaoSetInequalityBoundsMethod
TaoSetInequalityBounds(petsclib::PetscLibType,tao::Tao, IL::PetscVec, IU::PetscVec)

Sets the upper and lower bounds

Logically Collective

Input Parameters:

  • tao - the Tao context
  • IL - vector of lower bounds
  • IU - vector of upper bounds

Level: beginner

-seealso: , Tao, TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoGetInequalityBounds()

External Links

source
PETSc.LibPETSc.TaoSetInequalityConstraintsRoutineMethod
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 - the Tao context
  • ci - A vector that will be used to store inequality constraint evaluation
  • func - the bounds computation routine
  • ctx - [optional] user-defined context for private data for the inequality constraints computation (may be NULL)

Calling sequence of func:

  • tao - the Tao solver
  • x - point to evaluate inequality constraints
  • ci - vector of inequality constraints evaluated at x
  • ctx - the (optional) user-defined function context

Level: intermediate

-seealso: , Tao, TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoSetVariableBounds()

External Links

source
PETSc.LibPETSc.TaoSetInitialTrustRegionRadiusMethod
TaoSetInitialTrustRegionRadius(petsclib::PetscLibType,tao::Tao, radius::PetscReal)

Sets the initial trust region radius.

Logically Collective

Input Parameters:

  • tao - a Tao optimization solver
  • radius - the trust region radius

Options Database Key:

  • -tao_trust0 <t0> - sets initial trust region radius

Level: intermediate

-seealso: , Tao, TaoGetTrustRegionRadius(), TaoSetTrustRegionTolerance(), TAONTR

External Links

source
PETSc.LibPETSc.TaoSetIterationNumberMethod
TaoSetIterationNumber(petsclib::PetscLibType,tao::Tao, iter::PetscInt)

Sets the current iteration number.

Logically Collective

Input Parameters:

  • tao - the Tao context
  • iter - iteration number

Level: developer

-seealso: , Tao, TaoGetLinearSolveIterations()

External Links

source
PETSc.LibPETSc.TaoSetJacobianDesignRoutineMethod
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 - the Tao context
  • J - Matrix used for the Jacobian
  • func - Jacobian evaluation routine
  • ctx - [optional] user-defined context for private data for the

Jacobian evaluation routine (may be NULL)

Calling sequence of func:

  • tao - the Tao context
  • x - input vector
  • J - Jacobian matrix
  • ctx - [optional] user-defined Jacobian context

Level: intermediate

-seealso: , Tao, TaoComputeJacobianDesign(), TaoSetJacobianStateRoutine(), TaoSetStateDesignIS()

External Links

source
PETSc.LibPETSc.TaoSetJacobianEqualityRoutineMethod
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 - the Tao context
  • J - Matrix used for the Jacobian
  • Jpre - Matrix that will be used to construct the preconditioner, can be same as J.
  • func - Jacobian evaluation routine
  • ctx - [optional] user-defined context for private data for the

Jacobian evaluation routine (may be NULL)

Calling sequence of func:

  • tao - the Tao context
  • x - input vector
  • J - Jacobian matrix
  • Jpre - matrix used to construct the preconditioner, usually the same as J
  • ctx - [optional] user-defined Jacobian context

Level: intermediate

-seealso: , Tao, TaoComputeJacobianEquality(), TaoSetJacobianDesignRoutine(), TaoSetEqualityDesignIS()

External Links

source
PETSc.LibPETSc.TaoSetJacobianInequalityRoutineMethod
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 - the Tao context
  • J - Matrix used for the Jacobian
  • Jpre - Matrix that will be used to construct the preconditioner, can be same as J.
  • func - Jacobian evaluation routine
  • ctx - [optional] user-defined context for private data for the

Jacobian evaluation routine (may be NULL)

Calling sequence of func:

  • tao - the Tao context
  • x - input vector
  • J - Jacobian matrix
  • Jpre - matrix used to construct the preconditioner, usually the same as J
  • ctx - [optional] user-defined Jacobian context

Level: intermediate

-seealso: , Tao, TaoComputeJacobianInequality(), TaoSetJacobianDesignRoutine(), TaoSetInequalityDesignIS()

External Links

source
PETSc.LibPETSc.TaoSetJacobianResidualRoutineMethod
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 - the Tao context
  • J - Matrix used for the jacobian
  • Jpre - Matrix that will be used to construct the preconditioner, can be same as J
  • func - Jacobian evaluation routine
  • ctx - [optional] user-defined context for private data for the

Jacobian evaluation routine (may be NULL)

Calling sequence of func:

  • tao - the Tao context
  • x - input vector
  • J - Jacobian matrix
  • Jpre - matrix used to construct the preconditioner, usually the same as J
  • ctx - [optional] user-defined Jacobian context

Level: intermediate

-seealso: , Tao, TaoSetGradient(), TaoSetObjective()

External Links

source
PETSc.LibPETSc.TaoSetJacobianRoutineMethod
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 - the Tao context
  • J - Matrix used for the Jacobian
  • Jpre - Matrix that will be used to construct the preconditioner, can be same as J
  • func - Jacobian evaluation routine
  • ctx - [optional] user-defined context for private data for the

Jacobian evaluation routine (may be NULL)

Calling sequence of func:

  • tao - the Tao context
  • x - input vector
  • J - Jacobian matrix
  • Jpre - matrix used to construct the preconditioner, usually the same as J
  • ctx - [optional] user-defined Jacobian context

Level: intermediate

-seealso: , Tao, TaoSetGradient(), TaoSetObjective()

External Links

source
PETSc.LibPETSc.TaoSetJacobianStateRoutineMethod
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 - the Tao context
  • J - Matrix used for the Jacobian
  • Jpre - Matrix that will be used to construct the preconditioner, can be same as J. Only used if Jinv is NULL
  • Jinv - [optional] Matrix used to apply the inverse of the state Jacobian. Use NULL to default to PETSc KSP solvers to apply the inverse.
  • func - Jacobian evaluation routine
  • ctx - [optional] user-defined context for private data for the

Jacobian evaluation routine (may be NULL)

Calling sequence of func:

  • tao - the Tao context
  • x - input vector
  • J - Jacobian matrix
  • Jpre - matrix used to construct the preconditioner, usually the same as J
  • Jinv - inverse of J
  • ctx - [optional] user-defined Jacobian context

Level: intermediate

-seealso: , Tao, TaoComputeJacobianState(), TaoSetJacobianDesignRoutine(), TaoSetStateDesignIS()

External Links

source
PETSc.LibPETSc.TaoSetLMVMMatrixMethod
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 context
  • B - LMVM matrix

Level: advanced

-seealso: TAOBQNLS, TAOBQNKLS, TAOBQNKTL, TAOBQNKTR, MATLMVM, TaoGetLMVMMatrix()

External Links

source
PETSc.LibPETSc.TaoSetMaximumFunctionEvaluationsMethod
TaoSetMaximumFunctionEvaluations(petsclib::PetscLibType,tao::Tao, nfcn::PetscInt)

Sets a maximum number of function evaluations allowed for a TaoSolve().

Logically Collective

Input Parameters:

  • tao - the Tao solver context
  • nfcn - the maximum number of function evaluations (>=0), use PETSC_UNLIMITED to 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

source
PETSc.LibPETSc.TaoSetMaximumIterationsMethod
TaoSetMaximumIterations(petsclib::PetscLibType,tao::Tao, maxits::PetscInt)

Sets a maximum number of iterates to be used in TaoSolve()

Logically Collective

Input Parameters:

  • tao - the Tao solver context
  • maxits - the maximum number of iterates (>=0), use PETSC_UNLIMITED to have no bound

Options Database Key:

  • -tao_max_it <its> - sets the maximum number of iterations

Level: intermediate

-seealso: , Tao, TaoSetTolerances(), TaoSetMaximumFunctionEvaluations()

External Links

source
PETSc.LibPETSc.TaoSetObjectiveMethod
TaoSetObjective(petsclib::PetscLibType,tao::Tao, func::external, ctx::Cvoid)

Sets the function evaluation routine for minimization

Logically Collective

Input Parameters:

  • tao - the Tao context
  • func - the objective function
  • ctx - [optional] user-defined context for private data for the function evaluation

routine (may be NULL)

Calling sequence of func:

  • tao - the optimizer
  • x - input vector
  • f - function value
  • ctx - [optional] user-defined function context

Level: beginner

-seealso: , TaoSetGradient(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoGetObjective()

External Links

source
PETSc.LibPETSc.TaoSetObjectiveAndGradientMethod
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 - the Tao context
  • g - [optional] the vector to internally hold the gradient computation
  • func - the gradient function
  • ctx - [optional] user-defined context for private data for the gradient evaluation

routine (may be NULL)

Calling sequence of func:

  • tao - the optimization object
  • x - input vector
  • f - objective value (output)
  • g - gradient value (output)
  • ctx - [optional] user-defined function context

Level: beginner

-seealso: , Tao, TaoSolve(), TaoSetObjective(), TaoSetHessian(), TaoSetGradient(), TaoGetObjectiveAndGradient()

External Links

source
PETSc.LibPETSc.TaoSetOptionsPrefixMethod
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 - the Tao context
  • p - the prefix string to prepend to all Tao option requests

Level: advanced

-seealso: , Tao, TaoSetFromOptions(), TaoAppendOptionsPrefix(), TaoGetOptionsPrefix()

External Links

source
PETSc.LibPETSc.TaoSetRecycleHistoryMethod
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 - the Tao context
  • recycle - 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

source
PETSc.LibPETSc.TaoSetResidualRoutineMethod
TaoSetResidualRoutine(petsclib::PetscLibType,tao::Tao, res::PetscVec, func::external, ctx::Cvoid)

Sets the residual evaluation routine for least

Logically Collective

Input Parameters:

  • tao - the Tao context
  • res - the residual vector
  • func - the residual evaluation routine
  • ctx - [optional] user-defined context for private data for the function evaluation

routine (may be NULL)

Calling sequence of func:

  • tao - the optimizer
  • x - input vector
  • res - function value vector
  • ctx - [optional] user-defined function context

Level: beginner

-seealso: , Tao, TaoSetObjective(), TaoSetJacobianRoutine()

External Links

source
PETSc.LibPETSc.TaoSetResidualWeightsMethod
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 - the Tao context
  • sigma_v - vector of weights (diagonal terms only)
  • n - the number of weights (if using off-diagonal)
  • rows - index list of rows for sigma_v
  • cols - index list of columns for sigma_v
  • vals - array of weights

Level: intermediate

-seealso: , Tao, TaoSetResidualRoutine()

External Links

source
PETSc.LibPETSc.TaoSetSolutionMethod
TaoSetSolution(petsclib::PetscLibType,tao::Tao, x0::PetscVec)

Sets the vector holding the initial guess for the solve

Logically Collective

Input Parameters:

  • tao - the Tao context
  • x0 - the initial guess

Level: beginner

-seealso: , Tao, TaoCreate(), TaoSolve(), TaoGetSolution()

External Links

source
PETSc.LibPETSc.TaoSetStateDesignISMethod
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 - The Tao context
  • s_is - the index set corresponding to the state variables
  • d_is - the index set corresponding to the design variables

Level: intermediate

-seealso: , Tao, TaoSetJacobianStateRoutine(), TaoSetJacobianDesignRoutine()

External Links

source
PETSc.LibPETSc.TaoSetTolerancesMethod
TaoSetTolerances(petsclib::PetscLibType,tao::Tao, gatol::PetscReal, grtol::PetscReal, gttol::PetscReal)

Sets parameters used in TaoSolve() convergence tests

Logically Collective

Input Parameters:

  • tao - the Tao context
  • gatol - stop if norm of gradient is less than this
  • grtol - stop if relative norm of gradient is less than this
  • gttol - 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

source
PETSc.LibPETSc.TaoSetTypeMethod
TaoSetType(petsclib::PetscLibType,tao::Tao, type::TaoType)

Sets the TaoType for the minimization solver.

Collective

Input Parameters:

  • tao - the Tao solver context
  • type - 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

source
PETSc.LibPETSc.TaoSetUpMethod
TaoSetUp(petsclib::PetscLibType,tao::Tao)

Sets up the internal data structures for the later use of a Tao solver

Collective

Input Parameter:

  • tao - the Tao context

Level: advanced

-seealso: , Tao, TaoCreate(), TaoSolve()

External Links

source
PETSc.LibPETSc.TaoSetUpdateMethod
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 - The Tao solver
  • func - The function
  • ctx - The update function context

Calling sequence of func:

  • tao - The optimizer context
  • it - The current iteration index
  • ctx - The update context

Level: advanced

-seealso: , Tao, TaoSolve()

External Links

source
PETSc.LibPETSc.TaoSetVariableBoundsMethod
TaoSetVariableBounds(petsclib::PetscLibType,tao::Tao, XL::PetscVec, XU::PetscVec)

Sets the upper and lower bounds for the optimization problem

Logically Collective

Input Parameters:

  • tao - the Tao context
  • XL - vector of lower bounds
  • XU - vector of upper bounds

Level: beginner

-seealso: , Tao, TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoGetVariableBounds()

External Links

source
PETSc.LibPETSc.TaoSetVariableBoundsRoutineMethod
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 - the Tao context
  • func - the bounds computation routine
  • ctx - [optional] user-defined context for private data for the bounds computation (may be NULL)

Calling sequence of func:

  • tao - the Tao solver
  • xl - vector of lower bounds
  • xu - vector of upper bounds
  • ctx - the (optional) user-defined function context

Level: beginner

-seealso: , Tao, TaoSetObjective(), TaoSetHessian(), TaoSetObjectiveAndGradient(), TaoSetVariableBounds()

External Links

source
PETSc.LibPETSc.TaoShellGetContextMethod
TaoShellGetContext(petsclib::PetscLibType,tao::Tao, ctx::Cvoid)

Returns the user

Not Collective

Input Parameter:

  • tao - should have been created with TaoSetType(tao,TAOSHELL);

Output Parameter:

  • ctx - the user provided context

Level: advanced

-seealso: Tao, TAOSHELL, TaoShellSetContext()

External Links

source
PETSc.LibPETSc.TaoShellSetContextMethod
TaoShellSetContext(petsclib::PetscLibType,tao::Tao, ctx::Cvoid)

sets the context for a TAOSHELL

Logically Collective

Input Parameters:

  • tao - the shell Tao
  • ctx - the context

Level: advanced

-seealso: Tao, TAOSHELL, TaoShellGetContext()

External Links

source
PETSc.LibPETSc.TaoShellSetSolveMethod
TaoShellSetSolve(petsclib::PetscLibType,tao::Tao, solve::external)

Sets routine to apply as solver

Logically Collective

Input Parameters:

  • tao - the nonlinear solver context
  • solve - the application-provided solver routine

Calling sequence of solve:

  • tao - the optimizer, get the application context with TaoShellGetContext()

Level: advanced

-seealso: Tao, TAOSHELL, TaoShellSetContext(), TaoShellGetContext()

External Links

source
PETSc.LibPETSc.TaoSoftThresholdMethod
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 thresholded
  • lb - lower bound
  • ub - upper bound

Output Parameter:

  • out - Soft thresholded output vector

-seealso: Tao, Vec

External Links

source
PETSc.LibPETSc.TaoSolveMethod
TaoSolve(petsclib::PetscLibType,tao::Tao)

Solves an optimization problem min F(x) s.t. l <= x <= u

Collective

Input Parameter:

  • tao - the Tao context

Level: beginner

-seealso: , Tao, TaoCreate(), TaoSetObjective(), TaoSetGradient(), TaoSetHessian(), TaoGetConvergedReason(), TaoSetUp()

External Links

source
PETSc.LibPETSc.TaoVecGetSubVecMethod
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 matrix
  • is - the index set for the subvector
  • reduced_type - the method Tao is using for subsetting
  • maskvalue - the value to set the unused vector elements to (for TAO_SUBSET_MASK or TAO_SUBSET_MATRIXFREE)

Output Parameter:

  • vreduced - the subvector

Level: developer

-seealso: TaoMatGetSubMat(), TaoSubsetType

External Links

source
PETSc.LibPETSc.TaoViewMethod
TaoView(petsclib::PetscLibType,tao::Tao, viewer::PetscViewer)

Prints information about the Tao object

Collective

Input Parameters:

  • tao - the Tao context
  • viewer - visualization context

Options Database Key:

  • -tao_view - Calls TaoView() at the end of TaoSolve()

Level: beginner

-seealso: , Tao, PetscViewerASCIIOpen()

External Links

source
PETSc.LibPETSc.TaoViewFromOptionsMethod
TaoViewFromOptions(petsclib::PetscLibType,A::Tao, obj::PetscObject, name::String)

View a Tao object based on values in the options database

Collective

Input Parameters:

  • A - the Tao context
  • obj - Optional object that provides the prefix for the options database
  • name - command line option

Level: intermediate

-seealso: , Tao, TaoView, PetscObjectViewFromOptions(), TaoCreate()

External Links

source

Tao Add-ons

Additional Tao utilities and helper functions:

PETSc.LibPETSc.TaoLineSearchAppendOptionsPrefixMethod
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 - the TaoLineSearch solver context
  • p - the prefix string to prepend to all line search requests

Level: advanced

-seealso: , Tao, TaoLineSearch, TaoLineSearchSetOptionsPrefix(), TaoLineSearchGetOptionsPrefix()

External Links

source
PETSc.LibPETSc.TaoLineSearchApplyMethod
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 - the TaoLineSearch context
  • s - search direction

Output Parameters:

  • x - On input the current solution, on output x contains the new solution determined by the line search
  • f - On input the objective function value at current solution, on output contains the objective function value at new solution
  • g - On input the gradient evaluated at x, on output contains the gradient at new solution
  • steplength - scalar multiplier of s used ( x = x0 + steplength * x)
  • reason - TaoLineSearchConvergedReason reason why the line-search stopped

Level: advanced

-seealso: , Tao, TaoLineSearchConvergedReason, TaoLineSearch, TaoLineSearchCreate(), TaoLineSearchSetType(), TaoLineSearchSetInitialStepLength(), TaoAddLineSearchCounts()

External Links

source
PETSc.LibPETSc.TaoLineSearchComputeGradientMethod
TaoLineSearchComputeGradient(petsclib::PetscLibType,ls::TaoLineSearch, x::PetscVec, g::PetscVec)

Computes the gradient of the objective function

Collective

Input Parameters:

  • ls - the TaoLineSearch context
  • x - input vector

Output Parameter:

  • g - gradient vector

Level: developer

-seealso: , Tao, TaoLineSearch, TaoLineSearchComputeObjective(), TaoLineSearchComputeObjectiveAndGradient(), TaoLineSearchSetGradient()

External Links

source
PETSc.LibPETSc.TaoLineSearchComputeObjectiveMethod
f::PetscReal = TaoLineSearchComputeObjective(petsclib::PetscLibType,ls::TaoLineSearch, x::PetscVec)

Computes the objective function value at a given point

Collective

Input Parameters:

  • ls - the TaoLineSearch context
  • x - input vector

Output Parameter:

  • f - Objective value at x

Level: developer

-seealso: , Tao, TaoLineSearch, TaoLineSearchComputeGradient(), TaoLineSearchComputeObjectiveAndGradient(), TaoLineSearchSetObjectiveRoutine()

External Links

source
PETSc.LibPETSc.TaoLineSearchComputeObjectiveAndGTSMethod
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 - the TaoLineSearch context
  • x - input vector

Output Parameters:

  • f - Objective value at x
  • gts - inner product of gradient and step direction at x

Level: developer

-seealso: , Tao, TaoLineSearch, TaoLineSearchComputeGradient(), TaoLineSearchComputeObjectiveAndGradient(), TaoLineSearchSetObjectiveRoutine()

External Links

source
PETSc.LibPETSc.TaoLineSearchComputeObjectiveAndGradientMethod
f::PetscReal = TaoLineSearchComputeObjectiveAndGradient(petsclib::PetscLibType,ls::TaoLineSearch, x::PetscVec, g::PetscVec)

Computes the objective function value at a given point

Collective

Input Parameters:

  • ls - the TaoLineSearch context
  • x - input vector

Output Parameters:

  • f - Objective value at x
  • g - Gradient vector at x

Level: developer

-seealso: , Tao, TaoLineSearch, TaoLineSearchComputeGradient(), TaoLineSearchSetObjectiveRoutine()

External Links

source
PETSc.LibPETSc.TaoLineSearchCreateMethod
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 new TaoLineSearch context

Options Database Key:

  • -tao_ls_type - select which method Tao should use

Level: developer

-seealso: , Tao, TaoLineSearch, TaoLineSearchType, TaoLineSearchSetType(), TaoLineSearchApply(), TaoLineSearchDestroy()

External Links

source
PETSc.LibPETSc.TaoLineSearchDestroyMethod
TaoLineSearchDestroy(petsclib::PetscLibType,ls::TaoLineSearch)

Destroys the TaoLineSearch context that was created with TaoLineSearchCreate()

Collective

Input Parameter:

  • ls - the TaoLineSearch context

Level: developer

-seealso: TaoLineSearchCreate(), TaoLineSearchSolve()

External Links

source
PETSc.LibPETSc.TaoLineSearchGetFullStepObjectiveMethod
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 - the TaoLineSearch context

Output Parameter:

  • f_fullstep - the objective value at the full step length

Level: developer

-seealso: TaoLineSearchGetSolution(), TaoLineSearchGetStartingVector(), TaoLineSearchGetStepDirection()

External Links

source
PETSc.LibPETSc.TaoLineSearchGetNumberFunctionEvaluationsMethod
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 - the TaoLineSearch context

Output Parameters:

  • nfeval - number of function evaluations
  • ngeval - number of gradient evaluations
  • nfgeval - number of function/gradient evaluations

Level: intermediate

-seealso: TaoLineSearch

External Links

source
PETSc.LibPETSc.TaoLineSearchGetOptionsPrefixMethod
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 - the TaoLineSearch context

Output Parameter:

  • p - pointer to the prefix string used is returned

Level: advanced

-seealso: , Tao, TaoLineSearch, TaoLineSearchSetOptionsPrefix(), TaoLineSearchAppendOptionsPrefix()

External Links

source
PETSc.LibPETSc.TaoLineSearchGetSolutionMethod
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 - the TaoLineSearch context

Output Parameters:

  • x - the new solution
  • f - the objective function value at x
  • g - the gradient at x
  • steplength - the multiple of the step direction taken by the line search
  • reason - the reason why the line search terminated

Level: developer

-seealso: TaoLineSearchGetStartingVector(), TaoLineSearchGetStepDirection()

External Links

source
PETSc.LibPETSc.TaoLineSearchGetStartingVectorMethod
TaoLineSearchGetStartingVector(petsclib::PetscLibType,ls::TaoLineSearch, x::PetscVec)

Gets a the initial point of the line search.

Not Collective

Input Parameter:

  • ls - the TaoLineSearch context

Output Parameter:

  • x - The initial point of the line search

Level: advanced

-seealso: TaoLineSearchGetSolution(), TaoLineSearchGetStepDirection()

External Links

source
PETSc.LibPETSc.TaoLineSearchGetStepDirectionMethod
TaoLineSearchGetStepDirection(petsclib::PetscLibType,ls::TaoLineSearch, s::PetscVec)

Gets the step direction of the line search.

Not Collective

Input Parameter:

  • ls - the TaoLineSearch context

Output Parameter:

  • s - the step direction of the line search

Level: advanced

-seealso: TaoLineSearchGetSolution(), TaoLineSearchGetStartingVector()

External Links

source
PETSc.LibPETSc.TaoLineSearchGetStepLengthMethod
s::PetscReal = TaoLineSearchGetStepLength(petsclib::PetscLibType,ls::TaoLineSearch)

Get the current step length

Not Collective

Input Parameter:

  • ls - the TaoLineSearch context

Output Parameter:

  • s - the current step length

Level: intermediate

-seealso: , Tao, TaoLineSearch, TaoLineSearchSetInitialStepLength(), TaoLineSearchApply()

External Links

source
PETSc.LibPETSc.TaoLineSearchGetTypeMethod
type::TaoLineSearchType = TaoLineSearchGetType(petsclib::PetscLibType,ls::TaoLineSearch)

Gets the current line search algorithm

Not Collective

Input Parameter:

  • ls - the TaoLineSearch context

Output Parameter:

  • type - the line search algorithm in effect

Level: developer

-seealso: TaoLineSearch

External Links

source
PETSc.LibPETSc.TaoLineSearchInitializePackageMethod
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

source
PETSc.LibPETSc.TaoLineSearchIsUsingTaoRoutinesMethod
flg::PetscBool = TaoLineSearchIsUsingTaoRoutines(petsclib::PetscLibType,ls::TaoLineSearch)

Checks whether the line search is using the standard Tao evaluation routines.

Not Collective

Input Parameter:

  • ls - the TaoLineSearch context

Output Parameter:

  • flg - PETSC_TRUE if the line search is using Tao evaluation routines,

otherwise PETSC_FALSE

Level: developer

-seealso: TaoLineSearch

External Links

source
PETSc.LibPETSc.TaoLineSearchMonitorMethod
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 - the TaoLineSearch context
  • its - the current iterate number (>=0)
  • f - the current objective function value
  • step - 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

source
PETSc.LibPETSc.TaoLineSearchRegisterMethod
TaoLineSearchRegister(petsclib::PetscLibType,sname::String, func::external)

Adds a line

Not Collective, No Fortran Support

Input Parameters:

  • sname - name of a new user-defined solver
  • func - routine to Create method context

-seealso: , Tao, TaoLineSearch

External Links

source
PETSc.LibPETSc.TaoLineSearchResetMethod
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 - the TaoLineSearch context

Level: developer

-seealso: , Tao, TaoLineSearch, TaoLineSearchCreate(), TaoLineSearchApply()

External Links

source
PETSc.LibPETSc.TaoLineSearchSetFromOptionsMethod
TaoLineSearchSetFromOptions(petsclib::PetscLibType,ls::TaoLineSearch)

Sets various TaoLineSearch parameters from user options.

Collective

Input Parameter:

  • ls - the TaoLineSearch context

Options Database Keys:

  • -tao_ls_type <type> - The algorithm that TaoLineSearch uses (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

source
PETSc.LibPETSc.TaoLineSearchSetGradientRoutineMethod
TaoLineSearchSetGradientRoutine(petsclib::PetscLibType,ls::TaoLineSearch, func::external, ctx::Cvoid)

Sets the gradient evaluation routine for the line search

Logically Collective

Input Parameters:

  • ls - the TaoLineSearch context
  • func - the gradient evaluation routine
  • ctx - the (optional) user-defined context for private data

Calling sequence of func:

  • ls - the linesearch object
  • x - input vector
  • g - gradient vector
  • ctx - (optional) user-defined context

Level: beginner

-seealso: , Tao, TaoLineSearch, TaoLineSearchCreate(), TaoLineSearchSetObjectiveRoutine(), TaoLineSearchSetObjectiveAndGradientRoutine(), TaoLineSearchUseTaoRoutines()

External Links

source
PETSc.LibPETSc.TaoLineSearchSetInitialStepLengthMethod
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 - the TaoLineSearch context
  • s - the initial step size

Level: intermediate

-seealso: , Tao, TaoLineSearch, TaoLineSearchGetStepLength(), TaoLineSearchApply()

External Links

source
PETSc.LibPETSc.TaoLineSearchSetObjectiveAndGTSRoutineMethod
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 - the TaoLineSearch context
  • func - the objective and gradient evaluation routine
  • ctx - the (optional) user-defined context for private data

Calling sequence of func:

  • ls - the linesearch context
  • x - input vector
  • s - step direction
  • f - function value
  • gts - inner product of gradient and step direction vectors
  • ctx - (optional) user-defined context

Level: advanced

-seealso: , Tao, TaoLineSearch, TaoLineSearchCreate(), TaoLineSearchSetObjective(), TaoLineSearchSetGradient(), TaoLineSearchUseTaoRoutines()

External Links

source
PETSc.LibPETSc.TaoLineSearchSetObjectiveAndGradientRoutineMethod
TaoLineSearchSetObjectiveAndGradientRoutine(petsclib::PetscLibType,ls::TaoLineSearch, func::external, ctx::Cvoid)

Sets the objective/gradient evaluation routine for the line search

Logically Collective

Input Parameters:

  • ls - the TaoLineSearch context
  • func - the objective and gradient evaluation routine
  • ctx - the (optional) user-defined context for private data

Calling sequence of func:

  • ls - the linesearch object
  • x - input vector
  • f - function value
  • g - gradient vector
  • ctx - (optional) user-defined context

Level: beginner

-seealso: , Tao, TaoLineSearch, TaoLineSearchCreate(), TaoLineSearchSetObjectiveRoutine(), TaoLineSearchSetGradientRoutine(), TaoLineSearchUseTaoRoutines()

External Links

source
PETSc.LibPETSc.TaoLineSearchSetObjectiveRoutineMethod
TaoLineSearchSetObjectiveRoutine(petsclib::PetscLibType,ls::TaoLineSearch, func::external, ctx::Cvoid)

Sets the function evaluation routine for the line search

Logically Collective

Input Parameters:

  • ls - the TaoLineSearch context
  • func - the objective function evaluation routine
  • ctx - the (optional) user-defined context for private data

Calling sequence of func:

  • ls - the line search context
  • x - input vector
  • f - function value
  • ctx - (optional) user-defined context

Level: advanced

-seealso: , Tao, TaoLineSearch, TaoLineSearchCreate(), TaoLineSearchSetGradientRoutine(), TaoLineSearchSetObjectiveAndGradientRoutine(), TaoLineSearchUseTaoRoutines()

External Links

source
PETSc.LibPETSc.TaoLineSearchSetOptionsPrefixMethod
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 - the TaoLineSearch context
  • p - the prefix string to prepend to all ls option requests

Level: advanced

-seealso: , Tao, TaoLineSearch, TaoLineSearchAppendOptionsPrefix(), TaoLineSearchGetOptionsPrefix()

External Links

source
PETSc.LibPETSc.TaoLineSearchSetTypeMethod
TaoLineSearchSetType(petsclib::PetscLibType,ls::TaoLineSearch, type::TaoLineSearchType)

Sets the algorithm used in a line search

Collective

Input Parameters:

  • ls - the TaoLineSearch context
  • type - the TaoLineSearchType selection

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

source
PETSc.LibPETSc.TaoLineSearchSetUpMethod
TaoLineSearchSetUp(petsclib::PetscLibType,ls::TaoLineSearch)

Sets up the internal data structures for the later use of a TaoLineSearch

Collective

Input Parameter:

  • ls - the TaoLineSearch context

Level: developer

-seealso: , Tao, TaoLineSearch, TaoLineSearchCreate(), TaoLineSearchApply()

External Links

source
PETSc.LibPETSc.TaoLineSearchSetVariableBoundsMethod
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 - the TaoLineSearch context
  • xl - vector of lower bounds
  • xu - vector of upper bounds

Level: beginner

-seealso: , Tao, TaoLineSearch, TaoSetVariableBounds(), TaoLineSearchCreate()

External Links

source
PETSc.LibPETSc.TaoLineSearchUseTaoRoutinesMethod
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 - the TaoLineSearch context
  • ts - the Tao context with defined objective/gradient evaluation routines

Level: developer

-seealso: , Tao, TaoLineSearch, TaoLineSearchCreate()

External Links

source
PETSc.LibPETSc.TaoLineSearchViewMethod
TaoLineSearchView(petsclib::PetscLibType,ls::TaoLineSearch, viewer::PetscViewer)

Prints information about the TaoLineSearch

Collective

Input Parameters:

  • ls - the TaoLineSearch context
  • viewer - visualization context

Options Database Key:

  • -tao_ls_view - Calls TaoLineSearchView() at the end of each line search

Level: beginner

-seealso: , Tao, TaoLineSearch, PetscViewerASCIIOpen(), TaoLineSearchViewFromOptions()

External Links

source
PETSc.LibPETSc.TaoLineSearchViewFromOptionsMethod
TaoLineSearchViewFromOptions(petsclib::PetscLibType,A::TaoLineSearch, obj::PetscObject, name::String)

View a TaoLineSearch object based on values in the options database

Collective

Input Parameters:

  • A - the Tao context
  • obj - Optional object
  • name - command line option

Level: intermediate

-seealso: , Tao, TaoLineSearch, TaoLineSearchView(), PetscObjectViewFromOptions(), TaoLineSearchCreate()

External Links

source
PETSc.LibPETSc.TaoMonitorDrawCtxCreateMethod
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 context
  • host - the name of the X Windows host that will display the monitor
  • label - the label to put at the top of the display window
  • x - the horizontal coordinate of the lower left corner of the window to open
  • y - the vertical coordinate of the lower left corner of the window to open
  • m - the width of the window
  • n - the height of the window
  • howoften - how many Tao iterations between displaying the monitor information

Output Parameter:

  • ctx - the monitor context

Options Database Keys:

  • -tao_monitor_solution_draw - use TaoMonitorSolutionDraw() 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

source
PETSc.LibPETSc.TaoMonitorDrawCtxDestroyMethod
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

source