GASETMUT Call

CALL GASETMUT (id, mutprob <, type> <, parm> ) ;

The GASETMUT subroutine sets the mutation operator for a genetic algorithm optimization. The input arguments to the GASETMUT call are as follows:

id

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

mutprob

is the probability for a given solution to undergo mutation, a number between 0 and 1.

type

specifies the kind of mutation operator to be used. type is used in conjunction with parm to specify either a user-written module for the mutation operator or one of several other operators, as explained in the following list.

parm

is a matrix whose interpretation depends on the value of type, as described in the following list.

The GASETMUT call enables you to specify the frequency of mutation and the mutation operator to be used in the genetic algorithm optimization problem. If the type parameter is not specified, then the GASETMUT call only alters the mutation probability, without resetting the mutation operator, and any operator set by a previous GASETMUT call remains in effect. You can specify the following mutation operators with the type parameter:

0

specifies that a user-written module, whose name is passed in the parm parameter, be used as the mutation operator. This module should be a subroutine with one parameter, which receives the solution to be mutated. The module is called once for each mutation operation and is expected to modify the input solution according to the desired mutation operation. Any checking of bounds specified in the GAINIT call should be done inside the module; in this case they are not checked by the SAS/IML language.

1

specifies the uniform mutation operator, defined for fixed-length real or integer encoding, with upper and lower bounds specified in the GAINIT call. The parm parameter is not used with this option. To apply this operator, a position k is randomly chosen within the solution vector v and v[k] is modified to a random value between the upper and lower bounds for element k. This operator can prove especially useful in early stages of the optimization, since it tends to distribute solutions widely across the search space and avoid premature convergence to a local optimum. However, in later stages of an optimization with real vector encoding when the search needs to be fine-tuned to home in on an optimum, the uniform operator can hinder the optimization.

2

specifies the delta mutation operator, defined for integer and real fixed-length vector encoding. This operator first chooses an element of the solution at random, and then perturbs that element by a fixed amount, delta, which is set with the parm parameter. delta has the same dimension as the solution vectors, and each element delta[k] is set to parm[k], unless parm is a scalar, in which case all elements are set equal to parm. For integer encoding, all delta[k] are truncated to integers if they are not integers in parm. To apply the mutation, a randomly chosen element k of the solution vector v is modified such that one of the following statements is true:

v[k] = v[k] + delta[k]; /* with probability 0.5 */
        or
v[k] = v[k] - delta[k];

If bounds are specified for the problem in the GAINIT call, then v[k] is adjusted as necessary to fit within the bounds. This operator enables you to control the scope of the search with the parm matrix. One possible strategy is to start with a larger delta value and then reduce it with subsequent GASETMUT calls as the search progresses and begins to converge to an optimum. This operator is also useful if the optimum is known to be on or near a boundary, in which case delta can be set large enough to always perturb the solution element to a boundary.

3

specifies the swap operator, which is defined for sequence problem encoding. This operator picks two random locations in the solution vector and swaps their values. It is the default mutation operator for sequence encoding, except for when the traveling salesman option is specified in the GASETOBJ call. You can also specify that multiple swaps be made for each mutation with the parm parameter. The number of swaps defaults to 1 if parm is not specified, and is equal to parm otherwise.

4

specifies the invert operator, defined for sequence encoding. This operator picks two locations at random and then reverses the order of elements between them. This operator is most often applied to the traveling salesman problem. The parm parameter is not used with this operator.

Mutation is generally useful in the application of the genetic algorithm to ensure that a diverse population of solutions is sampled to avoid premature convergence to a local optimum. More than one GASETMUT call can be made at any time in the progress of the algorithm. This enables flexible adaptation of the mutation process, either changing the mutation probability or changing the operator itself. You can do this to ensure a wide search at the beginning of the optimization, and then reduce the variation later to narrow the search close to an optimum.

A GASETMUT call is required when an encoding parameter of 0 is specified in the GASETUP function. But when no GASETMUT call is made for fixed-length vector and sequence encoding, a default value of 0.05 is set for mutprob and a default mutation operator is used in the GAREGEN call. The mutation operator defaults to the uniform operator for fixed-length vector encoding with bounds specified in the GAINIT call, the delta operator with a parm value of 1 for fixed-length vector encoding with no bounds specified, the invert operator for sequence encoding when the traveling salesman option is chosen in the GASETOBJ call, and the swap operator for all other sequence encoded problems.

See the GASETUP function for an example.