DF1 User Manual for MATLAB Code

Morrison 6/99

Overview

This manual provides information on the use of the MATLAB (Version 4.2) code for visualization of test functions generated with the DF1 test function generator. This code is useful for 3D visualization of the dynamic fitness landscape generated by 2D functions, or it can be modified to display projections of higher-order landscapes. The code will make a MATLAB movie of the function you design, or it can be paused at each iteration to study the landscape. Further information about this Test Function can be found in "A Test Problem Generator for Non-Stationary Environments" by Ronald Morrison and Kenneth De Jong in the proceeding of the Congress on Evolutionary Computing 1999 (CEC-99).

A two step process provides the basis for the development of a general purpose dynamic fitness environment. The first step is to choose a static function to which dynamics could be effectively added. The second step is to determine a method for applying dynamics to this function. The advantage of separating these two steps is that it allows us to consider the features and complexity of the static problem independently of the method of change.

The Static Environment

The static function chosen for our initial attempt at generating a general purpose dynamic function is a "field of cones" identified by the equation:

where:

N = the number of cones in the environment

and random values for each come are assigned based on:

Hi Î [Hbase, Hbase + Hrange]

Ri Î [Rbase, Rbase + Rrange]

Xi Î [ -1, 1]

Yi Î [-1, 1]

There are several advantages to the use of this function as the static basis for the dynamic environment. They include:

1. the ability to represent a wide range of complexities

2. the surface contains non-differentiable regions

3. environment characteristics are parametrically identified

4. fitness values can be easily restricted to be positive (or any other minimum value), if desired

5. the function is extendable to many dimensions

6. the function offers three fundamentally different features that can be made dynamic (height, location, and slope), representing different classes of problems.

To generate a wide range of static problems of varying complexity, one need only specify the parameters N, the number of peaks, Rbase, the minimum value of the slope control variable, Rrange, allowed range of for the slope control, Hbase, the minimum cone height, and Hrange, the range of allowed cone heights. For examples of the variety of fitness landscapes generated with by varying these five parameters, see "A Test Problem Generator for Non-Stationary Environments" in the proceeding of the Congress on Evolutionary Computing 1999 (CEC-99).

The Dynamic Driver

DF1 provides a simple mechanism for describing a wide range of dynamic performance by generating a variety of dynamics with the change of a single parameter through the use of a one-dimensional, non-linear function with simple bifurcation transitions to progressively create more complex behavior: logistics function. The logistics function is:

Yi = A * Y(i-1) * (1 – Y(i – 1))

Where: A is a constant, and

Yi is the value at iteration i

A bifurcation map of the logistics function is provided as Figure 1. This figure shows the values of Y that can be generated on each iteration of the logistics function for values of A between 1 and 4. For example, if a value of 2.2 is chosen, the logistics function will generate a constant Y

Figure 1. The Logistics Function

value of .5455 on each iteration. For a larger A of 2.9, a larger constant Y value of .6552 is generated.

As A is increased, more complicated dynamic behavior emerges. Values slightly larger than the first bifurcation point generate two different values of Y for alternate iterations. Values of 3.3 and 3.4 generate pairs of Y values {.8236 .4794} and {.8420 .4520} respectively. As larger A values are chosen the function bifurcates again and provides more complex behavior. At A=3.5, the Y values generated are {.3828 .5009 .8269 .8750}. Still larger values of A generate chaotic sequences of Y values within the range shown in Figure 1.

Applying Dynamics

In the DF1 test function generator, the user is provided with the opportunity to select:

  1. The number of peaks in the landscape that will move.
  2. Whether the motion will be applied to the height of the peaks, the slope of the peaks, the x-location of the peaks, the y-location of the peaks, or any combination thereof.

The logistics function is used to select the amount of feature movement. The user specifies the chosen A value for each of the features to move, and, by choosing this single parameter, specifies whether the movement will be small same-sized steps, large same-sized steps, steps of few different sizes, or chaotically changing step sizes. The values chosen for A must be greater than one and less than four.

In the dynamic test function generator (DF1), the computed Y values are used to create step sizes for the motion. Motion parameters can be cone height, cone slope, x-location, y-location, or any combination of these. Motion can be applied to any number of cones in the environment. Movement is created by scaling the Y values to keep the step sizes below .5, and then using the step size as a percentage of the range to add to or subtract from the current parameter value. For example, for an individual cone that is increasingly dynamic in height, first the current height is computed as a percentage of maximum height:

Hpct = H /(Hbase + Hrange).

The current Y value is then scaled by the height scaling factor and added to the Hpct:

Hpct = Hpct + Y*Hscale.

If this is less than 100%, then the new height value is computed from the percentage value. If it is greater than 100% then the step change sign is reversed (and remains that way for each iteration until Hpct reaches zero) and the new height value is computed from the percentage value.

The result of this process is that the dynamics of the environment can be specified by determination of:

Additionally, the user provides a scaling constant for each type of movement and declare whether initial movement direction will be increasing or decreasing.

Detailed Instructions:

(1) Set the number of peaks, N . The more peaks you have, the longer Matlab takes to process the landscape.

(2) Set Rbase, the basic "spikiness" of the peaks, big = spiky,

(3) Set Rrange, the range of the spikiness among the peaks,

(4) Set Hbase, the basic height of the peaks,

(5) Set Hrange, the range of the difference is height off of the base,

(6) Set Numframes, which sets the number of iterations and also the number of frames in the MATLAB movie,

(7) The dynamics can be in height (H), "spikiness"(R ), X –location (X), Y-location (Y), or any combination of these. They are initiated by setting to "1" the variable

Hboolean

Rboolean

xboolean

yboolean

Set the ones you want to "1". For example, the settings shown here will apply dynamics along the x and y axes only.

Hboolean = 0;

Rboolean = 0;

xboolean = 1;

yboolean = 1;

(8) Not all of the peaks need move. Now set NumMove, the number of peaks that will move, to a number less than or equal to N, for example:

NumMove = 14;

moves 14 cones.

(9) Now apply the dyamics

You are allowed to select different types of movement (using the logistics function) for each characteristic that you are making dynamic (for example, you could apply slow, steady movement along the x-axis, while chaotically changing the peak heights). You do this by setting different values for the "A" variables associated with each characteristic. The A-values are the forcing parameter from the Logistic Function discussed above (see the paper in the CEC-99 proceeding for more information). Different A values generate different step-size values.

The step-sizes that result from the logistics function (real numbers from 0 to 1) are used as a fraction of the range of the characteristic that you are making dynamic. For example a step-size of .3 would result in each step being moved 30% of the total range. Because the rigid step-size values generated by the logistics function may not be what you desire your dynamic characteristics to be, the variables Hstepscale, Rstepscale, xstepscale, and ystepscale provide a simple linear-scaling mechanism for changing range of the step size generated by the output of the logistics function

For example:

An Ah value of 3.3 would generate two values for height changes, (.8236 and .4794). Since moving the value 82% of its range on each step is pretty drastic, and may not be desired, applying a value of .25 to the variable Hstepscale would make the height dynamics move approximately 21% or 12% on each iteration.

Values for the A values and step scales for each of the dynamic characteristics (h, r, x, y) are entered into the MATLAB code according to the following example

% for height:

Ah = 1.2;

Hstepscale = .3;

% for R:

Ar = 1.6;

Rstepscale = .5;

% for x:

Ax = 3.8;

xstepscale = .5;

% for y:

Ay = 3.8;

ystepscale = .5;

 (10) Now select the cones to apply the motion to with a vector C of indices from 1 to N C indices are the specific cones that you want to move. For example if you were only moving 2 cones and you wanted to move cones 4 and 12, you would put C = [4 12]. In general this is of limited usefulness, just MAKE SURE that you have as many indices as you have moving cones. Extra indices are not a problem (i.e., numbers > N)

This example moves cones 2 through 15.

C = [2 3 4 5 6 7 8 9 10 11 12 13 14 15];

(11) In the next step, you have the choice of picking the DIRECTION of the first step for each dynamic characteristic. For example, if you want, you can set some cones to start their movement by getting larger and some by getting smaller. 1 means start by getting larger. 0 means start by getting smaller.

AGAIN, YOU MUST HAVE ONE VALUE FOR EACH MOVING CONE, but extra indices ( >N) do not cause a problem. There is one vector for each dynamic characteristic (h,r,x,y).

IUP sets the initial movement as up or down, with reversal at the max and min, for each parameter H, R, x, or y.

 for example:

IUPH = [0 1 0 1 0 0 1 1 1 0 1 0 1 0];

IUPR = [0 1 0 1 0 0 1 1 1 0 1 0 1 0];

IUPx = [1 1 1 1 1 1 1 1 1 1 1 1 1 1];

IUPy = [1 0 1 0 1 0 1 0 1 0 1 0 1 0];

 

AT THIS POINT, YOU ARE DONE EXCEPT FOR SETTING SOME DISPLAY AXEX (skip down to step (12) ) UNLESS YOU WOULD LIKE TO:

- HARD-CODE SOME OR ALL OF THE CONE VALUES TO REPEAT IDENTICAL EXPERIMENTS

- SELECT WHETHER TO MAKE A MATLAB MOVIE, OR MERELY PAUSE THE DISPLAY AT EACH ITERATION TO STUDY THE RESULTS.

The next section of the program does some processing for the logistics function transients. You do not need to get involved here. Just let this code run. The code section looks like this for each of the dynamic characteristics :

Hstep = .5;

for i=2,100

Hstep = Ah*Hstep*(1-Hstep);

end

etc….

The next section of code establishes the landscape between -1 and 1 on the XY plane. The picture is drawn with the meshgrid Matlab function. Note the notation convention for this program: X and Y are the

[X,Y] = meshgrid(-1:.01:1);

Only change this if you ned to view the function with higher granularity or want a different range.

Th next section initialize radius, height, and x(0) and y(0) for all the cones. You can create specific peaks here, just hard code them and adjust the loop indices accordingly so that the system doesn't re-randomize them for you.

In the source code, I have hard coded cone #1 to al floor of H(1)=0 and R(1)= 0. Use this if you do NOT want negative fitnesses. You can also use this technique to select a minimum other than 0.

R(1) = 0;

H(1) = 0;

x(1) = .5;

y(1) = .5;

The next code randomly initialize the rest (unless you hard coded some others. In that case change the indices so as to not re-randomize cones that you hard coded.

for i = 2:N

R(i) = Rbase + Rrange*rand;

H(i) = Hbase + Hrange*rand;

x(i) = 2*rand - 1;

y(i) = 2*rand - 1;

end

The first cone is plotted next:

Z =(H(1) - R(1)*(sqrt((X-x(1)).^2 + (Y-y(1)).^2)));

This loop successively takes the MAX of all of the cones to build a surface.

for i = 2:N

ZI =(H(i) - R(i)*(sqrt((X-x(i)).^2 + (Y-y(i)).^2)));

Z = max(Z,ZI);

end

This draws the picture

meshc(Z);

axis([0 220 0 220 0 15]);

(12) NOTE IN THE PREVIOUS LINE…. The Z axis is set to the maximum height! SET THE LAST NUMBER IN THE axis VECTOR TO YOUR (Hbase + Hrange) SUM. You need to do this again in about the 5th to the last line of the program.

The next major loop in the code applies the dynamics and pints the picture:

for m = 1:NumFrames

… see code

Near the end of this loop, we plot the revised cones, taking the max of the surface, as before.

Z = (H(1) - R(1)*(sqrt((X-x(1)).^2 + (Y-y(1)).^2)));

for i = 2:N

ZI =(H(i) - R(i)*(sqrt((X-x(i)).^2 + (Y-y(i)).^2)));

Z = max(Z,ZI);

end

meshc(Z);

axis([0 220 0 220 0 15]); % NOTE: Remember to set the Z axis range to the maximum height (just like in step (12))

At this point, you get to pick whether you want to make a Matlab movie (called by the Movie command in Matlab) or whether you want the system to pause and just study the landscape changes, or both. Just put a % sign in from if the one you don't want to comment it out.

M(:,m) = getframe; %This makes a Matlab movie if you want one

pause %This pauses Matlab if you want to study the shape

end

 

FINAL NOTE: You can create some incredibly complex dynamics with this test function generator. I'd suggest STARTING SIMPLY (only a few cones, motion in only a few axes, small steps), then, after you understand what is going on, advancing to progressively more complex dynamics.

Enjoy.

Ron Morrison

ronald.morrison@mitretek.org





For more information, please contact William M. Spears.
Last modified: 07/29/99