:orphan:
# TaoSetConstraintsRoutine
Sets a function to be used to compute constraints.  Tao only handles constraints under certain conditions, see [](ch_tao) for details 
## Synopsis
```
#include "petsctao.h" 
PetscErrorCode TaoSetConstraintsRoutine(Tao tao, Vec c, PetscErrorCode (*func)(Tao, Vec, Vec, void *), void *ctx)
```
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`
```none
PetscErrorCode func(Tao tao, Vec x, Vec c, void *ctx);
```

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





## See Also
 [](ch_tao), `Tao`, `TaoSetObjective()`, `TaoSetHessian()`, `TaoSetObjectiveAndGradient()`, `TaoSetVariablevBounds()`

## Level
intermediate

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

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/complementarity/tutorials/blackscholes.c.html">src/tao/complementarity/tutorials/blackscholes.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/complementarity/tutorials/minsurf1.c.html">src/tao/complementarity/tutorials/minsurf1.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/pde_constrained/tutorials/elliptic.c.html">src/tao/pde_constrained/tutorials/elliptic.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/pde_constrained/tutorials/hyperbolic.c.html">src/tao/pde_constrained/tutorials/hyperbolic.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/pde_constrained/tutorials/parabolic.c.html">src/tao/pde_constrained/tutorials/parabolic.c</A><BR>


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


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