# TaoGAAppSetObjectiveRoutine

Sets a routine for function evaluations.

## Synopsis

    #include "taoapp_ga.h"
    int TaoGAAppSetObjectiveRoutine(TAO_GA_APPLICATION gaapp, int (*func)(TAO_GA_APPLICATION,GAVec,double*,void*), void *ctx)

Collective on TAO_GA_APPLICATION

## Input Parameters

| gaapp | - the TAO_GA_APPLICATION context
| func | - routine for evaluating the function
| ctx | - optional user-defined context for private data for the function evaluation routine (may be TAO_NULL)

## Calling sequence of funcgrad

        func (TAO_GA_APPLICATION tao,GAVec x,double *f,void *ctx);

| tao | - TAO_GA_APPLICATION application context
| x | - input vector
| f | - function value
| ctx | - optional user-defined context

## Notes

The user may call TaoGAAppSetObjectiveAndGradientRoutine() to set a routine that evaluates both the function and gradient. Alternatively, the user may call both TaoGAAppSetObjectiveRoutine() and TaoGAAppSetGradientRoutine() to set separate routines for function and gradient evaluation.

Using a single routine to compute the function and gradient, as specified via TaoGAAppSetObjectiveAndGradientRoutine(), may enable better performance for applications in which many of the function and gradient computations are identical.

## Options Database Keys

-tao_view_gradient -view the gradient after each iteration

## Keywords

TAO_GA_APPLICATION, set, function

## See Also

TaoGAAppSetGradientRoutine(), TaoGAAppSetObjectiveAndGradientRoutine(), TaoComputeFunctionGradient()

Level:beginner
Location:src/external/globalarraytao/taoapp_ga.c
TAO Solver Index
Table of Contents