                             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 III system aims at finding a global optimum (minimum or
maximum: this is one of the input parameters) of a function;
additional linear and nonlinear constraints (inequalities) can
be specified as well. 

This is the first version of Genocop III system (version 1.0); a new
version is being developed. The Genocop III system is based on the 
original Genocop (version 3.0).

The current version of Genocop should run without changes on any BSD-UN*X
system (preferably on a Sun SPARC machine).


                        HOW TO RUN THE GENOCOP III SYSTEM

To run the Genocop III system, there are five simple steps to follow:

(1) prepare input file, say, "t100" (for test_case 100),
(2) incorporate the objective function in the eval.c file,
(3) incorporate nonlinear constraints into the nlinear.c file,
(4) type "make",
(5) type "genocop t100 100.out" ("t100.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". There is also another test
case there (t02) with a typical output (t01.out).

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

 X[1]*X[1] + X[2]*X[2] + 2*X[3]*X[3] + X[4]*X[4] - 5*X[1]
                - 5*X[2] - 21*X[3] + 7*X[4]

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

Additional requirements are:

 * 2 linear inequalities:
 
     #  X[1] - 2*X[3] <= 1, and
     #  X[1] + X[4] <= 5.1.

 * 3 nonlinear inequalities:

     #  8 - X[1]*X[1] + X[2]*X[2] - X[3]*X[3] - X[4]*X[4] >= 0,
     #  sin(X[2]*X[4]/2) >= -0.1, and
     #  2*X[1]*X[2] + X[4] >= 0

(note that linear inequalities are given as <= some number, whereas 
 nonlinear inequalities as >= 0).

Also:

 -1.00   <=  X1   <=     5.00 
  0.00   <=  X2   <=     4.00 
 -7.32   <=  X3   <=     1.00 
 -1.00   <=  X4   <=     1.00 


Then the input file "t01" is as follows:
___________________________________________________

4	2	4

1.0   0   -2   0    1
1.0   0    0   1    5.1

-1.0	1	 5.0
 0.0	2	 4.0
-7.32	3	 1.0
-1.0	4	 1.0

70   500

4	4	4	4	4	4	4

0.1

0

1

6

10

100

0.15

3

0

___________________________________________________

Explanations (line by line) of the input file:

4	2	4

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

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

These two lines:

1.0     0     -2      0      1
1.0     0      0      1      5.1

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:

      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	 5.0
 0.0	2	 4.0
-7.32	3	 1.0
-1.0	4	 1.0

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. 

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). 

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

1      (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.

0.15   Probability of replacement of search vector by a fully feasible
       vector.

3      Number of non-linear inequalities (specified in nonlinear.c)

0      Mode of choosing reference (fully feasible) vector to move to
       in the reference population.  0 is random, 1 uses the probability
       distribution.


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]*X[1] + X[2]*X[2] + 2*X[3]*X[3] + X[4]*X[4] - 5*X[1]
                - 5*X[2] - 21*X[3] + 7*X[4]);
    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.


Also, in the file "nlinear.c", we have :

_____________________________________________________

#include "genocop.h"



int 
nonlinear(X, ninumber, nenumber, epsilon)
    VECTOR          X;
    int             ninumber;
    int             nenumber;
    float           epsilon;
{

.  .  .
.  .  .
.  .  .
.  .  .

    /* initial state of cflag = TRUE */

    switch (test_num)
    {
	
      case 1:
        g[1] = 8 - X[1]*X[1] + X[2]*X[2] - X[3]*X[3] - X[4]*X[4];
        g[2] = sin(X[2]*X[4]/2.0) + 0.1;
        g[3] = 2*X[1]*X[2] + X[4];
        break;
     
    default:
	printf("Non-Linear Constraint Specification error\n");
	exit(0);
    }
.  .  .
.  .  .
.  .  .
.  .  .

}

_____________________________________________________


Now, type 'make' to build the system and then type :

% genocop t01 t01.out

and (hopefully) you'll get your result.

IMPORTANT REMARKS: 

(1) if you run test case t01 and the system prompts you for a feasible
    starting point, provide a point which satisfies all (linear and
    nonlinear) constraints. In case t01 it is very easy to find a
    feasible solution; for example X[1] = 0.5; X[2] = 3.0; X[3] = 0.0;
    X[4] = 0.9 would do.

(2) remember about "break" statement when you insert a new test case
    in the file nlinear.c.

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

#define TRIES 100000

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: This version is an experimental alpha version.
              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@uncc.edu  *
*       University of North Carolina        Phone:  (704) 547-4873    *
*       9201 University City  Boulevard     Fax:    (704) 547-3516    *
*       Charlotte, NC 28223-0001                                      *
***********************************************************************




