Language Reference

GASETOBJ Call    -    Experimental

sets the objective function for a genetic algorithm optimization

CALL GASETOBJ( id, type <, parm > );

The inputs to the GASETOBJ call are as follows:



id
is the identifier for the genetic algorithm optimization problem, which was returned by the GASETUP function.
type
specifies the type of objective function to be used.
parm
is a matrix whose interpretation depends on the value of type, as described in the following list.

IML enables the specification of a user-written module to be used to compute the value of the objective function to be optimized, or a standard preset function can be specified. This is specified with the type and parm parameters.


type=0
specifies that a user-written function module is to be minimized. The name of the module is supplied in the parm parameter. The specified module should take a single parameter representing a given solution, and return a scalar numeric value for the objective function.
type=1
specifies that a user-written function module be maximized. The name of the module is supplied in the parm parameter. The specified module should take a single parameter representing a given solution, and return a scalar numeric value for the objective function.
type=2
specifies an objective function from the traveling salesman problem, which is minimized. This option is valid only if sequence encoding is specified in the corresponding GASETUP function call, and the solution vector is to be interpreted as a circular route, with each element representing a location. The parm parameter should be a square cost matrix, such that parm[i, j] is the cost of going from location i to location j. The dimension of the matrix should be the same as the size parameter of the corresponding GASETUP function call.
The specified objective function is called once for each solution, to evaluate the objective values for the GAREGEN call, GAINIT call, and GAREEVAL call. Also,

the objective values for the current solution population are reevaluated if GASETOBJ is called after a GAINIT call.

See the GASETUP function for an example.

Previous Page | Next Page | Top of Page