The GA Procedure

SetObj Call

call SetObj ( type, minmax, <, seg><, pname, pvalue><, pname, pvalue>…) ;

The SetObj call sets the objective function. The inputs to the SetObj subroutine are as follows:


is the name of the objective function to be used.


is an indicator to maximize or minimize the objective. A value of 0 is used to specify a minimization, and a value of 1 to specify maximizing the objective.


is optional, and specifies a segment of the solution to which the objective function should be applied. If seg is not specified, then it defaults to a value of 1. seg needs to be specified only if multisegment encoding is used.


is optional, and specifies the name of a particular property to be set for the objective function.


specifies the value to be assigned to the corresponding property name.

The SetObj routine is used to assign a procedure-supplied objective function. For multisegment encoding, the objective can be assigned to a particular solution segment with the seg parameter; otherwise a default segment of 1 is assumed. If more than one SetObj call is made, then the last call nullifies any previous call. Also, a SetObjFunc call nullifies all previous SetObj calls, and a SetObj call nullifies a previous SetObjFunc call. Properties for the chosen objective can be set with optional pname-pvalue pairs. It is also possible to set or reset objective properties with a SetProperty call.

The accepted values for type and the corresponding properties are summarized in Table 3.6. See the section Objective Functions for a full description of the available objectives.

Table 3.6: Objective Function Types and Properties





real, integer