:orphan:
# TaoSetVariableBoundsRoutine
Sets a function to be used to compute lower and upper variable bounds for the optimization
## Synopsis
```
#include "petsctao.h"
PetscErrorCode TaoSetVariableBoundsRoutine(Tao tao, PetscErrorCode (*func)(Tao, Vec, Vec, void *), void *ctx)
```
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`
```none
PetscErrorCode func(Tao tao, Vec xl, Vec xu, void *ctx);
```
- ***tao -*** the `Tao` solver
- ***xl -*** vector of lower bounds
- ***xu -*** vector of upper bounds
- ***ctx -*** the (optional) user-defined function context
## Note
The func passed to `TaoSetVariableBoundsRoutine()` takes precedence over any values set in `TaoSetVariableBounds()`.
## See Also
[](ch_tao), `Tao`, `TaoSetObjective()`, `TaoSetHessian()`, `TaoSetObjectiveAndGradient()`, `TaoSetVariableBounds()`
## Level
beginner
## Location
src/tao/interface/taosolver_bounds.c
## Examples
src/tao/bound/tutorials/plate2f.F90
src/tao/complementarity/tutorials/blackscholes.c
---
[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)