Language Reference


GAINIT Call

CALL GAINIT (id, popsize <, bounds> <, modname> );

The GAINIT subroutine creates and initializes a solution population for a genetic algorithm optimization. The input arguments to the GAINIT call are as follows:

id

is the identifier for the genetic algorithm optimization problem, which was returned by the GASETUP function .

popsize

is the number of solution matrices to create and initialize.

bounds

is an optional parameter matrix that specifies the lower and upper bounds for each element of a solution matrix. It is used only for integer and real fixed-length vector problem encoding.

modname

is the name of a user-written module to be called from GAINIT when it generates the initial members of the solution population.

The GAINIT call creates the members and computes the objective values for an initial solution population for a genetic algorithm optimization. If the problem encoding is specified as a sequence in the corresponding GASETUP function call and no modname parameter is specified, then GAINIT creates an initial population of vectors of randomly ordered integer values ranging from 1 to the size parameter of the GASETUP function call. Otherwise, you control how the population is created and initialized with the bounds and modname parameters.

If real or integer fixed-length vector encoding is specified in the corresponding GASETUP function call, then the bounds parameter can be supplied as a $2 \times n$ matrix, where the dimension n equals the size parameter of the GASETUP function call: the first row specifies the lower bounds of the corresponding vector elements and the second row specifies the upper bounds. The solutions that result from all crossover and mutation operators are checked to ensure they are within the upper and lower bounds, and any solution components that violate the bounds are reset to the bound. However, if user-written modules are provided for these operators, the modules are expected to do the bounds checking internally. If no modname parameter is specified, the initial population is generated by random variation of the solution components between the lower and upper bounds.

For all problem encodings, if the modname parameter is specified, it is expected to be the name of a user-written subroutine module with one parameter. The module should generate and return an individual solution in that parameter. The GAINIT call invokes that module popsize times, once for each member of the initial solution population. The modname parameter is required if the encoding parameter of the corresponding GASETUP function call was 0 or if the bounds parameter is not specified for real or integer fixed-length vector encoding.

See the GASETUP function for an example.