                             COPYRIGHT NOTICE

This software is copyright by Zbigniew Michalewicz. Permission is
granted to copy and use the software for scientific, noncommercial 
purposes only. The software is provided "as is", i.e., without any
warranties.

                              GENERAL REMARKS

The Genocop system aims at finding a global optimum (minimum or
maximum: this is one of the input parameters) of a function;
additional linear constraints (equations and inequalities) can
be specified as well. 

This is the third version of Genocop system (version 3.0); a few
improvements were made in comparison with the previous versions.
The system can start either from a single point (i.e., all initial
individuals are the same) or from a population of random individuals; 
some bugs in a few modules of were eliminated. If there are some linear
equations given in the input file, this version prompts the user for
indexes of variables to be eliminated. 

The current version of Genocop should run without changes on any BSD-UN*X
system (preferably on a Sun SPARC machine). 
This program can also be run on a DOS system. Edit the genocop.h header
file and change DOS_TYPE to TRUE and change UNIX_SYS to FALSE. The
program was debugged and run using Turbo C++ in the DOS enviroment.


                        HOW TO RUN THE GENOCOP SYSTEM

To run the genocop system, there are four simple steps to follow:

(1) prepare input file, say, "t01" (for test_case 01),
(2) incorporate the function in the eval.c file,
(3) type "make",
(4) type "genocop t01 t01.out" ("t01.out" is the name 
    of the output file provided by you).

A simple example follows. The input file of this example is the
transferred file "t01" you have now in your directory, the typical 
output is present in the file "t01.out". The function is already 
incorporated in the file "eval.c". Altogether, there are several test
cases (t01,t02,...) and their output files; all test functions are
given in the file eval.c.

In the example we try to maximize a function of 4 variables:

  X[1]*sin(X[2]) + X[3]*X[3] -12.7*X[4]

(NOTE: indexes of variables start from one, not zero).

Additional requirements are:

one linear equality:  

    2*X[1] + X[2] - 3.5*X[4]  =  1

two linear inequalities:

    X[2] + X[3]   <=  3.00
    X[1] - 2*X[2] <=  0.00

Also:

 1.00   <=  X1   <=    8.00 
 0.00   <=  X2   <=    8.00 
-2.10   <=  X3   <=    3.10 
 0.00   <=  X4   <=    4.40 

The input file "t01" is as follows:

___________________________________________________

4	1 	2	4

2.0     1.0     0.0     -3.5     1.0
0.0     1.0     1.0      0.0     3.0
1.0    -2.0     0.0      0.0     0.0

1.0	1	8.0
0.0	2	8.0
-2.1	3	3.1
0.0	4	4.4

70	500

4	4	4	4	4	4	4

0.1

1

0

6

10

1
___________________________________________________

Explanations (line by line) of the input file:

4	1 	2	4

These four integers have the following meaning (in order):

number of variables,
number of equalities,
number of inequalities,
number of domains specified.

The next line:

2.0     1.0     0.0     -3.5     1.0

represents the equation:

 2*X[1] + X[2] - 3.5*X[4]  =  1;

note, that for 4 variables you must provide 5 numbers (one for each variable
and the additional one for a value of the right hand side of the equation).

The next two lines:

0.0     1.0     1.0      0.0     3.0
1.0    -2.0     0.0      0.0     0.0

represent two inequalities. NOTE, that all inequalities assume that
left hand side is LESS OR EQUAL to the right hand side. In other words,
to represent an inequality:
       3.1*X[2] - 4.9*X[4] >= 12.1
you have to represent it as (assuming four variables):

      0.0    -3.1     0.0     4.9    -12.1, i.e.,

      -3.1*X[2] + 4.9*X[4] <= -12.1

The next four lines of the input file:

1.0	1	8.0
0.0	2	8.0
-2.1	3	3.1
0.0	4	4.4

describe domains of variables (the middle - integer - number of 
each line serves as an index of a variable).

The line:

70   500

indicate the population size (70) and the total number of generations (500).

The next line:

4	4	4	4	4	4	4

provides the frequencies of 7 operators (these are integers; their total
should not exceed 50% of the population size).
You can leave these frequencies as a standard set for all your
experiments. Note, that there is one operator more than in the
original Genocop system.

The final lines of the input file are:

0.1    (the coeficient q for cumulative probability distribution;
        higher q values provide stronger selective pressure;
        standard value 0.1 is very reasonable for a population
        size 70). 

1      (1 is for maximization problem, 0 for minimization).

0      (0 for a start from a random pupulation, 1 for a start
        from a single point, i.e., all individuals in the 
        initial population are identical). If the system has
        difficulties in finding feasible points, it will
        prompt you for these (see note below, for parameter TRIES).
 
6      (a parameter for non-uniform mutation; should stay as 6).

10     (a parameter for simple crossover, leave it as it is).

1      the number of your test-case; any integer would do. It is
       convenient if your eval.c file contains several test cases:
       then you can run the system (without recompiling) and any
       of the test problems present in eval.c.

EVALUATION FUNCTION:

One of the transferred files is "eval.c". For our current example, 
it is:

_____________________________________________________
#include "genocop.h"

/* COMMENTS */

float evaluate(X)
VECTOR X;
{
  switch (test_num)
   {
     case 1:  return(X[1]*sin(X[2]) + X[3]*X[3] -12.7*X[4]);
     case 2:  return(X[1]*(70.0-4.0*X[1]) + X[2]*(150.0 - 15.0*X[2])
                     - 100.0 - 15.0*X[1] - 15.0*X[2]);
     case 3:  return(-1.0*(X[1]-3.0)*(X[1]-3.0) - (X[2]-2.0)*(X[2]-2.0));
     case 4:  return(-2.0*X[1]*X[1] - X[2]*X[2] + X[1]*X[2] + 8.0*X[1] + 3.0*X[2]);
     case 5:  return((X[1] + 10.0*X[2])*(X[1] + 10.0*X[2]) + 
              5.0*(X[3] - X[4])*(X[3] - X[4]) + (X[2] - 2.0*X[3])*(X[2] - 
              2.0*X[3])*(X[2] - 2.0*X[3])*(X[2] - 2.0*X[3]) + 10.0*(X[1] - 
              X[4])*(X[1] - X[4])*(X[1] - X[4])*(X[1] - X[4]));
     case 6:  return(0.2*X[1]*X[1] + 0.08*X[2]*X[2] + 0.18*X[3]*X[3] + 
              0.1*X[1]*X[2] + 0.04*X[1]*X[3] + 0.06*X[3]*X[2]);
    default: printf("Invalid test case in eval.c - test case is %f", test_num);
              exit(0);
   }
  return(0);
}

_____________________________________________________

If the objective function is already present in eval.c file,
you can run the system. If not, you have to insert a new case,
say, case 7, type "make", and insert 7 as the last integer in your
input file.

% genocop t01 t01.out

and (hopefully) you'll get your result.

IMPORTANT REMARKS: 

(1) If the input file contains at least one equation, the user
    will be prompt for indexes of variables to be eliminated.

(2) There is a line in the genocop.h file:

#define TRIES 100

The variable TRIES defined the number of attempts the Genocop system
tries to find a feasible point in the search space (for initialization
process, for each individual). If successful, the system will run further. 
If not, the Genocop will prompt you for an initial point (if starting
from a single point) or for some number of initial points (you decide
on this number) for multiple initial points option.

OUTPUT: the output file is self-explanatory. After several control
lines, you get the generation number and the current best value
(only for generations, where there is an improvement).
This is followed by the best solution.

FINAL NOTICE: It is possible that there are some bugs in the system;
              please, report them to zbyszek@mosaic.uncc.edu.
              I will try to take care of them in the next version.


I hope these remarks would be sufficient to experiment with the system.

Happy optimizing,


Zbigniew Michalewicz

******************************************************************************
* Mail: Department of Computer Science      E-mail: zbyszek@mosaic.uncc.edu  *
*       University of North Carolina        Phone:  (704) 547-4873           *
*       Charlotte, NC 28223                 Fax:    (704) 547-2352           *
******************************************************************************





