# TaoSetMeritFunction

Sets the routine that evaluates the merit function.

## Synopsis

    #include "tao_solver.h"
    int TaoSetMeritFunction(TAO_SOLVER solver,int (*func)(TAO_SOLVER,TaoVec*,double*,void*),
                          int (*funcgrad)(TAO_SOLVER,TaoVec*,double*,TaoVec*,void*),
                          int (*grad)(TAO_SOLVER,TaoVec*,TaoVec*,void*),
                          int (*destroy)(TAO_SOLVER,void*),
                          void *ctx)

Collective on TAO_SOLVER

## Input Parameters

| solver | - the TAO_SOLVER solver context
| func | - merit function evaluation routine
| funcgrad | - merit function and gradient evalution routine
| grad | - merit gradient evaluation routine
| destroy | - context destructor routine
| ctx | - [optional] user-defined context for private data for the function and gradient evaluation routine (may be TAO_NULL)

## Calling sequence of func

        func (TAO_SOLVER solver,TaoVec *xx,double *f,void *ctx);

| solver | - the TAO_SOLVER solver context
| xx | - variable vector
| f | - objective function value
| ctx | - [optional] user-defined function context

## Calling sequence of funcgrad

        funcgrad (TAO_SOLVER solver,TaoVec *xx,double *f,TaoVec *gg, void *ctx);

| solver | - the TAO_SOLVER solver context
| xx | - variable vector
| f | - objective function value
| gg | - gradient vector
| ctx | - [optional] user-defined function context

## Calling sequence of grad

        grad (TAO_SOLVER solver,TaoVec *xx,TaoVec *gg,void *ctx);

| solver | - the TAO_SOLVER solver context
| xx | - variable vector
| gg | - gradient vector
| ctx | - [optional] user-defined function context

## Calling sequence of destroy

        destroy (TAO_SOLVER solver, void *ctx);

| solver | - the TAO_SOLVER solver context
| ctx | - [optional] user-defined function context

## Keywords

TAO_SOLVER, merit function

## See Also

TaoComputeMeritFunction()

Level:developer
Location:src/interface/tao_fghj.c
TAO Solver Index
Table of Contents