TaoAddTerm#
Add a term to the objective function. If Tao is empty, term will be the objective of Tao.
Synopsis#
#include "petsctao.h"
PetscErrorCode TaoAddTerm(Tao tao, const char prefix[], PetscReal scale, TaoTerm term, Vec params, Mat map)
Collective
Input Parameters#
tao - a
Taosolver contextprefix - the prefix used for configuring the new term (if
NULL, the index of the term will be used as a prefix, e.g. “0_”, “1_”, etc.)scale - scaling coefficient for the new term
term - the real-valued function defining the new term
params - (optional) parameters for the new term. It is up to each implementation of
TaoTermto determine how it behaves when parameters are omitted.map - (optional) a map from the
taosolution space to thetermsolution space; ifNULLthe map is assumed to be the identity
Notes#
If the objective function was \(f(x)\), after calling TaoAddTerm() it becomes
\(f(x) + \alpha g(Ax; p)\), where \(\alpha\) is the scale, \(g\) is the term, \(A\) is the
(optional) map, and \(p\) are the (optional) params of \(g\).
The map \(A\) transforms the Tao solution vector into the term’s solution space.
For example, if the Tao solution vector is \(x \in \mathbb{R}^n\) and the mapping
matrix is \(A \in \mathbb{R}^{m \times n}\), then the term evaluates \(g(Ax; p)\) with
\(Ax \in \mathbb{R}^m\). The term’s solution space is therefore \(\mathbb{R}^m\). If the map is
NULL, the identity is used and the term’s solution space must match the Tao solution space.
Tao automatically applies the chain rule for gradients (\(A^T \nabla g\)) and Hessians
(\(A^T \nabla^2 g \, A\)) with respect to \(x\).
The params \(p\) are fixed data that are not optimized over. Some TaoTermTypes
require the parameter space to be related to the term’s solution space (e.g., the same
size); when a mapping matrix \(A\) is used, the parameter space may depend on either the row
or column space of \(A\). See the documentation for each TaoTermType.
Currently, TaoAddTerm() does not support bounded Newton solvers (TAOBNK,TAOBNLS,TAOBNTL,TAOBNTR,and TAOBQNK)
See Also#
TAO: Optimization Solvers, Tao, TaoTerm, TAOTERMSUM, TaoGetTerm()
Level#
beginner
Location#
Examples#
src/tao/unconstrained/tutorials/elastic_net_regularization.c
src/tao/unconstrained/tutorials/rosenbrock1_taoterm.c
Index of all Tao routines
Table of Contents for all manual pages
Index of all manual pages