# TaoSolve
Solves an optimization problem min F(x) s.t. l <= x <= u 
## Synopsis
```
#include "petsctao.h" 
PetscErrorCode TaoSolve(Tao tao)
```
Collective on tao


## Input Parameters

- ***tao -*** the Tao context



## Notes
The user must set up the Tao with calls to `TaoSetSolution()`, `TaoSetObjective()`, `TaoSetGradient()`, and (if using 2nd order method) `TaoSetHessian()`.

You should call `TaoGetConvergedReason()` or run with -tao_converged_reason to determine if the optimization algorithm actually succeeded or
why it failed.




## See Also
 `Tao`, `TaoCreate()`, `TaoSetObjective()`, `TaoSetGradient()`, `TaoSetHessian()`, `TaoGetConvergedReason()`, `TaoSetUp()`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/interface/taosolver.c.html#TaoSolve">src/tao/interface/taosolver.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex20opt_ic.c.html">src/ts/tutorials/ex20opt_ic.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex20opt_p.c.html">src/ts/tutorials/ex20opt_p.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/unconstrained/tutorials/burgers_spectral.c.html">src/tao/unconstrained/tutorials/burgers_spectral.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/unconstrained/tutorials/eptorsion1.c.html">src/tao/unconstrained/tutorials/eptorsion1.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/unconstrained/tutorials/eptorsion2.c.html">src/tao/unconstrained/tutorials/eptorsion2.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/unconstrained/tutorials/eptorsion2f.F90.html">src/tao/unconstrained/tutorials/eptorsion2f.F90.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/unconstrained/tutorials/minsurf1.c.html">src/tao/unconstrained/tutorials/minsurf1.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/unconstrained/tutorials/minsurf2.c.html">src/tao/unconstrained/tutorials/minsurf2.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/unconstrained/tutorials/rosenbrock1.c.html">src/tao/unconstrained/tutorials/rosenbrock1.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/unconstrained/tutorials/rosenbrock1f.F90.html">src/tao/unconstrained/tutorials/rosenbrock1f.F90.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/unconstrained/tutorials/rosenbrock2.c.html">src/tao/unconstrained/tutorials/rosenbrock2.c.html</A><BR>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/bound/impls/blmvm/blmvm.c.html#TaoSolve_BLMVM">TaoSolve_BLMVM in src/tao/bound/impls/blmvm/blmvm.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/bound/impls/bncg/bncg.c.html#TaoSolve_BNCG">TaoSolve_BNCG in src/tao/bound/impls/bncg/bncg.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/bound/impls/bnk/bnls.c.html#TaoSolve_BNLS">TaoSolve_BNLS in src/tao/bound/impls/bnk/bnls.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/bound/impls/bnk/bntl.c.html#TaoSolve_BNTL">TaoSolve_BNTL in src/tao/bound/impls/bnk/bntl.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/bound/impls/bnk/bntr.c.html#TaoSolve_BNTR">TaoSolve_BNTR in src/tao/bound/impls/bnk/bntr.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/bound/impls/bqnk/bqnk.c.html#TaoSolve_BQNK">TaoSolve_BQNK in src/tao/bound/impls/bqnk/bqnk.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/bound/impls/tron/tron.c.html#TaoSolve_TRON">TaoSolve_TRON in src/tao/bound/impls/tron/tron.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/complementarity/impls/asls/asfls.c.html#TaoSolve_ASFLS">TaoSolve_ASFLS in src/tao/complementarity/impls/asls/asfls.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/complementarity/impls/asls/asils.c.html#TaoSolve_ASILS">TaoSolve_ASILS in src/tao/complementarity/impls/asls/asils.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/complementarity/impls/ssls/ssfls.c.html#TaoSolve_SSFLS">TaoSolve_SSFLS in src/tao/complementarity/impls/ssls/ssfls.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/complementarity/impls/ssls/ssils.c.html#TaoSolve_SSILS">TaoSolve_SSILS in src/tao/complementarity/impls/ssls/ssils.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/constrained/impls/admm/admm.c.html#TaoSolve_ADMM">TaoSolve_ADMM in src/tao/constrained/impls/admm/admm.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/constrained/impls/almm/almm.c.html#TaoSolve_ALMM">TaoSolve_ALMM in src/tao/constrained/impls/almm/almm.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/constrained/impls/ipm/ipm.c.html#TaoSolve_IPM">TaoSolve_IPM in src/tao/constrained/impls/ipm/ipm.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/constrained/impls/ipm/pdipm.c.html#TaoSolve_PDIPM">TaoSolve_PDIPM in src/tao/constrained/impls/ipm/pdipm.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/leastsquares/impls/brgn/brgn.c.html#TaoSolve_BRGN">TaoSolve_BRGN in src/tao/leastsquares/impls/brgn/brgn.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/leastsquares/impls/pounders/pounders.c.html#TaoSolve_POUNDERS">TaoSolve_POUNDERS in src/tao/leastsquares/impls/pounders/pounders.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/pde_constrained/impls/lcl/lcl.c.html#TaoSolve_LCL">TaoSolve_LCL in src/tao/pde_constrained/impls/lcl/lcl.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/quadratic/impls/bqpip/bqpip.c.html#TaoSolve_BQPIP">TaoSolve_BQPIP in src/tao/quadratic/impls/bqpip/bqpip.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/quadratic/impls/gpcg/gpcg.c.html#TaoSolve_GPCG">TaoSolve_GPCG in src/tao/quadratic/impls/gpcg/gpcg.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/unconstrained/impls/bmrm/bmrm.c.html#TaoSolve_BMRM">TaoSolve_BMRM in src/tao/unconstrained/impls/bmrm/bmrm.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/unconstrained/impls/cg/taocg.c.html#TaoSolve_CG">TaoSolve_CG in src/tao/unconstrained/impls/cg/taocg.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/unconstrained/impls/lmvm/lmvm.c.html#TaoSolve_LMVM">TaoSolve_LMVM in src/tao/unconstrained/impls/lmvm/lmvm.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/unconstrained/impls/neldermead/neldermead.c.html#TaoSolve_NM">TaoSolve_NM in src/tao/unconstrained/impls/neldermead/neldermead.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/unconstrained/impls/nls/nls.c.html#TaoSolve_NLS">TaoSolve_NLS in src/tao/unconstrained/impls/nls/nls.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/unconstrained/impls/ntl/ntl.c.html#TaoSolve_NTL">TaoSolve_NTL in src/tao/unconstrained/impls/ntl/ntl.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/unconstrained/impls/ntr/ntr.c.html#TaoSolve_NTR">TaoSolve_NTR in src/tao/unconstrained/impls/ntr/ntr.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/unconstrained/impls/owlqn/owlqn.c.html#TaoSolve_OWLQN">TaoSolve_OWLQN in src/tao/unconstrained/impls/owlqn/owlqn.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/tao/interface/taosolver.c)


[Index of all Tao routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
