These are examples of using NetSolve Farming.
In these examples, the optimum points of test functions are derived by Genetic Algorithm (GA).

If you want to know about GA, please read README.

There are two directories: server and client.
We have tested this examples on x86 architectures, Linux 2.4.xx, and gcc 2.96.

In this INSTALL, we assume you are using
  1. You are using Linux.
  2. You are using bash shell.


  The server libraries and header files will be installed at
  $NETSOLVE_ROOT/C++examples/gaExample/server/lib and 
  $NETSOLVE_ROOT/C++examples/gaExample/server/include 
  

[Step 1:]	Installation of NetSolve
    You can install NetSolve.  Please substitute <version> with the version of NetSolve.
   
    $ tar xfz NetSolve-<version>.tar.gz
    $ cd NetSolve-<version>
    $ ./configure
    $ make standard

[Step 2:]	Installation of Server service
(1) Move into the server directory.
    
    $ cd C++examples/gaExample/server

(2) Install libraries of optimization problems
    You can move to classic-functions directory and install the libraries of the optimization problems.
   
    $ cd classic-functions
	$ aclocal
	$ autoheader (>> version 2.5)
	$ autoconf (>> version 2.5)
	$ automake
    $ ./configure --prefix=$NETSOLVE_ROOT/C++examples/gaExample/server
    $ make
    $ make install
    $ cd ..

(3) Assign the problems into NetSolve
    At first, you can set the variable CLASSIC_FUNCTIONS_PATH.

    $ export CLASSIC_FUNCTIONS_PATH=$NETSOLVE_ROOT/C++examples/gaExample/server

    Then copy the PDF files from
    $NETSOLVE_ROOT/C++examples/gaExample/server/NetSolve/problems into $NETSOLVE_ROOT/problems.

    $ cp $NETSOLVE_ROOT/C++examples/gaExample/server/NetSolve/problems/* $NETSOLVE_ROOT/problems

    Then, you can add the following lines into @PROBLEMS of $NETSOLVE_ROOT/server_config   .

    ./problems/rastrigin
    ./problems/schwefel
    ./problems/griewank
    ./problems/ridge
    ./problems/rosenbrock

    You can perform "make server" in $NETSOLVE_ROOT directory and
    service-rastrigin and others would be generated.

    $ cd $NETSOLVE_ROOT
    $ make server

(4) Install server_config files
    In these examples,  there are five test functions; 
   
        1. Rastrigin
        2. Schwefel
        3. Griewank 
        4. Ridge
        5. Rosenbrock. 

     We prepare five different configuration file for each function. 
     Therefore, you can choose your function at each server.

     The configuration files are 
     $NETSOLVE_ROOT/C++examples/gaExample/server/NetSolve/server_config/server_config-* 
     You can copy these files into $NETSOLVE_ROOT directory.

     $ cp $NETSOLVE_ROOT/C++examples/gaExample/server/NetSolve/server_config/* $NETSOLVE_ROOT

     After finishing the copy, you can edit the files.
     At least, you should change the value @AGENT.

[Step 3:]	Installation of Client Software
(1) You can move to client directory.

    $ cd $NETSOLVE_ROOT/C++examples/gaExample/client

(2) Compiling ga2k/NetSolve
    You can move to ga2k-ns directory.  Then you can compile ga2k/NetSolve. 
    Ga2k is our GA implementation and it is modified for NetSolve.
   
    $ cd ga2k-ns
	$ aclocal
	$ autoheader (>> version 2.5)
	$ autoconf (>> version 2.5)
	$ automake
    $ ./configure --enable-ms-netsolve --with-netsolve=$NETSOLVE_ROOT
    $ make

(3) Setting Environment
    You can set NETSOVE_AGENT.
    export NETSOLVE_AGENT=your agent for NetSolve

[Step 4:]	Starting Agent and Server of NetSolve
(1) You can start NetSolve Agent.

    $ cd $NETSOLVE_ROOT/bin/i686_pc_linux_gnu
    $ ./agent

(2) You can start NetSolve Server.
    If you want to use the special configuration file when you start the server, you can use f option.

    $ ./server -f $NETSOLVE_ROOT/server_config-rastrigin

[Step 5:]	Start Optimization
    You can start GA optimization using ga2k.

    $ cd $NETSOLVE_ROOT/C++examples/gaExample/client/ga2k-ns
    $ ./ga2k-ms_netsolve O

    When you use option O, the output file fitness.out is created. 
    In this file, the generation and the best value of the generation are illustrated.
    The default function is the Rastrigin function.

    There are several options for ga2k.
	i: number of islands
	p: population size in each island
	D: problem size dimension
	g: generation number

    For example, 
    
    $ ./ga2k-ms_netsolve O i2 p20 D2 g30

    means there are 40 population(2*20) and 30 generations are used for two dimension Rastrigin function.

    If you want to use another test function, you can use F option.

    $ ./ga2k-ms_netsolve O i2 p20 D2 g30 Frosenbrock

    There are five types of test functions are prepared; those are rastrigin, schwefel, griewank,ridge ,and Rosenbrock.


