Local Search Optimization

Genetic Algorithms - Implementation details

Initializing Problem Data

The GA procedure offers great flexibility in how you initialize the problem data. You can either read data from SAS data sets that are created from other SAS procedures and DATA steps, or you can initialize the data with programming statements.

In the PROC GA statement, you can specify up to five data sets to be read with the DATAn= option, where n is a number from 1 to 5, that can be used to initialize parameters and data vectors applicable to the optimization problem.

Choosing Problem Encoding

Problem encoding refers to the structure or type of solution space that is to be optimized, such as real-valued fixed-length vectors or integer sequences. The GA procedure offers encoding options appropriate to several types of optimization problems. You specify the problem encoding with a SetEncoding call statement.

Setting the Objective Function

You can specify the objective function to be optimized using the SetObjFunc call. It takes two parameters - the name of the function, fname, and minmax, a number used to specify minimization(0) or maximization(1).

Controlling the Selection Process

The GA procedure offers two versions of a standard technique for the selection process commonly known as tournament selection. In the first version, you can control the selective pressure by specifying the tournament size, which has to be 2 or greater. You can invoke it using the SetSelTournament call statement. The second version provides a weaker selective pressure and you can invoke it using the SetSelDuel call statement. You can also ensure that the best solution in the current generation is passed on to the next one by using the SetElite call statement.

Setting Crossover Parameters

There are two crossover parameters that need to be specified: the crossover probability and the crossover operator. To set the probability, you use the SetCrossProb call statement. To set the crossover operator, you use the SetCross call. In addition, you can also specify your own operator using the SetCrossRoutine('name') statement.

Setting Mutation Parameters

There are two mutation parameters: the mutation probability and the mutation operator. To set the probability, you use the SetMutProb call statement. To set the mutation operator, you use the SetMut call. You can also specify your own operator using the SetMutRoutine('name') call.

Creating the Initial Generation

The GA procedure provides two methods for generating the initial population. You can specify a data set in the FIRSTGEN= option of the PROC GA statement that is read to populate the initial generation, or you can use the Initialize call.

Monitoring Progress and Reporting Results

The GA procedure enables your program to monitor and alter parameters during the optimization process and record final results. If a data set is specified in the LASTGEN= option of the PROC GA statement, then the last generation of solutions is written out to the data set.

You can specify an update subroutine with a SetUpdateRoutine call. You can also control the number of iterations dynamically in your program, using the ContinueFor call. Finally, to perform post-processing of the optimization data, you can use a SetFinalize call to instruct the GA procedure to call a subroutine you have defined, after the last iteration.