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 to the data set. See the section PROC GA Statement for a description of the data set created by the LASTGEN= option.
You can define a subroutine and designate it to be called at each iteration in an update phase, which occurs after the evaluation phase and before selection, crossover, and mutation. Your subroutine can check solution values and update and store variables you have defined, adjust any of the optimization parameters such as the mutation probability or elite value, or check termination criteria and end the optimization process. An update routine can be especially helpful in implementing advanced techniques such as multiobjective optimization. You can specify an update subroutine with a SetUpdateRoutine call :
call SetUpdateRoutine(
'routine');
where routine is the name of your subroutine to be executed at each iteration.
You can set the maximum number of iterations permitted for the optimization process with the MAXITER= option in the PROC GA statement. If none is specified, a default value of 500 iterations is used. You can also control the number of iterations dynamically in your program by using the ContinueFor call :
call ContinueFor(
n);
where n is the number of iterations to permit beyond the current iteration. A value of 0 ends the optimization process at the current iteration. One common way this call might be used is to include it in the logic of an update subroutine declared in the SetUpdateRoutine call . The update subroutine could check the objective values and end the optimization process when the optimal value of the objective function has not improved for a specific number of iterations. A ContinueFor call overrides an iteration limit set with the MAXITER= option.
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:
call SetFinalize(
'routine');
where routine is the name of a subroutine you have defined. Your finalize subroutine could perform some post processing tasks, such as applying heuristics or a local optimization technique to try to improve the final solution.