The GA Procedure

Dynamic_array Call

call Dynamic_array ( arrayname, dim1<, dim2, …, dim6> ) ;

The Dynamic_array call allocates a numeric array. The inputs to the Dynamic_array call are as follows:

arrayname

is a previously declared array, whose dimensions are to be re-allocated.

dim1

is the size of the first dimension.

dim2,…,dim6  

are optional. Up to six dimensions can be specified.

The Dynamic_array call is normally used to allocate working arrays when the required size of the array is data-dependent. It is often useful in user routines for genetic operators or objective functions to avoid hard-coding array dimensions that might depend on segment length or population size. The array to be allocated must first be declared in an ARRAY statement with the expected number of dimensions, as in the following example:

   subroutine sub(nx, ny);
      array x[1] /nosym;
      call dynamic_array(x, nx);
      array xy[1,1] /nosym;
      call dynamic_array(xy, nx, ny);
      ...