# 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
func (Tao tao, Vec xl, Vec xu);
```


- ***tao -*** the Tao
- ***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
 `Tao`, `TaoSetObjective()`, `TaoSetHessian()`, `TaoSetObjectiveAndGradient()`, `TaoSetVariableBounds()`


## Level
beginner

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

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/bound/tutorials/plate2f.F90.html">src/tao/bound/tutorials/plate2f.F90.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/complementarity/tutorials/blackscholes.c.html">src/tao/complementarity/tutorials/blackscholes.c.html</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](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
