Index: trunk/optimizer/src/pgapack/pgapack/CHANGES
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/CHANGES	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/CHANGES	(revision 816)
@@ -0,0 +1,208 @@
+Changes in Version 1.0
+======================
+
+        1)  Added support for parallel execution of the global model (single 
+            population) using MPI (Message Passing Interface).
+
+        2)  Added support for a restart operator.  The best string is used
+            to reinitialize the population.
+
+	3)  Added support for new native data type Character.
+
+        4)  Added support to specify the multiplier of the worst evaluation 
+            value when remapping a minimization problem.
+
+        5)  Separated specification of mutation type from rate.
+
+        6)  Added new integer mutation operators.
+
+        7)  Added an option to maintain integer and real allele values within
+            the range specified on initialization after mutation.
+
+	8)  The configure script argument -optimize has been removed and
+            replaced with the -debug switch for compiling a debug version.
+            An optimized version of PGAPack is now built by default.
+
+	9)  The configure script argument -arch AIX has been replaced with
+            -arch rs6000.
+
+        10)  The configure script now accepts the -cflags and -flags switchs to
+            supply supply options to the C and FORTRAN compiler, respectively.
+
+	11)  Changed PGATRUE and PGAFALSE to PGA_TRUE and PGA_FALSE.
+
+	12) Renamed debug macros to begin with PGA_DEBUG instead of PGADEBUG.
+
+	13) Renamed report macros to begin with PGA_REPORT (instead of, for
+            example PGA_ONLINE).
+
+	14) Removed macro PGAERROR from pgapack.h.
+
+	15) Rewrote PGARandomInterval(ctx, L, U) so that it would not
+	    return L-1.  It now returns [L, U].
+
+	16) PGADone, PGAUpdateGenertaion and PGAEvaluate all take an MPI
+	    communicator as the last argument.  See PGARunGM in parallel.c
+	    for details on how to rewrite a user run routine.
+
+	17) Removed "Time" from the output.
+
+	18) Shortened the names of the source files as follows:
+
+		character.c                  char.c
+		crossover.c                  cross.c
+		duplicate.c                  duplcate.c
+		f2c_interface.c              f2c.c
+
+	19) Shortened the name of the examples files as follows:
+
+		maxbit_custom.c              maxbitc.c
+		maxbit_menu.c                maxbitm.c
+		maxint_custom.c              maxbitc.c
+		rastrigin.c                  rstrgnb.c
+		real_rastrigin.c             rstrgnr.c
+		udt_struct.c                 udtstr.c
+		udt_struct_array.c           udtastr.c
+
+	20) Replaced the function names on the left with the function	
+	    names on the right.  The Perl script ./util/upgrade_script.pl
+            may be of use in automating part of the renaming process on
+            exisiting files.
+
+	PGABinaryBuildIndividualDatatype()
+					-> PGABinaryBuildDatatype()
+	PGABinaryRandomize()		-> PGABinaryInitString()
+	PGABinaryWrite()		-> PGABinaryPrint()
+	PGABinaryWriteString()		-> PGABinaryPrintString()
+	PGABuildIndividualDatatype()	-> PGABuildDatatype()
+	PGACharacterBuildIndividualDatatype()
+					-> PGACharacterBuildDatatype()
+	PGACharacterRandomize()		-> PGACharacterInitString()
+	PGACharacterWriteString()	-> PGACharacterPrintString()
+	PGAFitnessLinNor()		-> PGAFitnessLinearNormal()
+	PGAFitnessLinRank()		-> PGAFitnessLinearRank()
+	PGAFitnessMinRecprl()		-> PGAFitnessMinReciprocal()
+	PGAGetEvalUpToDate()		-> PGAGetEvaluationUpToDateFlag()
+	PGAGetEvaluate()		-> PGAGetEvaluation()
+	PGAGetFitnessRankMax()		-> PGAGetMaxFitnessRank()
+	PGAGetBest()			-> PGAGetBestIndex()
+	PGAGetWorst()			-> PGAGetWorstIndex()
+	PGAGetInitIntegerMax()		-> PGAGetMaxIntegerInitValue()
+	PGAGetInitIntegerMin()		-> PGAGetMinIntegerInitValue()
+	PGAGetInitRealMax()		-> PGAGetMaxRealInitValue()
+	PGAGetInitRealMin()		-> PGAGetMinRealInitValue()
+	PGAGetIntegerType()		-> PGAGetIntegerInitType()
+	PGAGetIter()			-> PGAGetGAIterValue()
+	PGAGetMaxDouble()		-> PGAGetMaxMachineDoubleValue()
+	PGAGetMaxInt()			-> PGAGetMaxMachineIntValue()
+	PGAGetMaxIter()			-> PGAGetMaxGAIterValue()
+	PGAGetMinDouble()		-> PGAGetMinMachineDoubleValue()
+	PGAGetMinInt()			-> PGAGetMinMachineIntValue()
+	PGAGetMutateIntegerVal()	-> PGAGetMutationIntegerValue()
+	PGAGetMutateOnlyNoCross()	-> PGAGetMutationAndCrossoverFlag()
+                                        -> PGAGetMutationOrCrossoverFlag()
+	PGAGetMutateRealVal()		-> PGAGetMutationRealValue()	
+	PGAGetNoDuplicates()		-> PGAGetNoDuplicatesFlag()
+	PGAGetNprocs()			-> PGAGetNumProcs()
+	PGAGetNumReplace()		-> PGAGetNumReplaceValue()
+	PGAGetOptDir()			-> PGAGetOptDirFlag()
+	PGAGetPID()			-> PGAGetRank()
+	PGAGetPopReplace()		-> PGAGetPopReplaceType()
+	PGAGetPrintFreq()		-> PGAGetPrintFrequency()
+	PGAGetRandomInit()		-> PGAGetRandomInitFlag()
+	PGAGetRestart()			-> PGAGetRestartFlag()
+	PGAGetRestartFrequency()	-> PGAGetRestartFrequencyValue()
+	PGAGetSortPop()			-> PGAGetSortedPopIndex()
+	PGAGetStoppingRule()		-> PGAGetStoppingRuleType()
+	PGAGetStringLen()		-> PGAGetStringLength()
+	PGAGetUniformCrossProb()	-> PGAGetUniformCrossoverProb()
+	PGAIntegerBuildIndividualDatatype()
+					-> PGAIntegerBuildDatatype()	
+	PGAIntegerRandomize()		-> PGAIntegerInitString()
+	PGAIntegerWriteString()		-> PGAIntegerPrintString()
+	PGAParallelDone()		-> PGADoneMS()
+	PGAParallelEvaluateMS()		-> PGAEvaluateMS()
+	PGAPrintContext()		-> PGAPrintContextVariable()
+	PGAPrintVersion()		-> PGAPrintVersionNumber()
+	PGARealBuildIndividualDatatype()-> PGARealBuildDatatype()
+	PGARealRandomize()		-> PGARealInitString()
+	PGARealWriteString()		-> PGARealPrintString()
+	PGARunMutateAndCross()		-> PGARunMutationAndCrossover()
+	PGARunMutateOrCross()		-> PGARunMutationOrCrossover()
+	PGASelectNext()			-> PGASelectNextIndex()
+	PGASetCharacterInit()		-> PGASetCharacterInitType()	
+	PGASetEvaluate()		-> PGASetEvaluation()
+	PGASetEvalUpToDate()		-> PGASetEvaluationUpToDateFlag()
+	PGASetFitnessRankMax()		-> PGASetMaxFitnessRank()
+	PGASetIntegerInitLU()           -> PGASetIntegerInitRange()
+	PGASetMaxIter()			-> PGASetMaxGAIterValue()
+	PGASetMaxNoChange()		-> PGASetMaxNoChangeValue()
+	PGASetMaxSimilarity()		-> PGASetMaxSimilarityValue()
+	PGASetMutateOnlyNoCross()	-> PGASetMutationOrCrossoverFlag()
+                                        -> PGASetMutationAndCrossoverFlag()
+	PGASetMutationIntegerVal()	-> PGASetMutationIntegerValue()
+	PGASetMutationRealVal()		-> PGASetMutationRealValue()
+	PGASetNoDuplicates()		-> PGASetNoDuplicatesFlag()
+	PGASetNumReplace()		-> PGASetNumReplaceValue()
+	PGASetPopReplacement()		-> PGASetPopReplacementType()
+	PGASetPrintFreq()		-> PGASetPrintFrequencyValue()
+	PGASetRandomInit()		-> PGASetRandomInitFlag()
+	PGASetRealInitLU()              -> PGASetRealInitRange()
+	PGASetRestart()			-> PGASetRestartFlag()
+	PGASetRestartFrequency()	-> PGASetRestartFrequencyValue()
+	PGASetStoppingRule()		-> PGASetStoppingRuleType()
+	PGASetSupportingDebugFlags()	-> PGASetDebugFlag()
+	PGASetUniformCrossProb()	-> PGASetUniformCrossoverProb()
+	PGAWriteString()		-> PGAPrintString()	
+
+
+Changes in Version 0.2b
+=======================
+
+        1) In PGABinaryTwoPointCrossover, add<ed a test before left-shifting.
+           The right operand of a shift must be strictly less than the number
+           of bits in the left operand, otherwise the result is undefined.
+
+        2) In udt_char.c, changed the data type to signed char since whether
+           char is signed is implementation dependent.
+
+        3) In real_rastrigin, made upper and lower to be dynamic arrays rather
+           than static arrays to allow variable string length.
+
+
+Changes in Version 0.2a
+=======================
+
+        1) Created pgapack-0.2.a.tar.Z to replace pgapack-0.2.tar.Z
+           when we found the IRIX's do not have a ranlib (unless it
+           is in /usr/local.
+
+        2) Deleted a space from ./examples/c/Makefile.in
+
+        3) Added the -w flag to FFLAGS for the freebsd version to
+           suppress warnings.
+
+
+Changes in Version 0.2
+======================
+
+	1) In PGASetUp, we changed the default value for the number of
+           individuals to replace each generation from 10 to 10% of the
+           population size.
+
+        2) Took all the parallel stuff out.
+
+        3) Defined PGAPrintReport and put various PGAPrint functions in 
+           the new file system.c
+
+        5) Changed EvalUpToDate to all lower case.
+
+        6) Changed PGARunMutateOnlyNoCross to take PGA_OLDPOP and PGA_NEWPOP
+           as arguments
+
+        7) Changed the low-level ops functions to take p,pop as arguments
+           instead of a void pointer
+
+        8) Changed PGAMutate to a 3-argument function.  It just mutates,
+           but does not copy the string to its final location.  Use
+            PGACopyIndividual for that.
Index: trunk/optimizer/src/pgapack/pgapack/COPYRIGHT
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/COPYRIGHT	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/COPYRIGHT	(revision 816)
@@ -0,0 +1,60 @@
+
+********************************************************************* 
+(C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+*********************************************************************
+
+This software was authored by
+
+D. Levine
+Mathematics and Computer Science Division Argonne National Laboratory
+Argonne IL 60439
+levine@mcs.anl.gov
+(708) 252-6735
+(708) 252-5986 (FAX)
+
+with programming assistance of participants in Argonne National 
+Laboratory's SERS program.
+
+This program contains material protectable under copyright laws of the 
+United States.  Permission is hereby granted to use it, reproduce it, 
+to translate it into another language, and to redistribute it to 
+others at no charge except a fee for transferring a copy, provided 
+that you conspicuously and appropriately publish on each copy the 
+University of Chicago's copyright notice, and the disclaimer of 
+warranty and Government license included below.  Further, permission 
+is hereby granted, subject to the same provisions, to modify a copy or 
+copies or any portion of it, and to distribute to others at no charge 
+materials containing or derived from the material.
+
+The developers of the software ask that you acknowledge its use in any 
+document referencing work based on the  program, such as published 
+research.  Also, they ask that you supply to Argonne National 
+Laboratory a copy of any published research referencing work based on 
+the software.
+
+Any entity desiring permission for further use must contact:
+
+J. Gleeson
+Industrial Technology Development Center Argonne National Laboratory
+Argonne IL 60439
+gleesonj@smtplink.eid.anl.gov
+(708) 252-6055
+
+******************************************************************** 
+DISCLAIMER
+
+THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+INFRINGE PRIVATELY OWNED RIGHTS.
+
+********************************************************************** 
+GOVERNMENT LICENSE
+
+The Government is granted for itself and others acting on its behalf a 
+paid-up, non-exclusive, irrevocable worldwide license in this computer 
+software to reproduce, prepare derivative works, and perform publicly 
+and display publicly.
Index: trunk/optimizer/src/pgapack/pgapack/Makefile
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/Makefile	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/Makefile	(revision 816)
@@ -0,0 +1,47 @@
+# Generated automatically from Makefile.in by configure.
+RM      = /bin/rm -f
+SHELL   = /bin/sh
+
+default:
+	@echo "Choices are:"
+	@echo "make install       (install the PGAPack distribution)"
+	@echo "make clean         (return to the state just after configure was run)"
+	@echo "make spotless      (keep ONLY *.a and include files)"
+
+install: 
+	@echo "Installing PGAPack . . ."
+	@cd source ; make
+	@echo "Installing Examples . . ."
+	@cd examples ; make
+	@echo "Installing Test program . . ."
+	@cd test ; make
+	@echo "Install successful."
+	@echo "	Please \"cd test\" and run the \"instverf\" program"
+	@echo "        to verify the correctness of your installation."
+
+clean:
+	@echo "Removing superfluous files . . ."
+	@$(RM) lib/*/*.o
+	@cd examples ; make clean
+	@cd test ; make clean
+
+spotless:
+	@echo "WARNING:  Removing docs, man, examples, and source directories"
+	@echo "          in 5 seconds!!"
+	@sleep 1
+	@echo " .. 4 .."
+	@sleep 1
+	@echo " .. 3 .."
+	@sleep 1
+	@echo " .. 2 .."
+	@sleep 1
+	@echo " .. 1 .."
+	@sleep 1
+	@echo " .. 0 .."
+	@echo " .. Removing everything except libraries and includes!!"
+	@sleep 1
+	@$(RM) -rf docs examples man source test util lib/*/*.o
+
+distribution:
+	@/home/pgapack/util/make_distribution	
+
Index: trunk/optimizer/src/pgapack/pgapack/Makefile.in
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/Makefile.in	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/Makefile.in	(revision 816)
@@ -0,0 +1,46 @@
+RM      = @RM@
+SHELL   = @SHELL@
+
+default:
+	@echo "Choices are:"
+	@echo "make install       (install the PGAPack distribution)"
+	@echo "make clean         (return to the state just after configure was run)"
+	@echo "make spotless      (keep ONLY *.a and include files)"
+
+install: 
+	@echo "Installing PGAPack . . ."
+	@cd source ; make
+	@echo "Installing Examples . . ."
+	@cd examples ; make
+	@echo "Installing Test program . . ."
+	@cd test ; make
+	@echo "Install successful."
+	@echo "	Please \"cd test\" and run the \"instverf\" program"
+	@echo "        to verify the correctness of your installation."
+
+clean:
+	@echo "Removing superfluous files . . ."
+	@$(RM) lib/*/*.o
+	@cd examples ; make clean
+	@cd test ; make clean
+
+spotless:
+	@echo "WARNING:  Removing docs, man, examples, and source directories"
+	@echo "          in 5 seconds!!"
+	@sleep 1
+	@echo " .. 4 .."
+	@sleep 1
+	@echo " .. 3 .."
+	@sleep 1
+	@echo " .. 2 .."
+	@sleep 1
+	@echo " .. 1 .."
+	@sleep 1
+	@echo " .. 0 .."
+	@echo " .. Removing everything except libraries and includes!!"
+	@sleep 1
+	@$(RM) -rf docs examples man source test util lib/*/*.o
+
+distribution:
+	@/home/pgapack/util/make_distribution	
+
Index: trunk/optimizer/src/pgapack/pgapack/README
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/README	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/README	(revision 816)
@@ -0,0 +1,231 @@
+This is the top-level README for PGAPack V1.0
+
+Copyright
+=========
+See the file COPYRIGHT for Copyright and disclaimer information.
+
+Introduction
+============
+PGAPack is a general-purpose, data-structure-neutral, parallel genetic
+algorithm library being developed at Argonne National Laboratory.  
+Key features are:
+
+* Callable from Fortran or C.
+* Runs on uniprocessors, parallel computers, and workstation networks.
+* Binary-, integer-, real-, and character-valued native data types.
+* Object-oriented data structure neutral design. 
+* Parameterized population replacement.
+* Multiple choices for selection, crossover, and mutation operators.
+* Easy integration of hill-climbing heuristics. 
+* Easy-to-use interface for novice and application users.
+* Fully extensible to support custom operators and new data types.
+* Extensive debugging facilities.
+* A large set of example problems.
+
+
+Availability
+============
+PGAPack is freely available.  The complete distribution is available
+by anonymous ftp from from ftp.mcs.anl.gov in the file 
+pub/pgapack/pgapack.tar.Z.  The distribution contains all source code,
+installation instructions, users guide, and a collection of examples in C and
+Fortran. Additional information is available on the World Wide Web at
+http://www.mcs.anl.gov/pgapack.html.
+
+
+Computational Environment
+=========================
+PGAPack is written in ANSI C and uses the MPI message passing interface
+and should run on most uniprocessors, parallel computers, and workstation
+networks.  PGAPack has been tested on the workstations and parallel computers 
+specified by the ARCH_TYPE variable below.
+
+
+Documentation
+=============
+* The PGAPack users guide is in ./docs/user_guide.ps.
+* Man pages for PGAPack functions are in the ./man directory.
+* Installation instructions are in this README file and the users guide.
+* Example problems are in the ./examples directory.
+
+
+Installation Requirements
+=========================
+To compile you must have an ANSI C compiler that includes a full
+implementation of the Standard C library and related header files.  To build a
+*parallel* version of PGAPack you must provide an implementation of MPI
+(Message Passing Interface) for the parallel computer or workstation network
+you are running on.
+
+Most of our testing and development was done using MPICH, a freely available
+implementation of MPI.  MPICH runs on many parallel computers and
+workstation networks and is publicly available and free.  The complete
+distribution is available by anonymous ftp from ftp.mcs.anl.gov.  Take the
+file mpich.tar.Z from the directory pub/mpi.  Additional information about
+MPICH is avaliable on the World Wide Web at http://www.mcs.anl.gov/mpi.
+
+Installation Instructions
+=========================
+When installing PGAPack you make two choices: whether to build a sequential
+(the default) or parallel version, and whether to build a debug or optimized
+(the default) version.  In broad outline, the
+installation steps are as follows.
+
+1.  Make a directory to install PGAPack in (mkdir /usr/local/pga).
+2.  Change directories to the directory created in the last step
+    (cd /usr/local/pga).
+3.  Obtain the compressed tar file pgapack.tar.Z by anonymous ftp in
+    ftp.mcs.anl.gov from the directory pub/pgapack.
+4.  Uncompress the tar file (uncompress pgapack.tar.Z).
+5.  Untar the uncompressed tar file (tar xvf ./pgapack.tar).
+6.  Run configure to configure the makefiles (configure -arch ARCH_TYPE)
+    where ARCH_TYPE is one of
+
+    sun4           for Sun SparcStations workstations,
+    next           for NeXT workstations,
+    rs600          for IBM RS6000 workstations,
+    irix           for Silicon Graphics workstations,
+    hpux           for Hewlett Packard workstations,
+    alpha          for DEC Alpha workstations,
+    linux          for machines running Linux,
+    freebsd        for machines running FreeBSD,
+    generic        for generic 32-bit machines, 
+    powerchallenge for the Silicon Graphics Power Challenge Array,
+    challenge      for the Silicon Graphics Challenge,
+    t3d            for the Cray T3D,
+    sp2            for the IBM SP2,
+    paragon        for the Intel Paragon, or
+    exemplar       for the Convex  Exemplar.
+
+    The full configure options are configure -arch ARCH_TYPE [-cc CC] 
+    [-cflags CFLAGS] [-f77 FC] [-fflags FFLAGS] [-debug]
+    [-mpiinc MPI_INCLUDE_DIRECTORY] [-mpilib MPI_LIBRARY]  [-help]
+
+    where all parameters except -arch are optional and do the following:
+
+    [-cc]:       The name of the ANSI C compiler, cc by default.
+    [-cflags]:   Options passed to the C compiler.
+    [-f77]:      The name of the Fortran 77 compiler, f77 by default.
+                 (The Fortran compiler is used only to compile the Fortran
+                 examples in the [./examples/] directory.)
+    [-fflags]:   Options passed to the Fortran compiler.
+    [-debug]:    If specified, enables the debugging features
+                 and compiles the source code with the -g flag.
+    [-mpiinc]:   The *directory* where MPI include files are located.
+    [-mpilib]:   The *full path* to the MPI library.  
+
+    If the [-mpilib] and [-mpiinc] options are specified, a parallel version 
+    of PGAPack will be built.  If these flags are not specified a sequential
+    version of PGAPack will be built.
+
+7.  Execute the makefile (make install).
+8.  Add PGAPack's man pages to your man page path.
+    (setenv MANPATH "$MANPATH"":/home/pgapack/man")
+9.  Execute a simple test problem
+    
+    Sequential version
+    ------------------
+    C:        /usr/local/pga/examples/c/maxbit
+    Fortran:  /usr/local/pga/examples/fortran/maxbit
+
+    Parallel version
+    ------------------
+    C:        mpirun -np 4 /usr/local/pga/examples/c/maxbit
+    Fortran:  mpirun -np 4 /usr/local/pga/examples/fortran/maxbit
+
+    If a parallel version of PGAPack was used, the actual commands to execute 
+    a parallel program depend on the particular MPI implementation and
+    parallel computer.  If the MPICH implementation was used the "mpirun"
+    command can be used to execute a parallel program on most systems.
+
+
+Example Installation
+====================
+Assuming you have the compressed tar file, pgapack.tar.Z, containing the
+distribution in /home/username.  To build a sequential version of PGAPack
+containing debug features for a Sun SparcStation in /usr/local/pga and run a
+test example, type:
+
+    uncompress /home/username/pgapack.tar.Z
+    mkdir /usr/local/pga
+    cd /usr/local/pga
+    tar xvf /home/username/pgapack.tar
+    configure -arch sun4 -debug
+    make install
+    /usr/local/pga/examples/c/maxbit
+
+To build a parallel version of PGAPack for an IBM SP parallel computer using
+an MPI implementation with include files in /usr/local/mpi/include and library
+in /usr/local/mpi/lib, and run a test example, type:
+
+   uncompress /home/username/pgapack.tar.Z
+   mkdir /usr/local/pga
+   cd /usr/local/pga
+   tar xvf /home/username/pgapack.tar
+   configure -arch rs6000 -mpiinc /usr/local/mpi/include \
+             -mpilib /usr/local/mpi/lib/libmpi.a
+   make install
+   mpirun -np 4 /usr/local/pga/examples/c/maxbit
+
+
+PGAPack on PCs 
+===================
+PGAPack has not been ported to MS-DOS, Windows 3.1, Windows 95, or Apple OS.
+As mentioned earlier, however, PGAPack is written in ANSI standard C and
+should compile in these environments.  Be aware, however, that PGAPack's
+random number generator, PGARandom01, assumes certain machine characteristics
+for ints and floats that may not correspond with what your PC and/or compiler
+support, resulting in erroneous values.
+
+
+Structure of the Distribution Directory
+=======================================
+CHANGES:      Changes new to this release of PGAPack.
+COPYRIGHT:    Copyright and disclaimer information.
+README:       This file.
+configure.in: The ``source code'' for the configure script.
+configure:    Unix shell script to configure Makefile.in for a specific
+              architecture.
+Makefile.in:  Prototype that is configured into ``Makefile'' by configure.
+docs:         Directory containing documentation.
+examples:     A directory containing C and Fortran examples.
+include:      The PGAPack include directory.
+lib:          The directory the library will be installed in.
+man:          The directory containing the PGAPack man pages.
+source:       The source code for the PGAPack system.
+test:         A directory containing programs to verify the installation.
+
+
+Email Addresses
+===============
+To join the PGAPack mailing list to receive announcements of new versions,
+enhancements, and bug fixes, send electronic mail to pgapack@mcs.anl.gov.  Bug
+reports should be sent to pgapack-bugs@mcs.anl.gov.  The World Wide Web page
+for PGAPack is http://www.mcs.anl.gov/pgapack.html and contains up-to-date
+news and a list of outstanding bug reports.
+
+
+When reporting a bug please include as much information and documentation as
+possible.  Helpful information would include PGAPack version number, MPI
+implementation and version used (if any), configuration options, type of
+computer system, problem description and error message output.  It is helpful
+if you put a PGAPrintContextVariable call before and after the PGASetUp call.
+Additionally, if possible, build a debug version of PGAPack and send
+``high-level'' output from running your program with the trace facility
+enabled.
+
+
+Contributions
+=============
+PGAPack was written to be extensible in two ways: adding new operators that
+work with existing data types, and defining new data types.  Enhancements of
+either type that you wish to share are welcome for possible inclusion in
+future versions of PGAPack.
+
+
+Acknowledgment
+==============
+Users of PGAPack are asked to acknowledge its use in any document referencing
+work based on the program, such as published research.  Also, please supply
+to us a copy of any published research referencing work based on the software.
+
Index: trunk/optimizer/src/pgapack/pgapack/config.status
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/config.status	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/config.status	(revision 816)
@@ -0,0 +1,111 @@
+#!/bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host mo.local:
+#
+# ./configure -arch linux -mpiinc /Volumes/Data_mo/GENES/Software/mpich-1.2.7p1/include/ -mpilib /Volumes/Data_mo/GENES/Software/mpich-1.2.7p1/lib/libmpich.a
+
+for arg
+do
+  case "$arg" in
+    -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    echo running ${CONFIG_SHELL-/bin/sh} ./configure -arch linux -mpiinc /Volumes/Data_mo/GENES/Software/mpich-1.2.7p1/include/ -mpilib /Volumes/Data_mo/GENES/Software/mpich-1.2.7p1/lib/libmpich.a
+    exec ${CONFIG_SHELL-/bin/sh} ./configure -arch linux -mpiinc /Volumes/Data_mo/GENES/Software/mpich-1.2.7p1/include/ -mpilib /Volumes/Data_mo/GENES/Software/mpich-1.2.7p1/lib/libmpich.a ;;
+    *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
+  esac
+done
+
+trap 'rm -f Makefile source/Makefile test/Makefile test/Makefile 	  examples/Makefile examples/c/Makefile examples/fortran/Makefile 	  examples/mgh/Makefile; exit 1' 1 3 15
+RANLIB='ranlib'
+CC='cc'
+FC='f77'
+CFLAGS='-O '
+FFLAGS='-w'
+CPPFLAGS='-I/Volumes/Data_mo/GENES/Software/pgapack/include -I/Volumes/Data_mo/GENES/Software/mpich-1.2.7p1/include/ -Dlinux -DWL=32 -DFORTRANUNDERSCORE -DOPTIMIZE '
+FORTWRAP='$(PGA_LIB_DIR)/f2c.o: f2c.c $(HEADERS)\
+	$(COMPILE.c) f2c.c'
+HEADERS='/Volumes/Data_mo/GENES/Software/pgapack/include/pgapack.h'
+LDFLAGS='-s  -L/Volumes/Data_mo/GENES/Software/pgapack/lib/linux  -lpgaO  /Volumes/Data_mo/GENES/Software/mpich-1.2.7p1/lib/libmpich.a -lm'
+PARALLEL='1'
+PGA_LIB_DIR='../lib/linux'
+PGA_LIB='pgaO'
+OBJS='$(PGA_LIB_DIR)/binary.o        \\\
+      $(PGA_LIB_DIR)/char.o          \\\
+      $(PGA_LIB_DIR)/cmdline.o       \\\
+      $(PGA_LIB_DIR)/create.o        \\\
+      $(PGA_LIB_DIR)/cross.o         \\\
+      $(PGA_LIB_DIR)/debug.o         \\\
+      $(PGA_LIB_DIR)/duplcate.o      \\\
+      $(PGA_LIB_DIR)/evaluate.o      \\\
+      $(PGA_LIB_DIR)/fitness.o       \\\
+      $(PGA_LIB_DIR)/hamming.o       \\\
+      $(PGA_LIB_DIR)/heap.o          \\\
+      $(PGA_LIB_DIR)/integer.o       \\\
+      $(PGA_LIB_DIR)/mutation.o      \\\
+      $(PGA_LIB_DIR)/parallel.o      \\\
+      $(PGA_LIB_DIR)/pga.o           \\\
+      $(PGA_LIB_DIR)/pop.o           \\\
+      $(PGA_LIB_DIR)/random.o        \\\
+      $(PGA_LIB_DIR)/real.o          \\\
+      $(PGA_LIB_DIR)/report.o        \\\
+      $(PGA_LIB_DIR)/restart.o       \\\
+      $(PGA_LIB_DIR)/select.o        \\\
+      $(PGA_LIB_DIR)/stop.o          \\\
+      $(PGA_LIB_DIR)/system.o        \\\
+      $(PGA_LIB_DIR)/user.o          \\\
+      $(PGA_LIB_DIR)/utility.o $(PGA_LIB_DIR)/f2c.o'
+MPICOMP=''
+RM='/bin/rm -f'
+SHELL='/bin/sh'
+LIBS='-lpgaO  /Volumes/Data_mo/GENES/Software/mpich-1.2.7p1/lib/libmpich.a -lm'
+srcdir='.'
+DEFS=''
+prefix=''
+exec_prefix=''
+prsub=''
+extrasub=''
+
+top_srcdir=$srcdir
+
+CONFIG_FILES=${CONFIG_FILES-"Makefile source/Makefile test/Makefile test/Makefile \
+	  examples/Makefile examples/c/Makefile examples/fortran/Makefile \
+	  examples/mgh/Makefile"}
+for file in .. ${CONFIG_FILES}; do if test "x$file" != x..; then
+  srcdir=$top_srcdir
+  # Remove last slash and all that follows it.  Not all systems have dirname.
+  dir=`echo $file|sed 's%/[^/][^/]*$%%'`
+  if test "$dir" != "$file"; then
+    test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
+    test ! -d $dir && mkdir $dir
+  fi
+  echo creating $file
+  rm -f $file
+  echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
+  sed -e "
+$prsub
+$extrasub
+s%@RANLIB@%$RANLIB%g
+s%@CC@%$CC%g
+s%@FC@%$FC%g
+s%@CFLAGS@%$CFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@FORTWRAP@%$FORTWRAP%g
+s%@HEADERS@%$HEADERS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@PARALLEL@%$PARALLEL%g
+s%@PGA_LIB_DIR@%$PGA_LIB_DIR%g
+s%@PGA_LIB@%$PGA_LIB%g
+s%@OBJS@%$OBJS%g
+s%@MPICOMP@%$MPICOMP%g
+s%@RM@%$RM%g
+s%@SHELL@%$SHELL%g
+s%@LIBS@%$LIBS%g
+s%@srcdir@%$srcdir%g
+s%@DEFS@%$DEFS%
+" $top_srcdir/${file}.in >> $file
+fi; done
+
+
+exit 0
Index: trunk/optimizer/src/pgapack/pgapack/configure
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/configure	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/configure	(revision 816)
@@ -0,0 +1,830 @@
+#!/bin/sh
+# This file is configure.
+#
+# Make all changes to configure.in, if at all possible.  After changing,
+# run "autoconf".  If autoconf is not installed, then make changes to
+# configure.
+#
+# Documentation on the autoconf program exists in GNU info file format.
+# To read this, run emacs and type C-h i.  Then press the down arrow
+# until you come to the line beginning "* Autoconf:".  Pressing enter on
+# this line will bring up the documentaition.
+#
+# Type "configure" (i.e., no arguments) or read below for usage information.
+#
+print_error() {
+    echo "$*" 2>&1 ;
+}
+
+print_usage()
+{
+cat <<.
+Usage: configure -arch ARCH_TYPE -cc CC -f77 FC -debug -help
+                 -cflags CFLAGS -fflags FFLAGS
+                 -mpiinc MPI_INC_DIR -mpilib MPI_LIB
+where
+   ARCH_TYPE    = the type of machine that PGAPack is to be configured for
+   CC           = the name of the ANSI C compiler
+   FC           = the name of the FORTRAN 77 compiler
+   CFLAGS       = C compiler flags
+   FFLAGS       = FORTRAN compiler flags
+   MPI_INC_DIR  = the MPI include directory
+   MPI_LIB      = the full path to the MPI library
+
+
+Known architectures are:
+
+Workstations
+	sun4		(SUN OS 4.x)
+	hpux		(HP UX)
+	irix    	(Silicon Graphics IRIX)
+	alpha		(DEC Alpha)
+	rs6000		(AIX for IBM RS6000)	
+	next		(NeXT 680x0)
+	freebsd		(PC clones running FreeBSD)
+	linux		(PC clones running LINUX)
+	generic		(Generic 32-bit UNIX-like machine)
+
+MPP's
+	powerchallenge	(Silicon Graphics PowerChallenge)
+	challenge	(Silicon Graphics Challenge)
+	t3d		(Cray-T3D)
+	sp2		(IBM SP2)
+	paragon		(Intel Paragon)
+	exemplar	(Convex Exemplar)
+
+
+In the absence of the -f77 or -cc options, configure assumes the name of 
+a FORTRAN 77 or ANSI C compiler based on the architecture type.
+
+If the -debug flag is set, then PGAPack will be built for debugging.  This
+enables the extensive debugging options and datatype checks.
+
+If both -mpiinc and -mpilib are missing, PGAPack is built using a non-parallel
+"stub" library for all MPI calls.
+
+The -help flag causes this usage guide to be printed.
+
+Example 1:
+----------
+Configure and build for parallel operation on the sun4 architectue.  MPI is
+in /usr/local/mpi; the MPI library is /usr/local/mpi/lib/sun4/ch_p4/libmpi.a.
+
+  configure -arch sun4 -mpilib /usr/local/mpi/lib/sun4/ch_p4/libmpi.a \
+            -mpiinc /usr/local/mpi/include
+  make install
+
+Example 2:
+----------
+Configure and build a debug sequential library on the rs6000 architecture.
+
+  configure -arch rs6000 -debug
+  make install
+.
+}
+
+###############################################################################
+# This section initializes the variables that will be used throughout
+# the script.
+###############################################################################
+#!/bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf.
+# Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp]
+#        [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE[=VALUE]]
+# Ignores all args except --srcdir, --prefix, --exec-prefix, and
+# --with-PACKAGE[=VALUE] unless this script has special code to handle it.
+
+for arg
+do
+  # Handle --exec-prefix with a space before the argument.
+  if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
+  # Handle --host with a space before the argument.
+  elif test x$next_host = xyes; then next_host=
+  # Handle --prefix with a space before the argument.
+  elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
+  # Handle --srcdir with a space before the argument.
+  elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
+  else
+    case $arg in
+     # For backward compatibility, recognize -exec-prefix and --exec_prefix.
+     -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*)
+	exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
+     -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
+	next_exec_prefix=yes ;;
+
+     -gas | --gas | --ga | --g) ;;
+
+     -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
+     -host | --host | --hos | --ho | --h)
+	next_host=yes ;;
+
+     -nfp | --nfp | --nf) ;;
+
+     -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+	prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
+     -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+	next_prefix=yes ;;
+
+     -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
+	srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
+     -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
+	next_srcdir=yes ;;
+
+     -with-* | --with-*)
+       package=`echo $arg|sed -e 's/-*with-//' -e 's/=.*//'`
+       # Reject names that aren't valid shell variable names.
+       if test -n "`echo $package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+         echo "configure: $package: invalid package name" >&2; exit 1
+       fi
+       package=`echo $package| sed 's/-/_/g'`
+       case "$arg" in
+         *=*) val="`echo $arg|sed 's/[^=]*=//'`" ;;
+         *) val=1 ;;
+       esac
+       eval "with_$package='$val'" ;;
+
+     -v | -verbose | --verbose | --verbos | --verbo | --verb | --ver | --ve | --v)
+       verbose=yes ;;
+
+     *) ;;
+    esac
+  fi
+done
+
+trap 'rm -fr conftest* confdefs* core; exit 1' 1 3 15
+trap 'rm -f confdefs*' 0
+
+# NLS nuisances.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+if test "${LC_ALL+set}" = 'set' ; then LC_ALL=C; export LC_ALL; fi
+if test "${LANG+set}"   = 'set' ; then LANG=C;   export LANG;   fi
+
+rm -f conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+compile='${CC-cc} $CFLAGS conftest.c -o conftest $LIBS >/dev/null 2>&1'
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+unique_file=source/pga.c
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  srcdirdefaulted=yes
+  # Try the directory containing this script, then `..'.
+  prog=$0
+  confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
+  test "X$confdir" = "X$prog" && confdir=.
+  srcdir=$confdir
+  if test ! -r $srcdir/$unique_file; then
+    srcdir=..
+  fi
+fi
+if test ! -r $srcdir/$unique_file; then
+  if test x$srcdirdefaulted = xyes; then
+    echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
+  else
+    echo "configure: Can not find sources in \`${srcdir}'." 1>&2
+  fi
+  exit 1
+fi
+# Preserve a srcdir of `.' to avoid automounter screwups with pwd.
+# But we can't avoid them for `..', to make subdirectories work.
+case $srcdir in
+  .|/*|~*) ;;
+  *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
+esac
+
+
+# Save the original args to write them into config.status later.
+configure_args="$*"
+
+ARCH=""                         # architecture type
+PARALLEL=0                      # parallel libray, or use stub routines?
+OPTIMIZE=1                      # optimized?
+CPPFLAGS=""                     # flags to send to the C preprocessor
+LDFLAGS=""                      # link flags
+CFLAGS=""                       # flags to send to the C compiler
+FFLAGS=""                       # flags to send to the FORTRAN compiler
+PGA_DIR="`pwd`"                 # the root of the pgapack tree
+PGA_DIR=`echo $PGA_DIR | sed "s=tmp_mnt/=="`    # get rid of 'tmp_mnt/'
+HEADERS="$PGA_DIR/include/pgapack.h" # headers upon which pgapack depends
+INCLUDES="-I$PGA_DIR/include"   # directories where to search for include files
+LIB_DIRS=""                     # directories where to search for libraries
+LIBS=""                         # libraries with which to link
+MPI_INC_DIR=""
+MPI_LIB=""
+SHELL="/usr/bin/sh"
+RM="/bin/rm -f"                 # command to force removal of files
+
+OBJS='$(PGA_LIB_DIR)/binary.o        \\\
+      $(PGA_LIB_DIR)/char.o          \\\
+      $(PGA_LIB_DIR)/cmdline.o       \\\
+      $(PGA_LIB_DIR)/create.o        \\\
+      $(PGA_LIB_DIR)/cross.o         \\\
+      $(PGA_LIB_DIR)/debug.o         \\\
+      $(PGA_LIB_DIR)/duplcate.o      \\\
+      $(PGA_LIB_DIR)/evaluate.o      \\\
+      $(PGA_LIB_DIR)/fitness.o       \\\
+      $(PGA_LIB_DIR)/hamming.o       \\\
+      $(PGA_LIB_DIR)/heap.o          \\\
+      $(PGA_LIB_DIR)/integer.o       \\\
+      $(PGA_LIB_DIR)/mutation.o      \\\
+      $(PGA_LIB_DIR)/parallel.o      \\\
+      $(PGA_LIB_DIR)/pga.o           \\\
+      $(PGA_LIB_DIR)/pop.o           \\\
+      $(PGA_LIB_DIR)/random.o        \\\
+      $(PGA_LIB_DIR)/real.o          \\\
+      $(PGA_LIB_DIR)/report.o        \\\
+      $(PGA_LIB_DIR)/restart.o       \\\
+      $(PGA_LIB_DIR)/select.o        \\\
+      $(PGA_LIB_DIR)/stop.o          \\\
+      $(PGA_LIB_DIR)/system.o        \\\
+      $(PGA_LIB_DIR)/user.o          \\\
+      $(PGA_LIB_DIR)/utility.o'      # these are pgapack's object files
+
+###############################################################################
+# This section parse the command line options. There a two types of options:
+# those that take arguments and those that don't.  Parsing the case where an
+# option takes an argument is a little tricky.  This is how it works.  Suppose
+# that the program comes upon "-cc".  Then we know that the next argument
+# will be the name of the C compiler.  Hence, we set the flag next_cc to be
+# equal to "yes".  The next time through the loop, it will be the case that
+# x$next_cc equal "xyes" because $next_cc expands to "yes".  Thus, we know that
+# this argument is the name of the compiler and we assign it to USR_CC.  Then
+# we set next_cc back to a null string.  This way on the next time through
+# the loop x$next_cc will equal just "x".  Since the shell initializes
+# variables to null strings, we do not have to initialize the "next_" family
+# of variables by hand.
+###############################################################################
+for arg
+do
+    if test x$next_arch = xyes
+        then
+            ARCH=$arg
+            next_arch=
+        elif test x$next_mpiinc = xyes
+            then
+                MPI_INC_DIR=$arg
+                next_mpiinc=
+        elif test x$next_mpilib = xyes
+            then
+                MPI_LIB=$arg
+                next_mpilib=
+        elif test x$next_f77 = xyes
+            then
+                USR_FC=$arg
+                next_f77=
+        elif test x$next_cc = xyes
+            then
+                USR_CC=$arg
+                next_cc=
+        elif test x$next_cflags = xyes
+            then
+                CFLAGS="$arg $CFLAGS"
+                next_cflags=
+        elif test x$next_fflags = xyes
+            then
+                FFLAGS="$arg $FFLAGS"
+                next_fflags=
+        else
+            case $arg in
+                -arch)
+                    next_arch=yes
+                    ;;
+                -f77)
+                    next_f77=yes
+                    ;;
+                -cc)
+                    next_cc=yes
+                    ;;
+                -mpiinc)
+                    next_mpiinc=yes
+                    PARALLEL=1
+                    ;;
+                -mpilib)
+                    next_mpilib=yes
+                    PARALLEL=1
+                    ;;
+                -debug)
+                    OPTIMIZE=0
+                    ;;
+                -cflags)
+                    next_cflags=yes
+                    ;;
+                -fflags)
+                    next_fflags=yes
+                    ;;
+                -help)
+                    print_usage >& 2
+                    exit 1
+                    ;;
+                *) 
+                    ;;
+            esac
+    fi
+done
+
+if test "$MPI_LIB" -a "$MPI_INC_DIR" ; then
+    if test ! -d "$MPI_INC_DIR" ; then
+        print_error "MPI_INC_DIR == $MPI_INC_DIR is not a valid directory!"
+        exit 1
+    fi
+    if test ! -f "$MPI_INC_DIR/mpi.h" ; then
+        print_error "Couldn't find $MPI_INC_DIR/mpi.h!"
+        exit 1
+    fi
+
+    if test ! -f "$MPI_LIB" ; then
+        print_error "MPI_LIB == $MPI_LIB is not a file!"
+        exit 1
+    fi
+
+    PARALLEL=1
+else
+    PARALLEL=0
+    CPPFLAGS="-DFAKE_MPI $CPPFLAGS"
+fi
+
+if test $OPTIMIZE -eq 1 ; then
+	CPPFLAGS="-DOPTIMIZE $CPPFLAGS"
+	CFLAGS="-O $CFLAGS"
+	FFLAGS="-O $FFLAGS"
+	PGA_LIB="pgaO"
+else
+	CFLAGS="-g $CFLAGS"
+	FFLAGS="-g $FFLAGS"
+	PGA_LIB="pgag"
+fi
+
+
+###############################################################################
+# This section sets the default values of certain variables based upon the
+# architecture type specified.  If no architecture was specified, the script
+# issues an error and aborts.
+###############################################################################
+if test -z "$ARCH"
+    then
+        print_error "You must specify the architecture with -arch <value>"
+        print_error "Valid architectures are the following:"	
+	print_error " Workstations      MPP's"
+	print_error "    sun4        powerchallenge"
+	print_error "    next        challenge"
+	print_error "    rs6000      t3d"
+	print_error "    freebsd     sp2"
+	print_error "    irix        paragon"
+	print_error "    linux       exemplar"
+	print_error "    hpux"
+	print_error "    alpha"
+	print_error "    generic"
+	print_error ""
+	print_error "For more information type configure -help."
+        exit 1
+fi
+
+case $ARCH in
+    sun4)
+        CC=cc
+        FC=f77
+        CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS"
+        ;;
+    next)
+        CC=cc
+        FC=
+        CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS"
+        ;;
+    rs6000)
+        CC=cc
+        FC=f77
+        CPPFLAGS="-DWL=32 $CPPFLAGS"
+        ;;
+    freebsd)
+        CC=cc
+        FC=f77
+	FFLAGS="-w"
+        CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS"
+        ;;
+    irix)
+        CC=cc
+        FC=f77
+        CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS"
+        ;;
+    alpha)
+        CC=cc
+        FC=f77
+        CPPFLAGS="-DWL=64 -DFORTRANUNDERSCORE $CPPFLAGS"
+        ;;
+    hpux)
+        CC=cc
+        FC=f77
+        CPPFLAGS="-DWL=32 $CPPFLAGS"
+	SHELL=/bin/sh
+        ;;
+    linux)
+	SHELL="/bin/sh"
+        CC=cc
+        FC=f77
+	FFLAGS="-w"
+	LDFLAGS="-s $LDFLAGS"
+        CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS"
+        ;;
+    t3d)
+        CC=/mpp/bin/cc
+        FC=/mpp/bin/cf77
+        CFLAGS="-T cray-t3d"
+        FFLAGS="-C cray-t3d -dp"
+        CPPFLAGS="-DWL=64 -DFORTRANCAP $CPPFLAGS"
+	SHELL=/bin/sh
+        ;;
+    powerchallenge)
+        CC=cc
+        FC=f77
+	CFLAGS="-mips4 -fullwarn -64"
+        CPPFLAGS="-DWL=64 -DFORTRANUNDERSCORE $CPPFLAGS"
+        ;;
+    challenge)
+        CC=cc
+        FC=f77
+	CFLAGS="-mips2 -fullwarn -32"
+        CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS"
+        ;;
+    paragon)
+        CC=cc
+        FC=f77
+        CFLAGS="-nx $CFLAGS"
+        FFLAGS="-nx $FFLAGS"
+        CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS"
+        ;;
+    sp2)
+        CC=cc
+        FC=f77
+        CPPFLAGS="-DWL=32 $CPPFLAGS"
+        ;;
+    exemplar)
+        CC=cc
+        FC=fort77
+	FFLAGS="-L/usr/lib -lU77 $FFLAGS"
+        CPPFLAGS="-DWL=32 $CPPFLAGS"
+	SHELL=/bin/sh
+        ;;
+    *)
+	CC=cc
+	FC=f77
+	CPPFLAGS="-DWL=32 $CPPFLAGS"
+	print_error "WARNING:  Configuring for untested architecture.  Using"
+        print_error "          word size of 32 bits, cc and f77 as compilers."
+	print_error "          You might have trouble with Fortran programs"
+        print_error "          not linking correctly.  Check the manual on"
+        print_error "          the FORTRANUNDERSCORE #define."
+	;;
+esac
+
+###############################################################################
+# This section sets the variables that do not relate to parallel code.
+###############################################################################
+CPPFLAGS="-D$ARCH $CPPFLAGS"
+PGA_LIB_DIR="../lib/$ARCH"
+LIB_DIRS="-L$PGA_DIR/lib/$ARCH $LIB_DIRS"
+LIBS="-l$PGA_LIB $LIBS"
+
+#     Set output variable `RANLIB' to `ranlib' if `ranlib' is found,
+#     otherwise to `:' (do nothing).
+if test -z "$RANLIB"; then
+  # Extract the first word of `ranlib', so it can be a program name with args.
+  set dummy ranlib; word=$2
+  echo checking for $word
+  IFS="${IFS= 	}"; saveifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/$word; then
+      RANLIB="ranlib"
+      break
+    fi
+  done
+  IFS="$saveifs"
+fi
+test -z "$RANLIB" && RANLIB=":"
+test -n "$RANLIB" && test -n "$verbose" && echo "	setting RANLIB to $RANLIB"
+
+
+#    "Determine a C compiler to use.  If `CC' is not already set in the
+#     environment, check for `gcc', and use `cc' if it's not found.  Set
+#     output variable `CC' to the name of the compiler found.
+#
+#    "If using the GNU C compiler, set shell variable `GCC' to `yes',
+#     empty otherwise.  If output variable `CFLAGS' was not already set,
+#     set it to `-g -O' for the GNU C compiler (`-O' on systems where
+#     GCC does not accept `-g'), or `-g' for other compilers."
+if test -n "$USR_CC"
+     then
+          CC=$USR_CC
+     else
+          if test -z "$CC"; then
+  # Extract the first word of `gcc', so it can be a program name with args.
+  set dummy gcc; word=$2
+  echo checking for $word
+  IFS="${IFS= 	}"; saveifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/$word; then
+      CC="gcc"
+      break
+    fi
+  done
+  IFS="$saveifs"
+fi
+test -z "$CC" && CC="cc"
+test -n "$CC" && test -n "$verbose" && echo "	setting CC to $CC"
+
+# Find out if we are using GNU C, under whatever name.
+cat > conftest.c <<EOF
+#ifdef __GNUC__
+  yes
+#endif
+EOF
+${CC-cc} -E conftest.c > conftest.out 2>&1
+if egrep yes conftest.out >/dev/null 2>&1; then
+  GCC=1 # For later tests.
+fi
+rm -f conftest*
+
+fi
+
+#     Check for each program in the whitespace-separated list
+#     PROGS-TO-CHECK-FOR exists in `PATH'.  If it is found, set VARIABLE
+#     to the name of that program.  Otherwise, continue checking the
+#     next program in the list.  If none of the programs in the list are
+#     found, set VARIABLE to VALUE-IF-NOT-FOUND; if VALUE-IF-NOT-FOUND
+#     is not specified, the value of VARIABLE is not changed.
+if test -n "$USR_FC"
+     then
+          FC=$USR_FC
+     else
+          for p in f77 fortran xlf gf77 mpxlf if77
+do
+if test -z "$FC"; then
+  # Extract the first word of `$p', so it can be a program name with args.
+  set dummy $p; word=$2
+  echo checking for $word
+  IFS="${IFS= 	}"; saveifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/$word; then
+      FC="$p"
+      break
+    fi
+  done
+  IFS="$saveifs"
+fi
+
+test -n "$FC" && test -n "$verbose" && echo "	setting FC to $FC"
+
+test -n "$FC" && break
+done
+
+fi
+
+# Originally had
+#                     OBJS="$OBJS $(PGA_LIB_DIR)/f2c.o"
+# However, freebsd bourne shell equates $(var) and `var`.  Hence, I had
+# to break the assignment up into two parts.  $FORTWRAP is a Makefile
+# dependency line defining how to compile f2c.c
+if test -n "$FC"
+    then
+	TEMP='$(PGA_LIB_DIR)/f2c.o'
+        OBJS="$OBJS $TEMP"
+        FORTWRAP='$(PGA_LIB_DIR)/f2c.o: f2c.c $(HEADERS)\
+	$(COMPILE.c) f2c.c'
+fi
+
+if test ! -d lib
+    then
+        mkdir lib
+fi
+
+if test ! -d lib/$ARCH
+    then
+        mkdir lib/$ARCH
+fi
+
+#  Set up symlinks for pgapackf.h to any directories with Fortran source
+rm -f ./examples/fortran/pgapackf.h ./examples/mgh/pgapackf.h ./test/pgapackf.h
+ln -s ../../include/pgapackf.h ./examples/fortran/pgapackf.h
+ln -s ../../include/pgapackf.h ./examples/mgh/pgapackf.h
+ln -s ../include/pgapackf.h    ./test/pgapackf.h
+
+#  Use the stub library.
+if test $PARALLEL -eq 0
+  then
+    rm -f ./include/mpi.h ./include/mpif.h ./examples/fortran/mpif.h ./examples/mgh/mpif.h ./test/mpif.h
+    ln -s fakempi_h include/mpi.h
+    ln -s fakempif_h include/mpif.h
+    ln -s ../../include/mpif.h ./examples/fortran/mpif.h
+    ln -s ../../include/mpif.h ./examples/mgh/mpif.h
+    ln -s ../include/mpif.h ./test/mpif.h
+    TEMP='$(PGA_LIB_DIR)/mpi_stub.o'
+    OBJS="$OBJS $TEMP"
+    MPICOMP='$(PGA_LIB_DIR)/mpi_stub.o: mpi_stub.c $(HEADERS)\
+	$(COMPILE.c) mpi_stub.c'
+#  The tab above is IMPORTANT!  Needed for make!
+else
+    rm -f ./include/mpi.h ./include/mpif.h ./examples/fortran/mpif.h ./examples/mgh/mpif.h ./test/mpif.h
+    ln -s $MPI_INC_DIR/mpif.h ./examples/fortran/mpif.h
+    ln -s $MPI_INC_DIR/mpif.h ./examples/mgh/mpif.h
+    ln -s $MPI_INC_DIR/mpif.h ./test/mpif.h
+    LIBS="$LIBS $MPI_LIB"
+    INCLUDES="$INCLUDES -I$MPI_INC_DIR"
+fi
+
+LIBS="$LIBS -lm"
+CPPFLAGS="$INCLUDES $CPPFLAGS"
+LDFLAGS="$LDFLAGS $LIB_DIRS $LIBS"
+###############################################################################
+# This section exports the variables that have previously been set.
+# Configure creates the Makefiles listed on the last line from the
+# Makefile.in in each directory.  It does this by substituting the value
+# of $VAR for every occurent of @VAR@ in the Makefile.in.  For
+# example, if the characters @CC@ occur any place in a Makefile.in, they
+# will be replaced with the value that $CC has when ac_subst(CC) is
+# called.
+###############################################################################
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Set default prefixes.
+if test -n "$prefix"; then
+  test -z "$exec_prefix" && exec_prefix='${prefix}'
+  prsub="s%^prefix\\([ 	]*\\)=\\([ 	]*\\).*$%prefix\\1=\\2$prefix%"
+fi
+if test -n "$exec_prefix"; then
+  prsub="$prsub
+s%^exec_prefix\\([ 	]*\\)=\\([ 	]*\\).*$%exec_prefix\\1=\\2$exec_prefix%"
+fi
+# Quote sed substitution magic chars in DEFS.
+cat >conftest.def <<EOF
+$DEFS
+EOF
+escape_ampersand_and_backslash='s%[&\\]%\\&%g'
+DEFS=`sed "$escape_ampersand_and_backslash" <conftest.def`
+rm -f conftest.def
+# Substitute for predefined variables.
+
+trap 'rm -f config.status; exit 1' 1 3 15
+echo creating config.status
+rm -f config.status
+cat > config.status <<EOF
+#!/bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $configure_args
+
+for arg
+do
+  case "\$arg" in
+    -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    echo running \${CONFIG_SHELL-/bin/sh} $0 $configure_args
+    exec \${CONFIG_SHELL-/bin/sh} $0 $configure_args ;;
+    *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
+  esac
+done
+
+trap 'rm -f Makefile source/Makefile test/Makefile test/Makefile \
+	  examples/Makefile examples/c/Makefile examples/fortran/Makefile \
+	  examples/mgh/Makefile; exit 1' 1 3 15
+RANLIB='$RANLIB'
+CC='$CC'
+FC='$FC'
+CFLAGS='$CFLAGS'
+FFLAGS='$FFLAGS'
+CPPFLAGS='$CPPFLAGS'
+FORTWRAP='$FORTWRAP'
+HEADERS='$HEADERS'
+LDFLAGS='$LDFLAGS'
+PARALLEL='$PARALLEL'
+PGA_LIB_DIR='$PGA_LIB_DIR'
+PGA_LIB='$PGA_LIB'
+OBJS='$OBJS'
+MPICOMP='$MPICOMP'
+RM='$RM'
+SHELL='$SHELL'
+LIBS='$LIBS'
+srcdir='$srcdir'
+DEFS='$DEFS'
+prefix='$prefix'
+exec_prefix='$exec_prefix'
+prsub='$prsub'
+extrasub='$extrasub'
+EOF
+cat >> config.status <<\EOF
+
+top_srcdir=$srcdir
+
+CONFIG_FILES=${CONFIG_FILES-"Makefile source/Makefile test/Makefile test/Makefile \
+	  examples/Makefile examples/c/Makefile examples/fortran/Makefile \
+	  examples/mgh/Makefile"}
+for file in .. ${CONFIG_FILES}; do if test "x$file" != x..; then
+  srcdir=$top_srcdir
+  # Remove last slash and all that follows it.  Not all systems have dirname.
+  dir=`echo $file|sed 's%/[^/][^/]*$%%'`
+  if test "$dir" != "$file"; then
+    test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
+    test ! -d $dir && mkdir $dir
+  fi
+  echo creating $file
+  rm -f $file
+  echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
+  sed -e "
+$prsub
+$extrasub
+s%@RANLIB@%$RANLIB%g
+s%@CC@%$CC%g
+s%@FC@%$FC%g
+s%@CFLAGS@%$CFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@FORTWRAP@%$FORTWRAP%g
+s%@HEADERS@%$HEADERS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@PARALLEL@%$PARALLEL%g
+s%@PGA_LIB_DIR@%$PGA_LIB_DIR%g
+s%@PGA_LIB@%$PGA_LIB%g
+s%@OBJS@%$OBJS%g
+s%@MPICOMP@%$MPICOMP%g
+s%@RM@%$RM%g
+s%@SHELL@%$SHELL%g
+s%@LIBS@%$LIBS%g
+s%@srcdir@%$srcdir%g
+s%@DEFS@%$DEFS%
+" $top_srcdir/${file}.in >> $file
+fi; done
+
+
+exit 0
+EOF
+chmod +x config.status
+${CONFIG_SHELL-/bin/sh} config.status
+
+
+if test ! -f ".pgapack" ; then
+  if test $PARALLEL -eq 1 ; then
+      OPERATION="parallel"
+      ECHO_LIBS="$MPI_LIB"
+  else
+      OPERATION="sequential"
+      ECHO_LIBS="stub routines in mpi_stub.c"
+  fi
+  if test $OPTIMIZE -eq 1 ; then
+      OPERATION="optimized $OPERATION"
+  else
+      OPERATION="debug $OPERATION"
+  fi
+  echo " "
+  echo "PGAPack has been configured for $OPERATION operation on"
+  echo "the $ARCH architecture, using $ECHO_LIBS."
+  echo " "
+  echo "**********************************************************************"
+  echo "*  Please register your copy of PGAPack by sending a mail message    *"
+  echo "*  to pgapack@mcs.anl.gov.  This will allow us to notify you of bug  *"
+  echo "*  fixes, enhancements, and new releases. The PGAPack homepage is at *"
+  echo "*  http://www.mcs.anl.gov/pgapack.html.                              *"
+  echo "**********************************************************************"
+  echo " "
+  echo "Type \"make install\" to install PGAPack."
+  echo " "
+fi
+
+
Index: trunk/optimizer/src/pgapack/pgapack/configure.in
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/configure.in	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/configure.in	(revision 816)
@@ -0,0 +1,523 @@
+#!/bin/sh
+# This file is configure.
+#
+# Make all changes to configure.in, if at all possible.  After changing,
+# run "autoconf".  If autoconf is not installed, then make changes to
+# configure.
+#
+# Documentation on the autoconf program exists in GNU info file format.
+# To read this, run emacs and type C-h i.  Then press the down arrow
+# until you come to the line beginning "* Autoconf:".  Pressing enter on
+# this line will bring up the documentaition.
+#
+# Type "configure" (i.e., no arguments) or read below for usage information.
+#
+print_error() {
+    echo "$*" 2>&1 ;
+}
+
+print_usage()
+{
+cat <<.
+Usage: configure -arch ARCH_TYPE [-cc CC] [-f77 FC] [-debug] [-help]
+                 [-cflags CFLAGS] [-fflags FFLAGS]
+                 [-mpiinc MPI_INC_DIR -mpilib MPI_LIB]
+where
+   ARCH_TYPE    = the type of machine that PGAPack is to be configured for
+   CC           = the name of the ANSI C compiler
+   FC           = the name of the FORTRAN 77 compiler
+   CFLAGS       = C compiler flags
+   FFLAGS       = FORTRAN compiler flags
+   MPI_INC_DIR  = the MPI include directory
+   MPI_LIB      = the full path to the MPI library
+
+
+Known architectures are:
+
+Workstations
+	sun4		(SUN OS 4.x)
+	hpux		(HP UX)
+	irix    	(Silicon Graphics IRIX)
+	alpha		(DEC Alpha)
+	rs6000		(AIX for IBM RS6000)	
+	next		(NeXT 680x0)
+	freebsd		(PC clones running FreeBSD)
+	linux		(PC clones running LINUX)
+	generic		(Generic 32-bit UNIX-like machine)
+
+MPP's
+	powerchallenge	(Silicon Graphics PowerChallenge)
+	challenge	(Silicon Graphics Challenge)
+	t3d		(Cray-T3D)
+	sp2		(IBM SP2)
+	paragon		(Intel Paragon)
+	exemplar	(Convex Exemplar)
+
+
+In the absence of the -f77 or -cc options, configure assumes the name of 
+a FORTRAN 77 or ANSI C compiler based on the architecture type.
+
+If the -debug flag is set, then PGAPack will be built for debugging.  This
+enables the extensive debugging options and datatype checks.
+
+If both -mpiinc and -mpilib are missing, PGAPack is built using a non-parallel
+"stub" library for all MPI calls.
+
+The -help flag causes this usage guide to be printed.
+
+Example 1:
+----------
+Configure and build for parallel operation on the sun4 architectue.  MPI is
+in /usr/local/mpi; the MPI library is /usr/local/mpi/lib/sun4/ch_p4/libmpi.a.
+
+  configure -arch sun4 -mpilib /usr/local/mpi/lib/sun4/ch_p4/libmpi.a \
+            -mpiinc /usr/local/mpi/include
+  make install
+
+Example 2:
+----------
+Configure and build a debug sequential library on the rs6000 architecture.
+
+  configure -arch rs6000 -debug
+  make install
+.
+}
+
+###############################################################################
+# This section initializes the variables that will be used throughout
+# the script.
+###############################################################################
+AC_INIT(source/pga.c)
+ARCH=""                         # architecture type
+PARALLEL=0                      # parallel libray, or use stub routines?
+OPTIMIZE=1                      # optimized?
+CPPFLAGS=""                     # flags to send to the C preprocessor
+LDFLAGS=""                      # link flags
+CFLAGS=""                       # flags to send to the C compiler
+FFLAGS=""                       # flags to send to the FORTRAN compiler
+PGA_DIR="`pwd`"                 # the root of the pgapack tree
+PGA_DIR=`echo $PGA_DIR | sed "s=tmp_mnt/=="`    # get rid of 'tmp_mnt/'
+HEADERS="$PGA_DIR/include/pgapack.h" # headers upon which pgapack depends
+INCLUDES="-I$PGA_DIR/include"   # directories where to search for include files
+LIB_DIRS=""                     # directories where to search for libraries
+LIBS=""                         # libraries with which to link
+MPI_INC_DIR=""
+MPI_LIB=""
+SHELL="/usr/bin/sh"
+RM="/bin/rm -f"                 # command to force removal of files
+
+OBJS='$(PGA_LIB_DIR)/binary.o        \\\
+      $(PGA_LIB_DIR)/char.o          \\\
+      $(PGA_LIB_DIR)/cmdline.o       \\\
+      $(PGA_LIB_DIR)/create.o        \\\
+      $(PGA_LIB_DIR)/cross.o         \\\
+      $(PGA_LIB_DIR)/debug.o         \\\
+      $(PGA_LIB_DIR)/duplcate.o      \\\
+      $(PGA_LIB_DIR)/evaluate.o      \\\
+      $(PGA_LIB_DIR)/fitness.o       \\\
+      $(PGA_LIB_DIR)/hamming.o       \\\
+      $(PGA_LIB_DIR)/heap.o          \\\
+      $(PGA_LIB_DIR)/integer.o       \\\
+      $(PGA_LIB_DIR)/mutation.o      \\\
+      $(PGA_LIB_DIR)/parallel.o      \\\
+      $(PGA_LIB_DIR)/pga.o           \\\
+      $(PGA_LIB_DIR)/pop.o           \\\
+      $(PGA_LIB_DIR)/random.o        \\\
+      $(PGA_LIB_DIR)/real.o          \\\
+      $(PGA_LIB_DIR)/report.o        \\\
+      $(PGA_LIB_DIR)/restart.o       \\\
+      $(PGA_LIB_DIR)/select.o        \\\
+      $(PGA_LIB_DIR)/stop.o          \\\
+      $(PGA_LIB_DIR)/system.o        \\\
+      $(PGA_LIB_DIR)/user.o          \\\
+      $(PGA_LIB_DIR)/utility.o'      # these are pgapack's object files
+
+###############################################################################
+# This section parse the command line options. There a two types of options:
+# those that take arguments and those that don't.  Parsing the case where an
+# option takes an argument is a little tricky.  This is how it works.  Suppose
+# that the program comes upon "-cc".  Then we know that the next argument
+# will be the name of the C compiler.  Hence, we set the flag next_cc to be
+# equal to "yes".  The next time through the loop, it will be the case that
+# x$next_cc equal "xyes" because $next_cc expands to "yes".  Thus, we know that
+# this argument is the name of the compiler and we assign it to USR_CC.  Then
+# we set next_cc back to a null string.  This way on the next time through
+# the loop x$next_cc will equal just "x".  Since the shell initializes
+# variables to null strings, we do not have to initialize the "next_" family
+# of variables by hand.
+###############################################################################
+for arg
+do
+    if test x$next_arch = xyes
+        then
+            ARCH=$arg
+            next_arch=
+        elif test x$next_mpiinc = xyes
+            then
+                MPI_INC_DIR=$arg
+                next_mpiinc=
+        elif test x$next_mpilib = xyes
+            then
+                MPI_LIB=$arg
+                next_mpilib=
+        elif test x$next_f77 = xyes
+            then
+                USR_FC=$arg
+                next_f77=
+        elif test x$next_cc = xyes
+            then
+                USR_CC=$arg
+                next_cc=
+        elif test x$next_cflags = xyes
+            then
+                CFLAGS="$arg $CFLAGS"
+                next_cflags=
+        elif test x$next_fflags = xyes
+            then
+                FFLAGS="$arg $FFLAGS"
+                next_fflags=
+        else
+            case $arg in
+                -arch)
+                    next_arch=yes
+                    ;;
+                -f77)
+                    next_f77=yes
+                    ;;
+                -cc)
+                    next_cc=yes
+                    ;;
+                -mpiinc)
+                    next_mpiinc=yes
+                    PARALLEL=1
+                    ;;
+                -mpilib)
+                    next_mpilib=yes
+                    PARALLEL=1
+                    ;;
+                -debug)
+                    OPTIMIZE=0
+                    ;;
+                -cflags)
+                    next_cflags=yes
+                    ;;
+                -fflags)
+                    next_fflags=yes
+                    ;;
+                -help)
+                    print_usage >& 2
+                    exit 1
+                    ;;
+                *) 
+                    ;;
+            esac
+    fi
+done
+
+if test "$MPI_LIB" -a "$MPI_INC_DIR" ; then
+    if test ! -d "$MPI_INC_DIR" ; then
+        print_error "MPI_INC_DIR == $MPI_INC_DIR is not a valid directory!"
+        exit 1
+    fi
+    if test ! -f "$MPI_INC_DIR/mpi.h" ; then
+        print_error "Couldn't find $MPI_INC_DIR/mpi.h!"
+        exit 1
+    fi
+
+    if test ! -f "$MPI_LIB" ; then
+        print_error "MPI_LIB == $MPI_LIB is not a file!"
+        exit 1
+    fi
+
+    PARALLEL=1
+else
+    PARALLEL=0
+    CPPFLAGS="-DFAKE_MPI $CPPFLAGS"
+fi
+
+if test $OPTIMIZE -eq 1 ; then
+	CPPFLAGS="-DOPTIMIZE $CPPFLAGS"
+	CFLAGS="-O $CFLAGS"
+	FFLAGS="-O $FFLAGS"
+	PGA_LIB="pgaO"
+else
+	CFLAGS="-g $CFLAGS"
+	FFLAGS="-g $FFLAGS"
+	PGA_LIB="pgag"
+fi
+
+
+###############################################################################
+# This section sets the default values of certain variables based upon the
+# architecture type specified.  If no architecture was specified, the script
+# issues an error and aborts.
+###############################################################################
+if test -z "$ARCH"
+    then
+        print_error "You must specify the architecture with -arch <value>"
+        print_error "Valid architectures are the following:"	
+	print_error " Workstations      MPP's"
+	print_error "    sun4        powerchallenge"
+	print_error "    next        challenge"
+	print_error "    rs6000      t3d"
+	print_error "    freebsd     sp2"
+	print_error "    irix        paragon"
+	print_error "    linux       exemplar"
+	print_error "    hpux"
+	print_error "    alpha"
+	print_error "    generic"
+	print_error ""
+	print_error "For more information type configure -help."
+        exit 1
+fi
+
+case $ARCH in
+    sun4)
+        CC=cc
+        FC=f77
+        CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS"
+        ;;
+    next)
+        CC=cc
+        FC=
+        CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS"
+        ;;
+    rs6000)
+        CC=cc
+        FC=f77
+        CPPFLAGS="-DWL=32 $CPPFLAGS"
+        ;;
+    freebsd)
+        CC=cc
+        FC=f77
+	FFLAGS="-w"
+        CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS"
+        ;;
+    irix)
+        CC=cc
+        FC=f77
+        CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS"
+        ;;
+    alpha)
+        CC=cc
+        FC=f77
+        CPPFLAGS="-DWL=64 -DFORTRANUNDERSCORE $CPPFLAGS"
+        ;;
+    hpux)
+        CC=cc
+        FC=f77
+        CPPFLAGS="-DWL=32 $CPPFLAGS"
+	SHELL=/bin/sh
+        ;;
+    linux)
+	SHELL="/bin/sh"
+        CC=cc
+        FC=f77
+	FFLAGS="-w"
+	LDFLAGS="-s $LDFLAGS"
+        CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS"
+        ;;
+    t3d)
+        CC=/mpp/bin/cc
+        FC=/mpp/bin/cf77
+        CFLAGS="-T cray-t3d"
+        FFLAGS="-C cray-t3d -dp"
+        CPPFLAGS="-DWL=64 -DFORTRANCAP $CPPFLAGS"
+	SHELL=/bin/sh
+        ;;
+    powerchallenge)
+        CC=cc
+        FC=f77
+	CFLAGS="-mips4 -fullwarn -64"
+        CPPFLAGS="-DWL=64 -DFORTRANUNDERSCORE $CPPFLAGS"
+        ;;
+    challenge)
+        CC=cc
+        FC=f77
+	CFLAGS="-mips2 -fullwarn -32"
+        CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS"
+        ;;
+    paragon)
+        CC=cc
+        FC=f77
+        CFLAGS="-nx $CFLAGS"
+        FFLAGS="-nx $FFLAGS"
+        CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS"
+        ;;
+    sp2)
+        CC=cc
+        FC=f77
+        CPPFLAGS="-DWL=32 $CPPFLAGS"
+        ;;
+    exemplar)
+        CC=cc
+        FC=fort77
+	FFLAGS="-L/usr/lib -lU77 $FFLAGS"
+        CPPFLAGS="-DWL=32 $CPPFLAGS"
+	SHELL=/bin/sh
+        ;;
+    *)
+	CC=cc
+	FC=f77
+	CPPFLAGS="-DWL=32 $CPPFLAGS"
+	print_error "WARNING:  Configuring for untested architecture.  Using"
+        print_error "          word size of 32 bits, cc and f77 as compilers."
+	print_error "          You might have trouble with Fortran programs"
+        print_error "          not linking correctly.  Check the manual on"
+        print_error "          the FORTRANUNDERSCORE #define."
+	;;
+esac
+
+###############################################################################
+# This section sets the variables that do not relate to parallel code.
+###############################################################################
+CPPFLAGS="-D$ARCH $CPPFLAGS"
+PGA_LIB_DIR="../lib/$ARCH"
+LIB_DIRS="-L$PGA_DIR/lib/$ARCH $LIB_DIRS"
+LIBS="-l$PGA_LIB $LIBS"
+
+#     Set output variable `RANLIB' to `ranlib' if `ranlib' is found,
+#     otherwise to `:' (do nothing).
+AC_PROG_RANLIB()
+
+#    "Determine a C compiler to use.  If `CC' is not already set in the
+#     environment, check for `gcc', and use `cc' if it's not found.  Set
+#     output variable `CC' to the name of the compiler found.
+#
+#    "If using the GNU C compiler, set shell variable `GCC' to `yes',
+#     empty otherwise.  If output variable `CFLAGS' was not already set,
+#     set it to `-g -O' for the GNU C compiler (`-O' on systems where
+#     GCC does not accept `-g'), or `-g' for other compilers."
+if test -n "$USR_CC"
+     then
+          CC=$USR_CC
+     else
+          AC_PROG_CC()
+fi
+
+#     Check for each program in the whitespace-separated list
+#     PROGS-TO-CHECK-FOR exists in `PATH'.  If it is found, set VARIABLE
+#     to the name of that program.  Otherwise, continue checking the
+#     next program in the list.  If none of the programs in the list are
+#     found, set VARIABLE to VALUE-IF-NOT-FOUND; if VALUE-IF-NOT-FOUND
+#     is not specified, the value of VARIABLE is not changed.
+if test -n "$USR_FC"
+     then
+          FC=$USR_FC
+     else
+          AC_PROGRAMS_CHECK(FC, f77 fortran xlf gf77 mpxlf if77)
+fi
+
+# Originally had
+#                     OBJS="$OBJS $(PGA_LIB_DIR)/f2c.o"
+# However, freebsd bourne shell equates $(var) and `var`.  Hence, I had
+# to break the assignment up into two parts.  $FORTWRAP is a Makefile
+# dependency line defining how to compile f2c.c
+if test -n "$FC"
+    then
+	TEMP='$(PGA_LIB_DIR)/f2c.o'
+        OBJS="$OBJS $TEMP"
+        FORTWRAP='$(PGA_LIB_DIR)/f2c.o: f2c.c $(HEADERS)\
+	$(COMPILE.c) f2c.c'
+fi
+
+if test ! -d lib
+    then
+        mkdir lib
+fi
+
+if test ! -d lib/$ARCH
+    then
+        mkdir lib/$ARCH
+fi
+
+#  Set up symlinks for pgapackf.h to any directories with Fortran source
+rm -f ./examples/fortran/pgapackf.h ./examples/mgh/pgapackf.h ./test/pgapackf.h
+ln -s ../../include/pgapackf.h ./examples/fortran/pgapackf.h
+ln -s ../../include/pgapackf.h ./examples/mgh/pgapackf.h
+ln -s ../include/pgapackf.h    ./test/pgapackf.h
+
+#  Use the stub library.
+if test $PARALLEL -eq 0
+  then
+    rm -f ./include/mpi.h ./include/mpif.h ./examples/fortran/mpif.h ./examples/mgh/mpif.h ./test/mpif.h
+    ln -s fakempi_h include/mpi.h
+    ln -s fakempif_h include/mpif.h
+    ln -s ../../include/mpif.h ./examples/fortran/mpif.h
+    ln -s ../../include/mpif.h ./examples/mgh/mpif.h
+    ln -s ../include/mpif.h ./test/mpif.h
+    TEMP='$(PGA_LIB_DIR)/mpi_stub.o'
+    OBJS="$OBJS $TEMP"
+    MPICOMP='$(PGA_LIB_DIR)/mpi_stub.o: mpi_stub.c $(HEADERS)\
+	$(COMPILE.c) mpi_stub.c'
+#  The tab above is IMPORTANT!  Needed for make!
+else
+    rm -f ./include/mpi.h ./include/mpif.h ./examples/fortran/mpif.h ./examples/mgh/mpif.h ./test/mpif.h
+    ln -s $MPI_INC_DIR/mpif.h ./examples/fortran/mpif.h
+    ln -s $MPI_INC_DIR/mpif.h ./examples/mgh/mpif.h
+    ln -s $MPI_INC_DIR/mpif.h ./test/mpif.h
+    LIBS="$LIBS $MPI_LIB"
+    INCLUDES="$INCLUDES -I$MPI_INC_DIR"
+fi
+
+LIBS="$LIBS -lm"
+CPPFLAGS="$INCLUDES $CPPFLAGS"
+LDFLAGS="$LDFLAGS $LIB_DIRS $LIBS"
+###############################################################################
+# This section exports the variables that have previously been set.
+# Configure creates the Makefiles listed on the last line from the
+# Makefile.in in each directory.  It does this by substituting the value
+# of $VAR for every occurent of @VAR@ in the Makefile.in.  For
+# example, if the characters @CC@ occur any place in a Makefile.in, they
+# will be replaced with the value that $CC has when ac_subst(CC) is
+# called.
+###############################################################################
+AC_SUBST(CC)
+AC_SUBST(CFLAGS)
+AC_SUBST(FFLAGS)
+AC_SUBST(CPPFLAGS)
+AC_SUBST(FC)
+AC_SUBST(FORTWRAP)
+AC_SUBST(HEADERS)
+AC_SUBST(LDFLAGS)
+AC_SUBST(PARALLEL)
+AC_SUBST(PGA_LIB_DIR)
+AC_SUBST(PGA_LIB)
+AC_SUBST(OBJS)
+AC_SUBST(MPICOMP)
+AC_SUBST(RM)
+AC_SUBST(RANLIB)
+AC_SUBST(SHELL)
+AC_OUTPUT(Makefile source/Makefile test/Makefile test/Makefile \
+	  examples/Makefile examples/c/Makefile examples/fortran/Makefile \
+	  examples/mgh/Makefile)
+
+if test ! -f ".pgapack" ; then
+  if test $PARALLEL -eq 1 ; then
+      OPERATION="parallel"
+      ECHO_LIBS="$MPI_LIB"
+  else
+      OPERATION="sequential"
+      ECHO_LIBS="stub routines in mpi_stub.c"
+  fi
+  if test $OPTIMIZE -eq 1 ; then
+      OPERATION="optimized $OPERATION"
+  else
+      OPERATION="debug $OPERATION"
+  fi
+  echo " "
+  echo "PGAPack has been configured for $OPERATION operation on"
+  echo "the $ARCH architecture, using $ECHO_LIBS."
+  echo " "
+  echo "**********************************************************************"
+  echo "*  Please register your copy of PGAPack by sending a mail message    *"
+  echo "*  to pgapack@mcs.anl.gov.  This will allow us to notify you of bug  *"
+  echo "*  fixes, enhancements, and new releases. The PGAPack homepage is at *"
+  echo "*  http://www.mcs.anl.gov/pgapack.html.                              *"
+  echo "**********************************************************************"
+  echo " "
+  echo "Type \"make install\" to install PGAPack."
+  echo " "
+fi
+
+
Index: trunk/optimizer/src/pgapack/pgapack/examples/Makefile
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/Makefile	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/Makefile	(revision 816)
@@ -0,0 +1,27 @@
+# Generated automatically from Makefile.in by configure.
+FC    = f77
+RM    = /bin/rm -f
+SHELL = /bin/sh
+
+default:
+	@echo "Making C examples"
+	@make C
+	@echo "Making fortran examples"
+	@make Fortran
+
+C:
+	@cd c; make
+
+Fortran:
+	@if test -n "$(FC)" ; then\
+		cd fortran; make; cd ..;\
+		cd mgh; make;\
+	else\
+		echo "Fortran compiler unavailable";\
+	fi
+
+clean:
+	@cd c; make clean
+	@cd fortran; make clean
+	@cd mgh; make clean
+
Index: trunk/optimizer/src/pgapack/pgapack/examples/Makefile.in
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/Makefile.in	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/Makefile.in	(revision 816)
@@ -0,0 +1,26 @@
+FC    = @FC@
+RM    = @RM@
+SHELL = @SHELL@
+
+default:
+	@echo "Making C examples"
+	@make C
+	@echo "Making fortran examples"
+	@make Fortran
+
+C:
+	@cd c; make
+
+Fortran:
+	@if test -n "$(FC)" ; then\
+		cd fortran; make; cd ..;\
+		cd mgh; make;\
+	else\
+		echo "Fortran compiler unavailable";\
+	fi
+
+clean:
+	@cd c; make clean
+	@cd fortran; make clean
+	@cd mgh; make clean
+
Index: trunk/optimizer/src/pgapack/pgapack/examples/README
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/README	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/README	(revision 816)
@@ -0,0 +1,7 @@
+This is the top-level parallel examples directory.  Under it are the
+three following directories:
+
+c         -- contains example programs in C
+fortran   -- contains example programs in FORTRAN
+mgh       -- contains the More, Garbow, and Hillstrom test suite
+templates -- contains stub routines for all the user defined routines
Index: trunk/optimizer/src/pgapack/pgapack/examples/c/Makefile
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/c/Makefile	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/c/Makefile	(revision 816)
@@ -0,0 +1,61 @@
+# Generated automatically from Makefile.in by configure.
+CC          = cc
+PRECFLAGS   = -O 
+CPPFLAGS    = -I/Volumes/Data_mo/GENES/Software/pgapack/include -I/Volumes/Data_mo/GENES/Software/mpich-1.2.7p1/include/ -Dlinux -DWL=32 -DFORTRANUNDERSCORE -DOPTIMIZE 
+FC          = f77
+RM          = /bin/rm -f
+LDFLAGS     = -s  -L/Volumes/Data_mo/GENES/Software/pgapack/lib/linux  -lpgaO  /Volumes/Data_mo/GENES/Software/mpich-1.2.7p1/lib/libmpich.a -lm
+SHELL       = /bin/sh
+
+#    "$@" expands to the target; "$?" expands to the dependency list
+CFLAGS      = -o $@ $? $(PRECFLAGS)
+
+LINK.c      = @echo "  Compiling $@" ; $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
+
+default:
+	@make classic
+	@make dejong
+	@make example
+	@make maxbit
+	@make maxchar
+	@make maxint
+	@make name
+	@make namefull
+	@make udtstr
+	@make sampleOptimization
+
+classic: classic.c
+	$(LINK.c)
+
+dejong: dejong.c
+	$(LINK.c)
+
+example: example.c
+	$(LINK.c)
+
+maxbit: maxbit.c
+	$(LINK.c)
+
+maxchar: maxchar.c
+	$(LINK.c)
+
+maxint: maxint.c
+	$(LINK.c)
+
+name: name.c
+	$(LINK.c)
+
+namefull: namefull.c
+	$(LINK.c)
+
+udtstr: udtstr.c
+	$(LINK.c)
+
+sampleOptimization: sampleOptimization.c
+	$(LINK.c)
+clean: 
+	@$(RM) classic dejong example maxbit maxchar maxint name namefull \
+	       udtstr *.o
+
+
+
Index: trunk/optimizer/src/pgapack/pgapack/examples/c/Makefile.in
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/c/Makefile.in	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/c/Makefile.in	(revision 816)
@@ -0,0 +1,54 @@
+CC          = @CC@
+PRECFLAGS   = @CFLAGS@
+CPPFLAGS    = @CPPFLAGS@
+FC          = @FC@
+RM          = @RM@
+LDFLAGS     = @LDFLAGS@
+SHELL       = @SHELL@
+
+#    "$@" expands to the target; "$?" expands to the dependency list
+CFLAGS      = -o $@ $? $(PRECFLAGS)
+
+LINK.c      = @echo "  Compiling $@" ; $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
+
+default:
+	@make classic
+	@make dejong
+	@make example
+	@make maxbit
+	@make maxchar
+	@make maxint
+	@make name
+	@make namefull
+	@make udtstr
+
+classic: classic.c
+	$(LINK.c)
+
+dejong: dejong.c
+	$(LINK.c)
+
+example: example.c
+	$(LINK.c)
+
+maxbit: maxbit.c
+	$(LINK.c)
+
+maxchar: maxchar.c
+	$(LINK.c)
+
+maxint: maxint.c
+	$(LINK.c)
+
+name: name.c
+	$(LINK.c)
+
+namefull: namefull.c
+	$(LINK.c)
+
+udtstr: udtstr.c
+	$(LINK.c)
+
+clean: 
+	@$(RM) classic dejong example maxbit maxchar maxint name namefull \
+	       udtstr *.o
Index: trunk/optimizer/src/pgapack/pgapack/examples/c/README
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/c/README	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/c/README	(revision 816)
@@ -0,0 +1,31 @@
+Eight example C programs come with PGAPack.  What follows is a listing 
+of the names of the programs and a brief description of their function.
+
+classic.c  -- Optimizes Griewank's, Rastrigin's or Schwefel's test function.
+              All use a real valued datatype.  The problems are:
+		1.  Griewank
+		2.  Rastrigin
+		3.  Schwefel
+
+dejong.c   -- This program optimizes one of the five functions from the DeJong
+              test suite with a binary string as the chromosome.  Graycoding is
+              an option.
+
+example.c  -- An example from the User's Guide.
+
+maxbit.c   -- A very simple example that maximizes the number of 1's in a
+              binary string.  Does no I/O.
+
+maxchar.c  -- Maximizes the number of z's in a character string.  Does I/O.
+
+maxint.c   -- Maximizes the sum of all alleles in the gene.
+
+name.c     -- Evolves a character string to match a hard-coded string.  Does
+              no I/O, but shows how to use userfunctions InitString, Mutation,
+              and Done.  Also uses an elitist model of evolution with no
+              crossover.
+
+namefull.c -- Same idea as name.c, but uses all native user defined functions.
+
+udtstr.c   -- Uses a user-defined datatype, a single structure.
+
Index: trunk/optimizer/src/pgapack/pgapack/examples/c/classic.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/c/classic.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/c/classic.c	(revision 816)
@@ -0,0 +1,132 @@
+/*  Miscelaneous test functions.
+ *
+ *  Rather than deal with parallel I/O, we just list the tests here:
+ *     1.  Griewank
+ *     2.  Rastrigin
+ *     3.  Schwefel
+ *
+ */
+#include <pgapack.h>
+
+#ifndef M_PI
+#define M_PI 3.14159265354
+#endif
+
+double griewank(PGAContext *, int, int);
+double rastrigin(PGAContext *, int, int);
+double schwefel(PGAContext *, int, int);
+void   printResultInterpretation(PGAContext *, int);
+int    GetIntegerParameter(char *query);
+
+int    NumCoords[3]  = { 10, 20, 10 };
+double Lower[3]      = { -512.0, -5.12, -512.0 };
+double Upper[3]      = { 511.0, 5.11, 511.0 };
+
+/*******************************************************************
+ *                   user main program                              *
+ *******************************************************************/
+void main( int argc, char **argv ) {
+    PGAContext *ctx;     /* the context variable */
+    int testnum;         /* the DeJong test to run */
+    int maxiter;         /* the maximum number of iterations */
+    double l[20], u[20]; /* for initializing lu ranges */
+    int i;
+
+    MPI_Init(&argc, &argv); 
+
+    testnum = GetIntegerParameter("Which test? (1-Griewank, 2-Rastrigin, 3-Schwefel)\n") - 1;
+    maxiter = GetIntegerParameter("How many iterations?\n");
+
+    for (i=0; i<20; i++) {
+	l[i] = Lower[testnum];
+	u[i] = Upper[testnum];
+    }
+
+
+    ctx = PGACreate(&argc, argv, PGA_DATATYPE_REAL, 
+		    NumCoords[testnum], PGA_MINIMIZE);
+    
+    PGASetRandomSeed(ctx, 1);
+
+    PGASetRealInitRange(ctx, l, u);
+    PGASetMaxGAIterValue(ctx, maxiter);
+    
+    PGASetUp(ctx);
+
+    if (testnum == 0)    PGARun(ctx, griewank);
+    if (testnum == 1)    PGARun(ctx, rastrigin);
+    if (testnum == 2)    PGARun(ctx, schwefel);
+
+    PGADestroy(ctx);
+    
+    MPI_Finalize();
+}
+
+
+double griewank(PGAContext *ctx, int p, int pop) {
+    int i, len;
+    double term, sum, product;
+
+    sum = 0;
+    product = 1;
+    len = PGAGetStringLength(ctx);
+    for (i = 0; i < len; i++) {
+        term = PGAGetRealAllele(ctx, p, pop, i);
+        sum = sum + term * term / 4000.0;
+        product = product * cos(term / sqrt(((double)i + 1)));
+    }
+
+    return (1 + sum - product);
+}
+
+
+double rastrigin(PGAContext *ctx, int p, int pop)
+{
+    int i, len;
+    double term, sum;
+
+    sum = 0;
+    len = PGAGetStringLength(ctx);
+    for (i = 0; i < len; i++) {
+        term = PGAGetRealAllele(ctx, p, pop, i);
+        sum = sum + term * term - 10 * cos(2 * M_PI * term);
+    }
+    return (len * 10 + sum);
+}
+
+
+double schwefel(PGAContext *ctx, int p, int pop) {
+    int i, len;
+    double term, sum;
+
+    sum = 0;
+    len = PGAGetStringLength(ctx);
+    for (i = 0; i < len; i++) {
+        term = PGAGetRealAllele(ctx, p, pop, i);
+        sum = sum - term * sin(sqrt(fabs(term)));
+    }
+    return (sum);
+}
+
+
+
+/*  Get an integer parameter from the user.  Since this is
+ *  typically a parallel program, we must only do I/O on the
+ *  "master" process -- process 0.  Once we read the parameter,
+ *  we broadcast it to all the other processes, then every 
+ *  process returns the correct value.
+ */
+int GetIntegerParameter(char *query) {
+    int  rank, tmp;
+
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    if (rank == 0) {
+        printf(query);
+        scanf("%d", &tmp);
+    }
+    MPI_Bcast(&tmp, 1, MPI_INT, 0, MPI_COMM_WORLD);
+    return(tmp);
+}
+
+
+
Index: trunk/optimizer/src/pgapack/pgapack/examples/c/dejong.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/c/dejong.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/c/dejong.c	(revision 816)
@@ -0,0 +1,202 @@
+/*  The DeJong test suite.
+ *
+ */
+#include <pgapack.h>
+
+double dejong1(PGAContext *, int, int);
+double dejong2(PGAContext *, int, int);
+double dejong3(PGAContext *, int, int);
+double dejong4(PGAContext *, int, int);
+double dejong5(PGAContext *, int, int);
+void   printResultInterpretation(PGAContext *, int);
+int    GetIntegerParameter(char *query);
+
+int    gray_on;
+
+int    BinLen[5]     = { 10, 12, 10, 8, 17 };
+int    NumCoords[5]  = { 3, 2, 5, 30, 2 };
+double Lower[5]      = { -5.12, -2.048, -5.12, -1.28, -65.536 };
+double Upper[5]      = { 5.11, 2.047, 5.11, 1.27, 65.535 };
+
+/*******************************************************************
+ *                   user main program                              *
+ *******************************************************************/
+void main( int argc, char **argv ) {
+    PGAContext *ctx;    /* the context variable */
+    int testnum;        /* the DeJong test to run */
+    int maxiter;        /* the maximum number of iterations */
+
+    MPI_Init(&argc, &argv); 
+
+    testnum = GetIntegerParameter("Which test? (1 - 5)\n") - 1;
+    gray_on = GetIntegerParameter("Gray-coded? (0 = no)\n");
+    maxiter = GetIntegerParameter("How many iterations?\n");
+
+    ctx = PGACreate(&argc, argv, PGA_DATATYPE_BINARY, 
+		    BinLen[testnum]*NumCoords[testnum], PGA_MINIMIZE);
+    
+    PGASetMaxGAIterValue(ctx, maxiter);
+    PGASetRandomSeed(ctx, 1);
+    
+    PGASetUp(ctx);
+
+    if (testnum == 0)    PGARun(ctx, dejong1);
+    if (testnum == 1)    PGARun(ctx, dejong2);
+    if (testnum == 2)    PGARun(ctx, dejong3);
+    if (testnum == 3)    PGARun(ctx, dejong4);
+    if (testnum == 4)    PGARun(ctx, dejong5);
+
+    printResultInterpretation(ctx, testnum);
+
+    PGADestroy(ctx);
+    
+    MPI_Finalize();
+}
+
+
+double GetTerm(PGAContext *ctx, int p, int pop, int t, int problem) {
+    double    x;
+    int       len;
+    double    l, u;
+
+    len = BinLen[problem];
+    l   = Lower[problem];
+    u   = Upper[problem];
+
+    if (gray_on) 
+	x = PGAGetRealFromGrayCode(ctx, p, pop, t*len, (t+1)*len-1, l, u);
+    else
+	x = PGAGetRealFromBinary(ctx, p, pop, t*len, (t+1)*len-1, l, u);
+    return(x);
+}
+
+
+double dejong1(PGAContext *ctx, int p, int pop) {
+    int i;
+    double term, sum = 0;
+    
+    for(i = 0; i < NumCoords[0]; i++) {
+	term = GetTerm(ctx, p, pop, i, 0);
+	sum += (term * term);
+    }
+    
+    return (sum);
+}
+
+
+double dejong2(PGAContext *ctx, int p, int pop) {
+    double x1, x2, p1, p2;
+    
+    x1 = GetTerm(ctx, p, pop, 0, 1);
+    x2 = GetTerm(ctx, p, pop, 1, 1);
+
+    p1 = x1 * x1 - x2;
+    p2 = 1 - x1;
+    
+    return (100 * p1 * p1 + p2 * p2);
+}
+
+double dejong3(PGAContext *ctx, int p, int pop) {
+    int i;
+    double sum = 0;
+    
+    for(i = 0; i < NumCoords[2]; i++)
+	sum += floor(GetTerm(ctx, p, pop, i, 2));
+
+    return (sum);
+}
+
+double dejong4(PGAContext *ctx, int p, int pop) {
+    int i;
+    double term, sum = 0;
+    
+    for(i = 0; i < NumCoords[3]; i++) {
+	term = GetTerm(ctx, p, pop, i, 3);
+	sum += ((i + 1) * term * term * term * term);
+    }
+    
+    return (sum + PGARandomGaussian(ctx, 0, 1));
+}
+
+double dejong5(PGAContext *ctx, int p, int pop) {
+    int    a[2][25];
+    int    i, j;
+    double sum_over_i = 0, sum_over_j = 0;
+
+    for (i=0; i<5; i++) {
+        a[0][5*i]   = -32;
+        a[1][i]     = -32;
+
+        a[0][5*i+1] = -16;
+        a[1][i+5]   = -16;
+
+        a[0][5*i+2] = 0;
+        a[1][i+10]  = 0;
+
+        a[0][5*i+3] = 16;
+        a[1][i+15]  = 16;
+
+        a[0][5*i+4] = 32;
+        a[1][i+20]  = 32;
+    }
+
+    for (j = 0; j < 25; j++) {
+	sum_over_i =
+	    pow(GetTerm(ctx, p, pop, 0, 4) - a[0][j], 6) +
+	    pow(GetTerm(ctx, p, pop, 1, 4) - a[1][j], 6);
+	sum_over_j += (1.0 / (j + sum_over_i));
+    }
+    
+    return (1.0 / (0.002 + sum_over_j));
+}
+
+
+void printResultInterpretation(PGAContext *ctx, int problem) {
+    int      best, i;
+    double   value;
+
+    if (PGAGetRank(ctx, MPI_COMM_WORLD) == 0) {
+	best = PGAGetBestIndex(ctx, PGA_OLDPOP);
+	
+	printf("The real interpretation:\n");
+	for (i = 0; i < NumCoords[problem]; i++) {
+	    value = GetTerm(ctx, best, PGA_OLDPOP, i, problem);
+	    
+	    switch ( i % 5 ) {
+	    case 0:
+		printf ("#%4d: [%11.7g]", i, value);
+		break;
+	    case 1:
+	    case 2:
+	    case 3:
+		printf (", [%11.7g]", value);
+		break;
+	    case 4:
+		printf (", [%11.7g]", value);
+		if (i+1 < NumCoords[problem])
+		    printf ("\n");
+		break;
+	    }
+	}
+	printf("\n");
+    }
+}
+
+
+/*  Get an integer parameter from the user.  Since this is
+ *  typically a parallel program, we must only do I/O on the
+ *  "master" process -- process 0.  Once we read the parameter,
+ *  we broadcast it to all the other processes, then every 
+ *  process returns the correct value.
+ */
+int GetIntegerParameter(char *query) {
+    int  rank, tmp;
+
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    if (rank == 0) {
+        printf(query);
+        scanf("%d", &tmp);
+    }
+    MPI_Bcast(&tmp, 1, MPI_INT, 0, MPI_COMM_WORLD);
+    return(tmp);
+}
Index: trunk/optimizer/src/pgapack/pgapack/examples/c/example.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/c/example.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/c/example.c	(revision 816)
@@ -0,0 +1,42 @@
+#include <pgapack.h>
+
+double evaluate (PGAContext *ctx, int p, int pop);
+int myMutation  (PGAContext *, int, int, double);
+
+int main( int argc, char **argv )
+{
+     PGAContext *ctx; 
+     int i, lower[10], upper[10];
+
+     for (i=0; i<10; i++) {
+	 lower[i] = 1;
+	 upper[i] = 10;
+     }
+     ctx = PGACreate (&argc, argv, PGA_DATATYPE_INTEGER, 10, PGA_MAXIMIZE);
+     PGASetUserFunction (ctx, PGA_USERFUNCTION_MUTATION, (void *)myMutation);
+     PGASetIntegerInitRange(ctx, lower, upper);
+     PGASetUp              (ctx);
+     PGARun                (ctx, evaluate);
+     PGADestroy            (ctx);
+     return(0);
+}
+int myMutation(PGAContext *ctx, int p, int pop, double pm)
+{
+    int stringlen, i, k, count = 0;
+    stringlen = PGAGetStringLength(ctx);
+    for (i = 0; i < stringlen; i++)
+    if (PGARandomFlip(ctx, pm)) {
+        k = PGARandomInterval(ctx, 1, stringlen);
+        PGASetIntegerAllele(ctx, p, pop, i, k);
+        count++;
+    }
+    return ((double) count);
+}
+double evaluate(PGAContext *ctx, int p, int pop)
+{
+     int stringlen, i, sum = 0;
+     stringlen = PGAGetStringLength(ctx);
+     for (i = 0; i < stringlen; i++)
+         sum += PGAGetIntegerAllele(ctx, p, pop, i);
+     return ((double)sum);
+}
Index: trunk/optimizer/src/pgapack/pgapack/examples/c/maxbit.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/c/maxbit.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/c/maxbit.c	(revision 816)
@@ -0,0 +1,45 @@
+/*
+ *  This is a test program for PGAPack.  The objective is to maximize the
+ *  number of 1-bits in a chromosome.
+ */
+
+#include <pgapack.h>
+
+double NumberOfSetBits(PGAContext *, int, int);
+
+/*******************************************************************
+*                   user main program                              *
+*******************************************************************/
+int main( int argc, char **argv ) {
+    PGAContext *ctx;
+    
+    ctx = PGACreate(&argc, argv, PGA_DATATYPE_BINARY, 256, PGA_MAXIMIZE);
+    PGASetRandomSeed(ctx, 1);
+    
+    PGASetUp(ctx);
+    PGARun(ctx, NumberOfSetBits);
+    PGADestroy(ctx);
+    
+    return(0);
+}
+
+
+/*******************************************************************
+*               user defined evaluation function                   *
+*   ctx - contex variable                                          *
+*   p   - chromosome index in population                           *
+*   pop - which population to refer to                             *
+*******************************************************************/
+double NumberOfSetBits(PGAContext *ctx, int p, int pop) {
+    int i, nbits, stringlen;
+
+    stringlen = PGAGetStringLength(ctx);
+    
+    nbits = 0;
+    for ( i=0; i<stringlen; i++ )
+	if ( PGAGetBinaryAllele(ctx, p, pop, i) )
+	    nbits++;
+    
+    return((double) nbits);
+}
+
Index: trunk/optimizer/src/pgapack/pgapack/examples/c/maxchar.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/c/maxchar.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/c/maxchar.c	(revision 816)
@@ -0,0 +1,103 @@
+/*
+ *  This is a test program for PGAPack.  The objective is to maximize the
+ *  number of 'z's in a chromosome.
+ */
+
+#include <pgapack.h>
+
+double NumberOfZs(PGAContext *, int, int);
+int    myMutation(PGAContext *, int, int, double);
+int    GetIntegerParameter(char *query);
+
+/*******************************************************************
+*                   user main program                              *
+*******************************************************************/
+int main( int argc, char **argv )
+{
+     PGAContext *ctx;
+     int         len, maxiter;
+
+
+     MPI_Init(&argc, &argv);
+
+     len = GetIntegerParameter("String length?\n");
+     maxiter = GetIntegerParameter("How many iterations?\n");
+
+     ctx = PGACreate(&argc, argv, PGA_DATATYPE_CHARACTER, len, PGA_MAXIMIZE);
+
+     PGASetRandomSeed(ctx, 1);
+     PGASetMaxGAIterValue(ctx, maxiter);
+     PGASetUserFunction(ctx, PGA_USERFUNCTION_MUTATION, (void *)myMutation);
+
+     PGASetUp(ctx);
+     PGARun(ctx, NumberOfZs);
+     PGADestroy(ctx);
+
+     MPI_Finalize();
+
+     return(0);
+}
+
+
+/*******************************************************************
+*               user defined evaluation function                   *
+*   ctx - contex variable                                          *
+*   p   - chromosome index in population                           *
+*   pop - which population to refer to                             *
+*******************************************************************/
+double NumberOfZs(PGAContext *ctx, int p, int pop) {
+     int i, nzs;
+     int stringlen;
+
+     stringlen = PGAGetStringLength(ctx);
+     
+     nzs = 0;
+     for ( i=0; i<stringlen; i++ )
+	  if (PGAGetCharacterAllele(ctx, p, pop, i) == 'z')
+	       nzs++;
+     
+     return((double) nzs);
+}
+
+
+/*  Custom mutation function.  Searches for an unset bit, 
+ *  then sets it.  Returns the number of bits that are changed.
+ */
+int myMutation(PGAContext *ctx, int p, int pop, double mr) {
+    int         i, count;
+    char        c;
+
+    count = 0;
+    for (i=PGAGetStringLength(ctx)-1; i>=0; i--) {
+	if (PGARandomFlip(ctx, mr)) {
+	    c = PGAGetCharacterAllele(ctx, p, pop, i);
+	    if (c != 'z') {
+		PGASetCharacterAllele(ctx, p, pop, i, c+1);
+		count++;
+	    }
+	}
+    }
+    return(count);
+}
+
+
+
+/*  Get an integer parameter from the user.  Since this is
+ *  typically a parallel program, we must only do I/O on the
+ *  "master" process -- process 0.  Once we read the parameter,
+ *  we broadcast it to all the other processes, then every 
+ *  process returns the correct value.
+ */
+int GetIntegerParameter(char *query) {
+    int  rank, tmp;
+
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    if (rank == 0) {
+        printf(query);
+        scanf("%d", &tmp);
+    }
+    MPI_Bcast(&tmp, 1, MPI_INT, 0, MPI_COMM_WORLD);
+    return(tmp);
+}
+
+
Index: trunk/optimizer/src/pgapack/pgapack/examples/c/maxint.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/c/maxint.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/c/maxint.c	(revision 816)
@@ -0,0 +1,94 @@
+/*
+ *  This is a test program for PGAPack.  The objective is to maximize each
+ *  allele.  The evaluation function sums all allele values.
+ */
+#include <pgapack.h>
+
+double evaluate(PGAContext *, int, int);
+int    myMutation(PGAContext *, int, int, double);
+int    GetIntegerParameter(char *query);
+
+
+int main(int argc, char **argv) {
+     PGAContext *ctx;
+     int         len, maxiter;
+
+     MPI_Init(&argc, &argv);
+
+     len     = GetIntegerParameter("String length?\n");
+     maxiter = GetIntegerParameter("How many iterations?\n");
+
+     ctx = PGACreate(&argc, argv, PGA_DATATYPE_INTEGER, len, PGA_MAXIMIZE);
+
+     PGASetRandomSeed(ctx, 1);
+     PGASetUserFunction(ctx, PGA_USERFUNCTION_MUTATION, (void *)myMutation);
+     PGASetIntegerInitPermute(ctx, 1, len);
+
+     PGASetMaxGAIterValue(ctx, maxiter);
+     PGASetNumReplaceValue(ctx, 90);
+     PGASetMutationAndCrossoverFlag(ctx, PGA_TRUE);
+     PGASetPrintOptions(ctx, PGA_REPORT_AVERAGE);
+
+     PGASetUp(ctx);
+
+     PGARun(ctx, evaluate);
+     PGADestroy(ctx);
+
+     MPI_Finalize();
+
+     return(0);
+}
+
+
+int myMutation(PGAContext *ctx, int p, int pop, double mr) {
+    int         stringlen, i, v, count;
+
+    stringlen = PGAGetStringLength(ctx);
+    count     = 0;
+
+    for (i=stringlen-1; i>=0; i--) {
+	if (PGARandomFlip(ctx, mr)) {
+	    v = PGARandomInterval(ctx, 1, stringlen);
+            PGASetIntegerAllele(ctx, p, pop, i, v);
+	    count++;
+	}
+    }
+    return((double)count);
+}
+
+
+
+double evaluate(PGAContext *ctx, int p, int pop) {
+     int  stringlen, i, sum;
+
+     stringlen = PGAGetStringLength(ctx);
+     sum       = 0;
+     
+     for (i=stringlen-1; i>=0; i--)
+	  sum += PGAGetIntegerAllele(ctx, p, pop, i);
+
+     return((double)sum);
+}
+
+
+
+/*  Get an integer parameter from the user.  Since this is
+ *  typically a parallel program, we must only do I/O on the
+ *  "master" process -- process 0.  Once we read the parameter,
+ *  we broadcast it to all the other processes, then every 
+ *  process returns the correct value.
+ */
+int GetIntegerParameter(char *query) {
+    int  rank, tmp;
+
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    if (rank == 0) {
+        printf(query);
+        scanf("%d", &tmp);
+    }
+    MPI_Bcast(&tmp, 1, MPI_INT, 0, MPI_COMM_WORLD);
+    return(tmp);
+}
+
+
+
Index: trunk/optimizer/src/pgapack/pgapack/examples/c/name.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/c/name.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/c/name.c	(revision 816)
@@ -0,0 +1,124 @@
+/*  PGAPack test program.
+ *
+ *  The objective is to evolve a string of characters to match a string
+ *  supplied by the user.  We will stop evolving when either we run out
+ *  of iterations (500), or when the best string has the same evaluation
+ *  value for 100 generations.
+ *
+ *  One problem with this implementation is that ' ' is not in
+ *  PGA_DATATYPE_CHAR if we limit it using PGA_CINIT_MIXED, PGA_CINIT_LOWER,
+ *  or PGA_CINIT_UPPER.  To fix this, we must define our own interval, and
+ *  thus, our own mutation, initialization operators.
+ *
+ *  A user function is also used to check the "done" condition; we are 
+ *  done if we've done more than 1000 iterations, or the evolved string
+ *  is correct.
+ *
+ *  Created 28 Sep 95, Brian P. Walenz.  Thanks to Dan Ashlock for the idea.
+ */
+
+#include "pgapack.h"
+
+void   N_InitString(PGAContext *ctx, int p, int pop);
+int    N_Mutation(PGAContext *ctx, int p, int pop, double mr);
+int    N_StopCond(PGAContext *ctx);
+double EvalName(PGAContext *ctx, int p, int pop);
+void   GetStringParameter(char *query, char *string);
+
+/*  Global, because we use it in EvalName.  */
+char   Name[42];
+
+void main(int argc, char **argv) {
+    PGAContext *ctx;
+
+    MPI_Init(&argc, &argv);
+
+    /*  Rather than deal with standard io and strings, we'll just set
+     *  this explicitly.
+     */
+    strcpy(Name,"Levine, Hallstrom, Noelle, Walenz");
+
+    ctx = PGACreate(&argc, argv, PGA_DATATYPE_CHARACTER, strlen(Name),
+		    PGA_MAXIMIZE);
+    
+    PGASetRandomSeed(ctx, 1);
+    
+    PGASetUserFunction(ctx, PGA_USERFUNCTION_INITSTRING, (void *)N_InitString);
+    PGASetUserFunction(ctx, PGA_USERFUNCTION_MUTATION,   (void *)N_Mutation);
+    PGASetUserFunction(ctx, PGA_USERFUNCTION_STOPCOND,   (void *)N_StopCond);
+
+    PGASetPopSize(ctx, 100);
+    PGASetNumReplaceValue(ctx, 75);
+    PGASetPopReplaceType(ctx, PGA_POPREPL_BEST);
+    
+    PGASetCrossoverProb(ctx, 0.0);
+    PGASetMutationOrCrossoverFlag(ctx, PGA_TRUE);
+    PGASetMaxGAIterValue(ctx, 100);
+    
+    PGASetUp(ctx);
+    PGARun(ctx, EvalName);
+    PGADestroy(ctx);
+
+    MPI_Finalize();
+}
+
+
+/*  Function to randomly initialize a PGA_DATATYPE_CHARACTER string using
+ *  all printable ASCII characters for the range.
+ */
+void N_InitString(PGAContext *ctx, int p, int pop) {
+    int               i;
+    
+    for(i=0; i<PGAGetStringLength(ctx); i++)
+	PGASetCharacterAllele(ctx, p, pop, i, 
+			      PGARandomInterval(ctx, 32, 126));
+}
+
+
+/*  Function to muatate a PGA_DATATYPE_CHARACTER string.  This is done
+ *  by simply picking allele locations, and replacing whatever was there
+ *  with a new value.  Again, legal values are all printable ASCII characters.
+ */
+int N_Mutation(PGAContext *ctx, int p, int pop, double mr) {
+    int               i, count=0;
+    
+    for(i=0; i<PGAGetStringLength(ctx); i++)
+	if (PGARandomFlip(ctx, mr)) {
+	    PGASetCharacterAllele(ctx, p, pop, i,
+				  PGARandomInterval(ctx, 32, 126));
+            count++;
+	}
+    return(count);
+}
+
+
+int N_StopCond(PGAContext *ctx) {
+    int   done, best;
+
+    done = PGACheckStoppingConditions(ctx);
+
+    best = PGAGetBestIndex(ctx, PGA_OLDPOP);
+    if ((done == PGA_FALSE) && 
+	(PGAGetEvaluation(ctx, best, PGA_OLDPOP) ==
+	 PGAGetStringLength(ctx)))
+	done = PGA_TRUE;
+
+    return(done);
+}
+
+    
+/*  Evaluate the string.  A highly fit string will have many of
+ *  the characters matching Name.
+ */
+double EvalName(PGAContext *ctx, int p, int pop) {
+    int     i, count;
+    
+    count = 0;
+    for (i=PGAGetStringLength(ctx)-1; i>=0; i--) {
+	if (PGAGetCharacterAllele(ctx, p, pop, i) == Name[i])
+	    count++;
+    }
+    
+    return((double)count);
+}
+
Index: trunk/optimizer/src/pgapack/pgapack/examples/c/namefull.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/c/namefull.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/c/namefull.c	(revision 816)
@@ -0,0 +1,242 @@
+/*  PGAPack test program.
+ *
+ *  The objective is to evolve a string of characters to match a string
+ *  supplied by the user.  We will stop evolving when either we run out
+ *  of iterations (500), or when the best string has the same evaluation
+ *  value for 100 generations.
+ *
+ *  One problem with this implementation is that ' ' is not in
+ *  PGA_DATATYPE_CHAR if we limit it using PGA_CINIT_MIXED, PGA_CINIT_LOWER,
+ *  or PGA_CINIT_UPPER.  To fix this, we must define our own interval, and
+ *  thus, our own mutation, initialization operators.
+ *
+ *  A user function is also used to check the "done" condition; we are 
+ *  done if we've done more than 1000 iterations, or the evolved string
+ *  is correct.
+ *
+ *  Created 28 Sep 95, Brian P. Walenz.  Thanks to Dan Ashlock for the idea.
+ *
+ *  Be warned that duplicate checking will sometimes go into an infinite
+ *  loop.
+ */
+
+#include "pgapack.h"
+
+void   N_InitString (PGAContext *, int, int);
+int    N_Mutation   (PGAContext *, int, int, double);
+int    N_StopCond   (PGAContext *);
+void   N_Crossover  (PGAContext *ctx, int, int, int, int, int, int);
+int    N_Duplicate  (PGAContext *, int, int, int, int);
+void   N_PrintString(PGAContext *, FILE *, int, int);
+void   N_EndOfGen   (PGAContext *);
+double EvalName     (PGAContext *, int, int);
+void   GetStringParameter(char *, char *);
+
+/*  Global, because we use it in EvalName.  */
+char   Name[70];
+
+void main(int argc, char **argv) {
+    PGAContext *ctx;
+
+    MPI_Init(&argc, &argv);
+
+    /*  Rather than deal with standard io and strings, we'll just set
+     *  this explicitly.
+     */
+    strcpy(Name, "David M. Levine, Philip L. Hallstrom, David M. Noelle, "
+                 "Brian P. Walenz");
+
+    ctx = PGACreate(&argc, argv, PGA_DATATYPE_CHARACTER, strlen(Name),
+		    PGA_MAXIMIZE);
+    
+    PGASetRandomSeed(ctx, 42);
+    
+    PGASetUserFunction(ctx, PGA_USERFUNCTION_INITSTRING, (void *)N_InitString);
+    PGASetUserFunction(ctx, PGA_USERFUNCTION_MUTATION,   (void *)N_Mutation);
+    PGASetUserFunction(ctx, PGA_USERFUNCTION_CROSSOVER,  (void *)N_Crossover);
+    PGASetUserFunction(ctx, PGA_USERFUNCTION_DUPLICATE,  (void *)N_Duplicate);
+    PGASetUserFunction(ctx, PGA_USERFUNCTION_STOPCOND,   (void *)N_StopCond);
+    PGASetUserFunction(ctx, PGA_USERFUNCTION_PRINTSTRING,(void *)N_PrintString);
+    PGASetUserFunction(ctx, PGA_USERFUNCTION_ENDOFGEN,   (void *)N_EndOfGen);
+
+    /*  We don't want to report anything.  */
+    PGASetPrintFrequencyValue(ctx, 10000);
+    PGASetPopSize(ctx, 100);
+    PGASetNumReplaceValue(ctx, 90);
+    PGASetPopReplaceType(ctx, PGA_POPREPL_BEST);
+    PGASetNoDuplicatesFlag(ctx, PGA_TRUE);
+    PGASetMaxGAIterValue(ctx, 100);
+    
+    PGASetUp(ctx);
+    PGARun(ctx, EvalName);
+    PGADestroy(ctx);
+
+    MPI_Finalize();
+}
+
+
+/*  Function to randomly initialize a PGA_DATATYPE_CHARACTER string using
+ *  all printable ASCII characters for the range.
+ */
+void N_InitString(PGAContext *ctx, int p, int pop) {
+    int               i;
+    
+    for(i=PGAGetStringLength(ctx)-1; i>=0; i--)
+	PGASetCharacterAllele(ctx, p, pop, i, 
+			      PGARandomInterval(ctx, 32, 126));
+}
+
+
+
+/*  Function to crossover two name strings.  Quite an interesting
+ *  crossover, too.  Works like a normal uniform crossover, except
+ *  that, if one of the strings matches the correct value, we set
+ *  BOTH children to the correct value 50% of the time.
+ */
+void N_Crossover(PGAContext *ctx, int p1, int p2, int pop1, int c1, 
+		 int c2, int pop2) {
+    int           i, length;
+    char          a, b;
+	    
+    length = PGAGetStringLength(ctx);
+
+    for (i=0; i<length; i++) {
+	a = PGAGetCharacterAllele(ctx, p1, pop1, i);
+	b = PGAGetCharacterAllele(ctx, p2, pop1, i);
+	if ((a == Name[i]) || (b == Name[i]))
+	    a = b = Name[i];
+
+	if (PGARandomFlip(ctx, 0.5) == PGA_TRUE) {
+            PGASetCharacterAllele(ctx, c1, pop2, i, a);
+            PGASetCharacterAllele(ctx, c2, pop2, i, b);
+	} else {
+            PGASetCharacterAllele(ctx, c1, pop2, i, b);
+            PGASetCharacterAllele(ctx, c2, pop2, i, a);
+        }
+    }
+}
+
+
+
+/*  Function to compare two strings.  Strings are "equalivalent"
+ *  if they match Name at the same alleles (and, thus, disagree at the
+ *  same alleles).  We don't care what the disagreement is, just that
+ *  it is there.
+ *
+ *  NOTE that because it is possible to get stuck in an infinite
+ *  loop while doing duplicate checking on this string (assuming that
+ *  the mutation operator is always beneficial), we ALWAYS return PGA_FALSE.
+ *  The code is left as an example (and for testing).
+ */
+int N_Duplicate(PGAContext *ctx, int p1, int pop1, int p2, int pop2) {
+    int          i, match;
+    char         a, b, c;
+    
+    match = PGA_TRUE;
+
+    for (i=PGAGetStringLength(ctx)-1; match && i>=0; i--) {
+	a = PGAGetCharacterAllele(ctx, p1, pop1, i);
+	b = PGAGetCharacterAllele(ctx, p2, pop2, i);
+	c = Name[i];
+	if (((a == c) && (b != c)) || ((a != c) && (b == c))) 
+	    match = PGA_FALSE;
+    }
+
+    return(match);
+}
+
+
+/*  Function to muatate a PGA_DATATYPE_CHARACTER string.  This is done
+ *  by simply picking allele locations and replacing whatever was there.
+ *  Again, legal values are all printable ASCII characters.
+ */
+int N_Mutation(PGAContext *ctx, int p, int pop, double mr) {
+    int               i, count;
+
+    count = 0;
+    for(i=PGAGetStringLength(ctx)-1; i>=0; i--)
+	if (PGAGetCharacterAllele(ctx, p, pop, i) != Name[i]) {
+	    if (PGARandomFlip(ctx, mr) == PGA_TRUE) {
+		PGASetCharacterAllele(ctx, p, pop, i,
+				      PGARandomInterval(ctx, 32, 126));
+		count++;
+	    }
+	}
+    return(count);
+}
+
+
+/*  Function to print a string.  Since fortran does NOT support
+ *  C file handles, we just print normally.  If we we're in C,
+ *  we would print to the file "file".
+ */
+void N_PrintString(PGAContext *ctx, FILE *file, int p, int pop) {
+    int          i;
+    char         string[71];
+
+    for (i=PGAGetStringLength(ctx)-1; i>=0; i--)
+	string[i] = PGAGetCharacterAllele(ctx, p, pop, i);
+    string[70] = 0;
+
+    fprintf(file," :%s:\n", string);
+}
+
+
+/*  Function to check "doneness" of the GA.  We check the iteration
+ *  count (by calling PGACheckStoppingConditions), then check if we have found
+ *  the string yet.
+ */
+int N_StopCond(PGAContext *ctx) {
+    int   done, best;
+
+    done = PGACheckStoppingConditions(ctx);
+
+    best = PGAGetBestIndex(ctx, PGA_OLDPOP);
+    if ((done == PGA_FALSE) && 
+	(PGAGetEvaluation(ctx, best, PGA_OLDPOP) ==
+	 PGAGetStringLength(ctx)))
+	done = PGA_TRUE;
+
+    return(done);
+}
+
+
+
+/*  After each generation, this routine is called.  What is done here,
+ *  is to print the best string in our own format, then check if the
+ *  best string is close to the correct value.  If it is, duplicate
+ *  checking is tunred off.  This is critical, as the mutation operator
+ *  will not degrade a string, so when the strings get near the correct
+ *  solution, they all become duplicates, but none can be changed!
+ *
+ *  Other applications have done such things as send the best string 
+ *  to another process to be visualized.  For here, we just call our
+ *  print string function to print the best string.
+ */
+void N_EndOfGen(PGAContext *ctx) {
+    int best;
+
+    best = PGAGetBestIndex(ctx, PGA_NEWPOP);
+    N_PrintString(ctx, stdout, best, PGA_NEWPOP);
+
+    if (PGAGetEvaluation(ctx, best, PGA_NEWPOP) >=
+	PGAGetStringLength(ctx)-10) 
+	PGASetNoDuplicatesFlag(ctx, PGA_FALSE);
+}
+
+    
+/*  Evaluate the string.  A highly fit string will have many of
+ *  the characters matching Name.
+ */
+double EvalName(PGAContext *ctx, int p, int pop) {
+    int     i, count;
+    
+    count = 0;
+    for (i=PGAGetStringLength(ctx)-1; i>=0; i--) {
+	if (PGAGetCharacterAllele(ctx, p, pop, i) == Name[i])
+	    count++;
+    }
+    
+    return((double)count);
+}
+
Index: trunk/optimizer/src/pgapack/pgapack/examples/c/sampleOptimization.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/c/sampleOptimization.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/c/sampleOptimization.c	(revision 816)
@@ -0,0 +1,81 @@
+/*
+ * Ganesh Hegde: GENES Learning
+ * This is a sample optimization written for simple parameter values
+ * The aim is to fit a given I-V for a MOSFET
+ * The variables that are entering into the optimization problem are Vgs - Gate to Source Voltage and W/L-
+ * The Width of the oxide layer divided by its length
+ * using given Vgs -- 2V and W/L == 10, an I-V is obtained and fet as the function to be optimized
+ * 
+ */
+ 
+#include <pgapack.h>
+#include <stdlib.h>
+
+double evaluationFunction(PGAContext *, int, int);
+
+
+int main(int argc, char **argv){
+	PGAContext *ctx;
+	int strLen;
+	double low[]={1.5,5} ,high[]={5,12.0};
+
+    ctx = PGACreate(&argc, argv, PGA_DATATYPE_REAL, 2, PGA_MINIMIZE); 
+    PGASetRealInitRange(ctx,low,high);
+    PGASetPopSize(ctx,1000);
+    PGASetCrossoverType(ctx,PGA_CROSSOVER_ONEPT);
+    PGASetRandomSeed(ctx, 1);
+    PGASetStoppingRuleType(ctx, PGA_STOP_NOCHANGE);
+    PGASetUp(ctx);
+    PGARun(ctx, evaluationFunction);
+    PGADestroy(ctx);
+	return 0;
+}
+
+/*
+ * Sample Evaluation function for evaluating the parameters returned by the PGARun function on one cycle
+ * ctx--> context variable
+ * index--> chromosome index in the population
+ * populationNumber --> Which population to look at
+ */
+
+double evaluationFunction(PGAContext *ctx, int index, int populationNumber){
+	int i, stringLen;
+	double realAllele,vGS=0.0,widthToLengthRatio=0.0;
+	double Vds[21]={0}, Ids[21]={0};
+	double mu = 300 ;/*In cm^2/V-s*/
+	int Vt=1,j=0;
+	double tox= 20e-7;
+	double Cox= (3.9*8.85e-14)/tox;
+	double k,slope,targetslope,fitness=0;
+	double targetIds[] = {0,0.0005,0.0010,0.0016,0.0021,0.0026,0.0031,0.0036,0.0041,0.0047,0.0052,0.0057,0.0062,0.0067,0.0072,0.0078,0.0083,0.0088,0.0093,0.0098,0.0104};
+	stringLen = PGAGetStringLength(ctx);
+	for(i=0;i<stringLen;i++){
+		realAllele = PGAGetRealAllele(ctx, index, populationNumber, i);
+		if(i==0){
+			vGS=realAllele;
+		}else{
+			widthToLengthRatio = realAllele;
+		}
+		
+	}
+	/*
+	 * Initing the Vds array
+	 */
+	k=mu*Cox*widthToLengthRatio;
+	
+	for(i=0;i<21;i++){
+		if(i>0){
+		Vds[i]=Vds[i-1]+0.5;
+		}else{
+			Vds[i]=0;
+		}		
+		Ids[i]=k*((vGS-Vt)*Vds[i]);
+	}
+	slope = (Ids[20]-Ids[0])/(Vds[20]-Vds[0]);
+	targetslope = (targetIds[20]-targetIds[0])/(Vds[20]-Vds[0]);
+	for(j=0;j<21;j++){
+//		printf("%lf ",Ids[j]);
+	}
+	return (double)abs(slope-targetslope);
+	
+}
Index: trunk/optimizer/src/pgapack/pgapack/examples/c/test.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/c/test.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/c/test.c	(revision 816)
@@ -0,0 +1,40 @@
+From levine@mcs.anl.gov Mon Nov 27 16:53:21 1995
+Received: from jadoube (jadoube.mcs.anl.gov [140.221.7.137]) by antares.mcs.anl.gov (8.6.10/8.6.10)  with ESMTP
+	id QAA23813 for <walenz@mcs.anl.gov>; Mon, 27 Nov 1995 16:53:21 -0600
+From: David Levine <levine@mcs.anl.gov>
+Date: Mon, 27 Nov 1995 16:53:19 -0600
+Message-Id: <199511272253.QAA01962@jadoube>
+To: walenz@mcs.anl.gov
+Status: R
+
+
+#include "pgapack.h"
+double evaluate (PGAContext *ctx, int p, int pop);
+
+int main(int argc, char **argv)
+{
+    PGAContext *ctx;
+    int rank;
+
+    ctx = PGACreate(&argc, argv, PGA_DATATYPE_BINARY, 100, PGA_MAXIMIZE);
+    PGASetUp   (ctx);
+    rank = PGAGetRank(ctx, MPI_COMM_WORLD);
+    PGAEvaluate(ctx, PGA_OLDPOP, evaluate, MPI_COMM_WORLD);
+    if ( rank == 0 )
+        PGAFitness (ctx, PGA_OLDPOP);
+    while(!PGADone(ctx, MPI_COMM_WORLD)) {
+        if ( rank == 0 ) {
+            PGASelect                 (ctx, PGA_OLDPOP);
+            PGARunMutationAndCrossover(ctx, PGA_OLDPOP, PGA_NEWPOP);
+        }
+        PGAEvaluate(ctx, PGA_OLDPOP, evaluate, MPI_COMM_WORLD);
+        if ( rank == 0 )
+            PGAFitness                (ctx, PGA_NEWPOP);
+        PGAUpdateGeneration           (ctx, MPI_COMM_WORLD);
+        if ( rank == 0 )
+            PGAPrintReport            (ctx, stdout, PGA_OLDPOP);
+    }
+    PGADestroy(ctx);
+    return(0);
+}
+
Index: trunk/optimizer/src/pgapack/pgapack/examples/c/udtstr.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/c/udtstr.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/c/udtstr.c	(revision 816)
@@ -0,0 +1,271 @@
+/*****************************************************************************
+ * The chromosome in this example is a structure containing three doubles    *
+ * representing a translation along each of the x-, y-, and z-axes; three    *
+ * doubles representing a rotation about each the axes; and forty ints       *
+ * representing an index to side chain rotations.  This is a simple          *
+ * illustration of how to set up a molecular docking problem.                *
+ *****************************************************************************/
+#include <pgapack.h>
+
+double       energy           (double *, int *);
+double       Evaluate         (PGAContext *, int, int);
+void         CreateString     (PGAContext *, int, int, int);
+int          Mutation         (PGAContext *, int, int, double);
+void         Crossover        (PGAContext *, int, int, int, int, int, int);
+void         WriteString      (PGAContext *, FILE *, int, int);
+void         CopyString       (PGAContext *, int, int, int, int);
+int          DuplicateString  (PGAContext *, int, int, int, int);
+MPI_Datatype BuildDT          (PGAContext *, int, int);
+
+typedef struct {
+    double t[6];          /* ligand translation and rotation */
+    int    sc[40];        /* ligand sidechain rotations      */
+} ligand;
+
+int main(int argc, char **argv) {
+    PGAContext *ctx;
+
+    ctx = PGACreate(&argc, argv, PGA_DATATYPE_USER, 46, PGA_MINIMIZE);
+    PGASetRandomSeed    (ctx, 1);
+    PGASetMaxGAIterValue(ctx, 5000);
+    PGASetUserFunction  (ctx, PGA_USERFUNCTION_CREATESTRING,  (void *)CreateString);
+    PGASetUserFunction  (ctx, PGA_USERFUNCTION_MUTATION,      (void *)Mutation);
+    PGASetUserFunction  (ctx, PGA_USERFUNCTION_CROSSOVER,     (void *)Crossover);
+    PGASetUserFunction  (ctx, PGA_USERFUNCTION_PRINTSTRING,   (void *)WriteString);
+    PGASetUserFunction  (ctx, PGA_USERFUNCTION_COPYSTRING,    (void *)CopyString);
+    PGASetUserFunction  (ctx, PGA_USERFUNCTION_DUPLICATE,     (void *)DuplicateString);
+    PGASetUserFunction  (ctx, PGA_USERFUNCTION_BUILDDATATYPE, (void *)BuildDT);
+    PGASetUp            (ctx);
+    PGARun              (ctx, Evaluate);
+    PGADestroy          (ctx);
+    return (0);
+}
+
+
+/*****************************************************************************
+ * CreateString allocates and initializes a chromosome.  If InitFlag is      *
+ * set to true, then it will randomly initialize the chromosome; otherwise,  *
+ * it sets each double to 0.0 and each int to 0.                             *
+ *****************************************************************************/
+void CreateString(PGAContext *ctx, int p, int pop, int InitFlag) {
+    int i;
+    ligand *ligand_ptr;
+    PGAIndividual *new;
+
+    new = PGAGetIndividual(ctx, p, pop);
+    if (!(new->chrom = malloc(sizeof(ligand)))) {
+        fprintf(stderr, "No room for new->chrom");
+        exit(1);
+    }
+    ligand_ptr = (ligand *)new->chrom;
+    if (InitFlag) {
+        for (i = 0; i < 3; i++)
+            ligand_ptr->t[i] = PGARandom01(ctx, 0) * 20.0 - 10.0;
+        for (i = 3; i < 6; i++)
+            ligand_ptr->t[i] = PGARandom01(ctx, 0) * 6.28 - 3.14;
+        for (i = 0; i < 40; i++)
+            ligand_ptr->sc[i] = PGARandomInterval(ctx, -20, 20);
+    } else {
+        for (i = 0; i < 6; i++)
+            ligand_ptr->t[i] = 0.0;
+        for (i = 0; i < 40; i++)
+            ligand_ptr->sc[i] = 0;
+    }
+}
+
+
+/*****************************************************************************
+ * Mutation performs mutation on a chromosome.  Each allele has a mr         *
+ * probability of being changed.  Mutation here perturbs each double by one  *
+ * tenth and each int by 1.                                                  *
+ *****************************************************************************/
+int Mutation(PGAContext *ctx, int p, int pop, double mr) {
+    ligand *ligand_ptr;
+    int i, count = 0;
+
+    ligand_ptr = (ligand *)PGAGetIndividual(ctx, p, pop)->chrom;
+    for (i = 0; i < 6; i++)
+        if (PGARandomFlip(ctx, mr)) {
+            if (PGARandomFlip(ctx, 0.5))
+                ligand_ptr->t[i] += 0.1*ligand_ptr->t[i];
+            else
+                ligand_ptr->t[i] -= 0.1*ligand_ptr->t[i];
+            count++;
+        }
+    for (i = 0; i < 40; i++)
+        if (PGARandomFlip(ctx, mr)) {
+            if (PGARandomFlip(ctx, 0.5))
+                ligand_ptr->sc[i] += 1;
+            else
+                ligand_ptr->sc[i] -= 1;
+            count++;
+        }
+    return (count);
+}
+
+
+/*****************************************************************************
+ * Crossover implements uniform crossover on the chromosome.                 *
+ *****************************************************************************/
+void Crossover(PGAContext *ctx, int p1, int p2, int pop1, int t1, int t2,
+               int pop2) {
+    int i;
+    ligand *parent1, *parent2, *child1, *child2;
+    double pu;
+
+    parent1 = (ligand *)PGAGetIndividual(ctx, p1, pop1)->chrom;
+    parent2 = (ligand *)PGAGetIndividual(ctx, p2, pop1)->chrom;
+    child1  = (ligand *)PGAGetIndividual(ctx, t1, pop2)->chrom;
+    child2  = (ligand *)PGAGetIndividual(ctx, t2, pop2)->chrom;
+
+    pu = PGAGetUniformCrossoverProb(ctx);
+
+    for (i = 0; i < 6; i++)
+            if (PGARandomFlip(ctx, pu)) {
+                child1->t[i] = parent1->t[i];
+                child2->t[i] = parent2->t[i];
+            } else {
+                child1->t[i] = parent2->t[i];
+                child2->t[i] = parent1->t[i];
+            }
+    for (i = 0; i < 40; i++)
+            if (PGARandomFlip(ctx, pu)) {
+                child1->sc[i] = parent1->sc[i];
+                child2->sc[i] = parent2->sc[i];
+            } else {
+                child1->sc[i] = parent2->sc[i];
+                child2->sc[i] = parent1->sc[i];
+            }
+}
+
+
+/*****************************************************************************
+ * WriteString sends a visual representation of the chromosome to the file   *
+ * fp.                                                                       *
+ *****************************************************************************/
+void WriteString(PGAContext *ctx, FILE *fp, int p, int pop) {
+    ligand *ligand_ptr;
+    int i;
+
+    ligand_ptr = (ligand *)PGAGetIndividual(ctx, p, pop)->chrom;
+    
+    fprintf(fp, "Position: [%11.7g, %11.7g, %11.7g]\n", 
+	    ligand_ptr->t[0], ligand_ptr->t[1], ligand_ptr->t[2]);
+    fprintf(fp, "Rotation: [%11.7g, %11.7g, %11.7g]\n", 
+	    ligand_ptr->t[3], ligand_ptr->t[4], ligand_ptr->t[5]);
+
+    fprintf(fp, "Sidechains:\n");
+    for (i=0; i<40; i+=8) {
+	fprintf(fp,"%2d: [%4ld] [%4ld] [%4ld] [%4ld]"
+		       " [%4ld] [%4ld] [%4ld] [%4ld]\n", i, 
+		ligand_ptr->sc[i+0], ligand_ptr->sc[i+2], 
+		ligand_ptr->sc[i+2], ligand_ptr->sc[i+3], 
+		ligand_ptr->sc[i+4], ligand_ptr->sc[i+5], 
+		ligand_ptr->sc[i+6], ligand_ptr->sc[i+7]);
+    }
+
+    fprintf ( fp, "\n" );
+}
+
+
+/*****************************************************************************
+ * CopyString makes a copy of the chromosome at (p1, pop1) and puts it at    *
+ * (p2, pop2).                                                               *
+ *****************************************************************************/
+void CopyString(PGAContext *ctx, int p1, int pop1, int p2, int pop2) {
+    void *d, *s;
+
+     s = PGAGetIndividual(ctx, p1, pop1)->chrom;
+     d = PGAGetIndividual(ctx, p2, pop2)->chrom;
+     memcpy(d, s, sizeof(ligand));
+}
+
+
+/*****************************************************************************
+ * DuplicateString compares two chromosomes and returns 1 if they are the    *
+ * same and 0 if they are different.                                         *
+ *****************************************************************************/
+int DuplicateString(PGAContext *ctx, int p1, int pop1, int p2, int pop2) {
+    void *a, *b;
+
+     a = PGAGetIndividual(ctx, p1, pop1)->chrom;
+     b = PGAGetIndividual(ctx, p2, pop2)->chrom;
+     return (!memcmp(a, b, sizeof(ligand)));
+}
+
+
+/*****************************************************************************
+ * BuildDatattype builds an MPI datatype for sending strings to other        *
+ * processors.  Consult your favorite MPI manual for more information.       *
+ *****************************************************************************/
+MPI_Datatype BuildDT(PGAContext *ctx, int p, int pop) {
+  int             counts[5];
+  MPI_Aint        displs[5];
+  MPI_Datatype    types[5];
+  MPI_Datatype    DT_PGAIndividual;
+  PGAIndividual  *P;
+  ligand         *S;
+
+  P = PGAGetIndividual(ctx, p, pop);
+  S = (ligand *)P->chrom;
+
+  /*  Build the MPI datatype.  Every user defined function needs these.
+   *  The first two calls are stuff that is internal to PGAPack, but 
+   *  the user still must include it.  See pgapack.h for details one the
+   *  fields (under PGAIndividual)
+   */
+  MPI_Address(&P->evalfunc, &displs[0]);
+  counts[0] = 2;
+  types[0]  = MPI_DOUBLE;
+
+  /*  Next, we have an integer, evaluptodate.  */  
+  MPI_Address(&P->evaluptodate, &displs[1]);
+  counts[1] = 1;
+  types[1]  = MPI_INT;
+
+  /*  Finally, we have the actual user-defined string.  */
+  MPI_Address(S->t, &displs[2]);
+  counts[2] = 6;
+  types[2]  = MPI_DOUBLE;
+
+  MPI_Address(S->sc, &displs[3]);
+  counts[3] = 40;
+  types[3]  = MPI_INT;
+
+  MPI_Type_struct(4, counts, displs, types, &DT_PGAIndividual);
+  MPI_Type_commit(&DT_PGAIndividual);
+  return(DT_PGAIndividual);
+}
+
+
+
+double Evaluate(PGAContext *ctx, int p, int pop) {
+    int     i;
+    double  x[6];
+    int     sc[40];
+    ligand *lig;
+
+    lig = (ligand *)PGAGetIndividual(ctx, p, pop)->chrom;
+    for (i = 0; i < 6; i++)
+        x[i] = lig->t[i];
+    for (i = 0; i < 40; i++)
+        sc[i] = lig->sc[i];
+    return ( energy(x,sc) );
+}
+
+
+#define SQ(z)  ((z)*(z))
+
+/*  For now just return distance from some fixed point plus
+ *  a penalty for not being aligned to the x, y and z axes.
+ *  The angles are divided by two so that we are in a range
+ *  that only has one zero.
+ */
+double energy(double *x, int *sc) {
+    double d;
+
+    d = sqrt( SQ(x[0]-1) + SQ(x[1]-2) + SQ(x[2]-3)) +
+	SQ(sin(x[3]/2)) + SQ(sin(x[4]/2)) + SQ(sin(x[5]/2));
+
+    return (d);
+}
Index: trunk/optimizer/src/pgapack/pgapack/examples/fortran/Makefile
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/fortran/Makefile	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/fortran/Makefile	(revision 816)
@@ -0,0 +1,53 @@
+# Generated automatically from Makefile.in by configure.
+FC           = f77
+PREFFLAGS    = -w
+RM           = /bin/rm -f
+LDFLAGS      = -s  -L/Volumes/Data_mo/GENES/Software/pgapack/lib/linux  -lpgaO  /Volumes/Data_mo/GENES/Software/mpich-1.2.7p1/lib/libmpich.a -lm
+SHELL        = /bin/sh
+
+#    "$@" expands to the target; "$?" expands to the dependency list
+FFLAGS      = -o $@ $? $(PREFFLAGS)
+
+LINK.f       = if test -n "$(FC)"; \
+                   then echo "  Compiling $@" ; $(FC) $(FFLAGS) $(LDFLAGS); \
+               else \
+                   echo "$@: Fortran compiler unavailable"; fi
+
+default:
+	@make classic
+	@make dejong
+	@make example
+	@make maxbit
+	@make maxchar
+	@make maxint 
+	@make name
+	@make namefull
+
+
+classic: classic.f
+	@$(LINK.f)
+
+dejong: dejong.f
+	@$(LINK.f)
+
+example: example.f
+	@$(LINK.f)
+
+maxbit: maxbit.f
+	@$(LINK.f)
+
+maxchar: maxchar.f
+	@$(LINK.f)
+
+maxint: maxint.f
+	@$(LINK.f)
+
+name: name.f
+	@$(LINK.f)
+
+namefull: namefull.f
+	@$(LINK.f)
+
+clean: 
+	@$(RM) classic dejong example maxbit maxchar maxint name namefull *.o
+
Index: trunk/optimizer/src/pgapack/pgapack/examples/fortran/Makefile.in
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/fortran/Makefile.in	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/fortran/Makefile.in	(revision 816)
@@ -0,0 +1,52 @@
+FC           = @FC@
+PREFFLAGS    = @FFLAGS@
+RM           = @RM@
+LDFLAGS      = @LDFLAGS@
+SHELL        = @SHELL@
+
+#    "$@" expands to the target; "$?" expands to the dependency list
+FFLAGS      = -o $@ $? $(PREFFLAGS)
+
+LINK.f       = if test -n "$(FC)"; \
+                   then echo "  Compiling $@" ; $(FC) $(FFLAGS) $(LDFLAGS); \
+               else \
+                   echo "$@: Fortran compiler unavailable"; fi
+
+default:
+	@make classic
+	@make dejong
+	@make example
+	@make maxbit
+	@make maxchar
+	@make maxint 
+	@make name
+	@make namefull
+
+
+classic: classic.f
+	@$(LINK.f)
+
+dejong: dejong.f
+	@$(LINK.f)
+
+example: example.f
+	@$(LINK.f)
+
+maxbit: maxbit.f
+	@$(LINK.f)
+
+maxchar: maxchar.f
+	@$(LINK.f)
+
+maxint: maxint.f
+	@$(LINK.f)
+
+name: name.f
+	@$(LINK.f)
+
+namefull: namefull.f
+	@$(LINK.f)
+
+clean: 
+	@$(RM) classic dejong example maxbit maxchar maxint name namefull *.o
+
Index: trunk/optimizer/src/pgapack/pgapack/examples/fortran/README
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/fortran/README	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/fortran/README	(revision 816)
@@ -0,0 +1,27 @@
+Seven example FORTRAN programs come with PGAPack.  What follows is a listing 
+of the names of the programs and a brief description of their function.
+
+classic.f  -- Optimizes one of Griewank;s test function, Rastrigin's test
+              function, or Schwefel's test function.  All use a real valued
+	      datatype.
+
+dejong.f   -- This program optimizes one of the five functions from the DeJong
+              test suite with a binary string as the chromosome.  Graycoding is
+              an option.
+
+example.f  -- An example from the User's Guide.
+
+maxbit.f   -- A very simple example that maximizes the number of 1's in a
+              binary string.  Does no I/O.
+
+maxchar.f  -- Maximizes the number of z's in a character string.  Does I/O.
+
+maxint.f   -- Maximizes the sum of all alleles in the gene.
+
+name.f     -- Evolves a character string to match a hard-coded string.  Does
+              no I/O, but shows how to use userfunctions InitString, Mutation,
+              and Done.  Also uses an elitist model of evolution with no
+              crossover.
+
+namefull.f -- Same idea as above, but uses all native user defined functions.
+
Index: trunk/optimizer/src/pgapack/pgapack/examples/fortran/classic.f
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/fortran/classic.f	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/fortran/classic.f	(revision 816)
@@ -0,0 +1,157 @@
+c     Miscelaneous test functions.
+c
+c     Rather than deal with parallel I/O, we just list the tests here:
+c       1.  Griewank
+c       2.  Rastrigin
+c       3.  Schwefel
+c
+      include 'pgapackf.h'
+      include 'mpif.h'
+
+      double precision  griewank, rastrigin, schwefel
+      external          griewank, rastrigin, schwefel
+      
+      integer           GetIntegerParameter
+      external          GetIntegerParameter
+
+      double precision  Lower(3), Upper(3)
+      integer           NumCoords(3)
+      common /data/     Lower, Upper, NumCoords
+
+      integer ctx
+      integer           testnum, maxiter, i, ierror
+      double precision  l(20), u(20)
+
+c
+c                   user main program                              
+c
+
+      call MPI_Init(ierror)
+
+c     Yes, it's ugly, but it does work...
+      testnum = GetIntegerParameter('Which test? (1-Griewank, 2-Rastrigi
+     &n, 3-Schwefel) ')
+      maxiter = GetIntegerParameter('How many iterations?               
+     &               ')
+
+      do i=1, 20
+         l(i) = Lower(testnum)
+         u(i) = Upper(testnum)
+      enddo
+
+      ctx = PGACreate(PGA_DATATYPE_REAL, NumCoords(testnum),
+     &                PGA_MINIMIZE)
+    
+      call PGASetRandomSeed(ctx, 1)
+
+      call PGASetRealInitRange(ctx, l, u)
+      call PGASetMaxGAIterValue(ctx, maxiter)
+    
+      call PGASetUp(ctx)
+
+      if (testnum .eq. 1)    call PGARun(ctx, griewank)
+      if (testnum .eq. 2)    call PGARun(ctx, rastrigin)
+      if (testnum .eq. 3)    call PGARun(ctx, schwefel)
+
+      call PGADestroy(ctx)
+    
+      call MPI_Finalize(ierror)
+
+      stop
+      end
+
+
+      double precision function griewank(ctx, p, pop)
+      include          'pgapackf.h'
+      integer ctx
+      integer           p, pop, i, len
+      double precision  allele, sum, product
+
+      sum = 0.
+      product = 1.
+      len = PGAGetStringLength(ctx)
+      do i=1, len
+         allele = PGAGetRealAllele(ctx, p, pop, i)
+         sum = sum + (allele * allele / 4000.)
+         product = product * dcos(allele / sqrt((dble(i))))
+      enddo
+
+      griewank = 1. + sum - product
+      return
+      end
+
+
+      double precision function rastrigin(ctx, p, pop)
+      include          'pgapackf.h'
+      integer ctx
+      integer           p, pop, i, len
+      double precision  allele, sum
+
+      sum = 0.
+      len = PGAGetStringLength(ctx)
+      do i=1, len
+         allele = PGAGetRealAllele(ctx, p, pop, i)
+         sum = sum + allele * allele - 10.d0 * 
+     &        dcos(6.28318530718d0 * allele)
+      enddo
+
+      rastrigin = dble(len-1) + sum
+      return
+      end
+
+
+
+      double precision function schwefel(ctx, p, pop)
+      include          'pgapackf.h'
+      integer ctx
+      integer           p, pop, i, len
+      double precision  allele, sum
+
+      sum = 0.
+      len = PGAGetStringLength(ctx)
+      do i=1, len
+         allele = PGAGetRealAllele(ctx, p, pop, i)
+         sum = sum - allele * dsin(dsqrt(dabs(allele)))
+      enddo
+     
+      schwefel = sum
+      return
+      end
+
+
+
+c     Get an integer parameter from the user.  Since this is
+c     typically a parallel program, we must only do I/O on the
+c     "master" process -- process 0.  Once we read the parameter,
+c     we broadcast it to all the other processes, then every 
+c     process returns the correct value.
+c     
+      integer function GetIntegerParameter(query)
+      include 'pgapackf.h'
+      include 'mpif.h'
+      character*52 query
+      integer  rank, tmp, ierror
+
+      call MPI_Comm_rank(MPI_COMM_WORLD, rank, ierror)
+      if (rank .eq. 0) then
+         print *, query
+         read *, tmp
+      endif
+      call MPI_Bcast(tmp, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierror)
+
+      GetIntegerParameter = tmp
+      return
+      end
+
+
+      block data
+      integer i
+      double precision Lower(3), Upper(3)
+      integer NumCoords(3)
+      common /data/    Lower, Upper, NumCoords
+
+      data (NumCoords(i), i=1,3) / 10, 20, 10 /
+      data (Lower(i), i=1,3)     / -512.0, -5.12, -512.0 /
+      data (Upper(i), i=1,3)     / 511.0, 5.11, 511.0 /
+
+      end
Index: trunk/optimizer/src/pgapack/pgapack/examples/fortran/dejong.f
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/fortran/dejong.f	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/fortran/dejong.f	(revision 816)
@@ -0,0 +1,310 @@
+c  The DeJong test suite.
+c
+c
+
+      include 'pgapackf.h'
+      include 'mpif.h'
+
+      double precision  dejong1, dejong2, dejong3, dejong4, dejong5
+      external          dejong1, dejong2, dejong3, dejong4, dejong5
+
+      integer           GetIntegerParameter
+      external          GetIntegerParameter
+
+      integer           gray_on
+      integer           BinLen(5), NumCoords(5)
+      double precision  Lower(5), Upper(5)
+
+      common /data/     BinLen, NumCoords, Lower, Upper, gray_on
+
+      integer ctx
+      integer           testnum, maxiter, ierror
+
+
+c
+c                   user main program
+c
+
+      call MPI_Init(ierror)
+
+      testnum = GetIntegerParameter('Which test? (1 - 5)        ')
+      gray_on = GetIntegerParameter('Gray-coded? (1=yes, 0 = no)')
+      maxiter = GetIntegerParameter('How many iterations?       ')
+
+      ctx = PGACreate(PGA_DATATYPE_BINARY, 
+     &     BinLen(testnum)*NumCoords(testnum), PGA_MINIMIZE)
+
+      call PGASetMaxGAIterValue(ctx, maxiter)
+      call PGASetRandomSeed(ctx, 1)
+    
+      call PGASetUp(ctx)
+
+      if (testnum .eq. 1)    call PGARun(ctx, dejong1)
+      if (testnum .eq. 2)    call PGARun(ctx, dejong2)
+      if (testnum .eq. 3)    call PGARun(ctx, dejong3)
+      if (testnum .eq. 4)    call PGARun(ctx, dejong4)
+      if (testnum .eq. 5)    call PGARun(ctx, dejong5)
+
+      call printResultInterpretation(ctx, testnum)
+
+      call PGADestroy(ctx)
+    
+      call MPI_Finalize(ierror)
+
+      stop
+      end
+
+
+      double precision function GetTerm(ctx, p, pop, t, problem) 
+      include           'pgapackf.h'
+      integer ctx
+      integer            p, pop, t, problem, len
+      integer            gray_on, BinLen(5), NumCoords(5)
+      double precision   Lower(5), Upper(5)
+      common /data/      BinLen, NumCoords, Lower, Upper, gray_on
+      double precision   x, l, u
+
+      len = BinLen(problem)
+      l   = Lower(problem)
+      u   = Upper(problem)
+
+      if (gray_on .eq. 1) then
+         x = PGAGetRealFromGrayCode(ctx, p, pop, (t-1)*len+1,
+     &        t*len, l, u)
+      else
+         x = PGAGetRealFromBinary(ctx, p, pop, (t-1)*len+1, 
+     &        t*len, l, u)
+      endif
+
+      GetTerm = x
+      return
+      end
+
+
+      double precision function dejong1(ctx, p, pop) 
+      include          'pgapackf.h'
+      integer ctx
+      integer           p, pop
+      double precision  GetTerm
+      external          GetTerm 
+      integer           gray_on, BinLen(5), NumCoords(5)
+      double precision  Lower(5), Upper(5)
+      common /data/     BinLen, NumCoords, Lower, Upper, gray_on
+      integer           i
+      double precision  term, sum
+
+      sum = 0.
+    
+      do i=1, NumCoords(1)
+         term = GetTerm(ctx, p, pop, i, 1)
+         sum = sum + (term * term)
+      enddo
+      
+      dejong1 = sum
+      return
+      end
+
+
+      double precision function dejong2(ctx, p, pop) 
+      include          'pgapackf.h'
+      integer ctx
+      integer           p, pop
+      double precision  GetTerm
+      external          GetTerm
+      integer           gray_on, BinLen(5), NumCoords(5)
+      double precision  Lower(5), Upper(5)
+      common /data/     BinLen, NumCoords, Lower, Upper, gray_on
+      double precision  x1, x2, p1, p2
+    
+      x1 = GetTerm(ctx, p, pop, 1, 2)
+      x2 = GetTerm(ctx, p, pop, 2, 2)
+      p1 = x1 * x1 - x2
+      p2 = 1 - x1
+
+      dejong 2 = 100 * p1 * p1 + p2 * p2
+      return
+      end
+
+
+      double precision function dejong3(ctx, p, pop) 
+      include          'pgapackf.h'
+      integer ctx
+      integer           p, pop, i
+      double precision  GetTerm
+      external          GetTerm
+      double precision  sum
+      external          ffloor
+      integer           gray_on, BinLen(5), NumCoords(5)
+      double precision  Lower(5), Upper(5)
+      common /data/     BinLen, NumCoords, Lower, Upper, gray_on
+      double precision  ffloor
+
+      sum = 0.
+    
+      do i=1, NumCoords(3)
+         sum = sum + ffloor(GetTerm(ctx, p, pop, i, 3)) 
+      enddo
+         
+      dejong3 = sum
+      return
+      end
+
+
+
+      double precision function dejong4(ctx, p, pop) 
+      include          'pgapackf.h'
+      integer ctx
+      integer           p, pop
+      double precision  GetTerm
+      external          GetTerm
+      integer           gray_on, BinLen(5), NumCoords(5)
+      double precision  Lower(5), Upper(5)
+      common /data/     BinLen, NumCoords, Lower, Upper, gray_on
+      integer           i
+      double precision  term, sum
+      
+      sum = 0.
+      do i=1, NumCoords(4)
+         term = GetTerm(ctx, p, pop, i, 4)
+         sum = sum + (i * term * term * term * term)
+      enddo
+    
+      
+      dejong4 = sum + PGARandomGaussian(ctx, 0d0, 1d0)
+      return
+      end
+
+
+      double precision function dejong5(ctx, p, pop) 
+      include          'pgapackf.h'
+      integer ctx
+      integer           p, pop, i, j
+      double precision  GetTerm
+      external          GetTerm
+      integer           gray_on, BinLen(5), NumCoords(5)
+      double precision  Lower(5), Upper(5)
+      common /data/     BinLen, NumCoords, Lower, Upper, gray_on
+      double precision  a(2,25)
+      double precision  sum_over_i, sum_over_j
+
+      sum_over_i = 0.
+      sum_over_j = 0.
+
+      do i=0, 4
+         a(1,5*i+1)   = -32.
+         a(2,i+1)     = -32.
+         
+         a(1,5*i+2) = -16.
+         a(2,i+6)   = -16.
+         
+         a(1,5*i+3) = 0.
+         a(2,i+11)  = 0.
+         
+         a(1,5*i+4) = 16.
+         a(2,i+16)  = 16.
+         
+         a(1,5*i+5) = 32.
+         a(2,i+21)  = 32.
+      enddo
+      
+      
+      do j=1, 25
+         sum_over_i =
+     &        (GetTerm(ctx, p, pop, 1, 5) - a(1,j)) ** 6 +
+     &        (GetTerm(ctx, p, pop, 2, 5) - a(2,j)) ** 6
+         sum_over_j = sum_over_j + (1.0d0 / (dble(j-1) + sum_over_i))
+      enddo
+    
+      dejong5 = 1.0d0 / (0.002d0 + sum_over_j)
+      return
+      end
+
+
+
+c     Since the linker searches this file first, if this function were
+c     called just "floor", PGAPack would break.  (PGAPack uses a floor
+c     function also).
+c
+      double precision function ffloor(x)
+      double precision  x, y
+
+      y = int(x)
+      if (x .lt. 0 .and. x .ne. y) then
+         y = y - 1
+      endif
+      ffloor = y
+
+      end
+
+
+
+
+
+      subroutine printResultInterpretation(ctx, problem)
+      include          'pgapackf.h'
+      include          'mpif.h'
+      integer ctx
+      integer           problem, best, i
+      double precision  GetTerm
+      external          GetTerm
+      integer           gray_on, BinLen(5), NumCoords(5)
+      double precision  Lower(5), Upper(5)
+      common /data/     BinLen, NumCoords, Lower, Upper, gray_on
+      double precision  value
+      integer comm
+
+
+      comm = PGAGetCommunicator(ctx)
+      if (PGAGetRank(ctx, comm) .eq. 0) then
+c      if (PGAGetRank(ctx, MPI_COMM_WORLD) .eq. 0) then
+         best = PGAGetBestIndex(ctx, PGA_OLDPOP)
+	
+         print *, 'The real interpretation:'
+         do i=1, NumCoords(problem)
+	    value = GetTerm(ctx, best, PGA_OLDPOP, i, problem)
+	    
+            print *, '#', i, ': ', value
+         enddo
+
+      endif
+
+      return
+      end
+
+
+c     Get an integer parameter from the user.  Since this is
+c     typically a parallel program, we must only do I/O on the
+c     "master" process -- process 0.  Once we read the parameter,
+c     we broadcast it to all the other processes, then every 
+c     process returns the correct value.
+c     
+      integer function GetIntegerParameter(query)
+      include      'pgapackf.h'
+      include      'mpif.h'
+      character*27  query
+      integer       rank, tmp, ierror
+
+      call MPI_Comm_rank(MPI_COMM_WORLD, rank, ierror)
+      if (rank .eq. 0) then
+         print *, query
+         read *, tmp
+      endif
+      call MPI_Bcast(tmp, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierror)
+
+      GetIntegerParameter = tmp
+      return
+      end
+
+
+      block data
+      integer i
+      double precision Lower(5), Upper(5)
+      integer gray_on, BinLen(5), NumCoords(5)
+      common /data/ BinLen, NumCoords, Lower, Upper, gray_on
+
+      data (BinLen(i), i=1,5)    / 10, 12, 10, 8, 17 /
+      data (NumCoords(i), i=1,5) / 3, 2, 5, 30, 2 /
+      data (Lower(i), i=1,5)     / -5.12,-2.048,-5.12,-1.28,-65.536 /
+      data (Upper(i), i=1,5)     / 5.11, 2.047, 5.11, 1.27, 65.535 /
+
+      end
Index: trunk/optimizer/src/pgapack/pgapack/examples/fortran/example.f
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/fortran/example.f	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/fortran/example.f	(revision 816)
@@ -0,0 +1,66 @@
+      include 'pgapackf.h'
+
+      double precision evaluate
+      integer          myMutation
+      external         evaluate, myMutation
+      
+      integer ctx
+      integer          i, ierror
+      integer          lower(10), upper(10)
+
+      do i=1, 10
+         lower(i) = 1
+         upper(i) = 10
+      enddo
+
+      call MPI_Init(ierror)
+
+      ctx = PGACreate         (PGA_DATATYPE_INTEGER, 10, PGA_MAXIMIZE)
+      call PGASetUserFunction (ctx, PGA_USERFUNCTION_MUTATION,
+     &                         myMutation)
+      call PGASetIntegerInitRange(ctx, lower, upper)
+      call PGASetUp              (ctx)
+      call PGARun                (ctx, evaluate)
+      call PGADestroy            (ctx)
+
+      call MPI_Finalize(ierror)
+
+      stop
+      end
+
+
+      integer function myMutation(ctx, p, pop, pm)
+      include          'pgapackf.h'
+      integer ctx
+      integer           p, pop
+      double precision  pm
+      integer           stringlen, i, k, count
+
+      count = 0
+      stringlen = PGAGetStringLength(ctx)
+      do i=1, stringlen
+         if (PGARandomFlip(ctx, pm) .eq. PGA_TRUE) then
+            k = PGARandomInterval(ctx, 1, stringlen)
+            call PGASetIntegerAllele(ctx, p, pop, i, k)
+            count = count + 1
+         endif
+      enddo
+      myMutation = count
+      return
+      end
+
+
+      double precision function evaluate(ctx, p, pop)
+      include          'pgapackf.h'
+      integer ctx
+      integer          p, pop
+      integer          stringlen, i, sum
+
+      sum = 0
+      stringlen = PGAGetStringLength(ctx)
+      do i=1, stringlen
+         sum = sum + PGAGetIntegerAllele(ctx, p, pop, i)
+      enddo
+      evaluate = sum
+      return
+      end
Index: trunk/optimizer/src/pgapack/pgapack/examples/fortran/maxbit.f
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/fortran/maxbit.f	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/fortran/maxbit.f	(revision 816)
@@ -0,0 +1,55 @@
+c     
+c     This is a test program for PGAPack.  The objective is to maximize the
+c     number of 1-bits in a chromosome.
+c     
+
+      include 'pgapackf.h'
+
+      double precision NumberOfSetBits
+      external         NumberOfSetBits
+      
+c     
+c     user main program
+c     
+      integer ctx
+      integer       ierror
+
+      call MPI_Init(ierror)
+
+      ctx = PGACreate(PGA_DATATYPE_BINARY, 256, PGA_MAXIMIZE)
+      call PGASetRandomSeed(ctx, 1)
+
+      call PGASetUp(ctx)
+      call PGARun(ctx, NumberOfSetBits)
+      call PGADestroy(ctx)
+
+      call MPI_Finalize(ierror)
+
+      stop
+      end
+
+
+c     
+c     user defined evaluation function
+c     ctx - contex variable
+c     p   - chromosome index in population
+c     pop - which population to refer to
+c     
+      double precision function NumberOfSetBits(ctx, p, pop) 
+      include    'pgapackf.h'
+      integer ctx
+      integer     p, pop
+      integer     i, nbits, stringlen
+
+      stringlen = PGAGetStringLength(ctx)
+      
+      nbits = 0
+      do i=1, stringlen
+         if (PGAGetBinaryAllele(ctx, p, pop, i) .eq. 1) then
+            nbits = nbits + 1
+         endif
+      enddo
+
+      NumberOfSetBits = dble(nbits)
+      return
+      end
Index: trunk/optimizer/src/pgapack/pgapack/examples/fortran/maxchar.f
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/fortran/maxchar.f	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/fortran/maxchar.f	(revision 816)
@@ -0,0 +1,123 @@
+c     Does not work, run it and see what happens.
+
+
+c       
+c     This is a test program for PGAPack.  The objective is to 
+c     maximize the number of 'z's in a chromosome.
+c       
+
+      include 'pgapackf.h'
+      include 'mpif.h'
+      
+      double precision NumberOfZs
+      integer          myMutation
+      integer          GetIntegerParameter
+      external         NumberOfZs
+      external         myMutation
+      external         GetIntegerParameter
+      
+      integer ctx
+      integer          len, maxiter, ierror
+      
+c     
+c     user main program
+c     
+      call MPI_Init(ierror)
+      
+      len     = GetIntegerParameter('String length?      ')
+      maxiter = GetIntegerParameter('How many iterations?')
+      
+      ctx     = PGACreate(PGA_DATATYPE_CHARACTER, len, PGA_MAXIMIZE)
+      
+      call PGASetRandomSeed(ctx, 1)
+      call PGASetMaxGAIterValue(ctx, maxiter)
+      call PGASetUserFunction(ctx, PGA_USERFUNCTION_MUTATION,
+     &     myMutation)
+      
+      call PGASetUp(ctx)
+      call PGARun(ctx, NumberOfZs)
+      call PGADestroy(ctx)
+      
+      call MPI_Finalize(ierror)
+      
+      stop
+      end
+      
+
+
+c
+c     user defined evaluation function
+c     ctx - contex variable
+c     p   - chromosome index in population
+c     pop - which population to refer to
+c     
+      double precision function NumberOfZs(ctx, p, pop)
+      include     'pgapackf.h'
+      integer ctx
+      integer      p, pop, i, nzs, stringlen
+      
+      stringlen = PGAGetStringLength(ctx)
+      
+      nzs = 0
+      do i=1, stringlen
+         if (PGAGetCharacterAllele(ctx, p, pop, i) .eq. 'z') then
+            nzs = nzs + 1
+         endif
+      enddo
+      
+      NumberOfZs = dble(nzs)
+      return
+      end
+
+
+
+c     Custom mutation function.  Searches for an unset bit, 
+c     then sets it.  Returns the number of bits that are changed.
+c     
+      integer function myMutation(ctx, p, pop, mr)
+      include          'pgapackf.h'
+      integer ctx
+      integer           p, pop, i, count
+      character         c
+      double precision  mr
+
+
+      count = 0
+      do i=PGAGetStringLength(ctx), 1, -1
+         if (PGARandomFlip(ctx, mr) .eq. 1) then
+            c = PGAGetCharacterAllele(ctx, p, pop, i)
+            if (c .ne. 'z') then
+               call PGASetCharacterAllele(ctx, p, pop, i,
+     &              char(ichar(c)+1))
+               count = count + 1
+            endif
+         endif
+      enddo
+      
+      myMutation = count
+      return
+      end
+
+
+c     Get an integer parameter from the user.  Since this is
+c     typically a parallel program, we must only do I/O on the
+c     "master" process -- process 0.  Once we read the parameter,
+c     we broadcast it to all the other processes, then every 
+c     process returns the correct value.
+c     
+      integer function GetIntegerParameter(query)
+      include      'pgapackf.h'
+      include      'mpif.h'
+      character*20  query
+      integer       rank, tmp
+
+      call MPI_Comm_rank(MPI_COMM_WORLD, rank, ierror)
+      if (rank .eq. 0) then
+         print *, query
+         read *, tmp
+      endif
+      call MPI_Bcast(tmp, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierror)
+
+      GetIntegerParameter = tmp
+      return
+      end
Index: trunk/optimizer/src/pgapack/pgapack/examples/fortran/maxint.f
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/fortran/maxint.f	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/fortran/maxint.f	(revision 816)
@@ -0,0 +1,113 @@
+c     
+c     This is a test program for PGAPack.  The objective is to 
+c     maximize each allele.  The evaluation function sums all allele
+c     values.
+c     
+
+      include 'pgapackf.h'
+      include 'mpif.h'
+
+      double precision evaluate
+      integer          myMutation
+      integer          GetIntegerParameter
+      external         GetIntegerParameter, evaluate, myMutation
+
+c     
+c     user main program
+c     
+      integer ctx
+      integer    len, maxiter, ierror
+
+
+      call MPI_Init(ierror)
+
+      len     = GetIntegerParameter('String length?      ')
+      maxiter = GetIntegerParameter('How many iterations?')
+
+      ctx = PGACreate(PGA_DATATYPE_INTEGER, len, PGA_MAXIMIZE)
+
+      call PGASetRandomSeed(ctx, 1)
+      call PGASetUserFunction(ctx, PGA_USERFUNCTION_MUTATION,
+     &     myMutation)
+      call PGASetIntegerInitPermute(ctx, 1, len)
+
+      call PGASetMaxGAIterValue(ctx, maxiter)
+      call PGASetNumReplaceValue(ctx, 90)
+      call PGASetMutationAndCrossoverFlag(ctx, PGA_TRUE)
+      call PGASetPrintOptions(ctx, PGA_REPORT_AVERAGE)
+
+      call PGASetUp(ctx)
+
+      call PGARun(ctx, evaluate)
+      call PGADestroy(ctx)
+
+      call MPI_Finalize(ierror)
+
+      stop
+      end
+
+c     Custom mutation function.  Searches for an unset bit, 
+c     then sets it.  Returns the number of bits that are changed.
+c     
+      integer function myMutation(ctx, p, pop, mr)
+      include          'pgapackf.h'
+      integer ctx, p, pop
+      double precision  mr
+      integer           stringlen, i, v, count
+
+      stringlen = PGAGetStringLength(ctx)
+      count     = 0
+
+      do i=stringlen, 1, -1
+         if (PGARandomFlip(ctx, mr) .eq. PGA_TRUE) then
+	    v = PGARandomInterval(ctx, 1, stringlen)
+            call PGASetIntegerAllele(ctx, p, pop, i, v)
+	    count = count + 1
+         endif
+      enddo
+
+      myMutation = count
+      return
+      end
+
+
+      double precision function evaluate(ctx, p, pop)
+      include  'pgapackf.h'
+      integer ctx, p, pop
+      integer   stringlen, i, sum
+
+
+      stringlen = PGAGetStringLength(ctx)
+      sum       = 0
+
+      do i=stringlen, 1, -1
+         sum = sum + PGAGetIntegerAllele(ctx, p, pop, i) 
+      enddo
+
+      evaluate = dble(sum)
+      return
+      end
+
+
+c     Get an integer parameter from the user.  Since this is
+c     typically a parallel program, we must only do I/O on the
+c     "master" process -- process 0.  Once we read the parameter,
+c     we broadcast it to all the other processes, then every 
+c     process returns the correct value.
+c     
+      integer function GetIntegerParameter(query)
+      include      'pgapackf.h'
+      include      'mpif.h'
+      character*20  query
+      integer       rank, tmp, ierror
+
+      call MPI_Comm_rank(MPI_COMM_WORLD, rank, ierror)
+      if (rank .eq. 0) then
+         print *, query
+         read *, tmp
+      endif
+      call MPI_Bcast(tmp, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierror)
+
+      GetIntegerParameter = tmp
+      return
+      end
Index: trunk/optimizer/src/pgapack/pgapack/examples/fortran/name.f
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/fortran/name.f	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/fortran/name.f	(revision 816)
@@ -0,0 +1,161 @@
+c  PGAPack test program.
+c
+c  The objective is to evolve a string of characters to match a string
+c  supplied by the user.  We will stop evolving when either we run out
+c  of iterations (500), or when the best string has the same evaluation
+c  value for 100 generations.
+c
+c  One problem with this implementation is that ' ' is not in
+c  PGA_DATATYPE_CHAR if we limit it using PGA_CINIT_MIXED, PGA_CINIT_LOWER,
+c  or PGA_CINIT_UPPER.  To fix this, we must define our own interval, and
+c  thus, our own mutation, initialization operators.
+c
+c  A user function is also used to check the "done" condition; we are 
+c  done if we've done more than 1000 iterations, or the evolved string
+c  is correct.
+c
+c  Created 28 Sep 95, Brian P. Walenz.  Thanks to Dan Ashlock for the idea.
+c
+      include 'pgapackf.h'
+
+      
+
+      integer          N_Mutation
+      integer          N_StopCond
+      double precision EvalName
+      
+      external   N_Mutation
+      external   N_StopCond
+      external   EvalName
+      external   N_InitString
+
+
+c     I'm not claiming to be a FORTRAN hacker, so if you want to use
+c     a string other than what is supplied, you must change the lengths 
+c     to correspond to the length of the new string.
+c     Also, this is common, sunce we need it in EvalName.
+      character*33     Name
+      common /global/  Name
+
+      integer ctx
+      integer    ierror
+
+
+      call MPI_Init(ierror)
+
+c             123456789012345678901234567890123
+      Name = 'Levine, Hallstrom, Noelle, Walenz'
+
+      ctx = PGACreate(PGA_DATATYPE_CHARACTER, 33, PGA_MAXIMIZE)
+    
+      call PGASetRandomSeed(ctx, 1)
+    
+      call PGASetUserFunction(ctx, PGA_USERFUNCTION_INITSTRING,
+     &     N_InitString)
+      call PGASetUserFunction(ctx, PGA_USERFUNCTION_MUTATION,
+     &     N_Mutation)
+      call PGASetUserFunction(ctx, PGA_USERFUNCTION_STOPCOND,
+     &     N_StopCond)
+
+      call PGASetPopSize(ctx, 100)
+      call PGASetNumReplaceValue(ctx, 75)
+      call PGASetPopReplaceType(ctx, PGA_POPREPL_BEST)
+    
+      call PGASetCrossoverProb(ctx, 0.0d0)
+      call PGASetMutationOrCrossoverFlag(ctx, PGA_TRUE)
+    
+      call PGASetMaxGAIterValue(ctx, 100)
+    
+      call PGASetUp(ctx)
+      call PGARun(ctx, EvalName)
+      call PGADestroy(ctx)
+
+      call MPI_Finalize(ierror)
+
+      stop
+      end
+
+
+c     Function to randomly initialize a PGA_DATATYPE_CHARACTER string 
+c     using all printable ASCII characters for the range.
+c
+      subroutine N_InitString(ctx, p, pop) 
+      include    'pgapackf.h'
+      integer ctx
+      integer     p, pop, i
+    
+      do i=1, PGAGetStringLength(ctx)
+         call PGASetCharacterAllele(ctx, p, pop, i,
+     &        char(PGARandomInterval(ctx, 32, 126)))
+      enddo
+
+      return
+      end
+
+c     Function to muatate a PGA_DATATYPE_CHARACTER string.  This is 
+c     done by simply picking allele locations, and replacing whatever 
+c     was there with a new value.  Again, legal values are all
+c     printable ASCII characters.
+c
+      integer function N_Mutation(ctx, p, pop, mr)
+      include          'pgapackf.h'
+      integer ctx
+      integer           p, pop, i, count
+      double precision  mr
+
+      count = 0
+
+      do i=1, PGAGetStringLength(ctx)
+         if (PGARandomFlip(ctx, mr) .eq. PGA_TRUE) then
+            call PGASetCharacterAllele(ctx, p, pop, i,
+     &           char(PGARandomInterval(ctx, 32, 126)))
+            count = count + 1
+         endif
+      enddo
+           
+      N_Mutation = count
+      return
+      end
+
+
+
+      integer function N_StopCond(ctx) 
+      include   'pgapackf.h'
+      include   'mpif.h'
+      integer ctx
+      integer    done, best
+
+
+      done = PGACheckStoppingConditions(ctx, MPI_COMM_WORLD)
+      best = PGAGetBestIndex(ctx, PGA_OLDPOP)
+      if ((done .eq. PGA_FALSE) .and. 
+     &     (PGAGetEvaluation(ctx, best, PGA_OLDPOP) .eq.
+     &      PGAGetStringLength(ctx))) then
+         done = PGA_TRUE
+      endif
+
+      N_StopCond = done
+      return
+      end
+
+    
+c     Evaluate the string.  A highly fit string will have many of
+c     the characters matching Name.
+c
+      double precision function EvalName(ctx, p, pop)
+      include          'pgapackf.h'
+      integer ctx
+      integer           p, pop, i, count
+      character         Name(33)
+      common /global/   Name
+    
+      count = 0
+      do i=PGAGetStringLength(ctx), 1, -1
+         if (PGAGetCharacterAllele(ctx, p, pop, i) .eq. Name(i)) then
+            count = count + 1
+         endif
+      enddo
+
+      EvalName = dble(count)
+      return
+      end
Index: trunk/optimizer/src/pgapack/pgapack/examples/fortran/namefull.f
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/fortran/namefull.f	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/fortran/namefull.f	(revision 816)
@@ -0,0 +1,303 @@
+c  PGAPack test program.
+c
+c  The objective is to evolve a string of characters to match a string
+c  supplied by the user.  We will stop evolving when either we run out
+c  of iterations (500), or when the best string has the same evaluation
+c  value for 100 generations.
+c
+c  One problem with this implementation is that ' ' is not in
+c  PGA_DATATYPE_CHAR if we limit it using PGA_CINIT_MIXED, PGA_CINIT_LOWER,
+c  or PGA_CINIT_UPPER.  To fix this, we must define our own interval, and
+c  thus, our own mutation, initialization operators.
+c
+c  A user function is also used to check the "done" condition; we are 
+c  done if we've done more than 1000 iterations, or the evolved string
+c  is correct.
+c
+c  Created 28 Sep 95, Brian P. Walenz.  Thanks to Dan Ashlock for the idea.
+c
+      include 'pgapackf.h'
+
+      
+
+      integer          N_Mutation
+      integer          N_Duplicate
+      integer          N_StopCond
+      double precision EvalName
+      
+      external   N_Mutation
+      external   N_Duplicate
+      external   N_StopCond
+      external   EvalName
+      external   N_Crossover
+      external   N_InitString
+      external   N_PrintString
+      external   N_EndOfGeneration
+
+c     I'm not claiming to be a FORTRAN hacker, so if you want to use
+c     a string other than what is supplied, you must change the lengths 
+c     to correspond to the length of the new string.
+c     Also, this is common, sunce we need it in EvalName.
+      character*70     Name
+      common /global/  Name
+
+      integer ctx
+      integer    ierror
+
+
+      call MPI_Init(ierror)
+
+      Name = 'David M. Levine, Philip L. Hallstrom, David M. Noelle,'
+     &        // ' Brian P. Walenz'
+
+      ctx = PGACreate(PGA_DATATYPE_CHARACTER, 70, PGA_MAXIMIZE)
+    
+      call PGASetRandomSeed(ctx, 42)
+    
+      call PGASetUserFunction(ctx, PGA_USERFUNCTION_INITSTRING,
+     &     N_InitString)
+      call PGASetUserFunction(ctx, PGA_USERFUNCTION_MUTATION,
+     &     N_Mutation)
+      call PGASetUserFunction(ctx, PGA_USERFUNCTION_CROSSOVER,
+     &     N_Crossover)
+      call PGASetUserFunction(ctx, PGA_USERFUNCTION_DUPLICATE,
+     &     N_Duplicate)
+      call PGASetUserFunction(ctx, PGA_USERFUNCTION_STOPCOND,
+     &     N_StopCond)
+      call PGASetUserFunction(ctx, PGA_USERFUNCTION_ENDOFGEN,
+     &     N_EndOfGeneration)
+      call PGASetUserFunction(ctx, PGA_USERFUNCTION_PRINTSTRING,
+     &     N_PrintString)
+
+c     We don't want to report anything.
+      call PGASetPrintFrequencyValue(ctx, 10000)
+
+      call PGASetPopSize(ctx, 100)
+      call PGASetNumReplaceValue(ctx, 90)
+      call PGASetPopReplaceType(ctx, PGA_POPREPL_BEST)
+
+      call PGASetNoDuplicatesFlag(ctx, PGA_TRUE)
+
+      call PGASetMaxGAIterValue(ctx, 100)
+    
+      call PGASetUp(ctx)
+      call PGARun(ctx, EvalName)
+      call PGADestroy(ctx)
+
+      call MPI_Finalize(ierror)
+
+      stop
+      end
+
+
+c     Function to randomly initialize a PGA_DATATYPE_CHARACTER string 
+c     using all printable ASCII characters for the range.
+c
+      subroutine N_InitString(ctx, p, pop) 
+      include   'pgapackf.h'
+      integer ctx
+      integer    p, pop, i
+    
+      do i=PGAGetStringLength(ctx), 1, -1
+         call PGASetCharacterAllele(ctx, p, pop, i,
+     &        char(PGARandomInterval(ctx, 32, 126)))
+      enddo
+
+      return
+      end
+
+
+c     Function to crossover two name strings.  Quite an interesting
+c     crossover, too.  Works like a normal uniform crossover, except
+c     that, if one of the strings matches the correct value, we set
+c     BOTH children to the correct value 50% of the time.
+c
+      subroutine N_Crossover(ctx, p1, p2, pop1, c1, c2, pop2)
+      include          'pgapackf.h'
+      character         Name(70)
+      common /global/   Name
+      integer ctx
+      integer           p1, p2, pop1, c1, c2, pop2
+      integer           i, length
+      character         a, b
+
+      length = PGAGetStringLength(ctx)
+
+      do i=1, length
+         a = PGAGetCharacterAllele(ctx, p1, pop1, i)
+         b = PGAGetCharacterAllele(ctx, p2, pop1, i)
+         if ((a .eq. Name(i)) .or. (b .eq. Name(i))) then
+            a = Name(i)
+            b = Name(i)
+         endif
+
+         if (PGARandomFlip(ctx, 0.5d0) .eq. PGA_TRUE) then
+            call PGASetCharacterAllele(ctx, c1, pop2, i, a)
+            call PGASetCharacterAllele(ctx, c2, pop2, i, b)
+         else
+            call PGASetCharacterAllele(ctx, c1, pop2, i, b)
+            call PGASetCharacterAllele(ctx, c2, pop2, i, a)
+         endif
+      enddo
+   
+      return
+      end
+
+
+c     Function to compare two strings.  Strings are "equalivalent"
+c     if they match Name at the same alleles (and, thus, disagree at the
+c     same alleles).  We don't care what the disagreement is, just that
+c     it is there.
+c
+      integer function N_Duplicate(ctx, p1, pop1, p2, pop2)
+      include          'pgapackf.h'
+      character         Name(70)
+      common /global/   Name
+      integer ctx
+      integer           p1, pop1, p2, pop2
+      integer           i, match
+      character         a, b, c
+
+      match = PGA_TRUE
+
+      do i=PGAGetStringLength(ctx), 1, -1
+         a = PGAGetCharacterAllele(ctx, p1, pop1, i)
+         b = PGAGetCharacterAllele(ctx, p2, pop2, i)
+         c = Name(i)
+         if (((a .eq. c) .and. (b .ne. c)) .or.
+     &        ((a .ne. c) .and. (b .eq. c))) then
+            match = PGA_FALSE
+            goto 10
+         endif
+      enddo
+
+ 10   N_Duplicate = match
+      
+      return
+      end
+      
+
+
+c     Function to muatate a PGA_DATATYPE_CHARACTER string.  This is 
+c     done by simply picking allele locations and replacing whatever
+c     was there with a new value.  Again, legal values are all
+c     printable ASCII characters.
+c
+      integer function N_Mutation(ctx, p, pop, mr)
+      include          'pgapackf.h'
+      character         Name(70)
+      common /global/   Name
+      integer ctx
+      integer           p, pop, i, count
+      double precision  mr
+
+      count = 0
+
+      do i=PGAGetStringLength(ctx), 1, -1
+         if (PGAGetCharacterAllele(ctx, p, pop, i) .ne. Name(i)) then
+            if (PGARandomFlip(ctx, mr) .eq. PGA_TRUE) then
+               call PGASetCharacterAllele(ctx, p, pop, i,
+     &              char(PGARandomInterval(ctx, 32, 126)))
+               count = count + 1
+            endif
+         endif
+      enddo
+           
+      N_Mutation = count
+      return
+      end
+
+
+c     Function to print a string.  Since fortran does NOT support
+c     C file handles, we just print normally.  If we we're in C,
+c     we would print to the file "file".
+c     
+      subroutine N_PrintString(ctx, file, p, pop)
+      include          'pgapackf.h'
+      integer ctx
+      integer           file, p, pop
+      character         string(70)
+
+      do i=PGAGetStringLength(ctx), 1, -1
+         string(i) = PGAGetCharacterAllele(ctx, p, pop, i)
+      enddo
+
+      print *, ':', string, ':'
+
+      return
+      end
+
+
+
+c     Function to check "doneness" of the GA.  We check the iteration
+c     count (by calling the system PGADone), then check if we have found
+c     the string yet.
+c
+      integer function N_StopCond(ctx) 
+      include          'pgapackf.h'
+      integer ctx
+      integer           done, best
+
+
+      done = PGACheckStoppingConditions(ctx)
+
+      best = PGAGetBestIndex(ctx, PGA_OLDPOP)
+      if ((done .eq. PGA_FALSE) .and. 
+     &     (PGAGetEvaluation(ctx, best, PGA_OLDPOP) .eq.
+     &      PGAGetStringLength(ctx))) then
+         done = PGA_TRUE
+      endif
+
+      N_StopCond = done
+      return
+      end
+
+c     After each generation, this routine is called.  What is done here,
+c     is to print the best string in our own format, then check if the
+c     best string is close to the correct value.  If it is, duplicate
+c     checking is tunred off.  This is critical, as the mutation operator
+c     will not degrade a string, so when the strings get near the correct
+c     solution, they all become duplicates, but none can be changed!
+c
+c     Other applications have done such things as send the best string 
+c     to another process to be visualized.  For here, we just call our
+c     print string function to print the best string.
+c
+      subroutine N_EndOfGeneration(ctx)
+      include          'pgapackf.h'
+      integer ctx
+      integer           best
+
+      best = PGAGetBestIndex(ctx, PGA_NEWPOP)
+
+      call N_PrintString(ctx, 0, best, PGA_NEWPOP)
+
+      if (PGAGetEvaluation(ctx, best, PGA_NEWPOP) .ge.
+     &     PGAGetStringLength(ctx)-10) then
+         call PGASetNoDuplicatesFlag(ctx, PGA_FALSE)
+      endif
+      
+      return
+      end
+      
+    
+c     Evaluate the string.  A highly fit string will have many of
+c     the characters matching Name.
+c
+      double precision function EvalName(ctx, p, pop)
+      include          'pgapackf.h'
+      integer ctx
+      integer           p, pop, i, count
+      character         Name(70)
+      common /global/   Name
+    
+      count = 0
+      do i=PGAGetStringLength(ctx), 1, -1
+         if (PGAGetCharacterAllele(ctx, p, pop, i) .eq. Name(i)) then
+            count = count + 1
+         endif
+      enddo
+
+      EvalName = dble(count)
+      return
+      end
Index: trunk/optimizer/src/pgapack/pgapack/examples/fortran/pgapackf.h
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/fortran/pgapackf.h	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/fortran/pgapackf.h	(revision 816)
@@ -0,0 +1,1 @@
+link ../../include/pgapackf.h
Index: trunk/optimizer/src/pgapack/pgapack/examples/mgh/Makefile
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/mgh/Makefile	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/mgh/Makefile	(revision 816)
@@ -0,0 +1,56 @@
+# Generated automatically from Makefile.in by configure.
+FC        = f77
+PREFFLAGS = -w
+RM        = /bin/rm -f
+LDFLAGS   = -s  -L/Volumes/Data_mo/GENES/Software/pgapack/lib/linux  -lpgaO  /Volumes/Data_mo/GENES/Software/mpich-1.2.7p1/lib/libmpich.a -lm
+
+SHELL     = /bin/sh
+RANLIB    = ranlib
+MGHDIR    = .
+
+FFLAGS    = -o $@ $(PREFFLAGS)
+
+COMPILE.f = @$(FC) $(FFLAGS) -c
+
+OBJS = grdfcn77.o hesfcn77.o objfcn77.o ssqfcn77.o ssqjac77.o vecfcn77.o \
+       vecjac77.o
+
+default:
+	@echo "Compiling mgh library"
+	@make tprobs.a
+	@echo "Compiling mgh testprog"
+	@make testprog
+
+tprobs.a: $(OBJS)
+	@ar ruv tprobs.a $(OBJS)
+	@$(RANLIB) tprobs.a
+
+gradfcn77.o: gradfcn77.f
+	$(COMPILE.f) gradfcn77.f
+
+hesfcn77.o: hesfcn77.f
+	$(COMPILE.f) hesfcn77.f
+
+objfcn77.o: objfcn77.f
+	$(COMPILE.f) objfcn77.f
+
+ssqfcn77.o: ssqfcn77.f
+	$(COMPILE.f) ssqfcn77.f
+
+ssqjac77.o: ssqjac77.f
+	$(COMPILE.f) ssqjac77.f
+
+vecfcn77.o: vecfcn77.f
+	$(COMPILE.f) vecfcn77.f
+
+vecjac77.o: vecjac77.f
+	$(COMPILE.f) vecjac77.f
+
+testprog: testprog.f
+	@if test ! -f "$(MGHDIR)/tprobs.a"; then\
+		cd $(MGHDIR); make tprobs;\
+	fi
+	@$(FC) $(FFLAGS) testprog.f $(MGHDIR)/tprobs.a $(LDFLAGS)
+
+clean:
+	@$(RM) $(OBJS) tprobs.a testprog
Index: trunk/optimizer/src/pgapack/pgapack/examples/mgh/Makefile.in
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/mgh/Makefile.in	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/mgh/Makefile.in	(revision 816)
@@ -0,0 +1,55 @@
+FC        = @FC@
+PREFFLAGS = @FFLAGS@
+RM        = @RM@
+LDFLAGS   = @LDFLAGS@
+
+SHELL     = @SHELL@
+RANLIB    = @RANLIB@
+MGHDIR    = .
+
+FFLAGS    = -o $@ $(PREFFLAGS)
+
+COMPILE.f = @$(FC) $(FFLAGS) -c
+
+OBJS = grdfcn77.o hesfcn77.o objfcn77.o ssqfcn77.o ssqjac77.o vecfcn77.o \
+       vecjac77.o
+
+default:
+	@echo "Compiling mgh library"
+	@make tprobs.a
+	@echo "Compiling mgh testprog"
+	@make testprog
+
+tprobs.a: $(OBJS)
+	@ar ruv tprobs.a $(OBJS)
+	@$(RANLIB) tprobs.a
+
+gradfcn77.o: gradfcn77.f
+	$(COMPILE.f) gradfcn77.f
+
+hesfcn77.o: hesfcn77.f
+	$(COMPILE.f) hesfcn77.f
+
+objfcn77.o: objfcn77.f
+	$(COMPILE.f) objfcn77.f
+
+ssqfcn77.o: ssqfcn77.f
+	$(COMPILE.f) ssqfcn77.f
+
+ssqjac77.o: ssqjac77.f
+	$(COMPILE.f) ssqjac77.f
+
+vecfcn77.o: vecfcn77.f
+	$(COMPILE.f) vecfcn77.f
+
+vecjac77.o: vecjac77.f
+	$(COMPILE.f) vecjac77.f
+
+testprog: testprog.f
+	@if test ! -f "$(MGHDIR)/tprobs.a"; then\
+		cd $(MGHDIR); make tprobs;\
+	fi
+	@$(FC) $(FFLAGS) testprog.f $(MGHDIR)/tprobs.a $(LDFLAGS)
+
+clean:
+	@$(RM) $(OBJS) tprobs.a testprog
Index: trunk/optimizer/src/pgapack/pgapack/examples/mgh/README
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/mgh/README	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/mgh/README	(revision 816)
@@ -0,0 +1,7 @@
+This directory contains the FORTRAN source code of a battery of 18
+unconstrained minimization problems and a program to run them.  These problems
+are the 18 listed on page 30 of the following article:
+
+More, Jorge J., Burton S. Garbow, and Kenneth E. Hillstrom.  "Testing
+	Unconstrained Optimization Software."  ACM Transactions on
+	Mathematical Software, Vol. 7, No. 1, March 1981.  Pages 17-41.
Index: trunk/optimizer/src/pgapack/pgapack/examples/mgh/grdfcn77.f
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/mgh/grdfcn77.f	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/mgh/grdfcn77.f	(revision 816)
@@ -0,0 +1,434 @@
+      subroutine grdfcn(n,x,g,nprob)
+      integer n,nprob
+      double precision x(n),g(n)
+c     **********
+c
+c     subroutine grdfcn
+c
+c     This subroutine defines the gradient vectors of eighteen
+c     nonlinear unconstrained minimization problems. The problem
+c     dimensions are as described in the prologue comments of objfcn.
+c
+c     The subroutine statement is
+c
+c       subroutine grdfcn(n,x,g,nprob)
+c
+c     where
+c
+c       n is a positive integer input variable.
+c
+c       x is an input array of length n.
+c
+c       g is an output array of length n which contains the components
+c         of the gradient vector of the nprob objective function
+c         evaluated at x.
+c
+c       nprob is a positive integer input variable which defines the
+c         number of the problem. nprob must not exceed 18.
+c
+c     Subprograms called
+c
+c       FORTRAN-supplied ... abs,atan,cos,dble,exp,log,sign,sin,sqrt
+c
+c     Argonne National Laboratory. MINPACK Project. march 1980.
+c     Burton S. Garbow, Kenneth E. Hillstrom, Jorge J. More
+c
+c     **********
+      integer i,iev,j
+      double precision ap,arg,c2pdm6,cp0001,cp1,cp2,cp25,cp5,c1p5,
+     *                 c2p25,c2p625,c3p5,c19p8,c20p2,c25,c29,c100,
+     *                 c180,c200,c10000,c1pd6,d1,d2,eight,fifty,five,
+     *                 four,one,r,s1,s2,s3,t,t1,t2,t3,ten,th,three,
+     *                 tpi,twenty,two,zero
+      double precision fvec(50),y(15)
+      data zero,one,two,three,four,five,eight,ten,twenty,fifty
+     *     /0.0d0,1.0d0,2.0d0,3.0d0,4.0d0,5.0d0,8.0d0,1.0d1,2.0d1,
+     *      5.0d1/
+      data c2pdm6,cp0001,cp1,cp2,cp25,cp5,c1p5,c2p25,c2p625,c3p5,
+     *     c19p8,c20p2,c25,c29,c100,c180,c200,c10000,c1pd6
+     *     /2.0d-6,1.0d-4,1.0d-1,2.0d-1,2.5d-1,5.0d-1,1.5d0,2.25d0,
+     *      2.625d0,3.5d0,1.98d1,2.02d1,2.5d1,2.9d1,1.0d2,1.8d2,2.0d2,
+     *      1.0d4,1.0d6/
+      data ap /1.0d-5/
+      data y(1),y(2),y(3),y(4),y(5),y(6),y(7),y(8),y(9),y(10),y(11),
+     *     y(12),y(13),y(14),y(15)
+     *     /9.0d-4,4.4d-3,1.75d-2,5.4d-2,1.295d-1,2.42d-1,3.521d-1,
+     *      3.989d-1,3.521d-1,2.42d-1,1.295d-1,5.4d-2,1.75d-2,4.4d-3,
+     *      9.0d-4/
+c
+c     Gradient routine selector.
+c
+      go to (10,20,50,70,80,100,130,190,220,260,270,290,310,350,370,
+     *       390,400,410), nprob
+c
+c     Helical valley function.
+c
+   10 continue
+      tpi = eight*atan(one)
+      th = sign(cp25,x(2))
+      if (x(1) .gt. zero) th = atan(x(2)/x(1))/tpi
+      if (x(1) .lt. zero) th = atan(x(2)/x(1))/tpi + cp5
+      arg = x(1)**2 + x(2)**2
+      r = sqrt(arg)
+      t = x(3) - ten*th
+      s1 = ten*t/(tpi*arg)
+      g(1) = c200*(x(1) - x(1)/r + x(2)*s1)
+      g(2) = c200*(x(2) - x(2)/r - x(1)*s1)
+      g(3) = two*(c100*t + x(3))
+      return
+c
+c     Biggs exp6 function.
+c
+   20 continue
+      do 30 j = 1, 6
+         g(j) = zero
+   30    continue
+      do 40 i = 1, 13
+         d1 = dble(i)/ten
+         d2 = exp(-d1) - five*exp(-ten*d1) + three*exp(-four*d1)
+         s1 = exp(-d1*x(1))
+         s2 = exp(-d1*x(2))
+         s3 = exp(-d1*x(5))
+         t = x(3)*s1 - x(4)*s2 + x(6)*s3 - d2
+         th = d1*t
+         g(1) = g(1) - s1*th
+         g(2) = g(2) + s2*th
+         g(3) = g(3) + s1*t
+         g(4) = g(4) - s2*t
+         g(5) = g(5) - s3*th
+         g(6) = g(6) + s3*t
+   40    continue
+      g(1) = two*x(3)*g(1)
+      g(2) = two*x(4)*g(2)
+      g(3) = two*g(3)
+      g(4) = two*g(4)
+      g(5) = two*x(6)*g(5)
+      g(6) = two*g(6)
+      return
+c
+c     Gaussian function.
+c
+   50 continue
+      g(1) = zero
+      g(2) = zero
+      g(3) = zero
+      do 60 i = 1, 15
+         d1 = cp5*dble(i-1)
+         d2 = c3p5 - d1 - x(3)
+         arg = -cp5*x(2)*d2**2
+         r = exp(arg)
+         t = x(1)*r - y(i)
+         s1 = r*t
+         s2 = d2*s1
+         g(1) = g(1) + s1
+         g(2) = g(2) - d2*s2
+         g(3) = g(3) + s2
+   60    continue
+      g(1) = two*g(1)
+      g(2) = x(1)*g(2)
+      g(3) = two*x(1)*x(2)*g(3)
+      return
+c
+c     Powell badly scaled function.
+c
+   70 continue
+      t1 = c10000*x(1)*x(2) - one
+      s1 = exp(-x(1))
+      s2 = exp(-x(2))
+      t2 = s1 + s2 - one - cp0001
+      g(1) = two*(c10000*x(2)*t1 - s1*t2)
+      g(2) = two*(c10000*x(1)*t1 - s2*t2)
+      return
+c
+c     Box 3-dimensional function.
+c
+   80 continue
+      g(1) = zero
+      g(2) = zero
+      g(3) = zero
+      do 90 i = 1, 10
+         d1 = dble(i)
+         d2 = d1/ten
+         s1 = exp(-d2*x(1))
+         s2 = exp(-d2*x(2))
+         s3 = exp(-d2) - exp(-d1)
+         t = s1 - s2 - s3*x(3)
+         th = d2*t
+         g(1) = g(1) - s1*th
+         g(2) = g(2) + s2*th
+         g(3) = g(3) - s3*t
+   90    continue
+      g(1) = two*g(1)
+      g(2) = two*g(2)
+      g(3) = two*g(3)
+      return
+c
+c     Variably dimensioned function.
+c
+  100 continue
+      t1 = zero
+      do 110 j = 1, n
+         t1 = t1 + dble(j)*(x(j) - one)
+  110    continue
+      t = t1*(one + two*t1**2)
+      do 120 j = 1, n
+         g(j) = two*(x(j) - one + dble(j)*t)
+  120    continue
+      return
+c
+c     Watson function.
+c
+  130 continue
+      do 140 j = 1, n
+         g(j) = zero
+  140    continue
+      do 180 i = 1, 29
+         d1 = dble(i)/c29
+         s1 = zero
+         d2 = one
+         do 150 j = 2, n
+            s1 = s1 + dble(j-1)*d2*x(j)
+            d2 = d1*d2
+  150       continue
+         s2 = zero
+         d2 = one
+         do 160 j = 1, n
+            s2 = s2 + d2*x(j)
+            d2 = d1*d2
+  160       continue
+         t = s1 - s2**2 - one
+         s3 = two*d1*s2
+         d2 = two/d1
+         do 170 j = 1, n
+            g(j) = g(j) + d2*(dble(j-1) - s3)*t
+            d2 = d1*d2
+  170       continue
+  180    continue
+      t1 = x(2) - x(1)**2 - one
+      g(1) = g(1) + x(1)*(two - four*t1)
+      g(2) = g(2) + two*t1
+      return
+c
+c     Penalty function I.
+c
+  190 continue
+      t1 = -cp25
+      do 200 j = 1, n
+         t1 = t1 + x(j)**2
+  200    continue
+      d1 = two*ap
+      th = four*t1
+      do 210 j = 1, n
+         g(j) = d1*(x(j) - one) + x(j)*th
+  210    continue
+      return
+c
+c     Penalty function II.
+c
+  220 continue
+      t1 = -one
+      do 230 j = 1, n
+         t1 = t1 + dble(n-j+1)*x(j)**2
+  230    continue
+      d1 = exp(cp1)
+      d2 = one
+      th = four*t1
+      do 250 j = 1, n
+         g(j) = dble(n-j+1)*x(j)*th
+         s1 = exp(x(j)/ten)
+         if (j .gt. 1) then
+            s3 = s1 + s2 - d2*(d1 + one)
+            g(j) = g(j) + ap*s1*(s3 + s1 - one/d1)/five
+            g(j-1) = g(j-1) + ap*s2*s3/five
+            end if
+         s2 = s1
+         d2 = d1*d2
+  250    continue
+      g(1) = g(1) + two*(x(1) - cp2)
+      return
+c
+c     Brown badly scaled function.
+c
+  260 continue
+      t1 = x(1) - c1pd6
+      t2 = x(2) - c2pdm6
+      t3 = x(1)*x(2) - two
+      g(1) = two*(t1 + x(2)*t3)
+      g(2) = two*(t2 + x(1)*t3)
+      return
+c
+c     Brown and Dennis function.
+c
+  270 continue
+      g(1) = zero
+      g(2) = zero
+      g(3) = zero
+      g(4) = zero
+      do 280 i = 1, 20
+         d1 = dble(i)/five
+         d2 = sin(d1)
+         t1 = x(1) + d1*x(2) - exp(d1)
+         t2 = x(3) + d2*x(4) - cos(d1)
+         t = t1**2 + t2**2
+         s1 = t1*t
+         s2 = t2*t
+         g(1) = g(1) + s1
+         g(2) = g(2) + d1*s1
+         g(3) = g(3) + s2
+         g(4) = g(4) + d2*s2
+  280    continue
+      g(1) = four*g(1)
+      g(2) = four*g(2)
+      g(3) = four*g(3)
+      g(4) = four*g(4)
+      return
+c
+c     Gulf research and development function.
+c
+  290 continue
+      g(1) = zero
+      g(2) = zero
+      g(3) = zero
+      d1 = two/three
+      do 300 i = 1, 99
+         arg = dble(i)/c100
+         r = (-fifty*log(arg))**d1 + c25 - x(2)
+         t1 = abs(r)**x(3)/x(1)
+         t2 = exp(-t1)
+         t = t2 - arg
+         s1 = t1*t2*t
+         g(1) = g(1) + s1
+         g(2) = g(2) + s1/r
+         g(3) = g(3) - s1*log(abs(r))
+  300    continue
+      g(1) = two*g(1)/x(1)
+      g(2) = two*x(3)*g(2)
+      g(3) = two*g(3)
+      return
+c
+c     Trigonometric function.
+c
+  310 continue
+      s1 = zero
+      do 320 j = 1, n
+         g(j) = cos(x(j))
+         s1 = s1 + g(j)
+  320    continue
+      s2 = zero
+      do 330 j = 1, n
+         th = sin(x(j))
+         t = dble(n+j) - th - s1 - dble(j)*g(j)
+         s2 = s2 + t
+         g(j) = (dble(j)*th - g(j))*t
+  330    continue
+      do 340 j = 1, n
+         g(j) = two*(g(j) + sin(x(j))*s2)
+  340    continue
+      return
+c
+c     Extended Rosenbrock function.
+c
+  350 continue
+      do 360 j = 1, n, 2
+         t1 = one - x(j)
+         g(j+1) = c200*(x(j+1) - x(j)**2)
+         g(j) = -two*(x(j)*g(j+1) + t1)
+  360    continue
+      return
+c
+c     Extended Powell function.
+c
+  370 continue
+      do 380 j = 1, n, 4
+         t = x(j) + ten*x(j+1)
+         t1 = x(j+2) - x(j+3)
+         s1 = five*t1
+         t2 = x(j+1) - two*x(j+2)
+         s2 = four*t2**3
+         t3 = x(j) - x(j+3)
+         s3 = twenty*t3**3
+         g(j) = two*(t + s3)
+         g(j+1) = twenty*t + s2
+         g(j+2) = two*(s1 - s2)
+         g(j+3) = -two*(s1 + s3)
+  380    continue
+      return
+c
+c     Beale function.
+c
+  390 continue
+      s1 = one - x(2)
+      t1 = c1p5 - x(1)*s1
+      s2 = one - x(2)**2
+      t2 = c2p25 - x(1)*s2
+      s3 = one - x(2)**3
+      t3 = c2p625 - x(1)*s3
+      g(1) = -two*(s1*t1 + s2*t2 + s3*t3)
+      g(2) = two*x(1)*(t1 + x(2)*(two*t2 + three*x(2)*t3))
+      return
+c
+c     Wood function.
+c
+  400 continue
+      s1 = x(2) - x(1)**2
+      s2 = one - x(1)
+      s3 = x(2) - one
+      t1 = x(4) - x(3)**2
+      t2 = one - x(3)
+      t3 = x(4) - one
+      g(1) = -two*(c200*x(1)*s1 + s2)
+      g(2) = c200*s1 + c20p2*s3 + c19p8*t3
+      g(3) = -two*(c180*x(3)*t1 + t2)
+      g(4) = c180*t1 + c20p2*t3 + c19p8*s3
+      return
+c
+c     Chebyquad function.
+c
+  410 continue
+      do 420 i = 1, n
+         fvec(i) = zero
+  420    continue
+      do 440 j = 1, n
+         t1 = one
+         t2 = two*x(j) - one
+         t = two*t2
+         do 430 i = 1, n
+            fvec(i) = fvec(i) + t2
+            th = t*t2 - t1
+            t1 = t2
+            t2 = th
+  430       continue
+  440    continue
+      d1 = one/dble(n)
+      iev = -1
+      do 450 i = 1, n
+         fvec(i) = d1*fvec(i)
+         if (iev .gt. 0) fvec(i) = fvec(i) + one/(dble(i)**2 - one)
+         iev = -iev
+  450    continue
+      do 470 j = 1, n
+         g(j) = zero
+         t1 = one
+         t2 = two*x(j) - one
+         t = two*t2
+         s1 = zero
+         s2 = two
+         do 460 i = 1, n
+            g(j) = g(j) + fvec(i)*s2
+            th = four*t2 + t*s2 - s1
+            s1 = s2
+            s2 = th
+            th = t*t2 - t1
+            t1 = t2
+            t2 = th
+  460       continue
+  470    continue
+      d2 = two*d1
+      do 480 j = 1, n
+         g(j) = d2*g(j)
+  480    continue
+      return
+c
+c     Last card of subroutine grdfcn.
+c
+      end
Index: trunk/optimizer/src/pgapack/pgapack/examples/mgh/hesfcn77.f
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/mgh/hesfcn77.f	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/mgh/hesfcn77.f	(revision 816)
@@ -0,0 +1,660 @@
+      subroutine hesfcn(n,x,h,ldh,nprob)
+      integer n,ldh,nprob
+      double precision x(n),h(ldh,n)
+c     **********
+c
+c     subroutine hesfcn
+c
+c     This subroutine defines the hessian matrices of eighteen
+c     nonlinear unconstrained minimization problems. The problem
+c     dimensions are as described in the prologue comments of objfcn.
+c     The upper triangle of the (symmetric) hessian matrix is
+c     computed columnwise. Storage locations below the diagonal
+c     are not disturbed until the final step, which reflects the
+c     upper triangle to fill the square matrix.
+c
+c     The subroutine statement is
+c
+c       subroutine hesfcn(n,x,h,ldh,nprob)
+c
+c     where
+c
+c       n is a positive integer input variable.
+c
+c       x is an input array of length n.
+c
+c       h is an output n by n array which contains the hessian
+c         matrix of the nprob objective function evaluated at x.
+c
+c       ldh is a positive integer input variable not less than n
+c         which specifies the leading dimension of the array h.
+c
+c       nprob is a positive integer input variable which defines the
+c         number of the problem. nprob must not exceed 18.
+c
+c     Subprograms called
+c
+c       FORTRAN-supplied ... abs,atan,cos,dble,exp,log,sign,sin,sqrt
+c
+c     Argonne National Laboratory. MINPACK Project. march 1980.
+c     Burton S. Garbow, Kenneth E. Hillstrom, Jorge J. More
+c
+c     **********
+      integer i,iev,j,k
+      double precision ap,arg,cp0001,cp1,cp25,cp5,c1p5,c2p25,
+     *                 c2p625,c3p5,c19p8,c25,c29,c100,c200,c10000,d1,
+     *                 d2,eight,fifty,five,four,one,r,s1,s2,s3,t,t1,
+     *                 t2,t3,ten,th,three,tpi,twenty,two,zero
+      double precision d3,r1,r2,r3,u1,u2,v,v1,v2
+      double precision fvec(50),fvec1(50),y(15)
+      double precision six,xnine,twelve,c120,c200p2,c202,c220p2,c360,
+     *                 c400,c1200
+      data six,xnine,twelve,c120,c200p2,c202,c220p2,c360,c400,c1200
+     *     /6.0d0,9.0d0,1.2d1,1.2d2,2.002d2,2.02d2,2.202d2,3.6d2,
+     *      4.0d2,1.2d3/
+      data zero,one,two,three,four,five,eight,ten,twenty,fifty
+     *     /0.0d0,1.0d0,2.0d0,3.0d0,4.0d0,5.0d0,8.0d0,1.0d1,2.0d1,
+     *      5.0d1/
+      data cp0001,cp1,cp25,cp5,c1p5,c2p25,c2p625,c3p5,c19p8,c25,c29,
+     *     c100,c200,c10000
+     *     /1.0d-4,1.0d-1,2.5d-1,5.0d-1,1.5d0,2.25d0,2.625d0,3.5d0,
+     *      1.98d1,2.5d1,2.9d1,1.0d2,2.0d2,1.0d4/
+      data ap /1.0d-5/
+      data y(1),y(2),y(3),y(4),y(5),y(6),y(7),y(8),y(9),y(10),y(11),
+     *     y(12),y(13),y(14),y(15)
+     *     /9.0d-4,4.4d-3,1.75d-2,5.4d-2,1.295d-1,2.42d-1,3.521d-1,
+     *      3.989d-1,3.521d-1,2.42d-1,1.295d-1,5.4d-2,1.75d-2,4.4d-3,
+     *      9.0d-4/
+c
+c     Hessian routine selector.
+c
+      go to (10,20,60,100,110,170,210,290,330,380,390,450,490,580,620,
+     *       660,670,680), nprob
+c
+c     Helical valley function.
+c
+   10 continue
+      tpi = eight*atan(one)
+      th = sign(cp25,x(2))
+      if (x(1) .gt. zero) th = atan(x(2)/x(1))/tpi
+      if (x(1) .lt. zero) th = atan(x(2)/x(1))/tpi + cp5
+      arg = x(1)**2 + x(2)**2
+      r = sqrt(arg)
+      t = x(3) - ten*th
+      s1 = ten*t/(tpi*arg)
+      t1 = ten/tpi
+      t2 = t1/arg
+      t3 = (x(1)/r - t1*t2*x(1) - two*x(2)*s1)/arg
+      h(1,1) = c200
+     *         *(one - x(2)/arg*(x(2)/r - t1*t2*x(2) + two*x(1)*s1))
+      h(1,2) = c200*(s1 + x(2)*t3)
+      h(2,2) = c200*(one - x(1)*t3)
+      h(1,3) = c200*t2*x(2)
+      h(2,3) = -c200*t2*x(1)
+      h(3,3) = c202
+      go to 800
+c
+c     Biggs exp6 function.
+c
+   20 continue
+      do 40 j = 1, 6
+         do 30 k = 1, j
+            h(k,j) = zero
+   30       continue
+   40    continue
+      do 50 i = 1, 13
+         d1 = dble(i)/ten
+         d2 = exp(-d1) - five*exp(-ten*d1) + three*exp(-four*d1)
+         s1 = exp(-d1*x(1))
+         s2 = exp(-d1*x(2))
+         s3 = exp(-d1*x(5))
+         t = x(3)*s1 - x(4)*s2 + x(6)*s3 - d2
+         th = d1*t
+         r1 = d1*s1
+         r2 = d1*s2
+         r3 = d1*s3
+         h(1,1) = h(1,1) + r1*(th + x(3)*r1)
+         h(1,2) = h(1,2) - r1*r2
+         h(2,2) = h(2,2) - r2*(th - x(4)*r2)
+         h(1,3) = h(1,3) - s1*(th + x(3)*r1)
+         h(3,3) = h(3,3) + s1**2
+         h(1,4) = h(1,4) + r1*s2
+         h(2,4) = h(2,4) + s2*(th - x(4)*r2)
+         h(3,4) = h(3,4) - s1*s2
+         h(4,4) = h(4,4) + s2**2
+         h(1,5) = h(1,5) + r1*r3
+         h(2,5) = h(2,5) - r2*r3
+         h(5,5) = h(5,5) + r3*(th + x(6)*r3)
+         h(1,6) = h(1,6) - r1*s3
+         h(2,6) = h(2,6) + r2*s3
+         h(3,6) = h(3,6) + s1*s3
+         h(4,6) = h(4,6) - s2*s3
+         h(5,6) = h(5,6) - s3*(th + x(6)*r3)
+         h(6,6) = h(6,6) + s3**2
+   50    continue
+      h(1,1) = two*x(3)*h(1,1)
+      h(1,2) = two*x(3)*x(4)*h(1,2)
+      h(2,2) = two*x(4)*h(2,2)
+      h(1,3) = two*h(1,3)
+      h(2,3) = two*x(4)*h(1,4)
+      h(3,3) = two*h(3,3)
+      h(1,4) = two*x(3)*h(1,4)
+      h(2,4) = two*h(2,4)
+      h(3,4) = two*h(3,4)
+      h(4,4) = two*h(4,4)
+      h(1,5) = two*x(3)*x(6)*h(1,5)
+      h(2,5) = two*x(4)*x(6)*h(2,5)
+      h(3,5) = two*x(6)*h(1,6)
+      h(4,5) = two*x(6)*h(2,6)
+      h(5,5) = two*x(6)*h(5,5)
+      h(1,6) = two*x(3)*h(1,6)
+      h(2,6) = two*x(4)*h(2,6)
+      h(3,6) = two*h(3,6)
+      h(4,6) = two*h(4,6)
+      h(5,6) = two*h(5,6)
+      h(6,6) = two*h(6,6)
+      go to 800
+c
+c     Gaussian function.
+c
+   60 continue
+      do 80 j = 1, 3
+         do 70 k = 1, j
+            h(k,j) = zero
+   70       continue
+   80    continue
+      do 90 i = 1, 15
+         d1 = cp5*dble(i-1)
+         d2 = c3p5 - d1 - x(3)
+         arg = -cp5*x(2)*d2**2
+         r = exp(arg)
+         t = x(1)*r - y(i)
+         s1 = r*t
+         s2 = d2*s1
+         t1 = s2 + d2*x(1)*r**2
+         t2 = d2*t1
+         h(1,1) = h(1,1) + r**2
+         h(1,2) = h(1,2) - t2
+         h(2,2) = h(2,2) + d2**2*t2
+         h(1,3) = h(1,3) + t1
+         h(2,3) = h(2,3) + two*s2 - d2*x(2)*t2
+         h(3,3) = h(3,3) + x(2)*t2 - s1
+   90    continue
+      h(1,1) = two*h(1,1)
+      h(1,2) = h(1,2)
+      h(2,2) = cp5*x(1)*h(2,2)
+      h(1,3) = two*x(2)*h(1,3)
+      h(2,3) = x(1)*h(2,3)
+      h(3,3) = two*x(1)*x(2)*h(3,3)
+      go to 800
+c
+c     Powell badly scaled function.
+c
+  100 continue
+      t1 = c10000*x(1)*x(2) - one
+      s1 = exp(-x(1))
+      s2 = exp(-x(2))
+      t2 = s1 + s2 - one - cp0001
+      h(1,1) = two*((c10000*x(2))**2 + s1*(s1 + t2))
+      h(1,2) = two*(c10000*(one + two*t1) + s1*s2)
+      h(2,2) = two*((c10000*x(1))**2 + s2*(s2 + t2))
+      go to 800
+c
+c     Box 3-dimensional function.
+c
+  110 continue
+      do 130 j = 1, 3
+         do 120 k = 1, j
+            h(k,j) = zero
+  120       continue
+  130    continue
+      do 140 i = 1, 10
+         d1 = dble(i)
+         d2 = d1/ten
+         s1 = exp(-d2*x(1))
+         s2 = exp(-d2*x(2))
+         s3 = exp(-d2) - exp(-d1)
+         t = s1 - s2 - s3*x(3)
+         th = d2*t
+         r1 = d2*s1
+         r2 = d2*s2
+         h(1,1) = h(1,1) + r1*(th + r1)
+         h(1,2) = h(1,2) - r1*r2
+         h(2,2) = h(2,2) - r2*(th - r2)
+         h(1,3) = h(1,3) + r1*s3
+         h(2,3) = h(2,3) - r2*s3
+         h(3,3) = h(3,3) + s3**2
+  140    continue
+      do 160 j = 1, 3
+         do 150 k = 1, j
+            h(k,j) = two*h(k,j)
+  150       continue
+  160    continue
+      go to 800
+c
+c     Variably dimensioned function.
+c
+  170 continue
+      t1 = zero
+      do 180 j = 1, n
+         t1 = t1 + dble(j)*(x(j) - one)
+  180    continue
+c     t = t1*(one + two*t1**2)
+      t2 = two + twelve*t1**2
+      do 200 j = 1, n
+         do 190 k = 1, j
+            h(k,j) = dble(k*j)*t2
+  190       continue
+         h(j,j) = h(j,j) + two
+  200    continue
+      go to 800
+c
+c     Watson function.
+c
+  210 continue
+      do 230 j = 1, n
+         do 220 k = 1, j
+            h(k,j) = zero
+  220       continue
+  230    continue
+      do 280 i = 1, 29
+         d1 = dble(i)/c29
+         s1 = zero
+         d2 = one
+         do 240 j = 2, n
+            s1 = s1 + dble(j-1)*d2*x(j)
+            d2 = d1*d2
+  240       continue
+         s2 = zero
+         d2 = one
+         do 250 j = 1, n
+            s2 = s2 + d2*x(j)
+            d2 = d1*d2
+  250       continue
+         t = s1 - s2**2 - one
+         s3 = two*d1*s2
+         d2 = two/d1
+         th = two*d1**2*t
+         do 270 j = 1, n
+            v = dble(j-1) - s3
+            d3 = one/d1
+            do 260 k = 1, j
+               h(k,j) = h(k,j) + d2*d3*(v*(dble(k-1) - s3) - th)
+               d3 = d1*d3
+  260          continue
+            d2 = d1*d2
+  270       continue
+  280    continue
+      t1 = x(2) - x(1)**2 - one
+      h(1,1) = h(1,1) + eight*x(1)**2 + two - four*t1
+      h(1,2) = h(1,2) - four*x(1)
+      h(2,2) = h(2,2) + two
+      go to 800
+c
+c     Penalty function I.
+c
+  290 continue
+      t1 = -cp25
+      do 300 j = 1, n
+         t1 = t1 + x(j)**2
+  300    continue
+      d1 = two*ap
+      th = four*t1
+      do 320 j = 1, n
+         t2 = eight*x(j)
+         do 310 k = 1, j
+            h(k,j) = x(k)*t2
+  310       continue
+         h(j,j) = h(j,j) + d1 + th
+  320    continue
+      go to 800
+c
+c     Penalty function II.
+c
+  330 continue
+      t1 = -one
+      do 340 j = 1, n
+         t1 = t1 + dble(n-j+1)*x(j)**2
+  340    continue
+      d1 = exp(cp1)
+      d2 = one
+      th = four*t1
+      do 370 j = 1, n
+         t2 = eight*dble(n-j+1)*x(j)
+         do 350 k = 1, j
+            h(k,j) = dble(n-k+1)*x(k)*t2
+  350       continue
+         h(j,j) = h(j,j) + dble(n-j+1)*th
+         s1 = exp(x(j)/ten)
+         if (j .gt. 1) then
+            s3 = s1 + s2 - d2*(d1 + one)
+            h(j,j) = h(j,j) + ap*s1*(s3 + three*s1 - one/d1)/fifty
+            h(j-1,j) = h(j-1,j) + ap*s1*s2/fifty
+            h(j-1,j-1) = h(j-1,j-1) + ap*s2*(s2 + s3)/fifty
+            end if
+         s2 = s1
+         d2 = d1*d2
+  370    continue
+      h(1,1) = h(1,1) + two
+      go to 800
+c
+c     Brown badly scaled function.
+c
+  380 continue
+c     t1 = x(1) - c1pd6
+c     t2 = x(2) - c2pdm6
+      t3 = x(1)*x(2) - two
+      h(1,1) = two*(one + x(2)**2)
+      h(1,2) = four*(one + t3)
+      h(2,2) = two*(one + x(1)**2)
+      go to 800
+c
+c     Brown and Dennis function.
+c
+  390 continue
+      do 410 j = 1, 4
+         do 400 k = 1, j
+            h(k,j) = zero
+  400       continue
+  410    continue
+      do 420 i = 1, 20
+         d1 = dble(i)/five
+         d2 = sin(d1)
+         t1 = x(1) + d1*x(2) - exp(d1)
+         t2 = x(3) + d2*x(4) - cos(d1)
+         t = t1**2 + t2**2
+c        s1 = t1*t
+c        s2 = t2*t
+         s3 = two*t1*t2
+         r1 = t + two*t1**2
+         r2 = t + two*t2**2
+         h(1,1) = h(1,1) + r1
+         h(1,2) = h(1,2) + d1*r1
+         h(2,2) = h(2,2) + d1**2*r1
+         h(1,3) = h(1,3) + s3
+         h(2,3) = h(2,3) + d1*s3
+         h(3,3) = h(3,3) + r2
+         h(1,4) = h(1,4) + d2*s3
+         h(2,4) = h(2,4) + d1*d2*s3
+         h(3,4) = h(3,4) + d2*r2
+         h(4,4) = h(4,4) + d2**2*r2
+  420    continue
+      do 440 j = 1, 4
+         do 430 k = 1, j
+            h(k,j) = four*h(k,j)
+  430       continue
+  440    continue
+      go to 800
+c
+c     Gulf research and development function.
+c
+  450 continue
+      do 470 j = 1, 3
+         do 460 k = 1, j
+            h(k,j) = zero
+  460       continue
+  470    continue
+      d1 = two/three
+      do 480 i = 1, 99
+         arg = dble(i)/c100
+         r = (-fifty*log(arg))**d1 + c25 - x(2)
+         t1 = abs(r)**x(3)/x(1)
+         t2 = exp(-t1)
+         t = t2 - arg
+         s1 = t1*t2*t
+         s2 = t1*(s1 + t2*(t1*t2 - t))
+         r1 = log(abs(r))
+         r2 = r1*s2
+         h(1,1) = h(1,1) + s2 - s1
+         h(1,2) = h(1,2) + s2/r
+         h(2,2) = h(2,2) + (s1 + x(3)*s2)/r**2
+         h(1,3) = h(1,3) - r2
+         h(2,3) = h(2,3) + (s1 - x(3)*r2)/r
+         h(3,3) = h(3,3) + r1*r2
+  480    continue
+      h(1,1) = two*h(1,1)/x(1)**2
+      h(1,2) = two*x(3)*h(1,2)/x(1)
+      h(2,2) = two*x(3)*h(2,2)
+      h(1,3) = two*h(1,3)/x(1)
+      h(2,3) = two*h(2,3)
+      h(3,3) = two*h(3,3)
+      go to 800
+c
+c     Trigonometric function.
+c
+  490 continue
+      u2 = cos(x(n))
+      s1 = u2
+      if (n .gt. 1) then
+         u1 = cos(x(n-1))
+         s1 = s1 + u1
+         do 500 j = 1, n-2
+            h(j,n-1) = cos(x(j))
+            s1 = s1 + h(j,n-1)
+  500       continue
+         end if
+      v2 = sin(x(n))
+      s2 = dble(2*n) - v2 - s1 - dble(n)*u2
+      r2 = dble(2*n)*v2 - u2
+      if (n .gt. 1) then
+         v1 = sin(x(n-1))
+         s2 = s2 + dble(2*n-1) - v1 - s1 - dble(n-1)*u1
+         r1 = dble(2*n-1)*v1 - u1
+         do 520 j = 1, n-2
+            h(j,n) = sin(x(j))
+            t = dble(n+j) - h(j,n) - s1 - dble(j)*h(j,n-1)
+            s2 = s2 + t
+  520       continue
+         do 540 j = 1, n-2
+            v = dble(j)*h(j,n-1) + h(j,n)
+            t = dble(n+j) - s1 - v
+            t1 = dble(n+j)*h(j,n) - h(j,n-1)
+            do 530 k = 1, j
+               th = dble(k)*h(k,n) - h(k,n-1)
+               h(k,j) = two*(h(k,n)*t1 + h(j,n)*th)
+  530          continue
+            h(j,j) = h(j,j) + two*(h(j,n-1)*s2 + v*t + th**2)
+  540       continue
+         do 550 k = 1, n-2
+            th = dble(k)*h(k,n) - h(k,n-1)
+            h(k,n-1) = two*(h(k,n)*r1 + v1*th)
+            h(k,n) = two*(h(k,n)*r2 + v2*th)
+  550       continue
+         v = dble(n-1)*u1 + v1
+         t = dble(2*n-1) - s1 - v
+         th = dble(n-1)*v1 - u1
+         h(n-1,n-1) = two*(v1*(r1 + th) + u1*s2 + v*t + th**2)
+         h(n-1,n) = two*(v1*r2 + v2*th)
+         end if
+      v = dble(n)*u2 + v2
+      t = dble(2*n) - s1 - v
+      th = dble(n)*v2 - u2
+      h(n,n) = two*(v2*(r2 + th) + u2*s2 + v*t + th**2)
+      go to 800
+c
+c     Extended Rosenbrock function.
+c
+  580 continue
+      do 600 j = 1, n
+         do 590 k = 1, j
+            h(k,j) = zero
+  590       continue
+  600    continue
+      do 610 j = 1, n, 2
+c        t1 = one - x(j)
+         h(j,j) = c1200*x(j)**2 - c400*x(j+1) + two
+         h(j,j+1) = -c400*x(j)
+         h(j+1,j+1) = c200
+  610    continue
+      go to 800
+c
+c     Extended Powell function.
+c
+  620 continue
+      do 640 j = 1, n
+         do 630 k = 1, j
+            h(k,j) = zero
+  630       continue
+  640    continue
+      do 650 j = 1, n, 4
+c        t = x(j) + ten*x(j+1)
+c        t1 = x(j+2) - x(j+3)
+c        s1 = five*t1
+         t2 = x(j+1) - two*x(j+2)
+c        s2 = four*t2**3
+         t3 = x(j) - x(j+3)
+c        s3 = twenty*t3**3
+         r2 = twelve*t2**2
+         r3 = c120*t3**2
+         h(j,j) = two + r3
+         h(j,j+1) = twenty
+         h(j+1,j+1) = c200 + r2
+         h(j+1,j+2) = -two*r2
+         h(j+2,j+2) = ten + four*r2
+         h(j,j+3) = -r3
+         h(j+2,j+3) = -ten
+         h(j+3,j+3) = ten + r3
+  650    continue
+      go to 800
+c
+c     Beale function.
+c
+  660 continue
+      s1 = one - x(2)
+      t1 = c1p5 - x(1)*s1
+      s2 = one - x(2)**2
+      t2 = c2p25 - x(1)*s2
+      s3 = one - x(2)**3
+      t3 = c2p625 - x(1)*s3
+      h(1,1) = two*(s1**2 + s2**2 + s3**2)
+      h(1,2) = two
+     *         *(t1 + x(2)*(two*t2 + three*x(2)*t3)
+     *           - x(1)*(s1 + x(2)*(two*s2 + three*x(2)*s3)))
+      h(2,2) = two*x(1)
+     *         *(x(1) + two*t2
+     *           + x(2)*(six*t3 + x(1)*x(2)*(four + xnine*x(2)**2)))
+      go to 800
+c
+c     Wood function.
+c
+  670 continue
+      s1 = x(2) - x(1)**2
+c     s2 = one - x(1)
+c     s3 = x(2) - one
+      t1 = x(4) - x(3)**2
+c     t2 = one - x(3)
+c     t3 = x(4) - one
+      h(1,1) = c400*(two*x(1)**2 - s1) + two
+      h(1,2) = -c400*x(1)
+      h(2,2) = c220p2
+      h(1,3) = zero
+      h(2,3) = zero
+      h(3,3) = c360*(two*x(3)**2 - t1) + two
+      h(1,4) = zero
+      h(2,4) = c19p8
+      h(3,4) = -c360*x(3)
+      h(4,4) = c200p2
+      go to 800
+c
+c     Chebyquad function.
+c
+  680 continue
+      do 690 i = 1, n
+         fvec(i) = zero
+  690    continue
+      do 710 j = 1, n
+         t1 = one
+         t2 = two*x(j) - one
+         t = two*t2
+         do 700 i = 1, n
+            fvec(i) = fvec(i) + t2
+            th = t*t2 - t1
+            t1 = t2
+            t2 = th
+  700       continue
+  710    continue
+      d1 = one/dble(n)
+      iev = -1
+      do 720 i = 1, n
+         fvec(i) = d1*fvec(i)
+         if (iev .gt. 0) fvec(i) = fvec(i) + one/(dble(i)**2 - one)
+         iev = -iev
+  720    continue
+      do 770 j = 1, n
+         do 730 k = 1, j
+            h(k,j) = zero
+  730       continue
+         t1 = one
+         t2 = two*x(j) - one
+         t = two*t2
+         s1 = zero
+         s2 = two
+         r1 = zero
+         r2 = zero
+         do 740 i = 1, n
+            h(j,j) = h(j,j) + fvec(i)*r2
+            th = eight*s2 + t*r2 - r1
+            r1 = r2
+            r2 = th
+            fvec1(i) = d1*s2
+            th = four*t2 + t*s2 - s1
+            s1 = s2
+            s2 = th
+            th = t*t2 - t1
+            t1 = t2
+            t2 = th
+  740       continue
+         do 760 k = 1, j
+            v1 = one
+            v2 = two*x(k) - one
+            v = two*v2
+            u1 = zero
+            u2 = two
+            do 750 i = 1, n
+               h(k,j) = h(k,j) + fvec1(i)*u2
+               th = four*v2 + v*u2 - u1
+               u1 = u2
+               u2 = th
+               th = v*v2 - v1
+               v1 = v2
+               v2 = th
+  750          continue
+  760       continue
+  770    continue
+      d2 = two*d1
+      do 790 j = 1, n
+         do 780 k = 1, j
+            h(k,j) = d2*h(k,j)
+  780       continue
+  790    continue
+c
+c     Reflect the upper triangle to fill the square matrix.
+c
+  800 continue
+      do 820 j = 1, n
+         do 810 k = j+1, n
+            h(k,j) = h(j,k)
+  810       continue
+  820    continue
+      return
+c
+c     Last card of subroutine hesfcn.
+c
+      end
+      subroutine expand(n,alin,amat,lda)
+      integer n,lda
+      double precision alin(*),amat(lda,n)
+c     **********
+c
+c     This subroutine is a dummy counterpart of one that expands a
+c     linear array to two-dimensional form.
+c
+c     Argonne National Laboratory. MINPACK Project. February 1984.
+c     Burton S. Garbow
+c
+c     **********
+      return
+c
+c     Last card of subroutine expand.
+c
+      end
Index: trunk/optimizer/src/pgapack/pgapack/examples/mgh/objfcn77.f
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/mgh/objfcn77.f	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/mgh/objfcn77.f	(revision 816)
@@ -0,0 +1,338 @@
+      subroutine objfcn(n,x,f,nprob)
+      integer n,nprob
+      double precision f
+      double precision x(n)
+c     **********
+c
+c     subroutine objfcn
+c
+c     This subroutine defines the objective functions of eighteen
+c     nonlinear unconstrained minimization problems. The values
+c     of n for functions 1,2,3,4,5,10,11,12,16 and 17 are
+c     3,6,3,2,3,2,4,3,2 and 4, respectively.
+c     For function 7, n may be 2 or greater but is usually 6 or 9.
+c     For functions 6,8,9,13,14,15 and 18 n may be variable,
+c     however it must be even for function 14, a multiple of 4 for
+c     function 15, and not greater than 50 for function 18.
+c
+c     The subroutine statement is
+c
+c       subroutine objfcn(n,x,f,nprob)
+c
+c     where
+c
+c       n is a positive integer input variable.
+c
+c       x is an input array of length n.
+c
+c       f is an output variable which contains the value of
+c         the nprob objective function evaluated at x.
+c
+c       nprob is a positive integer input variable which defines the
+c         number of the problem. nprob must not exceed 18.
+c
+c     Subprograms called
+c
+c       FORTRAN-supplied ... abs,atan,cos,dble,exp,log,sign,sin,sqrt
+c
+c     Argonne National Laboratory. MINPACK Project. march 1980.
+c     Burton S. Garbow, Kenneth E. Hillstrom, Jorge J. More
+c
+c     **********
+      integer i,iev,j
+      double precision ap,arg,c2pdm6,cp0001,cp1,cp2,cp25,cp5,c1p5,
+     *                 c2p25,c2p625,c3p5,c25,c29,c90,c100,c10000,
+     *                 c1pd6,d1,d2,eight,fifty,five,four,one,r,s1,s2,
+     *                 s3,t,t1,t2,t3,ten,th,three,tpi,two,zero
+      double precision fvec(50),y(15)
+      data zero,one,two,three,four,five,eight,ten,fifty
+     *     /0.0d0,1.0d0,2.0d0,3.0d0,4.0d0,5.0d0,8.0d0,1.0d1,5.0d1/
+      data c2pdm6,cp0001,cp1,cp2,cp25,cp5,c1p5,c2p25,c2p625,c3p5,c25,
+     *     c29,c90,c100,c10000,c1pd6
+     *     /2.0d-6,1.0d-4,1.0d-1,2.0d-1,2.5d-1,5.0d-1,1.5d0,2.25d0,
+     *      2.625d0,3.5d0,2.5d1,2.9d1,9.0d1,1.0d2,1.0d4,1.0d6/
+      data ap /1.0d-5/
+      data y(1),y(2),y(3),y(4),y(5),y(6),y(7),y(8),y(9),y(10),y(11),
+     *     y(12),y(13),y(14),y(15)
+     *     /9.0d-4,4.4d-3,1.75d-2,5.4d-2,1.295d-1,2.42d-1,3.521d-1,
+     *      3.989d-1,3.521d-1,2.42d-1,1.295d-1,5.4d-2,1.75d-2,4.4d-3,
+     *      9.0d-4/
+c
+c     Function routine selector.
+c
+      go to (10,20,40,60,70,90,110,150,170,200,210,230,250,280,300,
+     *       320,330,340), nprob
+c
+c     Helical valley function.
+c
+   10 continue
+      tpi = eight*atan(one)
+      th = sign(cp25,x(2))
+      if (x(1) .gt. zero) th = atan(x(2)/x(1))/tpi
+      if (x(1) .lt. zero) th = atan(x(2)/x(1))/tpi + cp5
+      arg = x(1)**2 + x(2)**2
+      r = sqrt(arg)
+      t = x(3) - ten*th
+      f = c100*(t**2 + (r - one)**2) + x(3)**2
+      return
+c
+c     Biggs exp6 function.
+c
+   20 continue
+      f = zero
+      do 30 i = 1, 13
+         d1 = dble(i)/ten
+         d2 = exp(-d1) - five*exp(-ten*d1) + three*exp(-four*d1)
+         s1 = exp(-d1*x(1))
+         s2 = exp(-d1*x(2))
+         s3 = exp(-d1*x(5))
+         t = x(3)*s1 - x(4)*s2 + x(6)*s3 - d2
+         f = f + t**2
+   30    continue
+      return
+c
+c     Gaussian function.
+c
+   40 continue
+      f = zero
+      do 50 i = 1, 15
+         d1 = cp5*dble(i-1)
+         d2 = c3p5 - d1 - x(3)
+         arg = -cp5*x(2)*d2**2
+         r = exp(arg)
+         t = x(1)*r - y(i)
+         f = f + t**2
+   50    continue
+      return
+c
+c     Powell badly scaled function.
+c
+   60 continue
+      t1 = c10000*x(1)*x(2) - one
+      s1 = exp(-x(1))
+      s2 = exp(-x(2))
+      t2 = s1 + s2 - one - cp0001
+      f = t1**2 + t2**2
+      return
+c
+c     Box 3-dimensional function.
+c
+   70 continue
+      f = zero
+      do 80 i = 1, 10
+         d1 = dble(i)
+         d2 = d1/ten
+         s1 = exp(-d2*x(1))
+         s2 = exp(-d2*x(2))
+         s3 = exp(-d2) - exp(-d1)
+         t = s1 - s2 - s3*x(3)
+         f = f + t**2
+   80    continue
+      return
+c
+c     Variably dimensioned function.
+c
+   90 continue
+      t1 = zero
+      t2 = zero
+      do 100 j = 1, n
+         t1 = t1 + dble(j)*(x(j) - one)
+         t2 = t2 + (x(j) - one)**2
+  100    continue
+      f = t2 + t1**2*(one + t1**2)
+      return
+c
+c     Watson function.
+c
+  110 continue
+      f = zero
+      do 140 i = 1, 29
+         d1 = dble(i)/c29
+         s1 = zero
+         d2 = one
+         do 120 j = 2, n
+            s1 = s1 + dble(j-1)*d2*x(j)
+            d2 = d1*d2
+  120       continue
+         s2 = zero
+         d2 = one
+         do 130 j = 1, n
+            s2 = s2 + d2*x(j)
+            d2 = d1*d2
+  130       continue
+         t = s1 - s2**2 - one
+         f = f + t**2
+  140    continue
+      t1 = x(2) - x(1)**2 - one
+      f = f + x(1)**2 + t1**2
+      return
+c
+c     Penalty function I.
+c
+  150 continue
+      t1 = -cp25
+      t2 = zero
+      do 160 j = 1, n
+         t1 = t1 + x(j)**2
+         t2 = t2 + (x(j) - one)**2
+  160    continue
+      f = ap*t2 + t1**2
+      return
+c
+c     Penalty function II.
+c
+  170 continue
+      t1 = -one
+      t2 = zero
+      t3 = zero
+      d1 = exp(cp1)
+      d2 = one
+      do 190 j = 1, n
+         t1 = t1 + dble(n-j+1)*x(j)**2
+         s1 = exp(x(j)/ten)
+         if (j .gt. 1) then
+            s3 = s1 + s2 - d2*(d1 + one)
+            t2 = t2 + s3**2
+            t3 = t3 + (s1 - one/d1)**2
+            end if
+         s2 = s1
+         d2 = d1*d2
+  190    continue
+      f = ap*(t2 + t3) + t1**2 + (x(1) - cp2)**2
+      return
+c
+c     Brown badly scaled function.
+c
+  200 continue
+      t1 = x(1) - c1pd6
+      t2 = x(2) - c2pdm6
+      t3 = x(1)*x(2) - two
+      f = t1**2 + t2**2 + t3**2
+      return
+c
+c     Brown and Dennis function.
+c
+  210 continue
+      f = zero
+      do 220 i = 1, 20
+         d1 = dble(i)/five
+         d2 = sin(d1)
+         t1 = x(1) + d1*x(2) - exp(d1)
+         t2 = x(3) + d2*x(4) - cos(d1)
+         t = t1**2 + t2**2
+         f = f + t**2
+  220    continue
+      return
+c
+c     Gulf research and development function.
+c
+  230 continue
+      f = zero
+      d1 = two/three
+      do 240 i = 1, 99
+         arg = dble(i)/c100
+         r = (-fifty*log(arg))**d1 + c25 - x(2)
+         t1 = abs(r)**x(3)/x(1)
+         t2 = exp(-t1)
+         t = t2 - arg
+         f = f + t**2
+  240    continue
+      return
+c
+c     Trigonometric function.
+c
+  250 continue
+      s1 = zero
+      do 260 j = 1, n
+         s1 = s1 + cos(x(j))
+  260    continue
+      f = zero
+      do 270 j = 1, n
+         t = dble(n+j) - sin(x(j)) - s1 - dble(j)*cos(x(j))
+         f = f + t**2
+  270    continue
+      return
+c
+c     Extended Rosenbrock function.
+c
+  280 continue
+      f = zero
+      do 290 j = 1, n, 2
+         t1 = one - x(j)
+         t2 = ten*(x(j+1) - x(j)**2)
+         f = f + t1**2 + t2**2
+  290    continue
+      return
+c
+c     Extended Powell function.
+c
+  300 continue
+      f = zero
+      do 310 j = 1, n, 4
+         t = x(j) + ten*x(j+1)
+         t1 = x(j+2) - x(j+3)
+         s1 = five*t1
+         t2 = x(j+1) - two*x(j+2)
+         s2 = t2**3
+         t3 = x(j) - x(j+3)
+         s3 = ten*t3**3
+         f = f + t**2 + s1*t1 + s2*t2 + s3*t3
+  310    continue
+      return
+c
+c     Beale function.
+c
+  320 continue
+      s1 = one - x(2)
+      t1 = c1p5 - x(1)*s1
+      s2 = one - x(2)**2
+      t2 = c2p25 - x(1)*s2
+      s3 = one - x(2)**3
+      t3 = c2p625 - x(1)*s3
+      f = t1**2 + t2**2 + t3**2
+      return
+c
+c     Wood function.
+c
+  330 continue
+      s1 = x(2) - x(1)**2
+      s2 = one - x(1)
+      s3 = x(2) - one
+      t1 = x(4) - x(3)**2
+      t2 = one - x(3)
+      t3 = x(4) - one
+      f = c100*s1**2 + s2**2 + c90*t1**2 + t2**2 + ten*(s3 + t3)**2
+     *    + (s3 - t3)**2/ten
+      return
+c
+c     Chebyquad function.
+c
+  340 continue
+      do 350 i = 1, n
+         fvec(i) = zero
+  350    continue
+      do 370 j = 1, n
+         t1 = one
+         t2 = two*x(j) - one
+         t = two*t2
+         do 360 i = 1, n
+            fvec(i) = fvec(i) + t2
+            th = t*t2 - t1
+            t1 = t2
+            t2 = th
+  360       continue
+  370    continue
+      f = zero
+      d1 = one/dble(n)
+      iev = -1
+      do 380 i = 1, n
+         t = d1*fvec(i)
+         if (iev .gt. 0) t = t + one/(dble(i)**2 - one)
+         f = f + t**2
+         iev = -iev
+  380    continue
+      return
+c
+c     Last card of subroutine objfcn.
+c
+      end
Index: trunk/optimizer/src/pgapack/pgapack/examples/mgh/pgapackf.h
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/mgh/pgapackf.h	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/mgh/pgapackf.h	(revision 816)
@@ -0,0 +1,1 @@
+link ../../include/pgapackf.h
Index: trunk/optimizer/src/pgapack/pgapack/examples/mgh/ssqfcn77.f
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/mgh/ssqfcn77.f	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/mgh/ssqfcn77.f	(revision 816)
@@ -0,0 +1,334 @@
+      subroutine ssqfcn(m,n,x,fvec,nprob)
+      integer m,n,nprob
+      double precision x(n),fvec(m)
+c     **********
+c
+c     subroutine ssqfcn
+c
+c     This subroutine defines the functions of eighteen nonlinear
+c     least squares problems. The allowable values of (m,n) for
+c     functions 1,2 and 3 are variable but with m .ge. n.
+c     For functions 4,5,6,7,8,9 and 10 the values of (m,n) are
+c     (2,2),(3,3),(4,4),(2,2),(15,3),(11,4) and (16,3), respectively.
+c     Function 11 (Watson) has m = 31 with n usually 6 or 9.
+c     However, any n, n = 2,...,31, is permitted.
+c     Functions 12,13 and 14 have n = 3,2 and 4, respectively, but
+c     allow any m .ge. n, with the usual choices being 10,10 and 20.
+c     Function 15 (Chebyquad) allows m and n variable with m .ge. n.
+c     Function 16 (Brown) allows n variable with m = n.
+c     For functions 17 and 18, the values of (m,n) are
+c     (33,5) and (65,11), respectively.
+c
+c     The subroutine statement is
+c
+c       subroutine ssqfcn(m,n,x,fvec,nprob)
+c
+c     where
+c
+c       m and n are positive integer input variables. n must not
+c         exceed m.
+c
+c       x is an input array of length n.
+c
+c       fvec is an output array of length m which contains the nprob
+c         function evaluated at x.
+c
+c       nprob is a positive integer input variable which defines the
+c         number of the problem. nprob must not exceed 18.
+c
+c     Subprograms called
+c
+c       FORTRAN-supplied ... atan,cos,dble,exp,sign,sin,sqrt
+c
+c     Argonne National Laboratory. MINPACK Project. march 1980.
+c     Burton S. Garbow, Kenneth E. Hillstrom, Jorge J. More
+c
+c     **********
+      integer i,iev,j
+      double precision c13,c14,c29,c45,div,dx,eight,five,one,prod,sum,
+     *                 s1,s2,temp,ten,ti,tmp1,tmp2,tmp3,tmp4,tpi,two,
+     *                 zero,zp25,zp5
+      double precision v(11),y1(15),y2(11),y3(16),y4(33),y5(65)
+      data zero,zp25,zp5,one,two,five,eight,ten,c13,c14,c29,c45
+     *     /0.0d0,2.5d-1,5.0d-1,1.0d0,2.0d0,5.0d0,8.0d0,1.0d1,1.3d1,
+     *      1.4d1,2.9d1,4.5d1/
+      data v(1),v(2),v(3),v(4),v(5),v(6),v(7),v(8),v(9),v(10),v(11)
+     *     /4.0d0,2.0d0,1.0d0,5.0d-1,2.5d-1,1.67d-1,1.25d-1,1.0d-1,
+     *      8.33d-2,7.14d-2,6.25d-2/
+      data y1(1),y1(2),y1(3),y1(4),y1(5),y1(6),y1(7),y1(8),y1(9),
+     *     y1(10),y1(11),y1(12),y1(13),y1(14),y1(15)
+     *     /1.4d-1,1.8d-1,2.2d-1,2.5d-1,2.9d-1,3.2d-1,3.5d-1,3.9d-1,
+     *      3.7d-1,5.8d-1,7.3d-1,9.6d-1,1.34d0,2.1d0,4.39d0/
+      data y2(1),y2(2),y2(3),y2(4),y2(5),y2(6),y2(7),y2(8),y2(9),
+     *     y2(10),y2(11)
+     *     /1.957d-1,1.947d-1,1.735d-1,1.6d-1,8.44d-2,6.27d-2,4.56d-2,
+     *      3.42d-2,3.23d-2,2.35d-2,2.46d-2/
+      data y3(1),y3(2),y3(3),y3(4),y3(5),y3(6),y3(7),y3(8),y3(9),
+     *     y3(10),y3(11),y3(12),y3(13),y3(14),y3(15),y3(16)
+     *     /3.478d4,2.861d4,2.365d4,1.963d4,1.637d4,1.372d4,1.154d4,
+     *      9.744d3,8.261d3,7.03d3,6.005d3,5.147d3,4.427d3,3.82d3,
+     *      3.307d3,2.872d3/
+      data y4(1),y4(2),y4(3),y4(4),y4(5),y4(6),y4(7),y4(8),y4(9),
+     *     y4(10),y4(11),y4(12),y4(13),y4(14),y4(15),y4(16),y4(17),
+     *     y4(18),y4(19),y4(20),y4(21),y4(22),y4(23),y4(24),y4(25),
+     *     y4(26),y4(27),y4(28),y4(29),y4(30),y4(31),y4(32),y4(33)
+     *     /8.44d-1,9.08d-1,9.32d-1,9.36d-1,9.25d-1,9.08d-1,8.81d-1,
+     *      8.5d-1,8.18d-1,7.84d-1,7.51d-1,7.18d-1,6.85d-1,6.58d-1,
+     *      6.28d-1,6.03d-1,5.8d-1,5.58d-1,5.38d-1,5.22d-1,5.06d-1,
+     *      4.9d-1,4.78d-1,4.67d-1,4.57d-1,4.48d-1,4.38d-1,4.31d-1,
+     *      4.24d-1,4.2d-1,4.14d-1,4.11d-1,4.06d-1/
+      data y5(1),y5(2),y5(3),y5(4),y5(5),y5(6),y5(7),y5(8),y5(9),
+     *     y5(10),y5(11),y5(12),y5(13),y5(14),y5(15),y5(16),y5(17),
+     *     y5(18),y5(19),y5(20),y5(21),y5(22),y5(23),y5(24),y5(25),
+     *     y5(26),y5(27),y5(28),y5(29),y5(30),y5(31),y5(32),y5(33),
+     *     y5(34),y5(35),y5(36),y5(37),y5(38),y5(39),y5(40),y5(41),
+     *     y5(42),y5(43),y5(44),y5(45),y5(46),y5(47),y5(48),y5(49),
+     *     y5(50),y5(51),y5(52),y5(53),y5(54),y5(55),y5(56),y5(57),
+     *     y5(58),y5(59),y5(60),y5(61),y5(62),y5(63),y5(64),y5(65)
+     *     /1.366d0,1.191d0,1.112d0,1.013d0,9.91d-1,8.85d-1,8.31d-1,
+     *      8.47d-1,7.86d-1,7.25d-1,7.46d-1,6.79d-1,6.08d-1,6.55d-1,
+     *      6.16d-1,6.06d-1,6.02d-1,6.26d-1,6.51d-1,7.24d-1,6.49d-1,
+     *      6.49d-1,6.94d-1,6.44d-1,6.24d-1,6.61d-1,6.12d-1,5.58d-1,
+     *      5.33d-1,4.95d-1,5.0d-1,4.23d-1,3.95d-1,3.75d-1,3.72d-1,
+     *      3.91d-1,3.96d-1,4.05d-1,4.28d-1,4.29d-1,5.23d-1,5.62d-1,
+     *      6.07d-1,6.53d-1,6.72d-1,7.08d-1,6.33d-1,6.68d-1,6.45d-1,
+     *      6.32d-1,5.91d-1,5.59d-1,5.97d-1,6.25d-1,7.39d-1,7.1d-1,
+     *      7.29d-1,7.2d-1,6.36d-1,5.81d-1,4.28d-1,2.92d-1,1.62d-1,
+     *      9.8d-2,5.4d-2/
+c
+c     Function routine selector.
+c
+      go to (10,40,70,110,120,130,140,150,170,190,210,250,270,290,310,
+     *       360,390,410), nprob
+c
+c     Linear function - full rank.
+c
+   10 continue
+      sum = zero
+      do 20 j = 1, n
+         sum = sum + x(j)
+   20    continue
+      temp = two*sum/dble(m) + one
+      do 30 i = 1, m
+         fvec(i) = -temp
+         if (i .le. n) fvec(i) = fvec(i) + x(i)
+   30    continue
+      return
+c
+c     Linear function - rank 1.
+c
+   40 continue
+      sum = zero
+      do 50 j = 1, n
+         sum = sum + dble(j)*x(j)
+   50    continue
+      do 60 i = 1, m
+         fvec(i) = dble(i)*sum - one
+   60    continue
+      return
+c
+c     Linear function - rank 1 with zero columns and rows.
+c
+   70 continue
+      sum = zero
+      do 80 j = 2, n-1
+         sum = sum + dble(j)*x(j)
+   80    continue
+      do 100 i = 1, m-1
+         fvec(i) = dble(i-1)*sum - one
+  100    continue
+      fvec(m) = -one
+      return
+c
+c     Rosenbrock function.
+c
+  110 continue
+      fvec(1) = ten*(x(2) - x(1)**2)
+      fvec(2) = one - x(1)
+      return
+c
+c     Helical valley function.
+c
+  120 continue
+      tpi = eight*atan(one)
+      tmp1 = sign(zp25,x(2))
+      if (x(1) .gt. zero) tmp1 = atan(x(2)/x(1))/tpi
+      if (x(1) .lt. zero) tmp1 = atan(x(2)/x(1))/tpi + zp5
+      tmp2 = sqrt(x(1)**2+x(2)**2)
+      fvec(1) = ten*(x(3) - ten*tmp1)
+      fvec(2) = ten*(tmp2 - one)
+      fvec(3) = x(3)
+      return
+c
+c     Powell singular function.
+c
+  130 continue
+      fvec(1) = x(1) + ten*x(2)
+      fvec(2) = sqrt(five)*(x(3) - x(4))
+      fvec(3) = (x(2) - two*x(3))**2
+      fvec(4) = sqrt(ten)*(x(1) - x(4))**2
+      return
+c
+c     Freudenstein and Roth function.
+c
+  140 continue
+      fvec(1) = -c13 + x(1) + ((five - x(2))*x(2) - two)*x(2)
+      fvec(2) = -c29 + x(1) + ((one + x(2))*x(2) - c14)*x(2)
+      return
+c
+c     Bard function.
+c
+  150 continue
+      do 160 i = 1, 15
+         tmp1 = dble(i)
+         tmp2 = dble(16-i)
+         tmp3 = tmp1
+         if (i .gt. 8) tmp3 = tmp2
+         fvec(i) = y1(i) - (x(1) + tmp1/(x(2)*tmp2 + x(3)*tmp3))
+  160    continue
+      return
+c
+c     Kowalik and Osborne function.
+c
+  170 continue
+      do 180 i = 1, 11
+         tmp1 = v(i)*(v(i) + x(2))
+         tmp2 = v(i)*(v(i) + x(3)) + x(4)
+         fvec(i) = y2(i) - x(1)*tmp1/tmp2
+  180    continue
+      return
+c
+c     Meyer function.
+c
+  190 continue
+      do 200 i = 1, 16
+         temp = five*dble(i) + c45 + x(3)
+         tmp1 = x(2)/temp
+         tmp2 = exp(tmp1)
+         fvec(i) = x(1)*tmp2 - y3(i)
+  200    continue
+      return
+c
+c     Watson function.
+c
+  210 continue
+      do 240 i = 1, 29
+         div = dble(i)/c29
+         s1 = zero
+         dx = one
+         do 220 j = 2, n
+            s1 = s1 + dble(j-1)*dx*x(j)
+            dx = div*dx
+  220       continue
+         s2 = zero
+         dx = one
+         do 230 j = 1, n
+            s2 = s2 + dx*x(j)
+            dx = div*dx
+  230       continue
+         fvec(i) = s1 - s2**2 - one
+  240    continue
+      fvec(30) = x(1)
+      fvec(31) = x(2) - x(1)**2 - one
+      return
+c
+c     Box 3-dimensional function.
+c
+  250 continue
+      do 260 i = 1, m
+         temp = dble(i)
+         tmp1 = temp/ten
+         fvec(i) = exp(-tmp1*x(1)) - exp(-tmp1*x(2))
+     *             + (exp(-temp) - exp(-tmp1))*x(3)
+  260    continue
+      return
+c
+c     Jennrich and Sampson function.
+c
+  270 continue
+      do 280 i = 1, m
+         temp = dble(i)
+         fvec(i) = two + two*temp - exp(temp*x(1)) - exp(temp*x(2))
+  280    continue
+      return
+c
+c     Brown and Dennis function.
+c
+  290 continue
+      do 300 i = 1, m
+         temp = dble(i)/five
+         tmp1 = x(1) + temp*x(2) - exp(temp)
+         tmp2 = x(3) + sin(temp)*x(4) - cos(temp)
+         fvec(i) = tmp1**2 + tmp2**2
+  300    continue
+      return
+c
+c     Chebyquad function.
+c
+  310 continue
+      do 320 i = 1, m
+         fvec(i) = zero
+  320    continue
+      do 340 j = 1, n
+         tmp1 = one
+         tmp2 = two*x(j) - one
+         temp = two*tmp2
+         do 330 i = 1, m
+            fvec(i) = fvec(i) + tmp2
+            ti = temp*tmp2 - tmp1
+            tmp1 = tmp2
+            tmp2 = ti
+  330       continue
+  340    continue
+      dx = one/dble(n)
+      iev = -1
+      do 350 i = 1, m
+         fvec(i) = dx*fvec(i)
+         if (iev .gt. 0) fvec(i) = fvec(i) + one/(dble(i)**2 - one)
+         iev = -iev
+  350    continue
+      return
+c
+c     Brown almost-linear function.
+c
+  360 continue
+      sum = -dble(n+1)
+      prod = one
+      do 370 j = 1, n
+         sum = sum + x(j)
+         prod = x(j)*prod
+  370    continue
+      do 380 i = 1, n-1
+         fvec(i) = x(i) + sum
+  380    continue
+      fvec(n) = prod - one
+      return
+c
+c     Osborne 1 function.
+c
+  390 continue
+      do 400 i = 1, 33
+         temp = ten*dble(i-1)
+         tmp1 = exp(-x(4)*temp)
+         tmp2 = exp(-x(5)*temp)
+         fvec(i) = y4(i) - (x(1) + x(2)*tmp1 + x(3)*tmp2)
+  400    continue
+      return
+c
+c     Osborne 2 function.
+c
+  410 continue
+      do 420 i = 1, 65
+         temp = dble(i-1)/ten
+         tmp1 = exp(-x(5)*temp)
+         tmp2 = exp(-x(6)*(temp-x(9))**2)
+         tmp3 = exp(-x(7)*(temp-x(10))**2)
+         tmp4 = exp(-x(8)*(temp-x(11))**2)
+         fvec(i) = y5(i)
+     *             - (x(1)*tmp1 + x(2)*tmp2 + x(3)*tmp3 + x(4)*tmp4)
+  420    continue
+      return
+c
+c     Last card of subroutine ssqfcn.
+c
+      end
Index: trunk/optimizer/src/pgapack/pgapack/examples/mgh/ssqjac77.f
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/mgh/ssqjac77.f	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/mgh/ssqjac77.f	(revision 816)
@@ -0,0 +1,340 @@
+      subroutine ssqjac(m,n,x,fjac,ldfjac,nprob)
+      integer m,n,ldfjac,nprob
+      double precision x(n),fjac(ldfjac,n)
+c     **********
+c
+c     subroutine ssqjac
+c
+c     This subroutine defines the Jacobian matrices of eighteen
+c     nonlinear least squares problems. The problem dimensions are
+c     as described in the prologue comments of ssqfcn.
+c
+c     The subroutine statement is
+c
+c       subroutine ssqjac(m,n,x,fjac,ldfjac,nprob)
+c
+c     where
+c
+c       m and n are positive integer input variables. n must not
+c         exceed m.
+c
+c       x is an input array of length n.
+c
+c       fjac is an m by n output array which contains the Jacobian
+c         matrix of the nprob function evaluated at x.
+c
+c       ldfjac is a positive integer input variable not less than m
+c         which specifies the leading dimension of the array fjac.
+c
+c       nprob is a positive integer variable which defines the
+c         number of the problem. nprob must not exceed 18.
+c
+c     Subprograms called
+c
+c       FORTRAN-supplied ... atan,cos,dble,exp,sin,sqrt
+c
+c     Argonne National Laboratory. MINPACK Project. march 1980.
+c     Burton S. Garbow, Kenneth E. Hillstrom, Jorge J. More
+c
+c     **********
+      integer i,j,k
+      double precision c14,c20,c29,c45,c100,div,dx,eight,five,four,
+     *                 one,prod,s2,temp,ten,three,ti,tmp1,tmp2,tmp3,
+     *                 tmp4,tpi,two,zero
+      double precision v(11)
+      data zero,one,two,three,four,five,eight,ten,c14,c20,c29,c45,c100
+     *     /0.0d0,1.0d0,2.0d0,3.0d0,4.0d0,5.0d0,8.0d0,1.0d1,1.4d1,
+     *      2.0d1,2.9d1,4.5d1,1.0d2/
+      data v(1),v(2),v(3),v(4),v(5),v(6),v(7),v(8),v(9),v(10),v(11)
+     *     /4.0d0,2.0d0,1.0d0,5.0d-1,2.5d-1,1.67d-1,1.25d-1,1.0d-1,
+     *      8.33d-2,7.14d-2,6.25d-2/
+c
+c     Jacobian routine selector.
+c
+      go to (10,40,70,130,140,150,180,190,210,230,250,310,330,350,370,
+     *       400,460,480), nprob
+c
+c     Linear function - full rank.
+c
+   10 continue
+      temp = two/dble(m)
+      do 30 j = 1, n
+         do 20 i = 1, m
+            fjac(i,j) = -temp
+   20       continue
+         fjac(j,j) = fjac(j,j) + one
+   30    continue
+      return
+c
+c     Linear function - rank 1.
+c
+   40 continue
+      do 60 j = 1, n
+         do 50 i = 1, m
+            fjac(i,j) = dble(i)*dble(j)
+   50       continue
+   60    continue
+      return
+c
+c     Linear function - rank 1 with zero columns and rows.
+c
+   70 continue
+      do 90 j = 1, n
+         do 80 i = 1, m
+            fjac(i,j) = zero
+   80       continue
+   90    continue
+      do 110 j = 2, n-1
+         do 100 i = 2, m-1
+            fjac(i,j) = dble(i-1)*dble(j)
+  100       continue
+  110    continue
+      return
+c
+c     Rosenbrock function.
+c
+  130 continue
+      fjac(1,1) = -c20*x(1)
+      fjac(1,2) = ten
+      fjac(2,1) = -one
+      fjac(2,2) = zero
+      return
+c
+c     Helical valley function.
+c
+  140 continue
+      tpi = eight*atan(one)
+      temp = x(1)**2 + x(2)**2
+      tmp1 = tpi*temp
+      tmp2 = sqrt(temp)
+      fjac(1,1) = c100*x(2)/tmp1
+      fjac(1,2) = -c100*x(1)/tmp1
+      fjac(1,3) = ten
+      fjac(2,1) = ten*x(1)/tmp2
+      fjac(2,2) = ten*x(2)/tmp2
+      fjac(2,3) = zero
+      fjac(3,1) = zero
+      fjac(3,2) = zero
+      fjac(3,3) = one
+      return
+c
+c     Powell singular function.
+c
+  150 continue
+      do 170 j = 1, 4
+         do 160 i = 1, 4
+            fjac(i,j) = zero
+  160       continue
+  170    continue
+      fjac(1,1) = one
+      fjac(1,2) = ten
+      fjac(2,3) = sqrt(five)
+      fjac(2,4) = -fjac(2,3)
+      fjac(3,2) = two*(x(2) - two*x(3))
+      fjac(3,3) = -two*fjac(3,2)
+      fjac(4,1) = two*sqrt(ten)*(x(1) - x(4))
+      fjac(4,4) = -fjac(4,1)
+      return
+c
+c     Freudenstein and Roth function.
+c
+  180 continue
+      fjac(1,1) = one
+      fjac(1,2) = x(2)*(ten - three*x(2)) - two
+      fjac(2,1) = one
+      fjac(2,2) = x(2)*(two + three*x(2)) - c14
+      return
+c
+c     Bard function.
+c
+  190 continue
+      do 200 i = 1, 15
+         tmp1 = dble(i)
+         tmp2 = dble(16-i)
+         tmp3 = tmp1
+         if (i .gt. 8) tmp3 = tmp2
+         tmp4 = (x(2)*tmp2 + x(3)*tmp3)**2
+         fjac(i,1) = -one
+         fjac(i,2) = tmp1*tmp2/tmp4
+         fjac(i,3) = tmp1*tmp3/tmp4
+  200    continue
+      return
+c
+c     Kowalik and Osborne function.
+c
+  210 continue
+      do 220 i = 1, 11
+         tmp1 = v(i)*(v(i) + x(2))
+         tmp2 = v(i)*(v(i) + x(3)) + x(4)
+         fjac(i,1) = -tmp1/tmp2
+         fjac(i,2) = -v(i)*x(1)/tmp2
+         fjac(i,3) = fjac(i,1)*fjac(i,2)
+         fjac(i,4) = fjac(i,3)/v(i)
+  220    continue
+      return
+c
+c     Meyer function.
+c
+  230 continue
+      do 240 i = 1, 16
+         temp = five*dble(i) + c45 + x(3)
+         tmp1 = x(2)/temp
+         tmp2 = exp(tmp1)
+         fjac(i,1) = tmp2
+         fjac(i,2) = x(1)*tmp2/temp
+         fjac(i,3) = -tmp1*fjac(i,2)
+  240    continue
+      return
+c
+c     Watson function.
+c
+  250 continue
+      do 280 i = 1, 29
+         div = dble(i)/c29
+         s2 = zero
+         dx = one
+         do 260 j = 1, n
+            s2 = s2 + dx*x(j)
+            dx = div*dx
+  260       continue
+         temp = two*div*s2
+         dx = one/div
+         do 270 j = 1, n
+            fjac(i,j) = dx*(dble(j-1) - temp)
+            dx = div*dx
+  270       continue
+  280    continue
+      do 300 j = 1, n
+         do 290 i = 30, 31
+            fjac(i,j) = zero
+  290       continue
+  300    continue
+      fjac(30,1) = one
+      fjac(31,1) = -two*x(1)
+      fjac(31,2) = one
+      return
+c
+c     Box 3-dimensional function.
+c
+  310 continue
+      do 320 i = 1, m
+         temp = dble(i)
+         tmp1 = temp/ten
+         fjac(i,1) = -tmp1*exp(-tmp1*x(1))
+         fjac(i,2) = tmp1*exp(-tmp1*x(2))
+         fjac(i,3) = exp(-temp) - exp(-tmp1)
+  320    continue
+      return
+c
+c     Jennrich and Sampson function.
+c
+  330 continue
+      do 340 i = 1, m
+         temp = dble(i)
+         fjac(i,1) = -temp*exp(temp*x(1))
+         fjac(i,2) = -temp*exp(temp*x(2))
+  340    continue
+      return
+c
+c     Brown and Dennis function.
+c
+  350 continue
+      do 360 i = 1, m
+         temp = dble(i)/five
+         ti = sin(temp)
+         tmp1 = x(1) + temp*x(2) - exp(temp)
+         tmp2 = x(3) + ti*x(4) - cos(temp)
+         fjac(i,1) = two*tmp1
+         fjac(i,2) = temp*fjac(i,1)
+         fjac(i,3) = two*tmp2
+         fjac(i,4) = ti*fjac(i,3)
+  360    continue
+      return
+c
+c     Chebyquad function.
+c
+  370 continue
+      dx = one/dble(n)
+      do 390 j = 1, n
+         tmp1 = one
+         tmp2 = two*x(j) - one
+         temp = two*tmp2
+         tmp3 = zero
+         tmp4 = two
+         do 380 i = 1, m
+            fjac(i,j) = dx*tmp4
+            ti = four*tmp2 + temp*tmp4 - tmp3
+            tmp3 = tmp4
+            tmp4 = ti
+            ti = temp*tmp2 - tmp1
+            tmp1 = tmp2
+            tmp2 = ti
+  380       continue
+  390    continue
+      return
+c
+c     Brown almost-linear function.
+c
+  400 continue
+      prod = one
+      do 420 j = 1, n
+         prod = x(j)*prod
+         do 410 i = 1, n
+            fjac(i,j) = one
+  410       continue
+         fjac(j,j) = two
+  420    continue
+      do 450 j = 1, n
+         temp = x(j)
+         if (temp .eq. zero) then
+            temp = one
+            prod = one
+            do 430 k = 1, n
+               if (k .ne. j) prod = x(k)*prod
+  430          continue
+            end if
+         fjac(n,j) = prod/temp
+  450    continue
+      return
+c
+c     Osborne 1 function.
+c
+  460 continue
+      do 470 i = 1, 33
+         temp = ten*dble(i-1)
+         tmp1 = exp(-x(4)*temp)
+         tmp2 = exp(-x(5)*temp)
+         fjac(i,1) = -one
+         fjac(i,2) = -tmp1
+         fjac(i,3) = -tmp2
+         fjac(i,4) = temp*x(2)*tmp1
+         fjac(i,5) = temp*x(3)*tmp2
+  470    continue
+      return
+c
+c     Osborne 2 function.
+c
+  480 continue
+      do 490 i = 1, 65
+         temp = dble(i-1)/ten
+         tmp1 = exp(-x(5)*temp)
+         tmp2 = exp(-x(6)*(temp-x(9))**2)
+         tmp3 = exp(-x(7)*(temp-x(10))**2)
+         tmp4 = exp(-x(8)*(temp-x(11))**2)
+         fjac(i,1) = -tmp1
+         fjac(i,2) = -tmp2
+         fjac(i,3) = -tmp3
+         fjac(i,4) = -tmp4
+         fjac(i,5) = temp*x(1)*tmp1
+         fjac(i,6) = x(2)*(temp - x(9))**2*tmp2
+         fjac(i,7) = x(3)*(temp - x(10))**2*tmp3
+         fjac(i,8) = x(4)*(temp - x(11))**2*tmp4
+         fjac(i,9) = -two*x(2)*x(6)*(temp - x(9))*tmp2
+         fjac(i,10) = -two*x(3)*x(7)*(temp - x(10))*tmp3
+         fjac(i,11) = -two*x(4)*x(8)*(temp - x(11))*tmp4
+  490    continue
+      return
+c
+c     Last card of subroutine ssqjac.
+c
+      end
Index: trunk/optimizer/src/pgapack/pgapack/examples/mgh/testprog.f
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/mgh/testprog.f	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/mgh/testprog.f	(revision 816)
@@ -0,0 +1,110 @@
+      program mgh_testprobs
+
+      include 'pgapackf.h'
+      include 'mpif.h'
+
+      external evaluate
+
+      double precision evaluate
+      integer ctx
+      integer     len, nprob, maxiter, ierror, myid
+
+      common nprob
+
+      call MPI_INIT(ierror)
+      call MPI_COMM_RANK(MPI_COMM_WORLD, myid, ierror)
+
+      if (myid .EQ. 0) then
+         print *, 'The following is a list of the test functions this pr
+     &ogram supports.'
+         print *, 'The number in parentheses after the name of the funct
+     &ion is the'
+         print *, 'dimension of the problem.  If the dimension is not a 
+     &constant (i.e.,'
+         print *, 'problems # 6-9, 13 - 15, and 18), the limitations on 
+     &the dimension'
+         print *, 'follow in parentheses after the function name.'
+
+         print *
+         print *, '1.  Helical Valley Function (3)'
+         print *, '2.  Biggs EXP6 function (6)'
+         print *, '3.  Gaussian Function (3)'
+         print *, '4.  Powell Badly Scaled Function (2)'
+         print *, '5.  Box Three-Dimensional Function (3)'
+         print *, '6.  Variably-dimentioned Function (variable)'
+         print *, '7.  Watson Function (2 - 31)'
+         print *, '8.  Penalty function I (variable)'
+         print *, '9.  Penalty function II (variable)'
+         print *, '10.  Brown Badly Scaled Function (2)'
+         print *, '11.  Brown and Dennis Function (4)'
+         print *, '12.  Gulf Research And Development Function (3)'
+         print *, '13.  Trigonometric Function (variable)'
+         print *, '14.  Extended Rosenbrock Function (even)'
+         print *, '15.  Extended Powell Singular Function (multiple of 4
+     &)'
+         print *, '16.  Beale Function (2)'
+         print *, '17.  Wood Function (4)'
+         print *, '18.  Chebyquad Function (variable less than 51)'
+         print *
+         print *, 'You will need to enter both the problem number and th
+     &e dimension of the'
+         print *, 'problem.  For problems with a constant dimension, use
+     & the number in'
+         print *, 'parenthesis.  For problems with variable dimension, m
+     &ake sure the'
+         print *, 'dimension that you choose falls within the stated lim
+     &itations AND is'
+         print *, 'less than or equal to 100.  For example, to select th
+     &e Watson function'
+         print *, 'with dimension twelve, enter the following: 7 12'
+         print *
+         print *, 'Please enter the problem number and dimension now.'
+         read *, nprob, len
+         if (nprob .LT. 1 .OR. nprob .GT. 18) then
+            print *, 'Invalid problem number.'
+            stop
+         endif
+         if (len .GT. 100) then
+            print *, 'Dimension exceeds 100'
+            stop
+         endif
+         print *, 'How many iterations? '
+         read *, maxiter
+      endif
+      call MPI_BCAST(nprob,   1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierror)
+      call MPI_BCAST(len,     1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierror)
+      call MPI_BCAST(maxiter, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierror)
+      ctx = PGACreate(PGA_DATATYPE_REAL, len, PGA_MINIMIZE)
+      if (len .eq. 2) then
+         call PGASetCrossoverType(ctx, PGA_CROSSOVER_UNIFORM)
+      endif
+      call PGASetMaxGAIterValue(ctx, maxiter)
+      call PGASetPopSize(ctx, 10000)
+      call PGASetRandomSeed(ctx, 1)
+      call PGASetUp(ctx)
+      call PGARun(ctx, evaluate)
+      call PGADestroy(ctx)
+      call MPI_FINALIZE(ierror)
+
+      stop
+      end
+
+
+      double precision function evaluate(ctx, p, pop)
+      include 'pgapackf.h'
+
+      double precision x(100), f
+      integer ctx
+      integer    pop, p, i, stringlen, nprob
+
+      common nprob
+
+      stringlen = PGAGetStringLength(ctx)
+      do i = 1, stringlen
+         x(i) = PGAGetRealAllele(ctx, p, pop, i)
+      enddo
+      call objfcn(stringlen, x, f, nprob)
+      evaluate = f
+
+      return
+      end
Index: trunk/optimizer/src/pgapack/pgapack/examples/mgh/vecfcn77.f
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/mgh/vecfcn77.f	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/mgh/vecfcn77.f	(revision 816)
@@ -0,0 +1,265 @@
+      subroutine vecfcn(n,x,fvec,nprob)
+      integer n,nprob
+      double precision x(n),fvec(n)
+c     **********
+c
+c     subroutine vecfcn
+c
+c     This subroutine defines fourteen test functions. The first
+c     five test functions are of dimensions 2,4,2,4,3, respectively,
+c     while the remaining test functions are of variable dimension
+c     n for any n greater than or equal to 1 (problem 6 is an
+c     exception to this, since it does not allow n = 1).
+c
+c     The subroutine statement is
+c
+c       subroutine vecfcn(n,x,fvec,nprob)
+c
+c     where
+c
+c       n is a positive integer input variable.
+c
+c       x is an input array of length n.
+c
+c       fvec is an output array of length n which contains the nprob
+c         function vector evaluated at x.
+c
+c       nprob is a positive integer input variable which defines the
+c         number of the problem. nprob must not exceed 14.
+c
+c     Subprograms called
+c
+c       FORTRAN-supplied ... atan,cos,dble,exp,max,min,sign,sin,sqrt
+c
+c     Argonne National Laboratory. MINPACK Project. march 1980.
+c     Burton S. Garbow, Kenneth E. Hillstrom, Jorge J. More
+c
+c     **********
+      integer i,iev,j,k,ml,mu
+      double precision c1,c2,c3,c4,c5,c6,c7,c8,c9,eight,five,h,one,
+     *                 prod,sum,sum1,sum2,temp,temp1,temp2,ten,three,
+     *                 ti,tj,tk,tpi,two,zero
+      data zero,one,two,three,five,eight,ten
+     *     /0.0d0,1.0d0,2.0d0,3.0d0,5.0d0,8.0d0,1.0d1/
+      data c1,c2,c3,c4,c5,c6,c7,c8,c9
+     *     /1.0d4,1.0001d0,2.0d2,2.02d1,1.98d1,1.8d2,2.5d-1,5.0d-1,
+     *      2.9d1/
+c
+c     Problem selector.
+c
+      go to (10,20,30,40,50,60,120,170,200,220,270,300,330,350), nprob
+c
+c     Rosenbrock function.
+c
+   10 continue
+      fvec(1) = one - x(1)
+      fvec(2) = ten*(x(2) - x(1)**2)
+      return
+c
+c     Powell singular function.
+c
+   20 continue
+      fvec(1) = x(1) + ten*x(2)
+      fvec(2) = sqrt(five)*(x(3) - x(4))
+      fvec(3) = (x(2) - two*x(3))**2
+      fvec(4) = sqrt(ten)*(x(1) - x(4))**2
+      return
+c
+c     Powell badly scaled function.
+c
+   30 continue
+      fvec(1) = c1*x(1)*x(2) - one
+      fvec(2) = exp(-x(1)) + exp(-x(2)) - c2
+      return
+c
+c     Wood function.
+c
+   40 continue
+      temp1 = x(2) - x(1)**2
+      temp2 = x(4) - x(3)**2
+      fvec(1) = -c3*x(1)*temp1 - (one - x(1))
+      fvec(2) = c3*temp1 + c4*(x(2) - one) + c5*(x(4) - one)
+      fvec(3) = -c6*x(3)*temp2 - (one - x(3))
+      fvec(4) = c6*temp2 + c4*(x(4) - one) + c5*(x(2) - one)
+      return
+c
+c     Helical valley function.
+c
+   50 continue
+      tpi = eight*atan(one)
+      temp1 = sign(c7,x(2))
+      if (x(1) .gt. zero) temp1 = atan(x(2)/x(1))/tpi
+      if (x(1) .lt. zero) temp1 = atan(x(2)/x(1))/tpi + c8
+      temp2 = sqrt(x(1)**2+x(2)**2)
+      fvec(1) = ten*(x(3) - ten*temp1)
+      fvec(2) = ten*(temp2 - one)
+      fvec(3) = x(3)
+      return
+c
+c     Watson function.
+c
+   60 continue
+      do 70 k = 1, n
+         fvec(k) = zero
+   70    continue
+      do 110 i = 1, 29
+         ti = dble(i)/c9
+         sum1 = zero
+         temp = one
+         do 80 j = 2, n
+            sum1 = sum1 + dble(j-1)*temp*x(j)
+            temp = ti*temp
+   80       continue
+         sum2 = zero
+         temp = one
+         do 90 j = 1, n
+            sum2 = sum2 + temp*x(j)
+            temp = ti*temp
+   90       continue
+         temp1 = sum1 - sum2**2 - one
+         temp2 = two*ti*sum2
+         temp = one/ti
+         do 100 k = 1, n
+            fvec(k) = fvec(k) + temp*(dble(k-1) - temp2)*temp1
+            temp = ti*temp
+  100       continue
+  110    continue
+      temp = x(2) - x(1)**2 - one
+      fvec(1) = fvec(1) + x(1)*(one - two*temp)
+      fvec(2) = fvec(2) + temp
+      return
+c
+c     Chebyquad function.
+c
+  120 continue
+      do 130 k = 1, n
+         fvec(k) = zero
+  130    continue
+      do 150 j = 1, n
+         temp1 = one
+         temp2 = two*x(j) - one
+         temp = two*temp2
+         do 140 i = 1, n
+            fvec(i) = fvec(i) + temp2
+            ti = temp*temp2 - temp1
+            temp1 = temp2
+            temp2 = ti
+  140       continue
+  150    continue
+      tk = one/dble(n)
+      iev = -1
+      do 160 k = 1, n
+         fvec(k) = tk*fvec(k)
+         if (iev .gt. 0) fvec(k) = fvec(k) + one/(dble(k)**2 - one)
+         iev = -iev
+  160    continue
+      return
+c
+c     Brown almost-linear function.
+c
+  170 continue
+      sum = -dble(n+1)
+      prod = one
+      do 180 j = 1, n
+         sum = sum + x(j)
+         prod = x(j)*prod
+  180    continue
+      do 190 k = 1, n-1
+         fvec(k) = x(k) + sum
+  190    continue
+      fvec(n) = prod - one
+      return
+c
+c     Discrete boundary value function.
+c
+  200 continue
+      h = one/dble(n+1)
+      do 210 k = 1, n
+         temp = (x(k) + dble(k)*h + one)**3
+         temp1 = zero
+         if (k .ne. 1) temp1 = x(k-1)
+         temp2 = zero
+         if (k .ne. n) temp2 = x(k+1)
+         fvec(k) = two*x(k) - temp1 - temp2 + temp*h**2/two
+  210    continue
+      return
+c
+c     Discrete integral equation function.
+c
+  220 continue
+      h = one/dble(n+1)
+      do 260 k = 1, n
+         tk = dble(k)*h
+         sum1 = zero
+         do 230 j = 1, k
+            tj = dble(j)*h
+            temp = (x(j) + tj + one)**3
+            sum1 = sum1 + tj*temp
+  230       continue
+         sum2 = zero
+         do 240 j = k+1, n
+            tj = dble(j)*h
+            temp = (x(j) + tj + one)**3
+            sum2 = sum2 + (one - tj)*temp
+  240       continue
+         fvec(k) = x(k) + h*((one - tk)*sum1 + tk*sum2)/two
+  260    continue
+      return
+c
+c     Trigonometric function.
+c
+  270 continue
+      sum = zero
+      do 280 j = 1, n
+         fvec(j) = cos(x(j))
+         sum = sum + fvec(j)
+  280    continue
+      do 290 k = 1, n
+         fvec(k) = dble(n+k) - sin(x(k)) - sum - dble(k)*fvec(k)
+  290    continue
+      return
+c
+c     Variably dimensioned function.
+c
+  300 continue
+      sum = zero
+      do 310 j = 1, n
+         sum = sum + dble(j)*(x(j) - one)
+  310    continue
+      temp = sum*(one + two*sum**2)
+      do 320 k = 1, n
+         fvec(k) = x(k) - one + dble(k)*temp
+  320    continue
+      return
+c
+c     Broyden tridiagonal function.
+c
+  330 continue
+      do 340 k = 1, n
+         temp = (three - two*x(k))*x(k)
+         temp1 = zero
+         if (k .ne. 1) temp1 = x(k-1)
+         temp2 = zero
+         if (k .ne. n) temp2 = x(k+1)
+         fvec(k) = temp - temp1 - two*temp2 + one
+  340    continue
+      return
+c
+c     Broyden banded function.
+c
+  350 continue
+      ml = 5
+      mu = 1
+      do 370 k = 1, n
+         temp = zero
+         do 360 j = max(1,k-ml),min(k+mu,n)
+            if (j .ne. k) temp = temp + x(j)*(one + x(j))
+  360       continue
+         fvec(k) = x(k)*(two + five*x(k)**2) + one - temp
+  370    continue
+  380 continue
+      return
+c
+c     Last card of subroutine vecfcn.
+c
+      end
Index: trunk/optimizer/src/pgapack/pgapack/examples/mgh/vecjac77.f
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/mgh/vecjac77.f	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/mgh/vecjac77.f	(revision 816)
@@ -0,0 +1,315 @@
+      subroutine vecjac(n,x,fjac,ldfjac,nprob)
+      integer n,ldfjac,nprob
+      double precision x(n),fjac(ldfjac,n)
+c     **********
+c
+c     subroutine vecjac
+c
+c     This subroutine defines the Jacobian matrices of fourteen
+c     test functions. The problem dimensions are as described
+c     in the prologue comments of vecfcn.
+c
+c     The subroutine statement is
+c
+c       subroutine vecjac(n,x,fjac,ldfjac,nprob)
+c
+c     where
+c
+c       n is a positive integer variable.
+c
+c       x is an array of length n.
+c
+c       fjac is an output n by n array which contains the
+c         Jacobian matrix of the nprob function evaluated at x.
+c
+c       ldfjac is a positive integer variable not less than n
+c         which specifies the leading dimension of the array fjac.
+c
+c       nprob is a positive integer variable which defines the
+c         number of the problem. nprob must not exceed 14.
+c
+c     Subprograms called
+c
+c       FORTRAN-supplied ... atan,cos,dble,exp,max,min,sin,sqrt
+c
+c     Argonne National Laboratory. MINPACK Project. march 1980.
+c     Burton S. Garbow, Kenneth E. Hillstrom, Jorge J. More
+c
+c     **********
+      integer i,j,k,ml,mu
+      double precision c1,c3,c4,c5,c6,c9,eight,fiftn,five,four,h,
+     *                 hundrd,one,prod,six,sum,sum1,sum2,temp,temp1,
+     *                 temp2,temp3,temp4,ten,three,ti,tj,tk,tpi,
+     *                 twenty,two,zero
+      data zero,one,two,three,four,five,six,eight,ten,fiftn,twenty,
+     *     hundrd
+     *     /0.0d0,1.0d0,2.0d0,3.0d0,4.0d0,5.0d0,6.0d0,8.0d0,1.0d1,
+     *      1.5d1,2.0d1,1.0d2/
+      data c1,c3,c4,c5,c6,c9 /1.0d4,2.0d2,2.02d1,1.98d1,1.8d2,2.9d1/
+c
+c     Jacobian routine selector.
+c
+      go to (10,20,50,60,90,100,200,230,290,320,350,380,420,450),
+     *      nprob
+c
+c     Rosenbrock function.
+c
+   10 continue
+      fjac(1,1) = -one
+      fjac(1,2) = zero
+      fjac(2,1) = -twenty*x(1)
+      fjac(2,2) = ten
+      return
+c
+c     Powell singular function.
+c
+   20 continue
+      do 40 k = 1, 4
+         do 30 j = 1, 4
+            fjac(k,j) = zero
+   30       continue
+   40    continue
+      fjac(1,1) = one
+      fjac(1,2) = ten
+      fjac(2,3) = sqrt(five)
+      fjac(2,4) = -fjac(2,3)
+      fjac(3,2) = two*(x(2) - two*x(3))
+      fjac(3,3) = -two*fjac(3,2)
+      fjac(4,1) = two*sqrt(ten)*(x(1) - x(4))
+      fjac(4,4) = -fjac(4,1)
+      return
+c
+c     Powell badly scaled function.
+c
+   50 continue
+      fjac(1,1) = c1*x(2)
+      fjac(1,2) = c1*x(1)
+      fjac(2,1) = -exp(-x(1))
+      fjac(2,2) = -exp(-x(2))
+      return
+c
+c     Wood function.
+c
+   60 continue
+      do 80 k = 1, 4
+         do 70 j = 1, 4
+            fjac(k,j) = zero
+   70       continue
+   80    continue
+      temp1 = x(2) - three*x(1)**2
+      temp2 = x(4) - three*x(3)**2
+      fjac(1,1) = -c3*temp1 + one
+      fjac(1,2) = -c3*x(1)
+      fjac(2,1) = -two*c3*x(1)
+      fjac(2,2) = c3 + c4
+      fjac(2,4) = c5
+      fjac(3,3) = -c6*temp2 + one
+      fjac(3,4) = -c6*x(3)
+      fjac(4,2) = c5
+      fjac(4,3) = -two*c6*x(3)
+      fjac(4,4) = c6 + c4
+      return
+c
+c     Helical valley function.
+c
+   90 continue
+      tpi = eight*atan(one)
+      temp = x(1)**2 + x(2)**2
+      temp1 = tpi*temp
+      temp2 = sqrt(temp)
+      fjac(1,1) = hundrd*x(2)/temp1
+      fjac(1,2) = -hundrd*x(1)/temp1
+      fjac(1,3) = ten
+      fjac(2,1) = ten*x(1)/temp2
+      fjac(2,2) = ten*x(2)/temp2
+      fjac(2,3) = zero
+      fjac(3,1) = zero
+      fjac(3,2) = zero
+      fjac(3,3) = one
+      return
+c
+c     Watson function.
+c
+  100 continue
+      do 120 k = 1, n
+         do 110 j = k, n
+            fjac(k,j) = zero
+  110       continue
+  120    continue
+      do 170 i = 1, 29
+         ti = dble(i)/c9
+         sum1 = zero
+         temp = one
+         do 130 j = 2, n
+            sum1 = sum1 + dble(j-1)*temp*x(j)
+            temp = ti*temp
+  130       continue
+         sum2 = zero
+         temp = one
+         do 140 j = 1, n
+            sum2 = sum2 + temp*x(j)
+            temp = ti*temp
+  140       continue
+         temp1 = two*(sum1 - sum2**2 - one)
+         temp2 = two*sum2
+         temp = ti**2
+         tk = one
+         do 160 k = 1, n
+            tj = tk
+            do 150 j = k, n
+               fjac(k,j) = fjac(k,j)
+     *                     + tj
+     *                       *((dble(k-1)/ti - temp2)
+     *                         *(dble(j-1)/ti - temp2) - temp1)
+               tj = ti*tj
+  150          continue
+            tk = temp*tk
+  160       continue
+  170    continue
+      fjac(1,1) = fjac(1,1) + six*x(1)**2 - two*x(2) + three
+      fjac(1,2) = fjac(1,2) - two*x(1)
+      fjac(2,2) = fjac(2,2) + one
+      do 190 k = 1, n
+         do 180 j = k+1, n
+            fjac(j,k) = fjac(k,j)
+  180       continue
+  190    continue
+      return
+c
+c     Chebyquad function.
+c
+  200 continue
+      tk = one/dble(n)
+      do 220 j = 1, n
+         temp1 = one
+         temp2 = two*x(j) - one
+         temp = two*temp2
+         temp3 = zero
+         temp4 = two
+         do 210 k = 1, n
+            fjac(k,j) = tk*temp4
+            ti = four*temp2 + temp*temp4 - temp3
+            temp3 = temp4
+            temp4 = ti
+            ti = temp*temp2 - temp1
+            temp1 = temp2
+            temp2 = ti
+  210       continue
+  220    continue
+      return
+c
+c     Brown almost-linear function.
+c
+  230 continue
+      prod = one
+      do 250 j = 1, n
+         prod = x(j)*prod
+         do 240 k = 1, n
+            fjac(k,j) = one
+  240       continue
+         fjac(j,j) = two
+  250    continue
+      do 280 j = 1, n
+         temp = x(j)
+         if (temp .eq. zero) then
+            temp = one
+            prod = one
+            do 260 k = 1, n
+               if (k .ne. j) prod = x(k)*prod
+  260          continue
+            end if
+         fjac(n,j) = prod/temp
+  280    continue
+      return
+c
+c     Discrete boundary value function.
+c
+  290 continue
+      h = one/dble(n+1)
+      do 310 k = 1, n
+         temp = three*(x(k) + dble(k)*h + one)**2
+         do 300 j = 1, n
+            fjac(k,j) = zero
+  300       continue
+         fjac(k,k) = two + temp*h**2/two
+         if (k .ne. 1) fjac(k,k-1) = -one
+         if (k .ne. n) fjac(k,k+1) = -one
+  310    continue
+      return
+c
+c     Discrete integral equation function.
+c
+  320 continue
+      h = one/dble(n+1)
+      do 340 k = 1, n
+         tk = dble(k)*h
+         do 330 j = 1, n
+            tj = dble(j)*h
+            temp = three*(x(j) + tj + one)**2
+            fjac(k,j) = h*min(tj*(one-tk),tk*(one-tj))*temp/two
+  330       continue
+         fjac(k,k) = fjac(k,k) + one
+  340    continue
+      return
+c
+c     Trigonometric function.
+c
+  350 continue
+      do 370 j = 1, n
+         temp = sin(x(j))
+         do 360 k = 1, n
+            fjac(k,j) = temp
+  360       continue
+         fjac(j,j) = dble(j+1)*temp - cos(x(j))
+  370    continue
+      return
+c
+c     Variably dimensioned function.
+c
+  380 continue
+      sum = zero
+      do 390 j = 1, n
+         sum = sum + dble(j)*(x(j) - one)
+  390    continue
+      temp = one + six*sum**2
+      do 410 k = 1, n
+         do 400 j = k, n
+            fjac(k,j) = dble(k*j)*temp
+            fjac(j,k) = fjac(k,j)
+  400       continue
+         fjac(k,k) = fjac(k,k) + one
+  410    continue
+      return
+c
+c     Broyden tridiagonal function.
+c
+  420 continue
+      do 440 k = 1, n
+         do 430 j = 1, n
+            fjac(k,j) = zero
+  430       continue
+         fjac(k,k) = three - four*x(k)
+         if (k .ne. 1) fjac(k,k-1) = -one
+         if (k .ne. n) fjac(k,k+1) = -two
+  440    continue
+      return
+c
+c     Broyden banded function.
+c
+  450 continue
+      ml = 5
+      mu = 1
+      do 480 k = 1, n
+         do 460 j = 1, n
+            fjac(k,j) = zero
+  460       continue
+         do 470 j = max(1,k-ml), min(k+mu,n)
+            if (j .ne. k) fjac(k,j) = -(one + two*x(j))
+  470       continue
+         fjac(k,k) = two + fiftn*x(k)**2
+  480    continue
+      return
+c
+c     Last card of subroutine vecjac.
+c
+      end
Index: trunk/optimizer/src/pgapack/pgapack/examples/templates/README
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/templates/README	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/templates/README	(revision 816)
@@ -0,0 +1,5 @@
+This directory contains stubs for all the PGAPack user defined routines.
+Simply cut out the ones you want and paste in the appropriate logic.
+
+uf_native.[cf] -- User functions usable on both native and custom datatypes.
+uf_new.c       -- User functions usable only when creating a custom datatype. 
Index: trunk/optimizer/src/pgapack/pgapack/examples/templates/uf_native.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/templates/uf_native.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/templates/uf_native.c	(revision 816)
@@ -0,0 +1,116 @@
+/*  Stub functions for using PGAPack with a native datatype, but user defined
+ *  operators.
+ *
+ *  Simple example (with no actual code) that shows how one would go about
+ *  setting PGAPack up to evolve "strings" that use a native datatype, but
+ *  need to use custom evolutionary operators.
+ */
+#include <pgapack.h>
+
+void         MyInitString(PGAContext *ctx, int p, int pop);
+void         MyCrossover(PGAContext *ctx, int p1, int p2, int p_pop, int c1,
+	                 int c2, int c_pop);
+int          MyMutation(PGAContext *ctx, int p, int pop, double mr);
+int          MyDuplicateString(PGAContext *ctx, int p1, int pop1, int p2,
+	                       int pop2);
+void         MyPrintString(PGAContext *ctx, FILE *fp, int p, int pop);
+int          MyDone(PGAContext *ctx);
+void         MyEndOfGen(PGAContext *ctx);
+
+double       MyEvaluate(PGAContext *ctx, int p, int pop);
+ 
+
+int main(int argc, char **argv) {
+  PGAContext *ctx;
+
+  ctx = PGACreate(&argc, argv, PGA_DATATYPE, 1, PGA_MAXIMIZE);
+
+  PGASetUserFunction(ctx, PGA_USERFUNCTION_MUTATION,    MyMutation);
+  PGASetUserFunction(ctx, PGA_USERFUNCTION_CROSSOVER,   MyCrossover);
+  PGASetUserFunction(ctx, PGA_USERFUNCTION_PRINTSTRING, MyPrintString);
+  PGASetUserFunction(ctx, PGA_USERFUNCTION_DUPLICATE,   MyDuplicateString);
+  PGASetUserFunction(ctx, PGA_USERFUNCTION_INITSTRING,  MyInitString);
+  PGASetUserFunction(ctx, PGA_USERFUNCTION_DONE,        MyDone);
+  PGASetUserFunction(ctx, PGA_USERFUNCTION_ENDOFGEN,    MyEndOfGen);
+  
+  PGASetUp(ctx);
+  PGARun(ctx, MyEvaluate);
+  PGADestroy(ctx);
+  return(0);
+}
+
+
+/*  Perform mutation on a "string".  It is important to keep count of the 
+ *  number of mutations performed and to return that value.
+ */
+int MyMutation(PGAContext *ctx, int p, int pop, double mr) {
+  int         count;
+
+  /*  Insert code to mutate Data here.  Remember to count the number
+   *  of mutations that happen, and return that value!
+   */
+
+  return(count);
+}
+
+
+/*  Perform crossover from two parents to two children.  */
+void MyCrossover(PGAContext *ctx, int p1, int p2, int p_pop, int c1, int c2,
+		 int c_pop) {
+    
+    /*  Perform crossover from p1 and p2 into c1 and c2 here.  */
+}
+
+
+/*  Print a "string" to the file fp.  */
+void MyPrintString(PGAContext *ctx, FILE *fp, int p, int pop) {
+
+    /*  Print the string referenced by p and pop to the file fp.  */
+}
+
+
+/*  Determine if two strings are the same.  If so, return non-zero, otherwise
+ *  return zero.  If contiguous data, usually a call to memcmp.
+ */
+int MyDuplicateString(PGAContext *ctx, int p1, int pop1, int p2, int pop2) {
+
+    /*  Compare strings p1 and p2 to see if they are different.  If they
+     *  are, return non-zero; else, return 0.
+     */
+}
+
+
+/*  Randomly initialize a string.  */
+void MyInitString(PGAContext *ctx, int p, int pop) {
+
+  /*  Insert code to randomly initialize p in popultion pop here.  */
+}
+
+
+/*  Check if a GA has found an acceptable solution.  */
+int MyDone(PGAContext *ctx) {
+    int done = PGA_FALSE;
+
+    /*  Check for "doneness".  */
+
+    return(done);
+}
+
+
+/*  After each generation, this funciton will get called.  */
+void MyEndOfGen(PGAContext *ctx) {
+
+    /*  Do something useful; display the population on a graphics output,
+     *  let the user adjust the population, etc.
+     */
+}
+
+
+/*  The evaluation function.    */
+double MyEvaluate(PGAContext *ctx, int p, int pop) {
+    
+    /*  Evaluate the string here, and return a double representing
+     *  the quality of the solution.
+     */
+}
+
Index: trunk/optimizer/src/pgapack/pgapack/examples/templates/uf_native.f
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/templates/uf_native.f	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/templates/uf_native.f	(revision 816)
@@ -0,0 +1,160 @@
+c     Stub functions for using PGAPack with a natve datatype, but user
+c     defined operators.
+c
+c     In Fortran, we cannot allocate memory, nor can we define a C type
+c     structure, thus, userdefined data types are rather silly.  So,
+c     PGA_USERFUNCTION_CREATESTRING, and PGA_USERFUNCTION_BUILDDATATYPE are
+c     not allowed.
+
+      include 'pgapackf.h'
+
+      external MyInitString
+      external MyCrossover
+      external MyMutation
+      external MyDuplicateString
+      external MyPrintString
+      external MyDone
+      external MyEndOfGen
+      external MyEvaluate
+
+      integer          MyMutation
+      integer          MyDuplicateString
+      integer          MyDone
+      double precision MyEvaluate
+
+      integer ctx
+
+
+      ctx = PGACreate(PGA_DATATYPE_INTEGER, 10, PGA_MAXIMIZE)
+
+      PGASetUserFunction(ctx, PGA_USERFUNCTION_MUTATION,    MyMutation)
+      PGASetUserFunction(ctx, PGA_USERFUNCTION_CROSSOVER,   MyCrossover)
+      PGASetUserFunction(ctx, PGA_USERFUNCTION_PRINTSTRING, MyPrintString)
+      PGASetUserFunction(ctx, PGA_USERFUNCTION_DUPLICATE,   MyDuplicateString)
+      PGASetUserFunction(ctx, PGA_USERFUNCTION_INITSTRING,  MyInitString)
+      PGASetUserFunction(ctx, PGA_USERFUNCTION_DONE,        MyDone)
+      PGASetUserFunction(ctx, PGA_USERFUNCTION_ENDOFGEN,    MyEndOfGen)
+  
+      PGASetUp(ctx)
+      PGARun(ctx, MyEvaluate)
+      PGADestroy(ctx)
+
+      stop
+      end
+
+
+
+
+
+c     Perform mutation on a "string".  It is important to keep count of
+c     the number of mutations performed and to return that value.
+c
+      integer function MyMutation(ctx, p, pop, mr)
+      include 'pgapackf.h'
+      integer ctx, p, pop, count, length
+      double precision mr
+
+      length = PGAGetStringLength(ctx)
+
+      do i=1, length
+         if (PGARandomFlip(ctx, mr) .eq. PGA_TRUE) then
+c
+c           Insert code to mutate an allele here.  Remember to count
+c           the number of mutations that happen, and return that value!
+c
+         endif
+      enddo
+
+      MyMutation = count
+      return
+      end
+
+
+c     Perform crossover from two parents to two children.  
+      subroutine MyCrossover(ctx, p1, p2, p_pop, c1, c2, c_pop)
+      include 'pgapackf.h'
+      integer ctx, p1, p2, p_pop, c1, c2, c_pop
+
+c     Perform crossover from P1 and P2 into C1 and C2 here. 
+
+      return
+      end
+      
+
+
+
+c     Print a "string".  The second argument is a C file pointer, 
+c     but we cannot do anything with it,
+      subroutine MyPrintString(ctx, fp, p, pop)
+      include 'pgapackf.h'
+      integer ctx, fp, p, pop
+     
+c     Print the string
+
+      return
+      end
+
+
+
+c     Determine if two strings are the same.  If so, return non-zero,
+c     otherwise return zero.
+      integer function MyDuplicateString(ctx, p1, pop1, p2, pop2)
+      include 'pgapackf.h'
+      integer ctx, p1, pop1, p2, pop2, equal
+
+c     Compare the strings
+
+      MyDuplicateString = equal
+      return
+      end
+
+
+
+c     Randomly initialize a string.
+      subroutine MyInitString(ctx, p, pop)
+      include 'pgapackf.h'
+      integer ctx, p, pop
+
+c     Insert code to randomly initialize Data here. 
+
+      return
+      end
+
+
+c     Check if a GA has found an acceptable solution.
+      integer function MyDone(ctx) 
+      include 'pgapackf.h'
+      integer ctx, done
+
+      done = PGA_FALSE
+
+c     Check for "doneness".
+
+      MyDone = done
+      return
+      end
+
+
+c     After each generation, this funciton will get called.
+      subroutine MyEndOfGen(ctx)
+      include 'pgapackf.h'
+      integer ctx
+
+c     Do something useful; display the population on a graphics output,
+c     let the user adjust the population, etc.
+
+      return
+      end
+
+
+
+c     The evaluation function.
+      double precision function MyEvaluate(ctx, p, pop)
+      include 'pgapackf.h'
+      integer ctx, p, pop
+
+c     Evaluate the string
+
+      MyEvaluate = evaluation
+      return
+      end
Index: trunk/optimizer/src/pgapack/pgapack/examples/templates/uf_new.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/examples/templates/uf_new.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/examples/templates/uf_new.c	(revision 816)
@@ -0,0 +1,172 @@
+/*  Stub functions for using PGAPAck with a user datatype.
+ *
+ *  Simple example (with no actual code) that shows how one would go about
+ *  setting PGAPack up to evolve "strings" that are a single structure,
+ *  using the necessary user defined functions.
+ */
+#include <pgapack.h>
+
+void         MyCreateString(PGAContext *ctx, int p, int pop, int InitFlag);
+MPI_Datatype MyBuildDatatype(PGAContext *ctx, int p, int pop);
+int          MyMutation(PGAContext *ctx, int p, int pop, double mr);
+void         MyCrossover(PGAContext *ctx, int p1, int p2, int p_pop, int c1,
+	                 int c2, int c_pop);
+void         MyPrintString(PGAContext *ctx, FILE *fp, int p, int pop);
+void         MyCopyString(PGAContext *ctx, int p1, int pop1, int p2, int pop2);
+int          MyDuplicateString(PGAContext *ctx, int p1, int pop1, int p2,
+	                       int pop2);
+
+
+double       MyEvaluate(PGAContext *ctx, int p, int pop);
+
+
+typedef struct {
+    /*  Put your favorite structure here!  */
+} MyStruct;
+
+
+int main(int argc, char **argv) {
+  PGAContext *ctx;
+
+  ctx = PGACreate(&argc, argv, PGA_DATATYPE_USER, 1, PGA_MAXIMIZE);
+
+  PGASetUserFunction(ctx, PGA_USERFUNCTION_CREATESTRING,    MyCreateString);
+  PGASetUserFunction(ctx, PGA_USERFUNCTION_BUILDDATATYPE,   MyBuildDatatype);
+  PGASetUserFunction(ctx, PGA_USERFUNCTION_MUTATION,        MyMutation);
+  PGASetUserFunction(ctx, PGA_USERFUNCTION_CROSSOVER,       MyCrossover);
+  PGASetUserFunction(ctx, PGA_USERFUNCTION_PRINTSTRING,     MyPrintString);
+  PGASetUserFunction(ctx, PGA_USERFUNCTION_COPYSTRING,      MyCopyString);
+  PGASetUserFunction(ctx, PGA_USERFUNCTION_DUPLICATE,       MyDuplicateString);
+
+  PGASetUp(ctx);
+  PGARun(ctx, MyEvaluate);
+  PGADestroy(ctx);
+  return(0);
+}
+
+
+/*  Function must allocate space for the "string", and, if InitFlag it PGA_TRUE,
+ *  randomly initialize the string, otherwise, set it to zero.  Note that we
+ *  do not need to keep track of each member of the population; the pointers
+ *  are stored internally.
+ */
+void MyCreateString(PGAContext *ctx, int p, int pop, int InitFlag) {
+  PGAIndividual  *New;
+  MyStruct       *Data;
+
+  New = PGAGetIndividual(ctx, p, pop);
+
+  /*  Allocate space for the new chromosome.  */
+  if (!(New->chrom = malloc(sizeof(MyStruct)))) {
+    fprintf(stderr, "No more room in memory for the population!/n");
+    exit(10);
+  }
+
+  /*  For convenience.  */
+  Data = (MyStruct *)New->chrom;
+
+  /*  Initialize, if needed.  Otherwise, clear.  */
+}
+
+
+/*  Perform mutation on a "string".  It is important to keep count of the 
+ *  number of mutations performed and to return that value.
+ */
+int MyMutation(PGAContext *ctx, int p, int pop, double mr) {
+  MyStruct   *Data;
+  int         count;
+
+  Data = (MyStruct *)PGAGetIndividual(ctx, p, pop)->chrom;
+
+  /*  Insert code to mutate Data here.  Remember to count the number
+   *  of mutations that happen, and return that value!
+   */
+
+  return(count);
+}
+
+
+/*  Perform crossover from two parents to two children.  */
+void MyCrossover(PGAContext *ctx, int p1, int p2, int p_pop, int c1, int c2,
+		 int c_pop) {
+    MyStruct   *P1, *P2, *C1, *C2;
+
+    P1 = (MyStruct *)PGAGetIndividual(ctx, p1, p_pop)->chrom;
+    P2 = (MyStruct *)PGAGetIndividual(ctx, p2, p_pop)->chrom;
+    C1 = (MyStruct *)PGAGetIndividual(ctx, c1, c_pop)->chrom;
+    C2 = (MyStruct *)PGAGetIndividual(ctx, c1, c_pop)->chrom;
+    
+    /*  Perform crossover from P1 and P2 into C1 and C2 here.  */
+}
+
+
+/*  Print a "string" to the file fp.  */
+void MyPrintString(PGAContext *ctx, FILE *fp, int p, int pop) {
+    MyStruct   *Data;
+
+    Data = (MyStruct *)PGAGetIndividual(ctx, p, pop)->chrom;
+    
+    /*  Print the string Data to the file fp.  */
+}
+
+
+/*  Copy one string to another.  If contiguous data, usually a call to memcpy.  */
+void MyCopyString(PGAContext *ctx, int p1, int pop1, int p2, int pop2) {
+    MyStruct  *P1, *P2;
+
+    P1 = (MyStruct *)PGAGetIndividual(ctx, p1, pop1)->chrom;
+    P2 = (MyStruct *)PGAGetIndividual(ctx, p2, pop2)->chrom;
+
+    /*  Copy string P1 into string P2.  This can be as simple as doing
+     *      memcpy(P2, P1, sizeof(MyStruct_s));
+     */
+}
+
+
+/*  Determine if two strings are the same.  If so, return non-zero, otherwise
+ *  return zero.  If contiguous data, usually a call to memcmp.
+ */
+int MyDuplicateString(PGAContext *ctx, int p1, int pop1, int p2, int pop2) {
+    MyStruct  *P1, *P2;
+
+    P1 = (MyStruct *)PGAGetIndividual(ctx, p1, pop1)->chrom;
+    P2 = (MyStruct *)PGAGetIndividual(ctx, p2, pop2)->chrom;
+
+    /*  Compare strings P1 and P2 to see if they are different.  If they
+     *  are, return non-zero; else, return 0.  This can be as simple as
+     *      return(!memcmp(P1, P2, sizeof(MyStruct_s)));
+     */
+}
+
+
+/*  Randomly initialize a string.  */
+void MyInitString(PGAContext *ctx, int p, int pop) {
+  MyStruct   *Data;
+
+  Data = (MyStruct *)PGAGetIndividual(ctx, p, pop)->chrom;
+
+  /*  Insert code to randomly initialize Data here.  */
+}
+
+
+/*  Create an MPI_Datatype for the "string".  */
+MPI_Datatype MyBuildDatatype(PGAContext *ctx, int p, int pop) {
+  MyStruct   *Data;
+
+  Data = (MyStruct *)PGAGetIndividual(ctx, p, pop)->chrom;
+
+  /*  Insert code to build an MPI datatype here.  */
+}
+
+
+/*  The evaluation function.    */
+double MyEvaluate(PGAContext *ctx, int p, int pop) {
+    MyStruct   *Data;
+
+    Data = (MyStruct *)PGAGetIndividual(ctx, p, pop)->chrom;
+    
+    /*  Evaluate the string here, and return a double representing
+     *  the quality of the solution.
+     */
+}
+
Index: trunk/optimizer/src/pgapack/pgapack/include/fakempi_h
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/include/fakempi_h	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/include/fakempi_h	(revision 816)
@@ -0,0 +1,59 @@
+/*  These are the definitions to use our fake version of MPI in mpi_stub.c 
+ *  Guaranteed only to make PGAPack compile and link without MPI, but should
+ *  work from user C and fortran programs.
+ *
+ *  Some of these are from mpich's mpi.h, others are custom.
+ *
+ *  Author: Brian P. Walenz
+ */
+typedef void *  MPI_Comm;
+typedef void *  MPI_Datatype;
+typedef long    MPI_Aint;
+
+typedef struct {
+    int     MPI_SOURCE;
+    int     MPI_TAG;
+    int     MPI_ERROR;
+} MPI_Status;
+
+#define MPI_BYTE            (void *)NULL
+#define MPI_CHAR            (void *)NULL
+#define MPI_DOUBLE          (void *)NULL
+#define MPI_FLOAT           (void *)NULL
+#define MPI_INT             (void *)NULL
+#define MPI_LONG            (void *)NULL
+#define MPI_LONG_DOUBLE     (void *)NULL
+#define MPI_PACKED          (void *)NULL
+#define MPI_SHORT           (void *)NULL
+#define MPI_UNSIGNED_CHAR   (void *)NULL
+#define MPI_UNSIGNED        (void *)NULL
+#define MPI_UNSIGNED_LONG   (void *)NULL
+#define MPI_UNSIGNED_SHORT  (void *)NULL
+
+#define MPI_COMM_WORLD      (void *)NULL
+#define MPI_COMM_SELF       (void *)NULL
+
+#define MPI_BOTTOM          (void *)0
+
+#define MPI_PROC_NULL       (-1)
+#define MPI_ANY_SOURCE      (-2)
+#define MPI_ANY_TAG         (-1)
+
+/*  Declare prototypes for the MPI functions.  */
+int MPI_Address(void *, MPI_Aint *);
+int MPI_Bcast(void *, int, MPI_Datatype, int, MPI_Comm);
+int MPI_Comm_dup(MPI_Comm, MPI_Comm *);
+int MPI_Comm_free(MPI_Comm *);
+int MPI_Comm_rank(MPI_Comm, int *);
+int MPI_Comm_size(MPI_Comm, int *);
+int MPI_Finalize(void);
+int MPI_Init(int *, char ***);
+int MPI_Initialized(int *);
+int MPI_Probe(int, int, MPI_Comm, MPI_Status *);
+int MPI_Send(void *, int, MPI_Datatype, int, int, MPI_Comm);
+int MPI_Recv(void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Status *);
+int MPI_Sendrecv(void *, int, MPI_Datatype, int, int, void *, int,
+	         MPI_Datatype, int, int, MPI_Comm, MPI_Status *);
+int MPI_Type_commit(MPI_Datatype *);
+int MPI_Type_free(MPI_Datatype *);
+int MPI_Type_struct(int, int *, MPI_Aint *, MPI_Datatype *, MPI_Datatype *);
Index: trunk/optimizer/src/pgapack/pgapack/include/fakempif_h
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/include/fakempif_h	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/include/fakempif_h	(revision 816)
@@ -0,0 +1,34 @@
+c     These are the definitions to use our fake version of MPI in mpi_stub.c 
+c     Guaranteed only to make PGAPack compile and link without MPI, but should
+c     work from user fortran program.
+c 
+c     Some are from mpich's mpif.h, others are custom.
+c
+c     Author: Brian P. Walenz
+c 
+      integer MPI_BYTE, MPI_CHARACTER, MPI_COMPLEX
+      integer MPI_DOUBLE_PRECISION, MPI_INTEGER, MPI_REAL
+      integer MPI_LOGICAL, MPI_PACKED
+      parameter(MPI_BYTE=0, MPI_CHARACTER=0, MPI_COMPLEX=0)
+      parameter(MPI_DOUBLE_PRECISION=0, MPI_INTEGER=0, MPI_REAL=0)
+      parameter(MPI_LOGICAL=0, MPI_PACKED=0)
+      
+      integer MPI_COMM_WORLD, MPI_COMM_SELF, MPI_BOTTOM
+      parameter (MPI_COMM_WORLD=0, MPI_COMM_SELF=0, MPI_BOTTOM=0)
+      
+      integer MPI_PROC_NULL, MPI_ANY_SOURCE, MPI_ANY_TAG
+      parameter(MPI_PROC_NULL=0, MPI_ANY_SOURCE=(-2), MPI_ANY_TAG=(-1))
+      
+      integer MPI_SOURCE, MPI_TAG, MPI_ERROR
+      parameter(MPI_SOURCE=2, MPI_TAG=3, MPI_ERROR=4)
+      
+      integer MPI_STATUS_SIZE
+      parameter (MPI_STATUS_SIZE=4)
+
+c     Functions
+      external MPI_Address, MPI_Bcast, MPI_Comm_dup, MPI_Comm_free
+      external MPI_Comm_rank, MPI_Comm_size, MPI_Finalize, MPI_Init
+      external MPI_Initialized, MPI_Probe, MPI_Send, MPI_Recv
+      external MPI_Sendrecv, MPI_Type_commit, MPI_Type_free
+      external MPI_Type_struct
+
Index: trunk/optimizer/src/pgapack/pgapack/include/pgapack.h
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/include/pgapack.h	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/include/pgapack.h	(revision 816)
@@ -0,0 +1,831 @@
+/******************************************************************************
+*     FILE: pgapack.h: This file contains all constant and structure
+*                      definitions definitions for PGAPack as well as all
+*                      function declarations.
+*     Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle,
+*              Brian P. Walenz
+******************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <time.h>
+#include <limits.h>
+#include <float.h>
+#include <string.h> 
+#include <ctype.h>
+#include <mpi.h>
+
+
+/*  If OPTIMIZED, remove various sanity checks, and debug output.
+ *
+ *  PGADebugEntered(a)      - Print a debug message about entering "a"
+ *  PGADebugExited(a)       - Print a debug message about exiting "a"
+ *  PGAFailIfNotSetup(a)    - Fail fatally if PGASetUp has not been called
+ *  PGAFailIfSetup(a)       - Fail fatally if PGASetUp has been called
+ *  PGACheckDataType(a, D)  - Fail fatally if the datatype is not D
+ */
+#ifndef OPTIMIZE
+#define OPTIMIZE 0
+#define PGADebugEntered(a) \
+  PGADebugPrint(ctx, PGA_DEBUG_ENTERED, a, "Entered", PGA_VOID, NULL)
+#define PGADebugExited(a) \
+  PGADebugPrint(ctx, PGA_DEBUG_EXIT, a, "Exited", PGA_VOID, NULL)
+#define PGAFailIfNotSetUp(Name)  \
+  if (ctx->sys.SetUpCalled == PGA_FALSE) \
+     PGAError(ctx, "PGASetUp must be called before " Name, \
+              PGA_FATAL, PGA_VOID, NULL)
+#define PGAFailIfSetUp(Name)  \
+  if (ctx->sys.SetUpCalled == PGA_TRUE) \
+     PGAError(ctx, Name " must be called before PGASetUp", PGA_FATAL, \
+	      PGA_VOID, NULL)
+#define PGACheckDataType(Name, DataType) \
+  if (ctx->ga.datatype != DataType) \
+     PGAError(ctx, "DataType is incorrect for " Name,PGA_FATAL,PGA_VOID,NULL)
+#else
+#undef OPTIMIZE
+#define OPTIMIZE 1
+#define PGADebugPrint(a,b,c,x,y,z) ;
+#define PGADebugEntered(a) ;
+#define PGADebugExited(a) ;
+#define PGAFailIfNotSetUp(Name)  ;
+#define PGAFailIfSetUp(Name)  ;
+#define PGACheckDataType(Name, DataType) ;
+#endif
+
+/*****************************************
+*           BINARY   MACROS              *
+*****************************************/
+#ifndef WL
+#error WL must be defined on the command line!
+#endif
+
+#define ONEL        ((PGABinary)1)
+#define BIT(x,y)    (y&(ONEL<<((WL-1)-(x))))    /* true if bit is 1,         */
+#define SET(x,y)    (y|=(ONEL<<((WL-1)-(x))))   /* set a bit to 1            */
+#define UNSET(x,y)  (y&=(~(ONEL<<((WL-1)-(x)))))/* set a bit to 0, clear     */
+#define TOGGLE(x,y) (y^=(ONEL<<((WL-1)-(x))))   /* complement a bits value   */
+#define INDEX(ix,bx,bit,WL) ix=bit/WL;bx=bit%WL /* map global column (bit)   */
+                                                /* to word (ix) and bit (bx) */
+
+/*****************************************
+*       ABSTRACT DATA TYPES              *
+*****************************************/
+#define PGA_DATATYPE_BINARY      1    /* Array of unsigned ints            */
+                                      /* parsed into bits    : binary.c    */
+#define PGA_DATATYPE_INTEGER     2    /* Array of ints       : integer.c   */
+#define PGA_DATATYPE_REAL        3    /* Array of doubles    : real.c      */
+#define PGA_DATATYPE_CHARACTER   4    /* Array of characters : character.c */
+#define PGA_DATATYPE_USER        5    /*  --user defined--                 */
+    
+#define PGABinary                unsigned long
+#define PGAInteger               signed long int
+#define PGAReal                  double
+#define PGACharacter             signed char
+
+#define PGA_INT                   1
+#define PGA_DOUBLE                2
+#define PGA_CHAR                  3
+#define PGA_VOID                  4
+
+    
+/*****************************************
+*              BOOLEANS                  *
+*****************************************/
+#define PGA_TRUE                   1
+#define PGA_FALSE                  0
+
+/*****************************************
+*                FLAGS                   *
+*****************************************/
+#define PGA_FATAL                 1
+#define PGA_WARNING               2
+
+/*****************************************
+*             MISC CONSTANT              *
+*****************************************/
+#define PGA_TEMP1                -1138
+#define PGA_TEMP2                -4239
+
+#define PGA_OLDPOP               -6728
+#define PGA_NEWPOP               -8376
+
+#define PGA_UNINITIALIZED_INT    -3827
+#define PGA_UNINITIALIZED_DOUBLE -968.3827
+
+/*****************************************
+*        DEBUG LEVELS                    *
+*****************************************/
+#define PGA_DEBUG_ENTERED        12
+#define PGA_DEBUG_EXIT           13
+#define PGA_DEBUG_MALLOC         80
+#define PGA_DEBUG_PRINTVAR       82
+#define PGA_DEBUG_SEND           22
+#define PGA_DEBUG_RECV           23
+#define PGA_DEBUG_MAXPGAPACKFUNCTIONS	300
+#define PGA_DEBUG_MAXFLAGS       1000
+
+/*****************************************
+*           DIRECTION                    *
+*****************************************/
+#define PGA_MAXIMIZE            1    /* specify direction for fitness calc  */
+#define PGA_MINIMIZE            2    /* specify direction for fitness calc  */
+    
+/*****************************************
+*         STOPPING CRITERIA              *
+*****************************************/
+#define PGA_STOP_MAXITER        1    /* Stop: for maximum iterations      */
+#define PGA_STOP_NOCHANGE       2    /* Stop: no change in best string    */
+#define PGA_STOP_TOOSIMILAR     4    /* Stop: homogeneous population      */
+
+/*****************************************
+*            CROSSOVER                   *
+*****************************************/
+#define PGA_CROSSOVER_ONEPT     1    /* One point crossover                */
+#define PGA_CROSSOVER_TWOPT     2    /* Two point crossover                */
+#define PGA_CROSSOVER_UNIFORM   3    /* Uniform   crossover                */
+
+/*****************************************
+*            SELECTION                   *
+*****************************************/
+#define PGA_SELECT_PROPORTIONAL 1    /* proportional selection              */
+#define PGA_SELECT_SUS          2    /* stochastic universal selection      */
+#define PGA_SELECT_TOURNAMENT   3    /* tournament selection                */
+#define PGA_SELECT_PTOURNAMENT  4    /* probabilistic tournament selection  */
+
+/*****************************************
+*            FITNESS                     *
+*****************************************/
+#define PGA_FITNESS_RAW         1    /* use raw fitness (evaluation)        */
+#define PGA_FITNESS_NORMAL      2    /* linear normalization fitness        */
+#define PGA_FITNESS_RANKING     3    /* linear ranking fitness              */
+
+/*****************************************
+*            FITNESS (MINIMIZATION)      *
+*****************************************/
+#define PGA_FITNESSMIN_RECIPROCAL  1 /* reciprocal fitness                  */
+#define PGA_FITNESSMIN_CMAX        2 /* cmax fitness                        */
+
+/*****************************************
+*               MUTATION                 *
+*****************************************/
+#define PGA_MUTATION_CONSTANT   1    /* Real/Integer: Fixed value           */
+#define PGA_MUTATION_RANGE      2    /* Real/Integer: Uniform range         */
+#define PGA_MUTATION_UNIFORM    3    /* Real: +- Uniform random no.         */
+#define PGA_MUTATION_GAUSSIAN   4    /* Real: +- Gaussian random no.        */
+#define PGA_MUTATION_PERMUTE    5    /* Integer: Permutation (swap)         */
+    
+/*****************************************
+*        POPULATION REPLACEMENT          *
+*****************************************/
+#define PGA_POPREPL_BEST         1   /* Select best   string                */
+#define PGA_POPREPL_RANDOM_NOREP 2   /* Select random string w/o replacement*/
+#define PGA_POPREPL_RANDOM_REP   3   /* Select random string w/  replacement*/
+
+/****************************************
+ *       REPORT OPTIONS                 *
+ ****************************************/
+#define PGA_REPORT_ONLINE        1    /* Print the online analysis           */
+#define PGA_REPORT_OFFLINE       2    /* Print the offline analysis          */
+#define PGA_REPORT_HAMMING       4    /* Print the Hamming distance          */
+#define PGA_REPORT_STRING        8    /* Print the string                    */
+#define PGA_REPORT_WORST         16   /* Print the worst individual          */
+#define PGA_REPORT_AVERAGE       32   /* Print the average of the population */
+
+/*****************************************
+*            RANDOMIZER                  *
+*****************************************/
+#define PGA_RINIT_PERCENT        1  /* real percent offset                   */
+#define PGA_RINIT_RANGE          2  /* real range                            */
+#define PGA_IINIT_PERMUTE        1  /* integer permutation                   */
+#define PGA_IINIT_RANGE          2  /* integer range (nonunique)             */
+#define PGA_CINIT_LOWER          1  /* all lowercase letters                 */
+#define PGA_CINIT_UPPER          2  /* all uppercase letters                 */
+#define PGA_CINIT_MIXED          3  /* both upper and lower case letters     */
+
+/*****************************************
+*         SET USER FUNCTION              *
+*****************************************/
+#define PGA_USERFUNCTION_CREATESTRING            1
+#define PGA_USERFUNCTION_MUTATION                2
+#define PGA_USERFUNCTION_CROSSOVER               3
+#define PGA_USERFUNCTION_PRINTSTRING             4
+#define PGA_USERFUNCTION_COPYSTRING              5
+#define PGA_USERFUNCTION_DUPLICATE               6
+#define PGA_USERFUNCTION_INITSTRING              7
+#define PGA_USERFUNCTION_BUILDDATATYPE           8
+#define PGA_USERFUNCTION_STOPCOND                9
+#define PGA_USERFUNCTION_ENDOFGEN                10
+#define PGA_NUM_USERFUNCTIONS                    10
+
+/*****************************************
+*           MPI SEND/RECV TAGS           *
+*****************************************/
+#define PGA_COMM_STRINGTOEVAL        1  /* MPI tag for sending string       */
+#define PGA_COMM_EVALOFSTRING        2  /* MPI tag for returning evaluation */
+#define PGA_COMM_DONEWITHEVALS       3  /* MPI tag for ending parallel eval */
+
+
+
+
+/*****************************************
+*       INDIVIDUAL STRUTURE              *
+*****************************************/
+
+typedef struct {                    /* primary population data structure   */
+  double evalfunc;                  /* evaluation function value           */
+  double fitness;                   /* fitness    function value           */
+  int    evaluptodate;              /* flag whether evalfunc is current    */
+  void   *chrom;                    /* pointer to the GA string            */
+} PGAIndividual;
+
+
+/*****************************************
+*          GA ALGORITHM STRUCTURE        *
+*****************************************/
+typedef struct {
+    int datatype;            /* data type: binary, integer, or real       */
+    int optdir;              /* direction of optimization                 */
+    int tw;                  /* total number of words, full + partial     */
+    int fw;                  /* number of full (WL length) words          */
+    int eb;                  /* number of extra bits in last NOT full word*/
+    int PopSize;             /* Number of strings to use                  */
+    int StringLen;           /* string lengths                            */
+    int StoppingRule;        /* Termination Criteria                      */
+    int MaxIter;             /* Maximum number of iterations to run       */
+    int MaxNoChange;         /* # of iters with no change before stopping */
+    int MaxSimilarity;       /* % of pop the same before stopping         */
+    int NumReplace;          /* Number of string to replace each gen      */
+    int PopReplace;          /* Method of choosing ind.s to copy to newpop*/
+    int iter;                /* iteration (generation) counter            */
+    int ItersOfSame;         /* # iters with no change in best            */
+    int PercentSame;         /* % of pop that is homogeneous              */
+    int NoDuplicates;        /* Don't allow duplicate strings             */
+    int CrossoverType;       /* Type of crossover for genetic algorithm   */
+    int SelectType;          /* Type of selection for genetic algorithm   */
+    int SelectIndex;         /* index of Select for next two individuals  */
+    int FitnessType;         /* Type of fitness transformation used       */
+    int FitnessMinType;      /* Transformation for minimization problems  */
+    int MutateOnlyNoCross;   /* Mutate only strings not from crossover    */
+    int MutationType;        /* Type of mutation used                     */
+    int MutateIntegerValue;  /* Multiplier to mutate Integer strings with */
+    int MutateBoundedFlag;   /* Confine integer alleles to given range    */
+    double MutateRealValue;  /* Multiplier to mutate Real strings with    */
+    double MutationProb;     /* Starting mutation probability             */
+    double CrossoverProb;    /* Crossover probability                     */
+    double UniformCrossProb; /* Prob of bit select in uniform crossover   */
+    double PTournamentProb;  /* Prob of selection in Prob. Tournament     */
+    double FitnessRankMax;   /* MAX value for use in ranking              */
+    double FitnessCmaxValue; /* Cmax value used to convert minimizations  */
+    double restartAlleleProb;/* prob of changing an allele in a restart   */
+    int restart;             /* whether to use the restart operator       */
+    int restartFreq;         /* frequency with which to restart           */
+    int *selected;           /* array of indices for selection            */
+    int *sorted;             /* array of sorted individual indices        */
+    PGAIndividual *oldpop;   /* pointer to population (old)               */
+    PGAIndividual *newpop;   /* pointer to population (new)               */
+} PGAAlgorithm;
+
+
+
+/*****************************************
+*        OPERATIONS STRUCTURES           *
+*****************************************/
+typedef struct PGAContext PGAContext;
+typedef struct {
+    void         (*CreateString)(PGAContext *, int, int, int);
+    int          (*Mutation)(PGAContext *, int, int, double);
+    void         (*Crossover)(PGAContext *, int, int, int, int, int, int);
+    void         (*PrintString)(PGAContext *, FILE *, int, int);
+    void         (*CopyString)(PGAContext *, int, int, int, int);
+    int          (*Duplicate)(PGAContext *, int, int, int, int);
+    void         (*InitString)(PGAContext *, int, int);
+    MPI_Datatype (*BuildDatatype)(PGAContext *, int, int);
+    int          (*StopCond)(PGAContext *);
+    void         (*EndOfGen)(PGAContext *);
+} PGACOperations;
+
+typedef struct {
+    int          (*Mutation)(void *, void *, void *, void *);
+    void         (*Crossover)(void *, void *, void *, void *, void *, void *, void *);
+    void         (*PrintString)(void *, void *, void *, void *);
+    void         (*CopyString)(void *, void *, void *, void *, void *);
+    int          (*Duplicate)(void *, void *, void *, void *, void *);
+    void         (*InitString)(void *, void *, void *);
+    int          (*StopCond)(void *);
+    void         (*EndOfGen)(void *);
+} PGAFortranOperations;
+
+/*****************************************
+*          PARALLEL STRUCTURE            *
+*****************************************/
+typedef struct {
+    int      MPIAlreadyInit;   /* Flag whether MPI was previously initialized*/
+    int      NumIslands;       /* Number of islands in island model          */
+    int      NumDemes;         /* Number of demes in neighborhood model      */
+    MPI_Comm DefaultComm;      /* Default communicator for PGARun            */
+    int      MPIStubLibrary;   /* Boolean: real or stub version of MPI       */
+} PGAParallel;
+
+/*****************************************
+*          REPORT STRUCTURE              *
+*****************************************/
+typedef struct {
+     int    PrintFreq;               /* How often to print statistics reports*/
+     int    PrintOptions;
+     double Offline;
+     double Online;
+     double Average;
+     double Best;
+     time_t starttime;
+} PGAReport;
+
+
+/*****************************************
+*          SYSTEM STRUCTURE              *
+*****************************************/
+typedef struct {
+    int    UserFortran;             /* user routines in Fortran or C?        */
+    int    SetUpCalled;             /* has PGASetUp been called?             */
+    int    PGAMaxInt;               /* largest  int     of machine           */
+    int    PGAMinInt;               /* smallest int     of machine           */
+    double PGAMaxDouble;            /* largest  double  of machine           */
+    double PGAMinDouble;            /* smallest double  of machine           */
+} PGASystem;
+
+
+/*****************************************
+*          DEBUG STRUCTURE               *
+*****************************************/
+typedef struct {
+    int PGADebugFlags[PGA_DEBUG_MAXFLAGS];
+} PGADebug;
+
+/*****************************************
+*      INITIALIZATION STRUCTURE          *
+*****************************************/
+typedef struct {
+    int    RandomInit;             /* flag whether to randomize strings    */
+    double BinaryProbability;      /* probability that a Bit will be 1     */
+    int    RealType;               /* type of real      initialization     */
+    int    IntegerType;            /* type of integer   initialization     */
+    int    CharacterType;          /* type of character initialization     */
+    int    *IntegerMin;            /* minimum of range of integers         */
+    int    *IntegerMax;            /* maximum of range of integers         */
+    double *RealMin;               /* minimum of range of reals            */
+    double *RealMax;               /* maximum of range of reals            */
+    int    RandomSeed;             /* integer to seed random numbers with  */
+} PGAInitialize;
+
+/*****************************************
+*      SCRATCH DATA STRUCTURES           *
+*****************************************/
+typedef struct {
+    int    *intscratch;            /* integer-scratch space                 */
+    double *dblscratch;            /* double- scratch space                 */
+} PGAScratch;
+
+/*****************************************
+*          CONTEXT STRUCTURE             *
+*****************************************/
+struct PGAContext {
+    PGAAlgorithm           ga;
+    PGACOperations         cops;
+    PGAFortranOperations   fops;
+    PGAParallel            par;
+    PGAReport              rep;
+    PGASystem              sys;
+    PGADebug               debug;
+    PGAInitialize          init;
+    PGAScratch             scratch;
+};
+
+/*****************************************
+*          binary.c
+*****************************************/
+
+void PGASetBinaryAllele ( PGAContext *ctx, int p, int pop, int i, int val );
+int PGAGetBinaryAllele ( PGAContext *ctx, int p, int pop, int i );
+void PGASetBinaryInitProb ( PGAContext *ctx, double probability );
+double PGAGetBinaryInitProb (PGAContext *ctx);
+void PGABinaryCreateString(PGAContext *ctx, int p, int pop, int initflag);
+int PGABinaryMutation( PGAContext *ctx, int p, int pop, double mr );
+void PGABinaryOneptCrossover(PGAContext *ctx, int p1, int p2, int pop1, int c1,
+                             int c2, int pop2);
+void PGABinaryTwoptCrossover(PGAContext *ctx, int p1, int p2, int pop1, int c1,
+                             int c2, int pop2);
+void PGABinaryUniformCrossover(PGAContext *ctx, int p1, int p2, int pop1,
+                               int c1, int c2, int pop2);
+void PGABinaryPrintString( PGAContext *ctx, FILE *fp, int p, int pop );
+void PGABinaryCopyString (PGAContext *ctx, int p1, int pop1, int p2, int pop2);
+int PGABinaryDuplicate( PGAContext *ctx, int p1, int pop1, int p2, int pop2);
+void PGABinaryInitString(PGAContext *ctx, int p, int pop);
+MPI_Datatype PGABinaryBuildDatatype(PGAContext *ctx, int p, int pop);
+int PGABinaryHammingDistance ( PGAContext *ctx, PGABinary *s1, PGABinary *s2 );
+void PGABinaryPrint( PGAContext *ctx, FILE *fp, PGABinary *chrom, int nb );
+
+/*****************************************
+*          char.c
+*****************************************/
+
+void PGASetCharacterAllele (PGAContext *ctx, int p, int pop, int i, char value);
+char PGAGetCharacterAllele (PGAContext *ctx, int p, int pop, int i);
+void PGASetCharacterInitType(PGAContext *ctx, int value);
+void PGACharacterCreateString (PGAContext *ctx, int p, int pop, int InitFlag);
+int PGACharacterMutation( PGAContext *ctx, int p, int pop, double mr );
+void PGACharacterOneptCrossover(PGAContext *ctx, int p1, int p2, int pop1,
+                                int c1, int c2, int pop2);
+void PGACharacterTwoptCrossover( PGAContext *ctx, int p1, int p2, int pop1,
+                              int c1, int c2, int pop2);
+void PGACharacterUniformCrossover(PGAContext *ctx, int p1, int p2, int pop1,
+                                int c1, int c2, int pop2);
+void PGACharacterPrintString ( PGAContext *ctx, FILE *fp, int p, int pop);
+void PGACharacterCopyString (PGAContext *ctx, int p1, int pop1, int p2,
+                             int pop2);
+int PGACharacterDuplicate( PGAContext *ctx, int p1, int pop1, int p2, int pop2);
+void PGACharacterInitString(PGAContext *ctx, int p, int pop);
+MPI_Datatype PGACharacterBuildDatatype(PGAContext *ctx, int p, int pop);
+
+/*****************************************
+*          cmdline.c
+*****************************************/
+
+void PGAReadCmdLine( PGAContext *ctx, int *argc, char **argv );
+void PGAParseDebugArg(PGAContext *ctx, char *st);
+void PGAStripArgs(char **argv, int *argc, int *c, int num);
+
+/*****************************************
+*          create.c
+*****************************************/
+
+PGAContext *PGACreate ( int *argc, char **argv,
+                        int datatype, int len, int maxormin );
+void PGASetUp ( PGAContext *ctx );
+void PGASetRandomInitFlag(PGAContext *ctx, int RandomBoolean);
+int PGAGetRandomInitFlag (PGAContext *ctx);
+void PGACreatePop (PGAContext *ctx, int pop);
+void PGACreateIndividual (PGAContext *ctx, int p, int pop, int initflag);
+
+/*****************************************
+*          cross.c
+*****************************************/
+
+void PGACrossover ( PGAContext *ctx, int p1, int p2, int pop1,
+                    int c1, int c2, int pop2 );
+int PGAGetCrossoverType (PGAContext *ctx);
+double PGAGetCrossoverProb (PGAContext *ctx);
+double PGAGetUniformCrossoverProb (PGAContext *ctx);
+void PGASetCrossoverType (PGAContext *ctx, int crossover_type);
+void PGASetCrossoverProb( PGAContext *ctx, double crossover_prob);
+void PGASetUniformCrossoverProb( PGAContext *ctx, double uniform_cross_prob);
+
+/*****************************************
+*          debug.c
+*****************************************/
+
+void PGASortFuncNameIndex(PGAContext *ctx);
+#if OPTIMIZE==0
+void PGADebugPrint( PGAContext *ctx, int level, char *funcname,
+                   char *msg, int datatype, void *data );
+#endif
+void PGASetDebugLevel(PGAContext *ctx, int level);
+void PGAClearDebugLevel(PGAContext *ctx, int level);
+void PGASetDebugLevelByName(PGAContext *ctx, char *funcname);
+void PGAClearDebugLevelByName(PGAContext *ctx, char *funcname);
+int PGAGetDebugLevelOfName(PGAContext *ctx, char *funcname);
+int PGAGetDebugFlag(PGAContext *ctx, char *funcname);
+void PGASetDebugFlag11(PGAContext *ctx, int Flag);
+void PGASetDebugFlag20(PGAContext *ctx, int Flag);
+void PGASetDebugFlag21(PGAContext *ctx, int Flag);
+void PGASetDebugFlag30(PGAContext *ctx, int Flag);
+void PGASetDebugFlag32(PGAContext *ctx, int Flag);
+void PGASetDebugFlag34(PGAContext *ctx, int Flag);
+void PGASetDebugFlag36(PGAContext *ctx, int Flag);
+void PGASetDebugFlag40(PGAContext *ctx, int Flag);
+void PGASetDebugFlag42(PGAContext *ctx, int Flag);
+void PGASetDebugFlag44(PGAContext *ctx, int Flag);
+void PGASetDebugFlag46(PGAContext *ctx, int Flag);
+void PGASetDebugFlag48(PGAContext *ctx, int Flag);
+void PGASetDebugFlag50(PGAContext *ctx, int Flag);
+void PGASetDebugFlag52(PGAContext *ctx, int Flag);
+void PGASetDebugFlag54(PGAContext *ctx, int Flag);
+void PGASetDebugFlag56(PGAContext *ctx, int Flag);
+void PGASetDebugFlag58(PGAContext *ctx, int Flag);
+void PGASetDebugFlag60(PGAContext *ctx, int Flag);
+void PGASetDebugFlag62(PGAContext *ctx, int Flag);
+void PGASetDebugFlag64(PGAContext *ctx, int Flag);
+void PGASetDebugFlag66(PGAContext *ctx, int Flag);
+void PGAPrintDebugOptions(PGAContext *ctx);
+
+/*****************************************
+*          duplcate.c
+*****************************************/
+
+int PGADuplicate(PGAContext *ctx, int p, int pop1, int pop2, int n);
+void PGAChange( PGAContext *ctx, int p, int pop );
+void PGASetNoDuplicatesFlag( PGAContext *ctx, int no_dup);
+int PGAGetNoDuplicatesFlag (PGAContext *ctx);
+
+/*****************************************
+*          evaluate.c
+*****************************************/
+
+void PGASetEvaluation ( PGAContext *ctx, int p, int pop, double val );
+double PGAGetEvaluation ( PGAContext *ctx, int p, int pop );
+void PGASetEvaluationUpToDateFlag ( PGAContext *ctx, int p, int pop,
+                                   int status );
+int PGAGetEvaluationUpToDateFlag ( PGAContext *ctx, int p, int pop );
+double PGAGetRealFromBinary(PGAContext *ctx, int p, int pop, int start,
+                            int end, double lower, double upper);
+double PGAGetRealFromGrayCode(PGAContext *ctx, int p, int pop, int start,
+                                  int end, double lower, double upper);
+void PGAEncodeRealAsBinary(PGAContext *ctx, int p, int pop, int start,
+                               int end, double low, double high, double val);
+void PGAEncodeRealAsGrayCode(PGAContext *ctx, int p, int pop, int start,
+                              int end, double low, double high, double val);
+int PGAGetIntegerFromBinary(PGAContext *ctx, int p, int pop, int start,
+                                 int end);
+int PGAGetIntegerFromGrayCode(PGAContext *ctx, int p, int pop, int start,
+                                   int end);
+void PGAEncodeIntegerAsBinary(PGAContext *ctx, int p, int pop, int start,
+                              int end, int val);
+void PGAEncodeIntegerAsGrayCode(PGAContext *ctx, int p, int pop, int start,
+                                int end, int val);
+double PGAMapIntegerToReal (PGAContext *ctx, int v, int a, int b, double l,
+                            double u);
+int PGAMapRealToInteger(PGAContext *ctx, double r, double l, double u, int a,
+                        int b);
+
+/*****************************************
+*          fitness.c
+*****************************************/
+
+void PGAFitness ( PGAContext *ctx, int popindex );
+int PGARank( PGAContext *ctx, int p, int *order, int n );
+double PGAGetFitness ( PGAContext *ctx, int p, int pop );
+int PGAGetFitnessType (PGAContext *ctx);
+int PGAGetFitnessMinType (PGAContext *ctx);
+double PGAGetMaxFitnessRank (PGAContext *ctx);
+void PGASetFitnessType( PGAContext *ctx, int fitness_type);
+void PGASetFitnessMinType( PGAContext *ctx, int fitness_type);
+void PGASetMaxFitnessRank( PGAContext *ctx, double fitness_rank_max);
+void PGAFitnessLinearNormal ( PGAContext *ctx, PGAIndividual *pop );
+void PGAFitnessLinearRank ( PGAContext *ctx, PGAIndividual *pop );
+void PGAFitnessMinReciprocal ( PGAContext *ctx, PGAIndividual *pop );
+void PGAFitnessMinCmax ( PGAContext *ctx, PGAIndividual *pop );
+void PGASetFitnessCmaxValue( PGAContext *ctx, double val);
+double PGAGetFitnessCmaxValue (PGAContext *ctx);
+
+/*****************************************
+*          hamming.c
+*****************************************/
+
+double PGAHammingDistance( PGAContext *ctx, int popindex);
+
+/*****************************************
+*          heap.c
+*****************************************/
+
+void PGADblHeapSort ( PGAContext *ctx, double *a, int *idx, int n );
+void PGAIntHeapSort ( PGAContext *ctx, int *a, int *idx, int n );
+
+/*****************************************
+*          integer.c
+*****************************************/
+
+void PGASetIntegerAllele (PGAContext *ctx, int p, int pop, int i, int value);
+int PGAGetIntegerAllele (PGAContext *ctx, int p, int pop, int i);
+void PGASetIntegerInitPermute ( PGAContext *ctx, int min, int max);
+void PGASetIntegerInitRange (PGAContext *ctx, int *min, int *max);
+int PGAGetIntegerInitType (PGAContext *ctx);
+int PGAGetMinIntegerInitValue (PGAContext *ctx, int i);
+int PGAGetMaxIntegerInitValue (PGAContext *ctx, int i);
+void PGAIntegerCreateString (PGAContext *ctx, int p, int pop, int InitFlag);
+int PGAIntegerMutation( PGAContext *ctx, int p, int pop, double mr );
+void PGAIntegerOneptCrossover(PGAContext *ctx, int p1, int p2, int pop1,
+                              int c1, int c2, int pop2);
+void PGAIntegerTwoptCrossover( PGAContext *ctx, int p1, int p2, int pop1,
+                              int c1, int c2, int pop2);
+void PGAIntegerUniformCrossover(PGAContext *ctx, int p1, int p2, int pop1,
+                                int c1, int c2, int pop2);
+void PGAIntegerPrintString ( PGAContext *ctx, FILE *fp, int p, int pop);
+void PGAIntegerCopyString (PGAContext *ctx, int p1, int pop1, int p2, int pop2);
+int PGAIntegerDuplicate( PGAContext *ctx, int p1, int pop1, int p2, int pop2);
+void PGAIntegerInitString(PGAContext *ctx, int p, int pop);
+MPI_Datatype PGAIntegerBuildDatatype(PGAContext *ctx, int p, int pop);
+
+/*****************************************
+*          mpi_stub.c
+*****************************************/
+
+
+/*****************************************
+*          mutation.c
+*****************************************/
+
+int PGAMutate(PGAContext *ctx, int p, int pop);
+void PGASetMutationType( PGAContext *ctx, int mutation_type);
+int PGAGetMutationType (PGAContext *ctx);
+void PGASetMutationRealValue( PGAContext *ctx, double val);
+double PGAGetMutationRealValue (PGAContext *ctx);
+void PGASetMutationIntegerValue( PGAContext *ctx, int val);
+int PGAGetMutationIntegerValue (PGAContext *ctx);
+void PGASetMutationBoundedFlag(PGAContext *ctx, int val);
+int PGAGetMutationBoundedFlag(PGAContext *ctx);
+void PGASetMutationProb(PGAContext *ctx, double mutation_prob);
+double PGAGetMutationProb (PGAContext *ctx);
+
+/*****************************************
+*          parallel.c
+*****************************************/
+
+void PGARunGM(PGAContext *ctx, double (*f)(PGAContext *, int, int),
+	      MPI_Comm comm);
+void PGAEvaluateSeq(PGAContext *ctx, int pop,
+		    double (*f)(PGAContext *, int, int));
+void PGAEvaluateCoop(PGAContext *ctx, int pop,
+		     double (*f)(PGAContext *, int, int), MPI_Comm comm);
+void PGAEvaluateMS(PGAContext *ctx, int pop,
+		   double (*f)(PGAContext *c, int p, int pop), MPI_Comm comm);
+void PGAEvaluateSlave(PGAContext *ctx, int pop,
+		      double (*f)(PGAContext *, int, int), MPI_Comm comm);
+void PGAEvaluate(PGAContext *ctx, int pop,
+		 double (*f)(PGAContext *, int, int), MPI_Comm comm);
+MPI_Datatype PGABuildDatatype(PGAContext *ctx, int p, int pop);
+void PGASendIndividual(PGAContext *ctx, int p, int pop, int dest, int tag,
+                       MPI_Comm comm);
+void PGAReceiveIndividual(PGAContext *ctx, int p, int pop, int source, int tag,
+                          MPI_Comm comm, MPI_Status *status);
+void PGASendReceiveIndividual(PGAContext *ctx, int send_p, int send_pop,
+                              int dest, int send_tag, int recv_p, int recv_pop,
+                              int source, int recv_tag, MPI_Comm comm,
+                              MPI_Status *status);
+void PGARunIM(PGAContext *ctx, double (*f)(PGAContext *c, int p, int pop),
+              MPI_Comm tcomm);
+void PGARunNM(PGAContext *ctx, double (*f)(PGAContext *c, int p, int pop),
+              MPI_Comm tcomm);
+int PGAGetRank (PGAContext *ctx, MPI_Comm comm);
+int PGAGetNumProcs (PGAContext *ctx, MPI_Comm comm);
+void PGASetNumIslands( PGAContext *ctx, int n);
+int PGAGetNumIslands (PGAContext *ctx);
+void PGASetNumDemes( PGAContext *ctx, int numdemes);
+int PGAGetNumDemes (PGAContext *ctx);
+void PGASetCommunicator( PGAContext *ctx, MPI_Comm comm);
+MPI_Comm PGAGetCommunicator( PGAContext *ctx);
+
+/*****************************************
+*          pga.c
+*****************************************/
+
+void PGARun(PGAContext *ctx, double (*evaluate)(PGAContext *c, int p, int pop));
+void PGARunMutationAndCrossover (PGAContext *ctx, int oldpop, int newpop);
+void PGARunMutationOrCrossover ( PGAContext *ctx, int oldpop, int newpop );
+void PGAUpdateGeneration(PGAContext *ctx, MPI_Comm comm);
+int PGAGetDataType (PGAContext *ctx);
+int PGAGetOptDirFlag (PGAContext *ctx);
+int PGAGetStringLength (PGAContext *ctx);
+int PGAGetVariableStringLength (PGAContext *ctx, int p, int pop);
+int PGAGetGAIterValue (PGAContext *ctx);
+void PGASetMutationOrCrossoverFlag( PGAContext *ctx, int flag);
+void PGASetMutationAndCrossoverFlag( PGAContext *ctx, int flag);
+int PGAGetMutationOrCrossoverFlag (PGAContext *ctx);
+int PGAGetMutationAndCrossoverFlag (PGAContext *ctx);
+
+/*****************************************
+*          pop.c
+*****************************************/
+
+void PGASortPop ( PGAContext *ctx, int pop );
+int PGAGetPopSize (PGAContext *ctx);
+int PGAGetNumReplaceValue (PGAContext *ctx);
+int PGAGetPopReplaceType (PGAContext *ctx);
+int PGAGetSortedPopIndex ( PGAContext *ctx, int n );
+void PGASetPopSize (PGAContext *ctx, int popsize);
+void PGASetNumReplaceValue( PGAContext *ctx, int pop_replace);
+void PGASetPopReplaceType( PGAContext *ctx, int pop_replace);
+
+/*****************************************
+*          random.c
+*****************************************/
+
+int PGARandomFlip ( PGAContext *ctx, double p );
+int PGARandomInterval( PGAContext *ctx, int start, int end);
+double PGARandom01( PGAContext *ctx, int newseed );
+double PGARandomUniform( PGAContext *ctx, double start, double end);
+double PGARandomGaussian( PGAContext *ctx, double mean, double sigma);
+int PGAGetRandomSeed(PGAContext *ctx);
+void PGASetRandomSeed(PGAContext *ctx, int seed);
+
+/*****************************************
+*          real.c
+*****************************************/
+
+void PGASetRealAllele (PGAContext *ctx, int p, int pop, int i, double value);
+double PGAGetRealAllele (PGAContext *ctx, int p, int pop, int i);
+void PGASetRealInitPercent ( PGAContext *ctx, double *median, double *percent);
+void PGASetRealInitRange (PGAContext *ctx, double *min, double *max);
+double PGAGetMinRealInitValue (PGAContext *ctx, int i);
+double PGAGetMaxRealInitValue (PGAContext *ctx, int i);
+int PGAGetRealInitType (PGAContext *ctx);
+void PGARealCreateString (PGAContext *ctx, int p, int pop, int initflag);
+int PGARealMutation( PGAContext *ctx, int p, int pop, double mr );
+void PGARealOneptCrossover( PGAContext *ctx, int p1, int p2, int pop1,
+                           int c1, int c2, int pop2);
+void PGARealTwoptCrossover( PGAContext *ctx, int p1, int p2, int pop1,
+                           int c1, int c2, int pop2);
+void PGARealUniformCrossover( PGAContext *ctx, int p1, int p2, int pop1,
+                             int c1, int c2, int pop2);
+void PGARealPrintString (PGAContext *ctx, FILE *fp, int p, int pop);
+void PGARealCopyString ( PGAContext *ctx, int p1, int pop1, int p2, int pop2);
+int PGARealDuplicate( PGAContext *ctx, int p1, int pop1, int p2, int pop2);
+void PGARealInitString ( PGAContext *ctx, int p, int pop);
+MPI_Datatype PGARealBuildDatatype(PGAContext *ctx, int p, int pop);
+
+/*****************************************
+*          report.c
+*****************************************/
+
+void PGAPrintReport(PGAContext *ctx, FILE *fp, int pop);
+void PGASetPrintOptions (PGAContext *ctx, int option);
+void PGASetPrintFrequencyValue( PGAContext *ctx, int print_freq);
+int PGAGetPrintFrequencyValue (PGAContext *ctx);
+void PGAPrintPopulation ( PGAContext *ctx, FILE *fp, int pop );
+void PGAPrintIndividual ( PGAContext *ctx, FILE *fp, int p, int pop );
+void PGAPrintString ( PGAContext *ctx, FILE *file, int p, int pop );
+void PGAPrintContextVariable ( PGAContext *ctx, FILE *fp );
+
+/*****************************************
+*          restart.c
+*****************************************/
+
+void PGARestart(PGAContext *ctx, int source_pop, int dest_pop);
+void PGASetRestartFlag(PGAContext *ctx, int val);
+int PGAGetRestartFlag(PGAContext *ctx);
+void PGASetRestartFrequencyValue(PGAContext *ctx, int numiter);
+int PGAGetRestartFrequencyValue(PGAContext *ctx);
+void PGASetRestartAlleleChangeProb(PGAContext *ctx, double prob);
+double PGAGetRestartAlleleChangeProb(PGAContext *ctx);
+
+/*****************************************
+*          select.c
+*****************************************/
+
+void PGASelect( PGAContext *ctx, int popix );
+int PGASelectNextIndex ( PGAContext *ctx );
+void PGASetSelectType( PGAContext *ctx, int select_type);
+int PGAGetSelectType (PGAContext *ctx);
+void PGASetPTournamentProb(PGAContext *ctx, double ptournament_prob);
+double PGAGetPTournamentProb(PGAContext *ctx);
+int PGASelectProportional(PGAContext *ctx, PGAIndividual *pop);
+void PGASelectSUS( PGAContext *ctx, PGAIndividual *pop );
+int PGASelectTournament( PGAContext *ctx, PGAIndividual *pop );
+int PGASelectPTournament( PGAContext *ctx, PGAIndividual *pop );
+
+/*****************************************
+*          stop.c
+*****************************************/
+
+int PGADone(PGAContext *ctx, MPI_Comm comm);
+int PGACheckStoppingConditions( PGAContext *ctx);
+void PGASetStoppingRuleType (PGAContext *ctx, int stoprule);
+int PGAGetStoppingRuleType (PGAContext *ctx);
+void PGASetMaxGAIterValue(PGAContext *ctx, int maxiter);
+int PGAGetMaxGAIterValue (PGAContext *ctx);
+void PGASetMaxNoChangeValue(PGAContext *ctx, int max_no_change);
+void PGASetMaxSimilarityValue(PGAContext *ctx, int max_similarity);
+
+/*****************************************
+*          system.c
+*****************************************/
+
+void PGAError( PGAContext *ctx, char *msg,
+               int level, int datatype, void *data );
+void PGADestroy (PGAContext *ctx);
+int PGAGetMaxMachineIntValue (PGAContext *ctx);
+int PGAGetMinMachineIntValue (PGAContext *ctx);
+double PGAGetMaxMachineDoubleValue (PGAContext *ctx);
+double PGAGetMinMachineDoubleValue (PGAContext *ctx);
+void PGAUsage( PGAContext *ctx );
+void PGAPrintVersionNumber( PGAContext *ctx );
+
+/*****************************************
+*          user.c
+*****************************************/
+
+void PGASetUserFunction(PGAContext *ctx, int constant, void *f);
+
+/*****************************************
+*          utility.c
+*****************************************/
+
+double PGAMean ( PGAContext *ctx, double *a, int n);
+double PGAStddev ( PGAContext *ctx, double *a, int n, double mean);
+int PGARound(PGAContext *ctx, double x);
+void PGACopyIndividual( PGAContext *ctx, int p1, int pop1, int p2, int pop2);
+int PGACheckSum(PGAContext *ctx, int p, int pop);
+int PGAGetWorstIndex(PGAContext *ctx, int pop);
+int PGAGetBestIndex(PGAContext *ctx, int pop);
+PGAIndividual *PGAGetIndividual ( PGAContext *ctx, int p, int pop);
+void PGAUpdateAverage(PGAContext *ctx, int pop);
+void PGAUpdateOnline(PGAContext *ctx, int pop);
+void PGAUpdateOffline(PGAContext *ctx, int pop);
+int PGAComputeSimilarity(PGAContext *ctx, PGAIndividual *pop);
Index: trunk/optimizer/src/pgapack/pgapack/include/pgapackf.h
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/include/pgapackf.h	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/include/pgapackf.h	(revision 816)
@@ -0,0 +1,359 @@
+c******************************************************************************
+c     FILE: pgapackf.h
+c
+c     Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle,
+c              Brian P. Walenz
+c*****************************************************************************/
+c *** I/O FLAGS
+CBARF !! is NULL ok?
+      integer STDIN, STDOUT, STDERR, NULL
+      parameter(STDIN=5, STDOUT=6, STDERR=6, NULL=0)
+
+
+c *** ABSTRACT DATA TYPES
+      integer PGA_DATATYPE_BINARY
+      parameter( PGA_DATATYPE_BINARY =      1)
+      integer PGA_DATATYPE_INTEGER
+      parameter( PGA_DATATYPE_INTEGER =     2)
+      integer PGA_DATATYPE_REAL
+      parameter( PGA_DATATYPE_REAL =        3)
+      integer PGA_DATATYPE_CHARACTER
+      parameter( PGA_DATATYPE_CHARACTER =   4)
+      integer PGA_DATATYPE_USER
+      parameter( PGA_DATATYPE_USER =        5)
+
+      integer PGA_INT
+      parameter( PGA_INT =                   1)
+      integer PGA_DOUBLE
+      parameter( PGA_DOUBLE =                2)
+      integer PGA_CHAR
+      parameter( PGA_CHAR =                  3)
+      integer PGA_VOID
+      parameter( PGA_VOID =                  4)
+
+    
+c *** BOOLEANS &  FLAGS
+      integer PGA_TRUE
+      parameter ( PGA_TRUE =                   1)
+      integer PGA_FALSE
+      parameter ( PGA_FALSE =                  0)
+
+      integer PGA_FATAL
+      parameter ( PGA_FATAL =                 1)
+      integer PGA_WARNING
+      parameter ( PGA_WARNING =               2)
+
+
+      integer PGA_UNINITIALIZED_INT
+      parameter ( PGA_UNINITIALIZED_INT =    -3827)
+      double precision PGA_UNINITIALIZED_DOUBLE
+      parameter ( PGA_UNINITIALIZED_DOUBLE = -968.3827)
+
+c *** TEMP & POP REFERENT CONSTANTS
+      integer PGA_TEMP1
+      parameter ( PGA_TEMP1 =                -1138)
+      integer PGA_TEMP2
+      parameter ( PGA_TEMP2 =                -4239)
+
+      integer PGA_OLDPOP
+      parameter ( PGA_OLDPOP =               -6728)
+      integer PGA_NEWPOP
+      parameter ( PGA_NEWPOP =               -8376)
+
+c *** DEBUG LEVELS
+      integer PGA_DEBUG_ENTERED
+      parameter ( PGA_DEBUG_ENTERED =          12)
+      integer PGA_DEBUG_EXIT
+      parameter ( PGA_DEBUG_EXIT =             13)
+      integer PGA_DEBUG_MALLOC
+      parameter ( PGA_DEBUG_MALLOC =           80)
+      integer PGA_DEBUG_PRINTVAR
+      parameter ( PGA_DEBUG_PRINTVAR =         82)
+      integer PGA_DEBUG_SEND
+      parameter ( PGA_DEBUG_SEND =             22)
+      integer PGA_DEBUG_RECV
+      parameter ( PGA_DEBUG_RECV =             23)
+      integer PGA_DEBUG_MAXPGAPACKFUNCTIONS
+      parameter ( PGA_DEBUG_MAXPGAPACKFUNCTIONS =        300)
+      integer PGA_DEBUG_MAXFLAGS
+      parameter ( PGA_DEBUG_MAXFLAGS =       1000)
+
+c *** DIRECTION
+      integer PGA_MAXIMIZE
+      parameter ( PGA_MAXIMIZE =            1)
+      integer PGA_MINIMIZE
+      parameter ( PGA_MINIMIZE =            2)
+    
+c *** STOPPING CRITERIA
+      integer PGA_STOP_MAXITER
+      parameter ( PGA_STOP_MAXITER =        1)
+      integer PGA_STOP_NOCHANGE
+      parameter ( PGA_STOP_NOCHANGE =       2)
+      integer PGA_STOP_TOOSIMILAR
+      parameter ( PGA_STOP_TOOSIMILAR =     4)
+
+c *** CROSSOVER
+      integer PGA_CROSSOVER_ONEPT
+      parameter ( PGA_CROSSOVER_ONEPT =     1)
+      integer PGA_CROSSOVER_TWOPT
+      parameter ( PGA_CROSSOVER_TWOPT =     2)
+      integer PGA_CROSSOVER_UNIFORM
+      parameter ( PGA_CROSSOVER_UNIFORM =   3)
+
+c *** SELECTION
+      integer PGA_SELECT_PROPORTIONAL
+      parameter ( PGA_SELECT_PROPORTIONAL = 1)
+      integer PGA_SELECT_SUS
+      parameter ( PGA_SELECT_SUS =          2)
+      integer PGA_SELECT_TOURNAMENT
+      parameter ( PGA_SELECT_TOURNAMENT =   3)
+      integer PGA_SELECT_PTOURNAMENT
+      parameter ( PGA_SELECT_PTOURNAMENT =  4)
+
+c *** FITNESS
+      integer PGA_FITNESS_RAW
+      parameter ( PGA_FITNESS_RAW =         1)
+      integer PGA_FITNESS_NORMAL
+      parameter ( PGA_FITNESS_NORMAL =      2)
+      integer PGA_FITNESS_RANKING
+      parameter ( PGA_FITNESS_RANKING =     3)
+
+c *** FITNESS (MINIMIZATION)
+      integer PGA_FITNESSMIN_RECIPROCAL
+      parameter ( PGA_FITNESSMIN_RECIPROCAL =  1)
+      integer PGA_FITNESSMIN_CMAX
+      parameter ( PGA_FITNESSMIN_CMAX =        2)
+
+c *** MUTATION
+      integer PGA_MUTATION_CONSTANT
+      parameter ( PGA_MUTATION_CONSTANT =  1)
+      integer PGA_MUTATION_RANGE
+      parameter ( PGA_MUTATION_RANGE    =  2)
+      integer PGA_MUTATION_UNIFORM
+      parameter ( PGA_MUTATION_UNIFORM  =  3)
+      integer PGA_MUTATION_GAUSSIAN
+      parameter ( PGA_MUTATION_GAUSSIAN =  4)
+      integer PGA_MUTATION_PERMUTE
+      parameter ( PGA_MUTATION_PERMUTE  =  5)
+    
+c *** POPULATION REPLACEMENT
+      integer PGA_POPREPL_BEST
+      parameter ( PGA_POPREPL_BEST =         1)
+      integer PGA_POPREPL_RANDOM_NOREP
+      parameter ( PGA_POPREPL_RANDOM_NOREP = 2)
+      integer PGA_POPREPL_RANDOM_REP
+      parameter ( PGA_POPREPL_RANDOM_REP =   3)
+
+c *** REPORT OPTIONS
+      integer PGA_REPORT_ONLINE
+      parameter ( PGA_REPORT_ONLINE =   1 )
+      integer PGA_REPORT_OFFLINE
+      parameter ( PGA_REPORT_OFFLINE =  2 )
+      integer PGA_REPORT_HAMMING
+      parameter ( PGA_REPORT_HAMMING =  4 )
+      integer PGA_REPORT_STRING
+      parameter ( PGA_REPORT_STRING =   8 )
+      integer PGA_REPORT_WORST
+      parameter ( PGA_REPORT_WORST =   16 )
+      integer PGA_REPORT_AVERAGE
+      parameter ( PGA_REPORT_AVERAGE = 32 )
+
+c *** RANDOMIZER
+      integer PGA_IINIT_PERMUTE
+      parameter ( PGA_IINIT_PERMUTE =             1)
+      integer PGA_IINIT_RANGE
+      parameter ( PGA_IINIT_RANGE =               2)
+      integer PGA_CINIT_LOWER
+      parameter ( PGA_CINIT_LOWER =               1)
+      integer PGA_CINIT_UPPER
+      parameter ( PGA_CINIT_UPPER =               2)
+      integer PGA_CINIT_MIXED
+      parameter ( PGA_CINIT_MIXED =               3)
+
+c *** SET USER FUNCTION
+      integer PGA_USERFUNCTION_CREATESTRING
+      parameter ( PGA_USERFUNCTION_CREATESTRING =       1)
+      integer PGA_USERFUNCTION_MUTATION
+      parameter ( PGA_USERFUNCTION_MUTATION =           2)
+      integer PGA_USERFUNCTION_CROSSOVER
+      parameter ( PGA_USERFUNCTION_CROSSOVER =          3)
+      integer PGA_USERFUNCTION_PRINTSTRING
+      parameter ( PGA_USERFUNCTION_PRINTSTRING  =       4)
+      integer PGA_USERFUNCTION_COPYSTRING
+      parameter ( PGA_USERFUNCTION_COPYSTRING =         5)
+      integer PGA_USERFUNCTION_DUPLICATE
+      parameter ( PGA_USERFUNCTION_DUPLICATE =          6)
+      integer PGA_USERFUNCTION_INITSTRING
+      parameter ( PGA_USERFUNCTION_INITSTRING =         7)
+      integer PGA_USERFUNCTION_BUILDDATATYPE
+      parameter ( PGA_USERFUNCTION_BUILDDATATYPE =      8)
+      integer PGA_USERFUNCTION_STOPCOND
+      parameter ( PGA_USERFUNCTION_STOPCOND =           9)
+      integer PGA_USERFUNCTION_ENDOFGEN
+      parameter ( PGA_USERFUNCTION_ENDOFGEN =          10)
+
+c *** TAGS
+      integer PGA_COMM_STRINGTOEVAL
+      parameter ( PGA_COMM_STRINGTOEVAL =              1)
+      integer PGA_COMM_EVALOFSTRING
+      parameter ( PGA_COMM_EVALOFSTRING =              2)
+      integer PGA_COMM_DONEWITHEVALS
+      parameter ( PGA_COMM_DONEWITHEVALS =             3)
+      integer PGAGetBinaryAllele
+      double precision PGAGetBinaryInitProb
+      character PGAGetCharacterAllele
+      integer PGACreate
+      integer PGAGetRandomInitFlag
+      integer PGAGetCrossoverType
+      double precision PGAGetCrossoverProb
+      double precision PGAGetUniformCrossoverProb
+      integer PGADuplicate
+      integer PGAGetNoDuplicatesFlag
+      double precision PGAGetEvaluation
+      integer PGAGetEvaluationUpToDateFlag
+      double precision PGAGetRealFromBinary
+      double precision PGAGetRealFromGrayCode
+      integer PGAGetIntegerFromBinary
+      integer PGAGetIntegerFromGrayCode
+      integer PGARank
+      double precision PGAGetFitness
+      integer PGAGetFitnessType
+      integer PGAGetFitnessMinType
+      double precision PGAGetMaxFitnessRank
+      double precision PGAGetFitnessCmaxValue
+      double precision PGAHammingDistance
+      integer PGAGetIntegerAllele
+      integer PGAGetIntegerInitType
+      integer PGAGetMinIntegerInitValue
+      integer PGAGetMaxIntegerInitValue
+      integer PGAMutate
+      integer PGAGetMutationType
+      double precision PGAGetMutationRealValue
+      integer PGAGetMutationIntegerValue
+      integer PGAGetMutationBoundedFlag
+      double precision PGAGetMutationProb
+      integer PGABuildDatatype
+      integer PGAGetRank
+      integer PGAGetNumProcs
+      integer PGAGetCommunicator
+      integer PGAGetDataType
+      integer PGAGetOptDirFlag
+      integer PGAGetStringLength
+      integer PGAGetGAIterValue
+      integer PGAGetMutationOrCrossoverFlag
+      integer PGAGetMutationAndCrossoverFlag
+      integer PGAGetPopSize
+      integer PGAGetNumReplaceValue
+      integer PGAGetPopReplaceType
+      integer PGAGetSortedPopIndex
+      integer PGARandomFlip
+      integer PGARandomInterval
+      double precision PGARandom01
+      double precision PGARandomUniform
+      double precision PGARandomGaussian
+      integer PGAGetRandomSeed
+      double precision PGAGetRealAllele
+      double precision PGAGetMinRealInitValue
+      double precision PGAGetMaxRealInitValue
+      integer PGAGetRealInitType
+      integer PGAGetPrintFrequencyValue
+      integer PGAGetRestartFlag
+      integer PGAGetRestartFrequencyValue
+      double precision PGAGetRestartAlleleChangeProb
+      integer PGASelectNextIndex
+      integer PGAGetSelectType
+      double precision PGAGetPTournamentProb
+      integer PGADone
+      integer PGACheckStoppingConditions
+      integer PGAGetStoppingRuleType
+      integer PGAGetMaxGAIterValue
+      integer PGAGetMaxMachineIntValue
+      integer PGAGetMinMachineIntValue
+      double precision PGAGetMaxMachineDoubleValue
+      double precision PGAGetMinMachineDoubleValue
+      double precision PGAMean
+      double precision PGAStddev
+      integer PGARound
+      integer PGACheckSum
+      integer PGAGetWorstIndex
+      integer PGAGetBestIndex
+
+      external PGAGetBinaryAllele
+      external PGAGetBinaryInitProb
+      external PGAGetCharacterAllele
+      external PGACreate
+      external PGAGetRandomInitFlag
+      external PGAGetCrossoverType
+      external PGAGetCrossoverProb
+      external PGAGetUniformCrossoverProb
+      external PGADuplicate
+      external PGAGetNoDuplicatesFlag
+      external PGAGetEvaluation
+      external PGAGetEvaluationUpToDateFlag
+      external PGAGetRealFromBinary
+      external PGAGetRealFromGrayCode
+      external PGAGetIntegerFromBinary
+      external PGAGetIntegerFromGrayCode
+      external PGARank
+      external PGAGetFitness
+      external PGAGetFitnessType
+      external PGAGetFitnessMinType
+      external PGAGetMaxFitnessRank
+      external PGAGetFitnessCmaxValue
+      external PGAHammingDistance
+      external PGAGetIntegerAllele
+      external PGAGetIntegerInitType
+      external PGAGetMinIntegerInitValue
+      external PGAGetMaxIntegerInitValue
+      external PGAMutate
+      external PGAGetMutationType
+      external PGAGetMutationRealValue
+      external PGAGetMutationIntegerValue
+      external PGAGetMutationBoundedFlag
+      external PGAGetMutationProb
+      external PGABuildDatatype
+      external PGAGetRank
+      external PGAGetNumProcs
+      external PGAGetCommunicator
+      external PGAGetDataType
+      external PGAGetOptDirFlag
+      external PGAGetStringLength
+      external PGAGetGAIterValue
+      external PGAGetMutationOrCrossoverFlag
+      external PGAGetMutationAndCrossoverFlag
+      external PGAGetPopSize
+      external PGAGetNumReplaceValue
+      external PGAGetPopReplaceType
+      external PGAGetSortedPopIndex
+      external PGARandomFlip
+      external PGARandomInterval
+      external PGARandom01
+      external PGARandomUniform
+      external PGARandomGaussian
+      external PGAGetRandomSeed
+      external PGAGetRealAllele
+      external PGAGetMinRealInitValue
+      external PGAGetMaxRealInitValue
+      external PGAGetRealInitType
+      external PGAGetPrintFrequencyValue
+      external PGAGetRestartFlag
+      external PGAGetRestartFrequencyValue
+      external PGAGetRestartAlleleChangeProb
+      external PGASelectNextIndex
+      external PGAGetSelectType
+      external PGAGetPTournamentProb
+      external PGADone
+      external PGACheckStoppingConditions
+      external PGAGetStoppingRuleType
+      external PGAGetMaxGAIterValue
+      external PGAGetMaxMachineIntValue
+      external PGAGetMinMachineIntValue
+      external PGAGetMaxMachineDoubleValue
+      external PGAGetMinMachineDoubleValue
+      external PGAMean
+      external PGAStddev
+      external PGARound
+      external PGACheckSum
+      external PGAGetWorstIndex
+      external PGAGetBestIndex
+
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGAEncodeIntegerAsBinary.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGAEncodeIntegerAsBinary.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGAEncodeIntegerAsBinary.1	(revision 816)
@@ -0,0 +1,59 @@
+.TH PGAEncodeIntegerAsBinary 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAEncodeIntegerAsBinary \- encodes an integer value as a binary string
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- string index
+.PD 0
+.TP
+pop
+- symbolic constant of the population the string is in
+.PD 0
+.TP
+start
+- starting bit position in p to encode val in
+.PD 0
+.TP
+end
+- ending bit position in p to encode val in
+.PD 0
+.TP
+val
+- the integer value to be represented as a binary string
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+side
+-effect.
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGAEncodeIntegerAsBinary(ctx, p, pop, start, end, val)
+PGAContext *ctx
+int p
+int pop
+int start
+int end
+int val
+.fi
+.SH LOCATION
+evaluate.c
+.SH EXAMPLE
+.nf
+Encode an integer v in 20 bits in bit positions 0--19 in string p
+in population PGA_NEWPOP.
+
+PGAContext *ctx;
+int v, p;
+:
+PGAEncodeIntegerAsBinary(ctx, p, PGA_NEWPOP, 0, 19, v);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGAEncodeIntegerAsGrayCode.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGAEncodeIntegerAsGrayCode.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGAEncodeIntegerAsGrayCode.1	(revision 816)
@@ -0,0 +1,61 @@
+.TH PGAEncodeIntegerAsGrayCode 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAEncodeIntegerAsGrayCode \- encodes a real value as a binary reflected
+Gray code sequence
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- string index
+.PD 0
+.TP
+pop
+- symbolic constant of the population the string is in
+.PD 0
+.TP
+start
+- starting bit position in p to encode val in
+.PD 0
+.TP
+end
+- ending bit position in p to encode val in
+.PD 0
+.TP
+val
+- the integer value to be represented as a binary reflected
+Gray code sequence
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+side
+-effect.
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGAEncodeIntegerAsGrayCode(ctx, p, pop, start, end, val)
+PGAContext *ctx
+int p
+int pop
+int start
+int end
+int val
+.fi
+.SH LOCATION
+evaluate.c
+.SH EXAMPLE
+.nf
+Encode an integer v in 20 bits in bit positions  0--19 in string p in
+population PGA_NEWPOP using Gray code.
+
+PGAContext *ctx;
+int v, p;
+:
+PGAEncodeIntegerAsGrayCode(ctx, p, PGA_NEWPOP, 0, 19, 7);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGAEncodeRealAsBinary.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGAEncodeRealAsBinary.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGAEncodeRealAsBinary.1	(revision 816)
@@ -0,0 +1,69 @@
+.TH PGAEncodeRealAsBinary 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAEncodeRealAsBinary \- encodes a real value as a binary string
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- string index
+.PD 0
+.TP
+pop
+- symbolic constant of the population the string is in
+.PD 0
+.TP
+start
+- starting bit position in p to encode val in
+.PD 0
+.TP
+end
+- ending bit position in p to encode val in
+.PD 0
+.TP
+low
+- lower bound of the interval the val is defined on
+.PD 0
+.TP
+high
+- lower bound of the interval the val is defined on
+.PD 0
+.TP
+val
+- the real number to be represented as a binary string
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+side
+-effect.
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGAEncodeRealAsBinary(ctx, p, pop, start, end, low, high, val)
+PGAContext *ctx
+int p
+int pop
+int start
+int end
+double low
+double high
+double val
+.fi
+.SH LOCATION
+evaluate.c
+.SH EXAMPLE
+.nf
+Encode 3.14 from the interval [0,10] in 30 bits in bit positions
+0--29 in string p in population PGA_NEWPOP.
+
+PGAContext *ctx;
+int p;
+:
+PGAEncodeRealAsBinary(ctx, p, PGA_NEWPOP, 0, 29, 0.0, 10.0, 3.14);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGAEncodeRealAsGrayCode.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGAEncodeRealAsGrayCode.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGAEncodeRealAsGrayCode.1	(revision 816)
@@ -0,0 +1,71 @@
+.TH PGAEncodeRealAsGrayCode 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAEncodeRealAsGrayCode \- encodes a real value as a binary reflected Gray
+code sequence
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- string index
+.PD 0
+.TP
+pop
+- symbolic constant of the population the string is in
+.PD 0
+.TP
+start
+- starting bit position in p to encode val in
+.PD 0
+.TP
+end
+- ending bit position in p to encode val in
+.PD 0
+.TP
+low
+- lower bound of the interval the val is defined on
+.PD 0
+.TP
+high
+- lower bound of the interval the val is defined on
+.PD 0
+.TP
+val
+- the real number to be represented as a binary string
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+side
+-effect.
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGAEncodeRealAsGrayCode(ctx, p, pop, start, end, low, high, val)
+PGAContext *ctx
+int p
+int pop
+int start
+int end
+double low
+double high
+double val
+.fi
+.SH LOCATION
+evaluate.c
+.SH EXAMPLE
+.nf
+Encode 3.14 from the interval [0,10] in 30 bits in bit positions
+0--29 in string p in population PGA_NEWPOP as a binary reflected Gray
+code sequence.
+
+PGAContext *ctx;
+int p;
+:
+PGAEncodeRealAsGrayCode(ctx, p, PGA_NEWPOP, 0, 29, 0.0, 10.0, 3.14);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGAEvaluate.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGAEvaluate.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGAEvaluate.1	(revision 816)
@@ -0,0 +1,61 @@
+.TH PGAEvaluate 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAEvaluate \- Calls a user-specified function to return an evaluation of
+each string in the population. The user-specified function is only called
+if the string has been changed (e.g., by crossover or mutation) or the user
+has explicitly signaled the string's evaluation is out-of-date by a call
+to PGASetEvaluationUpToDateFlag().
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+pop
+- symbolic constant of the population to be evaluated
+.PD 0
+.TP
+f
+- a pointer to a function to evaluate a string.  This function will
+be called once for each string in population pop that requires
+evaluation.  This function must return a double (the evaluation
+function value) and must fit the prototype
+double f(PGAContext *c, int p, int pop);
+.PD 0
+.TP
+comm
+- an MPI communicator
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGAEvaluate(ctx, pop, , comm)
+PGAContext *ctx
+int pop
+double (*f)(PGAContext *, int, int)
+MPI_Comm comm
+.fi
+.SH LOCATION
+parallel.c
+.SH EXAMPLE
+.nf
+Example:
+Evaluate all strings in population PGA_NEWPOP using the user-defined
+evaluation function Energy.
+
+double Energy(PGAContext *ctx, int p, int pop) {
+:
+};
+
+PGAContext *ctx;
+:
+PGAEvaluate(ctx, PGA_NEWPOP, Energy, MPI_COMM_WORLD);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGAFitness.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGAFitness.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGAFitness.1	(revision 816)
@@ -0,0 +1,47 @@
+.TH PGAFitness 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAFitness \- Maps the user's evaluation function value to a fitness value.
+First, the user's evaluation function value is translated to all positive
+values if any are negative.  Next, this positive sequence is translated to
+a maximization problem if the user's optimization direction was minimization.
+This positive sequence is then mapped to a fitness value using linear
+ranking, linear normalization fitness, or the identity (i.e., the evaluation
+function value).  This routine is usually used after PGAEvaluate is called.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+pop
+- symbolic constant of the population to calculate fitness for
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGAFitness(ctx, popindex)
+PGAContext *ctx
+int popindex
+.fi
+.SH LOCATION
+fitness.c
+.SH EXAMPLE
+.nf
+Example:
+Calculate the fitness of all strings in population PGA_NEWPOP after
+calling PGAEvaluate to calculate the strings evaluation value.
+
+double energy(PGAContext *ctx, int p, int pop);
+PGAContext *ctx;
+:
+PGAEvaluate(ctx, PGA_NEWPOP, energy);
+PGAFitness (ctx, PGA_NEWPOP);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetBinaryAllele.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetBinaryAllele.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetBinaryAllele.1	(revision 816)
@@ -0,0 +1,53 @@
+.TH PGAGetBinaryAllele 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetBinaryAllele \- returns the value of a (binary) allele in a
+PGA_DATATYPE_BINARY string
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- string index
+.PD 0
+.TP
+pop
+- symbolic constant of the population the string is in
+.PD 0
+.TP
+i
+- allele index
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetBinaryAllele(ctx, p, pop, i)
+PGAContext *ctx
+int p
+int pop
+int i
+.fi
+.SH LOCATION
+binary.c
+.SH EXAMPLE
+.nf
+Example:
+Copies the alleles from member p in PGA_OLDPOP to member q PGA_NEWPOP.
+Assumes the strings are of the same length.
+
+PGAContext *ctx;
+int p, q, i;
+:
+for (i=PGAGetStringLength(ctx)-1; i>=0; i--)
+PGASetBinaryAllele(ctx, q, PGA_NEWPOP, i,
+PGAGetBinaryAllele(ctx, p, PGA_OLDPOP, i))
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetCharacterAllele.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetCharacterAllele.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetCharacterAllele.1	(revision 816)
@@ -0,0 +1,52 @@
+.TH PGAGetCharacterAllele 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetCharacterAllele: returns the value of character allele in a\-PGA_DATATYPE_CHARACTER string
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- string index
+.PD 0
+.TP
+pop
+- symbolic constant of the population the string is in
+.PD 0
+.TP
+i
+- allele index
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+char  PGAGetCharacterAllele(ctx, p, pop, i)
+PGAContext *ctx
+int p
+int pop
+int i
+.fi
+.SH LOCATION
+char.c
+.SH EXAMPLE
+.nf
+Example:
+Copies the alleles from member p in PGA_OLDPOP to member q in PGA_NEWPOP.
+Assumes the strings are of the same length.
+
+PGAContext *ctx;
+int p, q, i;
+:
+for (i=PGAGetStringLength(ctx, p, PGA_NEWPOP)-1; i>=0; i--)
+PGASetCharacterAllele(ctx, q, PGA_NEWPOP, i,
+PGAGetCharacterAllele(ctx, p, PGA_OLDPOP, i))
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetEvaluation.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetEvaluation.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetEvaluation.1	(revision 816)
@@ -0,0 +1,44 @@
+.TH PGAGetEvaluation 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetEvaluation \- returns the evaluation function value for
+string p in population pop
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- string index
+.PD 0
+.TP
+pop
+- symbolic constant of the population the string is in
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+double  PGAGetEvaluation(ctx, p, pop)
+PGAContext *ctx
+int p
+int pop
+.fi
+.SH LOCATION
+evaluate.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int p;
+double eval;
+:
+eval = PGAGetEvaluation(ctx, p, PGA_NEWPOP);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetEvaluationUpToDateFlag.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetEvaluationUpToDateFlag.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetEvaluationUpToDateFlag.1	(revision 816)
@@ -0,0 +1,51 @@
+.TH PGAGetEvaluationUpToDateFlag 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetEvaluationUpToDateFlag \- returns true/false to indicate
+whether the evaluate function value is up to date
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- string index
+.PD 0
+.TP
+pop
+- symbolic constant of the population the string is in
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetEvaluationUpToDateFlag(ctx, p, pop)
+PGAContext *ctx
+int p
+int pop
+.fi
+.SH LOCATION
+evaluate.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int uptodate;
+:
+uptodate = PGAGetEvaluationUpToDateFlag(ctx);
+switch (uptodate) {
+case PGA_TRUE:
+printf("Evaluation function value current\n");
+break;
+case PGA_FALSE:
+printf("Evaluation function value out-of-date\n");
+break;
+}
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetFitness.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetFitness.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetFitness.1	(revision 816)
@@ -0,0 +1,43 @@
+.TH PGAGetFitness 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetFitness \- returns the fitness value for a string
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- string index
+.PD 0
+.TP
+pop
+- symbolic constant of the population the string is in
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+double  PGAGetFitness(ctx, p, pop)
+PGAContext *ctx
+int p
+int pop
+.fi
+.SH LOCATION
+fitness.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int p;
+double fit;
+:
+fit = PGAGetFitness(ctx, p, PGA_NEWPOP);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetFitnessCmaxValue.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetFitnessCmaxValue.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetFitnessCmaxValue.1	(revision 816)
@@ -0,0 +1,33 @@
+.TH PGAGetFitnessCmaxValue 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetFitnessCmaxValue \- returns the value of the multiplier used by
+PGAFitnessMinCmax.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+double  PGAGetFitnessCmaxValue(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+fitness.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+double cmax;
+:
+cmax = PGAGetFitnessCmaxValue(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetFitnessMinType.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetFitnessMinType.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetFitnessMinType.1	(revision 816)
@@ -0,0 +1,43 @@
+.TH PGAGetFitnessMinType 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetFitnessMinType \- Returns the type of fitness transformation used
+for minimization problems.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetFitnessMinType(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+fitness.c
+.SH EXAMPLE
+.nf
+for minimization problems
+
+Example:
+PGAContext *ctx;
+int fitmintype;
+:
+fitmintype = PGAGetFitnessMinType(ctx);
+switch (fitmintype) {
+case PGA_FITNESSMIN_RECIPROCAL:
+printf("Fitness Minimization Type = PGA_FITNESSMIN_RECIPROCAL\n");
+break;
+case PGA_FITNESSMIN_CMAX:
+printf("Fitness Minimization Type = PGA_FITNESSMIN_CMAX\n");
+break;
+}
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetFitnessType.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetFitnessType.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetFitnessType.1	(revision 816)
@@ -0,0 +1,43 @@
+.TH PGAGetFitnessType 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetFitnessType \- Returns the type of fitness transformation used.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetFitnessType(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+fitness.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int fittype;
+:
+fittype = PGAGetFitnessType(ctx);
+switch (fittype) {
+case PGA_FITNESS_RAW:
+printf("Fitness Type = PGA_FITNESS_RAW\n");
+break;
+case PGA_FITNESS_NORMAL:
+printf("Fitness Type = PGA_FITNESS_NORMAL\n");
+break;
+case PGA_FITNESS_RANKING:
+printf("Fitness Type = PGA_FITNESS_RANKING\n");
+break;
+}
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetIntegerAllele.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetIntegerAllele.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetIntegerAllele.1	(revision 816)
@@ -0,0 +1,50 @@
+.TH PGAGetIntegerAllele 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetIntegerAllele \- Returns the value of allele i of member p in
+population pop.  Assumes the data type is PGA_DATATYPE_INTEGER.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- string index
+.PD 0
+.TP
+pop
+- symbolic constant of the population the string is in
+.PD 0
+.TP
+i
+- allele index
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetIntegerAllele(ctx, p, pop, i)
+PGAContext *ctx
+int p
+int pop
+int i
+.fi
+.SH LOCATION
+integer.c
+.SH EXAMPLE
+.nf
+Returns the value of the ith integer allele of string p
+in population PGA_NEWPOP.
+
+PGAContext *ctx;
+int p, i, k;
+:
+k =  PGAGetIntegerAllele ( ctx, p, PGA_NEWPOP, i )
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetIntegerFromBinary.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetIntegerFromBinary.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetIntegerFromBinary.1	(revision 816)
@@ -0,0 +1,55 @@
+.TH PGAGetIntegerFromBinary 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetIntegerFromBinary \- interpets a binary string as encoding an integer
+value and returns the integer value it represents.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- string index
+.PD 0
+.TP
+pop
+- symbolic constant of the population the string is in
+.PD 0
+.TP
+start
+- starting bit position in the binary representation
+.PD 0
+.TP
+end
+- ending bit position in the binary representation
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetIntegerFromBinary(ctx, p, pop, start, end)
+PGAContext *ctx
+int p
+int pop
+int start
+int end
+.fi
+.SH LOCATION
+evaluate.c
+.SH EXAMPLE
+.nf
+Example:
+Get an integer j from bits 10--29 of string p in population PGA_NEWPOP.
+
+PGAContext *ctx;
+int j, p;
+:
+j = PGAGetIntegerFromBinary(ctx, p, PGA_NEWPOP, 10, 29);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetIntegerFromGrayCode.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetIntegerFromGrayCode.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetIntegerFromGrayCode.1	(revision 816)
@@ -0,0 +1,56 @@
+.TH PGAGetIntegerFromGrayCode 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetIntegerFromGrayCode \- interpets a binary reflected Gray code sequence
+as encoding an integer value and returns the integer value it represents.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- string index
+.PD 0
+.TP
+pop
+- symbolic constant of the population the string is in
+.PD 0
+.TP
+start
+- starting bit position in the binary representation
+.PD 0
+.TP
+end
+- ending bit position in the binary representation
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetIntegerFromGrayCode(ctx, p, pop, start, end)
+PGAContext *ctx
+int p
+int pop
+int start
+int end
+.fi
+.SH LOCATION
+evaluate.c
+.SH EXAMPLE
+.nf
+Example:
+Get an integer j from bits 10--29 of string p in population PGA_NEWPOP.
+The string is encoded in Gray code.
+
+PGAContext *ctx;
+int j, p;
+:
+j = PGAGetIntegerFromGrayCode(ctx, p, PGA_NEWPOP, 10, 29);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetMaxFitnessRank.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetMaxFitnessRank.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetMaxFitnessRank.1	(revision 816)
@@ -0,0 +1,32 @@
+.TH PGAGetMaxFitnessRank 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetMaxFitnessRank \- returns the maximum value used in rank-based
+fitness.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+rank
+-based fitness
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+double  PGAGetMaxFitnessRank(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+fitness.c
+.SH EXAMPLE
+.nf
+PGAContext *ctx;
+double max;
+:
+max = PGAGetMaxFitnessRank(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetRealAllele.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetRealAllele.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetRealAllele.1	(revision 816)
@@ -0,0 +1,50 @@
+.TH PGAGetRealAllele 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetRealAllele \- returns the value of real-valued allele i in string p
+in population pop
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- string index
+.PD 0
+.TP
+pop
+- symbolic constant of the population the string is in
+.PD 0
+.TP
+i
+- allele index
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+double  PGAGetRealAllele(ctx, p, pop, i)
+PGAContext *ctx
+int p
+int pop
+int i
+.fi
+.SH LOCATION
+real.c
+.SH EXAMPLE
+.nf
+Example:
+Returns the value of the ith real-valued allele of string p
+in population PGA_NEWPOP
+
+PGAContext *ctx;
+int p, i, r;
+r =  PGAGetRealAllele (ctx, p, PGA_NEWPOP, i)
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetRealFromBinary.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetRealFromBinary.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetRealFromBinary.1	(revision 816)
@@ -0,0 +1,66 @@
+.TH PGAGetRealFromBinary 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetRealFromBinary \- Interpets a binary string as encoding a real value
+and returns the real value it represents.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- string index
+.PD 0
+.TP
+pop
+- symbolic constant of the population the string is in
+.PD 0
+.TP
+start
+- starting bit position in the binary representation
+.PD 0
+.TP
+end
+- ending bit position in the binary representation
+.PD 0
+.TP
+lower
+- lower bound of the interval the real number is defined on
+.PD 0
+.TP
+upper
+- lower bound of the interval the real number is defined on
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+double  PGAGetRealFromBinary(ctx, p, pop, start, end, lower, upper)
+PGAContext *ctx
+int p
+int pop
+int start
+int end
+double lower
+double upper
+.fi
+.SH LOCATION
+evaluate.c
+.SH EXAMPLE
+.nf
+Example:
+Decode a real value from the string p in population PGA_NEWPOP.  The
+value to decode lies on the interval [-10,20] and is represented
+using the 20 bits in bit positions 10--29.
+
+double x;
+:
+x = PGAGetRealFromBinary(ctx, p, PGA_NEWPOP, 10, 29, -10.0, 20.0);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetRealFromGrayCode.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetRealFromGrayCode.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGAGetRealFromGrayCode.1	(revision 816)
@@ -0,0 +1,67 @@
+.TH PGAGetRealFromGrayCode 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetRealFromGrayCode \- interpets a binary reflected Gray code sequence in
+a binary string as encoding a real value and returns the real value it
+represents.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- string index
+.PD 0
+.TP
+pop
+- symbolic constant of the population the string is in
+.PD 0
+.TP
+start
+- starting bit position in the binary representation
+.PD 0
+.TP
+end
+- ending bit position in the binary representation
+.PD 0
+.TP
+lower
+- lower bound of the interval the real number is defined on
+.PD 0
+.TP
+upper
+- lower bound of the interval the real number is defined on
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+double  PGAGetRealFromGrayCode(ctx, p, pop, start, end, lower, upper)
+PGAContext *ctx
+int p
+int pop
+int start
+int end
+double lower
+double upper
+.fi
+.SH LOCATION
+evaluate.c
+.SH EXAMPLE
+.nf
+Example:
+Decode a real value from the string p in population PGA_NEWPOP.  The
+value to decode lies on the interval [-10,20] and is represented
+using the 20 bits in bit positions 10--29.
+
+double x;
+:
+x = PGAGetRealFromGrayCode(ctx, p, PGA_NEWPOP, 10, 29, -10.0, 20.0);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGARank.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGARank.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGARank.1	(revision 816)
@@ -0,0 +1,62 @@
+.TH PGARank 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGARank \- returns the rank of a string in a population.  This is a value
+between 1,...,N (the population size).  The most fit string has rank 1,
+the least fit string has rank N.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- the index of the string whose rank is desired
+.PD 0
+.TP
+order
+- an array containing a unique rank for each string
+.PD 0
+.TP
+n
+- the size of the array order
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGARank(ctx, p, order, n)
+PGAContext *ctx
+int p
+int *order
+int n
+.fi
+.SH LOCATION
+fitness.c
+.SH EXAMPLE
+.nf
+Example:
+Determine the rank of string p.
+
+PGAContext *ctx;
+int i, popsize, rank, *order;
+double *fitness;
+
+popsize = PGAGetPopsize(ctx);
+order   = (int *)   malloc(sizeof(int)    * popsize);
+fitness = (double *)malloc(sizeof(double) * popsize);
+
+for(i=0;i<popsize; i++) {
+fitness[i] = PGAGetFitness(ctx, p, PGA_OLDPOP);
+order[i]   = i;
+}
+
+PGADblHeapSort(ctx, fitness, order, popsize);
+rank = PGARank(ctx, p, order, popsize)
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetBinaryAllele.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetBinaryAllele.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetBinaryAllele.1	(revision 816)
@@ -0,0 +1,56 @@
+.TH PGASetBinaryAllele 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetBinaryAllele \- sets a binary allele to the specified value.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- string index
+.PD 0
+.TP
+pop
+- symbolic constant of the population the string is in
+.PD 0
+.TP
+i
+- allele index
+.PD 0
+.TP
+val
+- binary value (either 1 or 0) to set the allele to
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+side
+-effect.
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetBinaryAllele(ctx, p, pop, i, val)
+PGAContext *ctx
+int p
+int pop
+int i
+int val
+.fi
+.SH LOCATION
+binary.c
+.SH EXAMPLE
+.nf
+Copies the alleles from member p in PGA_OLDPOP to member q PGA_NEWPOP.
+Assumes strings are of the same length.
+
+PGAContext *ctx;
+int p, q, i;
+:
+for (i=PGAGetStringLength(ctx)-1; i>=0; i--)
+PGASetBinaryAllele(ctx, q, PGA_NEWPOP, i,
+PGAGetBinaryAllele(ctx, p, PGA_OLDPOP, i))
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetCharacterAllele.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetCharacterAllele.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetCharacterAllele.1	(revision 816)
@@ -0,0 +1,57 @@
+.TH PGASetCharacterAllele 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetCharacterAllele \- sets the value of an allele in a
+PGA_DATATYPE_CHARACTER string.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- string index
+.PD 0
+.TP
+pop
+- symbolic constant of the population the string is in
+.PD 0
+.TP
+i
+- allele index
+.PD 0
+.TP
+val
+- character value to set the allele to
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+side
+-effect.
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetCharacterAllele(ctx, p, pop, i, value)
+PGAContext *ctx
+int p
+int pop
+int i
+char value
+.fi
+.SH LOCATION
+char.c
+.SH EXAMPLE
+.nf
+Copies the alleles from member p in PGA_OLDPOP to member q in PGA_NEWPOP.
+Assumes the strings are of the same length.
+
+PGAContext *ctx;
+int p, q, i;
+:
+for (i=PGAGetStringLength(ctx)-1; i>=0; i--)
+PGASetCharacterAllele(ctx, q, PGA_NEWPOP, i,
+PGAGetCharacterAllele(ctx, p, PGA_OLDPOP, i))
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetEvaluation.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetEvaluation.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetEvaluation.1	(revision 816)
@@ -0,0 +1,51 @@
+.TH PGASetEvaluation 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetEvaluation \- Set the evaluation function value for a string to a
+specified value.  Also sets the evaulation up to date flag to PGA_TRUE.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- string index
+.PD 0
+.TP
+pop
+- symbolic constant of the population string p is in
+.PD 0
+.TP
+val
+- the (user) evaluation value to assign to string p
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetEvaluation(ctx, p, pop, val)
+PGAContext *ctx
+int p
+int pop
+double val
+.fi
+.SH LOCATION
+evaluate.c
+.SH EXAMPLE
+.nf
+Example:
+Set the evaluation function value of string p in population PGA_NEWPOP
+to 123.456.
+
+PGAContext *ctx;
+int p;
+:
+PGASetEvaluation(ctx, p, PGA_NEWPOP, 123.456);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetEvaluationUpToDateFlag.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetEvaluationUpToDateFlag.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetEvaluationUpToDateFlag.1	(revision 816)
@@ -0,0 +1,54 @@
+.TH PGASetEvaluationUpToDateFlag 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetEvaluationUpToDateFlag \- sets the flag associated with a
+string to PGA_TRUE or PGA_FLASE to indicate whether the evaluate
+function value is out-of-date or not.  Note that this flag is always
+set to PGA_TRUE when PGASetEvaluation is called.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- string index
+.PD 0
+.TP
+pop
+- symbolic constant of the population string p is in
+.PD 0
+.TP
+status
+- boolean for whether up-to-date
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetEvaluationUpToDateFlag(ctx, p, pop, status)
+PGAContext *ctx
+int p
+int pop
+int status
+.fi
+.SH LOCATION
+evaluate.c
+.SH EXAMPLE
+.nf
+Example:
+Set the evaluation function flag for string p in population PGA_NEWPOP
+to PGA_FALSE (as might happen after, for example, calling a hill-climbing
+routine that modified this string).
+
+PGAContext *ctx;
+int p;
+:
+PGASetEvaluationUpToDateFlag(ctx, p, PGA_NEWPOP, PGA_FALSE);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetFitnessCmaxValue.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetFitnessCmaxValue.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetFitnessCmaxValue.1	(revision 816)
@@ -0,0 +1,38 @@
+.TH PGASetFitnessCmaxValue 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetFitnessCmaxValue \- The value of the multiplier used by
+PGAFitnessMinCmax so that the worst string has a nonzero fitness.
+The default value is 1.01.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+val
+- the value of the multiplier
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetFitnessCmaxValue(ctx, val)
+PGAContext *ctx
+double val
+.fi
+.SH LOCATION
+fitness.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGASetFitnessCmaxValue(ctx, 1.2);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetFitnessMinType.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetFitnessMinType.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetFitnessMinType.1	(revision 816)
@@ -0,0 +1,41 @@
+.TH PGASetFitnessMinType 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetFitnessMinType \- sets the type of algorithm used if a minimization
+problem is specified to determine how values are remapped for maximization.
+Valid choices are PGA_FITNESSMIN_RECIPROCAL and PGA_FITNESSMIN_CMAX to do
+the mapping using the reciprocal of the evaluation function, or by
+subtracting the worst evaluation function value from each evaluation
+function value, respectively.  The default is PGA_FITNESSMIN_CMAX
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+fitness_type
+- symbolic constant to specify fitness minimization type
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetFitnessMinType(ctx, fitness_type)
+PGAContext *ctx
+int fitness_type
+.fi
+.SH LOCATION
+fitness.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGASetFitnessMinType(ctx, PGA_FITNESSMIN_CMAX);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetFitnessType.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetFitnessType.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetFitnessType.1	(revision 816)
@@ -0,0 +1,39 @@
+.TH PGASetFitnessType 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetFitnessType \- Set the type of fitness algorithm to use. Valid choices
+are PGA_FITNESS_RAW, PGA_FITNESS_NORMAL, or PGA_FITNESS_RANKING for
+raw fitness (the evaluation function value), linear normalization, or
+linear ranking, respectively.  The default is PGA_FITNESS_RAW.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+fitness_type
+- symbolic constant to specify fitness type
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetFitnessType(ctx, fitness_type)
+PGAContext *ctx
+int fitness_type
+.fi
+.SH LOCATION
+fitness.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGASetFitnessType(ctx, PGA_FITNESS_RANKING);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetIntegerAllele.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetIntegerAllele.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetIntegerAllele.1	(revision 816)
@@ -0,0 +1,54 @@
+.TH PGASetIntegerAllele 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetIntegerAllele \- sets the value of a (integer) allele.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- string index
+.PD 0
+.TP
+pop
+- symbolic constant of the population the string is in
+.PD 0
+.TP
+i
+- allele index
+.PD 0
+.TP
+val
+- integer value to set the allele to
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetIntegerAllele(ctx, p, pop, i, value)
+PGAContext *ctx
+int p
+int pop
+int i
+int value
+.fi
+.SH LOCATION
+integer.c
+.SH EXAMPLE
+.nf
+Set the value of the ith allele of string p in population PGA_NEWPOP
+to 64.
+
+PGAContext *ctx;
+int p, i;
+:
+PGASetIntegerAllele (ctx, p, PGA_NEWPOP, i, 64)
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetMaxFitnessRank.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetMaxFitnessRank.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetMaxFitnessRank.1	(revision 816)
@@ -0,0 +1,40 @@
+.TH PGASetMaxFitnessRank 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetMaxFitnessRank \- The value of the parameter Max when using linear
+ranking for fitness determination. The default value is 1.2.  The value
+must be from the interval [1.0, 2.0].  The fitness type must have been set
+to PGA_FITNESS_RANKING with PGASetFitnessType for this function call
+to have any effect.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+max
+- the value of the parameter Max when using linear ranking
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetMaxFitnessRank(ctx, fitness_rank_max)
+PGAContext *ctx
+double fitness_rank_max
+.fi
+.SH LOCATION
+fitness.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGASetMaxFitnessRank(ctx, 1.1);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetRealAllele.1
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetRealAllele.1	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man1/PGASetRealAllele.1	(revision 816)
@@ -0,0 +1,55 @@
+.TH PGASetRealAllele 1 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetRealAllele \- sets the value of real-valued allele i in string p
+in population pop
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- string index
+.PD 0
+.TP
+pop
+- symbolic constant of the population the string is in
+.PD 0
+.TP
+i
+- allele index
+.PD 0
+.TP
+val
+- real value to set the allele to
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+side
+-effect.
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetRealAllele(ctx, p, pop, i, value)
+PGAContext *ctx
+int p
+int pop
+int i
+double value
+.fi
+.SH LOCATION
+real.c
+.SH EXAMPLE
+.nf
+Sets the value of the ith allele of string p in population PGA_NEWPOP
+to 1.57
+
+PGAContext *ctx;
+int i, p;
+:
+PGASetRealAllele ( ctx, p, PGA_NEWPOP, i, 1.57)
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man2/PGAGetBinaryInitProb.2
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man2/PGAGetBinaryInitProb.2	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man2/PGAGetBinaryInitProb.2	(revision 816)
@@ -0,0 +1,33 @@
+.TH PGAGetBinaryInitProb 2 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetBinaryInitProb \- Returns the probability that an allele will be
+randomly initialized to "1" in a PGA_DATATYPE_BINARY string.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+double  PGAGetBinaryInitProb(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+binary.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+double prob;
+:
+prob = PGAGetBinaryInitProb(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man2/PGAGetIntegerInitType.2
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man2/PGAGetIntegerInitType.2	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man2/PGAGetIntegerInitType.2	(revision 816)
@@ -0,0 +1,41 @@
+.TH PGAGetIntegerInitType 2 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetIntegerInitType \- returns the type of scheme used to randomly
+initialize strings of data type PGA_DATATYPE_INTEGER.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetIntegerInitType(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+integer.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int inittype;
+:
+inittype = PGAGetIntegerInitType(ctx);
+switch (inittype) {
+case PGA_IINIT_PERMUTE:
+printf("Data Type = PGA_IINIT_PERMUTE\n");
+break;
+case PGA_IINIT_RANGE:
+printf("Data Type = PGA_IINIT_RANGE\n");
+break;
+}
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man2/PGAGetMaxIntegerInitValue.2
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man2/PGAGetMaxIntegerInitValue.2	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man2/PGAGetMaxIntegerInitValue.2	(revision 816)
@@ -0,0 +1,34 @@
+.TH PGAGetMaxIntegerInitValue 2 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetMaxIntegerInitValue \- returns the maximum of the range of integers
+used to randomly initialize integer strings.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetMaxIntegerInitValue(ctx, i)
+PGAContext *ctx
+int i
+.fi
+.SH LOCATION
+integer.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int max;
+:
+max = PGAGetMaxIntegerInitValue(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man2/PGAGetMaxRealInitValue.2
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man2/PGAGetMaxRealInitValue.2	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man2/PGAGetMaxRealInitValue.2	(revision 816)
@@ -0,0 +1,38 @@
+.TH PGAGetMaxRealInitValue 2 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetMaxRealInitValue \- returns the maximum value used to randomly
+initialize allele i in a real string
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+i
+- an allele position
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+double  PGAGetMaxRealInitValue(ctx, i)
+PGAContext *ctx
+int i
+.fi
+.SH LOCATION
+real.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int max;
+:
+max = PGAGetMaxRealInitValue(ctx, 0);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man2/PGAGetMinIntegerInitValue.2
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man2/PGAGetMinIntegerInitValue.2	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man2/PGAGetMinIntegerInitValue.2	(revision 816)
@@ -0,0 +1,34 @@
+.TH PGAGetMinIntegerInitValue 2 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetMinIntegerInitValue \- returns the minimum of the range of integers
+used to randomly initialize integer strings.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetMinIntegerInitValue(ctx, i)
+PGAContext *ctx
+int i
+.fi
+.SH LOCATION
+integer.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int min;
+:
+min = PGAGetMinIntegerInitValue(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man2/PGAGetMinRealInitValue.2
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man2/PGAGetMinRealInitValue.2	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man2/PGAGetMinRealInitValue.2	(revision 816)
@@ -0,0 +1,38 @@
+.TH PGAGetMinRealInitValue 2 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetMinRealInitValue \- returns the minimum value used to randomly
+initialize allele i in a real string
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+i
+- an allele position
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+double  PGAGetMinRealInitValue(ctx, i)
+PGAContext *ctx
+int i
+.fi
+.SH LOCATION
+real.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int min;
+:
+min = PGAGetMinRealInitValue(ctx, 0);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man2/PGAGetRandomInitFlag.2
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man2/PGAGetRandomInitFlag.2	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man2/PGAGetRandomInitFlag.2	(revision 816)
@@ -0,0 +1,41 @@
+.TH PGAGetRandomInitFlag 2 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetRandomInitFlag \- returns true/false to indicate whether or not
+alleles are randomly initialized.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetRandomInitFlag(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+create.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int raninit;
+:
+raninit = PGAGetRandomInitFlag(ctx);
+switch (raninit) {
+case PGA_TRUE:
+printf("Population is randomly initialized\n");
+break;
+case PGA_FALSE:
+printf("Population initialized to zero\n");
+break;
+}
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man2/PGAGetRealInitType.2
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man2/PGAGetRealInitType.2	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man2/PGAGetRealInitType.2	(revision 816)
@@ -0,0 +1,41 @@
+.TH PGAGetRealInitType 2 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetRealInitType \- returns the type of scheme used to randomly
+initialize strings of data type PGA_DATATYPE_REAL.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetRealInitType(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+real.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int inittype;
+:
+inittype = PGAGetRealInitType(ctx);
+switch (inittype) {
+case PGA_RINIT_PERCENT:
+printf("Data Type = PGA_RINIT_PERCENT\n");
+break;
+case PGA_RINIT_RANGE:
+printf("Data Type = PGA_RINIT_RANGE\n");
+break;
+}
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man2/PGASetBinaryInitProb.2
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man2/PGASetBinaryInitProb.2	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man2/PGASetBinaryInitProb.2	(revision 816)
@@ -0,0 +1,40 @@
+.TH PGASetBinaryInitProb 2 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetBinaryInitProb \- specify the probability of initializing an allele to
+"1" when creating a PGA_DATATYPE_BINARY string.  The default value is 0.5.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- the binary initialization probability
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetBinaryInitProb(ctx, probability)
+PGAContext *ctx
+double probability
+.fi
+.SH LOCATION
+binary.c
+.SH EXAMPLE
+.nf
+Example:
+Set approximately 1 percent of all binary alleles to "1" when randomly
+initializing the population.
+
+PGAContext *ctx;
+:
+PGASetBinaryInitProb(ctx, 0.01);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man2/PGASetCharacterInitType.2
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man2/PGASetCharacterInitType.2	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man2/PGASetCharacterInitType.2	(revision 816)
@@ -0,0 +1,40 @@
+.TH PGASetCharacterInitType 2 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetCharacterInitType \- sets a flag to specify whether the character
+strings will be exclusively lowercase, exclusively uppercase, or a mixure
+of both cases.  Legal flags are PGA_CINIT_UPPER, PGA_CINIT_LOWER, and
+PGA_CINIT_MIXED.  Default is PGA_CINIT_LOWER.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+value
+- symbolic constant specifying which case
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetCharacterInitType(ctx, value)
+PGAContext *ctx
+int value
+.fi
+.SH LOCATION
+char.c
+.SH EXAMPLE
+.nf
+Set program to generate exclusively uppercase letters
+
+PGAContext *ctx;
+:
+PGASetCharacterInitType(ctx, PGA_CINIT_UPPER);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man2/PGASetIntegerInitPermute.2
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man2/PGASetIntegerInitPermute.2	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man2/PGASetIntegerInitPermute.2	(revision 816)
@@ -0,0 +1,48 @@
+.TH PGASetIntegerInitPermute 2 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetIntegerInitPermute \- sets a flag to tell the initialization routines
+to set each integer-valued gene to a random permutation of the values given
+by an upper and lower bound.  The length of the interval must be the same
+as the string length.  This is the default strategy for initializing
+integer-valued strings. The default interval is [0,L-1] where L is the
+string length.  No string initialization is done by this call.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+min
+- the lower bound of numbers used in the permutation
+.PD 0
+.TP
+max
+- the upper bound of numbers used in the permutation
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetIntegerInitPermute(ctx, min, max)
+PGAContext *ctx
+int min
+int max
+.fi
+.SH LOCATION
+integer.c
+.SH EXAMPLE
+.nf
+Set the initialization routines to set each gene to a random and
+unique value from the interval $[500,599]$.
+
+PGAContext *ctx;
+:
+PGASetIntegerInitPermute(ctx, 500, 599)}
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man2/PGASetIntegerInitRange.2
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man2/PGASetIntegerInitRange.2	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man2/PGASetIntegerInitRange.2	(revision 816)
@@ -0,0 +1,57 @@
+.TH PGASetIntegerInitRange 2 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetIntegerInitRange \- sets a flag to tell the initialization routines to
+set each integer-valued gene to a value chosen randomly from the interval
+given by an upper and lower bound.  No string initialization is done by
+this call.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+min
+- array of lower bounds that define the interval the gene is
+initialized from
+.PD 0
+.TP
+max
+- array of upper bounds that define the interval the gene is
+initialized from
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetIntegerInitRange(ctx, min, max)
+PGAContext *ctx
+int *min
+int *max
+.fi
+.SH LOCATION
+integer.c
+.SH EXAMPLE
+.nf
+Set the initialization routines to select a value for gene i
+uniformly randomly from the interval [0,i].  Assumes all strings
+are of the same length.
+
+PGAContext *ctx;
+int *low, *high, stringlen, i;
+:
+stringlen = PGAGetStringLength(ctx);
+low  = (int *) malloc(stringlen*sizeof(int));
+high = (int *) malloc(stringlen*sizeof(int));
+for(i=0;i<stringlen;i++) {
+low[i]  = 0;
+high[i] = i
+}
+PGASetIntegerInitRange(ctx, low, high);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man2/PGASetRandomInitFlag.2
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man2/PGASetRandomInitFlag.2	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man2/PGASetRandomInitFlag.2	(revision 816)
@@ -0,0 +1,40 @@
+.TH PGASetRandomInitFlag 2 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetRandomInitFlag \- A boolean flag to indicate whether to randomly
+initialize alleles.  Legal values are PGA_TRUE and PGA_FALSE.  Default
+is PGA_TRUE -- randomly initialize alleles.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+flag
+- either PGA_TRUE or PGA_FALSE
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetRandomInitFlag(ctx, RandomBoolean)
+PGAContext *ctx
+int RandomBoolean
+.fi
+.SH LOCATION
+create.c
+.SH EXAMPLE
+.nf
+Example:
+Set the initialization routine to initialize all alleles to zero
+
+PGAContext *ctx;
+:
+PGASetRandomInitFlag(ctx,PGA_FALSE);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man2/PGASetRealInitPercent.2
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man2/PGASetRealInitPercent.2	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man2/PGASetRealInitPercent.2	(revision 816)
@@ -0,0 +1,58 @@
+.TH PGASetRealInitPercent 2 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetRealInitPercent \- sets the upper and lower bounds for randomly
+initializing real-valued genes.  For each gene these bounds define an
+interval from which the initial allele value is selected uniformly randomly.
+With this routine the user specifies a median value and a percent offset
+for each allele.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+median
+- an array containing the mean value of the interval
+.PD 0
+.TP
+percent
+- an array containing the percent offset to add and subtract to
+the median to define the interval
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetRealInitPercent(ctx, median, percent)
+PGAContext *ctx
+double *median
+double *percent
+.fi
+.SH LOCATION
+real.c
+.SH EXAMPLE
+.nf
+Set the initialization routines to select a value for each real-valued
+gene i uniformly randomly from the interval [i-v,i+v], where $v = i/2$.
+Assumes all strings are the same length.
+
+PGAContext *ctx;
+double *median, *percent;
+int i, stringlen;
+:
+stringlen = PGAGetStringLength(ctx);
+median  = (double *) malloc(stringlen*sizeof(double));
+percent = (double *) malloc(stringlen*sizeof(double));
+for(i=0;i<stringlen;i++) {
+median[i]  = (double) i;
+percent[i] = 0.5;
+}
+PGASetRealInitPercent(ctx, median, percent);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man2/PGASetRealInitRange.2
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man2/PGASetRealInitRange.2	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man2/PGASetRealInitRange.2	(revision 816)
@@ -0,0 +1,58 @@
+.TH PGASetRealInitRange 2 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetRealInitRange \- sets the upper and lower bounds for randomly
+initializing real-valued genes.  For each gene these bounds define an
+interval from which the initial allele value is selected uniformly randomly.
+The user specifies two arrays containing lower and bound for each gene to
+define the interval.  This is the default strategy for initializing
+real-valued strings.  The default interval is $[0,1.0]$ for each gene.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+min
+- array containing the lower bound of the interval for each gene
+.PD 0
+.TP
+mac
+- array containing the upper bound of the interval for each gene
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetRealInitRange(ctx, min, max)
+PGAContext *ctx
+double *min
+double *max
+.fi
+.SH LOCATION
+real.c
+.SH EXAMPLE
+.nf
+Set the initialization routines to select a value for each real-valued
+gene i uniformly randomly from the interval [-10.,i]
+Assumes all strings are of the same length.
+
+PGAContext *ctx;
+double *low, *high;
+int i, stringlen;
+:
+stringlen = PGAGetStringLength(ctx);
+low  = (double *) malloc(stringlen*sizeof(double));
+high = (double *) malloc(stringlen*sizeof(double));
+for(i=0;i<stringlen;i++) {
+low[i]  = -10.0;
+high[i] = i;
+}
+PGASetRealInitRange(ctx, low, high);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGACrossover.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGACrossover.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGACrossover.3	(revision 816)
@@ -0,0 +1,68 @@
+.TH PGACrossover 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGACrossover \- performs crossover on two parent strings to create two
+child strings (via side-effect).  The type of crossover performed is
+either the default or that specified by PGASetCrossoverType
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p1
+- the first parent string
+.PD 0
+.TP
+p2
+- the second parent string
+.PD 0
+.TP
+pop1
+- symbolic constant of the population containing string p1 and p2
+.PD 0
+.TP
+c1
+- the first child string
+.PD 0
+.TP
+c2
+- the second child string
+.PD 0
+.TP
+pop2
+- symbolic constant of the population to contain string c1 and c2
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGACrossover(ctx, p1, p2, pop1, c1, c2, pop2)
+PGAContext *ctx
+int p1
+int p2
+int pop1
+int c1
+int c2
+int pop2
+.fi
+.SH LOCATION
+cross.c
+.SH EXAMPLE
+.nf
+Example:
+Perform crossover on the two parent strings mom and dad in population
+PGA_OLDPOP, and insert the child strings, child1 and child1, in
+population PGA_NEWPOP.
+
+PGAContext *ctx;
+int mom, dad, child1, child2;
+:
+PGACrossover(ctx, mom, dad, PGA_OLDPOP, child1, child2, PGA_NEWPOP);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetCrossoverProb.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetCrossoverProb.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetCrossoverProb.3	(revision 816)
@@ -0,0 +1,32 @@
+.TH PGAGetCrossoverProb 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetCrossoverProb \- Returns the crossover probability
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+double  PGAGetCrossoverProb(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+cross.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+double pc;
+:
+pc = PGAGetCrossoverProb(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetCrossoverType.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetCrossoverType.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetCrossoverType.3	(revision 816)
@@ -0,0 +1,43 @@
+.TH PGAGetCrossoverType 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetCrossoverType \- Returns the type of crossover selected
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetCrossoverType(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+cross.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int crosstype;
+:
+crosstype = PGAGetCrossoverType(ctx);
+switch (crosstype) {
+case PGA_CROSSOVER_ONEPT:
+printf("Crossover Type = PGA_CROSSOVER_ONEPT\n");
+break;
+case PGA_CROSSOVER_TWOPT:
+printf("Crossover Type = PGA_CROSSOVER_TWOPT\n");
+break;
+case PGA_CROSSOVER_UNIFORM:
+printf("Crossover Type = PGA_CROSSOVER_UNIFORM\n");
+break;
+}
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetMutationBoundedFlag.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetMutationBoundedFlag.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetMutationBoundedFlag.3	(revision 816)
@@ -0,0 +1,34 @@
+.TH PGAGetMutationBoundedFlag 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetMutationBoundedFlag \- returns PGA_TRUE or PGA_FALSE to indicate
+whether mutated integer strings remain in the range specified when
+initialized with PGASetIntegerInitRange.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetMutationBoundedFlag(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+mutation.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int val;
+:
+val = PGAGetMutationBoundedFlag(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetMutationIntegerValue.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetMutationIntegerValue.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetMutationIntegerValue.3	(revision 816)
@@ -0,0 +1,33 @@
+.TH PGAGetMutationIntegerValue 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetMutationIntegerValue \- Returns the value of the multiplier
+used to mutate PGA_DATATYPE_INTEGER strings with.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetMutationIntegerValue(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+mutation.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int ival;
+:
+ival = PGAGetMutationIntegerValue(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetMutationProb.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetMutationProb.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetMutationProb.3	(revision 816)
@@ -0,0 +1,32 @@
+.TH PGAGetMutationProb 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetMutationProb \- Returns the probability of mutation.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+double  PGAGetMutationProb(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+mutation.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+double pm;
+:
+pm = PGAGetMutateProb(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetMutationRealValue.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetMutationRealValue.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetMutationRealValue.3	(revision 816)
@@ -0,0 +1,33 @@
+.TH PGAGetMutationRealValue 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetMutationRealValue \- Returns the value of the multiplier used to
+mutate PGA_DATATYPE_REAL strings with.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+double  PGAGetMutationRealValue(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+mutation.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+double val;
+:
+val = PGAGetMutationRealValue(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetMutationType.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetMutationType.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetMutationType.3	(revision 816)
@@ -0,0 +1,49 @@
+.TH PGAGetMutationType 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetMutationType \- Returns the type of mutation used
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetMutationType(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+mutation.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int mutatetype;
+:
+mutatetype = PGAGetMutationType(ctx);
+switch (mutatetype) {
+case PGA_MUTATION_CONSTANT:
+printf("Mutation Type = PGA_MUTATION_CONSTANT\n");
+break;
+case PGA_MUTATION_RANGE:
+printf("Mutation Type = PGA_MUTATION_RANGE\n");
+break;
+case PGA_MUTATION_UNIFORM:
+printf("Mutation Type = PGA_MUTATION_UNIFORM\n");
+break;
+case PGA_MUTATION_GAUSSIAN:
+printf("Mutation Type = PGA_MUTATION_GAUSSIAN\n");
+break;
+case PGA_MUTATION_PERMUTE:
+printf("Mutation Type = PGA_MUTATION_PERMUTE\n");
+break;
+}
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetPTournamentProb.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetPTournamentProb.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetPTournamentProb.3	(revision 816)
@@ -0,0 +1,33 @@
+.TH PGAGetPTournamentProb 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetPTournamentProb \- returns the probability of selecting the best
+string in a probabilistic binary tournament
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+double  PGAGetPTournamentProb(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+select.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+double pt;
+:
+pt = PGAGetPTournamentProb(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetRestartAlleleChangeProb.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetRestartAlleleChangeProb.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetRestartAlleleChangeProb.3	(revision 816)
@@ -0,0 +1,32 @@
+.TH PGAGetRestartAlleleChangeProb 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetRestartAlleleChangeProb \- returns the probability with which
+an allele will be mutated during a restart
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+double  PGAGetRestartAlleleChangeProb(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+restart.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+prob = PGASetRestartAlleleChangeProb(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetRestartFlag.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetRestartFlag.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetRestartFlag.3	(revision 816)
@@ -0,0 +1,33 @@
+.TH PGAGetRestartFlag 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetRestartFlag \- returns whether the algorithm should employ the
+restart operator
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetRestartFlag(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+restart.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int val;
+:
+val = PGAGetRestartFlag(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetRestartFrequencyValue.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetRestartFrequencyValue.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetRestartFrequencyValue.3	(revision 816)
@@ -0,0 +1,36 @@
+.TH PGAGetRestartFrequencyValue 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetRestartFrequencyValue \- returns the number of iterations of no
+change in the best string after which the algorithm should restart
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+numiter
+- number of changeless iterations
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetRestartFrequencyValue(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+restart.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+numiter = PGAGetRestartFrequencyValue(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetSelectType.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetSelectType.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetSelectType.3	(revision 816)
@@ -0,0 +1,46 @@
+.TH PGAGetSelectType 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetSelectType \- Returns the type of selection selected
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetSelectType(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+select.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int selecttype;
+:
+selecttype = PGAGetSelectType(ctx);
+switch (selecttype) {
+case PGA_SELECT_PROPORTIONAL:
+printf("Selection Type = PGA_SELECT_PROPORTIONAL\n");
+break;
+case PGA_SELECT_SUS:
+printf("Selection Type = PGA_SELECT_SUS\n");
+break;
+case PGA_SELECT_TOURNAMENT:
+printf("Selection Type = PGA_SELECT_TOURNAMENT\n");
+break;
+case PGA_SELECT_PTOURNAMENT:
+printf("Selection Type = PGA_SELECT_PTOURNAMENT\n");
+break;
+}
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetUniformCrossoverProb.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetUniformCrossoverProb.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGAGetUniformCrossoverProb.3	(revision 816)
@@ -0,0 +1,33 @@
+.TH PGAGetUniformCrossoverProb 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetUniformCrossoverProb \- returns the probability of a bit being
+selected from the first child string in uniform crossover
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+double  PGAGetUniformCrossoverProb(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+cross.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+double pu;
+:
+pu = PGAGetUniformCrossoverProb(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGAMutate.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGAMutate.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGAMutate.3	(revision 816)
@@ -0,0 +1,50 @@
+.TH PGAMutate 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAMutate \- This routine performs mutation on a string.  The type of mutation
+depends on the data type.  Refer to the user guide for data-specific
+examples.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- index of string to mutate
+.PD 0
+.TP
+pop
+- symbolic constant of the population containing p
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAMutate(ctx, p, pop)
+PGAContext *ctx
+int p
+int pop
+.fi
+.SH LOCATION
+mutation.c
+.SH EXAMPLE
+.nf
+Example:
+Mutate the best string in the population, until 10 or more mutations
+have occured.
+
+PGAContext *ctx;
+int p, count = 0;
+:
+p = PGAGetBestIndex(ctx, PGA_NEWPOP);
+while (count < 10) {
+count += PGAMutate(ctx, p, PGA_NEWPOP);
+}
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGARestart.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGARestart.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGARestart.3	(revision 816)
@@ -0,0 +1,51 @@
+.TH PGARestart 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGARestart \- reseeds a population from the best string
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+val
+- the probability of changing an allele when copying the
+best string to the new population
+.PD 0
+.TP
+source_pop
+- the source population
+.PD 0
+.TP
+dest_pop
+- symbolic constant of the destination population
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+side
+-effect.
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGARestart(ctx, source_pop, dest_pop)
+PGAContext *ctx
+int source_pop
+int dest_pop
+.fi
+.SH LOCATION
+restart.c
+.SH EXAMPLE
+.nf
+Perform an unspecified test to determine if the current evolution is
+not evolving fast enough, and if so, restart the evolution.
+
+PGAContext *ctx;	    PGAEvaluateMS(ctx, PGA_OLDPOP, f, comm);
+PGAFitness   (ctx, PGA_OLDPOP);
+}
+
+:
+if (StagnantEvolution()) {
+PGARestart(ctx, PGA_OLDPOP, PGA_NEWPOP);
+PGAEvaluate(ctx, PGA_NEWPOP, EvalFunc);
+PGAUpdateGeneration(ctx);
+}
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGASelect.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGASelect.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGASelect.3	(revision 816)
@@ -0,0 +1,43 @@
+.TH PGASelect 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASelect \- performs genetic algorithm selection using either the default
+selection scheme or that specified with PGASetSelectType().  Valid selection
+methods are proportional, stochastic universal, tournament, or probabilistic
+tournament selection, PGA_SELECT_PROPORTIONAL, PGA_SELECT_SUS, 
+PGA_SELECT_TOURNAMENT, and PGA_SELECT_PTOURNAMENT, respectively.  This 
+function updates an internal array with the indices of members of popix 
+selected for recombination.  These indices may be accessed with 
+PGASelectNextIndex()
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+popix
+- symbolic constant of population to select from
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASelect(ctx, popix)
+PGAContext *ctx
+int popix
+.fi
+.SH LOCATION
+select.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx,
+:
+PGASelect(ctx, PGA_OLDPOP);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGASelectNextIndex.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGASelectNextIndex.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGASelectNextIndex.3	(revision 816)
@@ -0,0 +1,33 @@
+.TH PGASelectNextIndex 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASelectNextIndex \- returns the index of next individual in
+internal array that contains the indices determined by PGASelect
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGASelectNextIndex(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+select.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int l;
+:
+l = PGASelectNextIndex(ctx, PGA_OLDPOP);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetCrossoverProb.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetCrossoverProb.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetCrossoverProb.3	(revision 816)
@@ -0,0 +1,39 @@
+.TH PGASetCrossoverProb 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetCrossoverProb \- Probability that a selected string will undergo
+crossover.  The default is 0.85.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- the crossover probability
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetCrossoverProb(ctx, crossover_prob)
+PGAContext *ctx
+double crossover_prob
+.fi
+.SH LOCATION
+cross.c
+.SH EXAMPLE
+.nf
+Example:
+Make crossover happen infrequently.
+
+PGAContext *ctx;
+:
+PGASetCrossoverProb(ctx,0.001);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetCrossoverType.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetCrossoverType.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetCrossoverType.3	(revision 816)
@@ -0,0 +1,41 @@
+.TH PGASetCrossoverType 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetCrossoverType \- specify the type of crossover to use. Valid choices
+are PGA_CROSSOVER_ONEPT, PGA_CROSSOVER_TWOPT, or PGA_CROSSOVER_UNIFORM for
+one-point, two-point, and uniform crossover, respectively.  The default is
+PGA_CROSSOVER_TWOPT.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+crossover_type
+- symbolic constant to specify crossover type
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetCrossoverType(ctx, crossover_type)
+PGAContext *ctx
+int crossover_type
+.fi
+.SH LOCATION
+cross.c
+.SH EXAMPLE
+.nf
+Example:
+Use uniform crossover when crossingover strings.
+
+PGAContext *ctx;
+:
+PGASetCrossoverType(ctx, PGA_CROSSOVER_UNIFORM);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetMutationBoundedFlag.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetMutationBoundedFlag.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetMutationBoundedFlag.3	(revision 816)
@@ -0,0 +1,41 @@
+.TH PGASetMutationBoundedFlag 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetMutationBoundedFlag \- If this flag is set to PGA_TRUE, then for
+Integer and Real strings whenever a gene is mutated, if it underflows
+(overflows) the lower (upper)bound it is reset to the lower (upper) bound.
+In this way all allele values remain within the range the integer strings
+were initialized on.  If this flag is PGA_FALSE (the default), the alleles
+may take any values.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+flag
+- either PGA_TRUE or PGA_FALSE
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetMutationBoundedFlag(ctx, val)
+PGAContext *ctx
+int val
+.fi
+.SH LOCATION
+mutation.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGASetMutationBoundedFlag(ctx, PGA_TRUE);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetMutationIntegerValue.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetMutationIntegerValue.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetMutationIntegerValue.3	(revision 816)
@@ -0,0 +1,38 @@
+.TH PGASetMutationIntegerValue 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetMutationIntegerValue \- Set multiplier to mutate PGA_DATATYPE_INTEGER
+strings with.  The use of this value depends on the type of mutation
+being used.  The default value is 1.  See the user guide for more details.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+val
+- the mutation value to use for Integer mutation
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetMutationIntegerValue(ctx, val)
+PGAContext *ctx
+int val
+.fi
+.SH LOCATION
+mutation.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGASetMutationIntegerValue(ctx, 5);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetMutationProb.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetMutationProb.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetMutationProb.3	(revision 816)
@@ -0,0 +1,39 @@
+.TH PGASetMutationProb 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetMutationProb \- Specifies the probability that a given allele will
+be mutated.  If this is called without calling PGASetMutationType(), the
+default mutation type is PGA_MUTATION_FIXED.  The default probability is
+the reciprocal of the string length.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- the mutation probability
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetMutationProb(ctx, mutation_prob)
+PGAContext *ctx
+double mutation_prob
+.fi
+.SH LOCATION
+mutation.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGASetMutationProb(ctx,0.001);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetMutationRealValue.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetMutationRealValue.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetMutationRealValue.3	(revision 816)
@@ -0,0 +1,38 @@
+.TH PGASetMutationRealValue 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetMutationRealValue \- Set multiplier to mutate PGA_DATATYPE_REAL
+strings with.  The use of this value depends on the type of mutation
+being used.  The default value is 0.1.  See the user guide for more details.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+val
+- the mutation value to use for Real mutation
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetMutationRealValue(ctx, val)
+PGAContext *ctx
+double val
+.fi
+.SH LOCATION
+mutation.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGASetMutationRealValue(ctx,50.0);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetPTournamentProb.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetPTournamentProb.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetPTournamentProb.3	(revision 816)
@@ -0,0 +1,39 @@
+.TH PGASetPTournamentProb 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetPTournamentProb \- Specifies the probability that the string that wins
+a binary tournament will be selected.  This function will have no effect
+unless PGA_SELECT_PTOURNAMENT was specified as the type of selection to
+use with PGASetSelectType.  The default value is 0.6.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- the probability of selecting the better string
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetPTournamentProb(ctx, ptournament_prob)
+PGAContext *ctx
+double ptournament_prob
+.fi
+.SH LOCATION
+select.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGASetPTournamentProb(ctx,0.8);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetRestartAlleleChangeProb.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetRestartAlleleChangeProb.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetRestartAlleleChangeProb.3	(revision 816)
@@ -0,0 +1,37 @@
+.TH PGASetRestartAlleleChangeProb 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetRestartAlleleChangeProb \- specifies the probability with which
+an allele will be mutated during a restart
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+prob
+- probability of mutation
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetRestartAlleleChangeProb(ctx, prob)
+PGAContext *ctx
+double prob
+.fi
+.SH LOCATION
+restart.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGASetRestartAlleleChangeProb(ctx, 0.5);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetRestartFlag.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetRestartFlag.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetRestartFlag.3	(revision 816)
@@ -0,0 +1,37 @@
+.TH PGASetRestartFlag 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetRestartFlag \- specifies whether the algorithm should employ
+the restart operator
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+val
+- boolean variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetRestartFlag(ctx, val)
+PGAContext *ctx
+int val
+.fi
+.SH LOCATION
+restart.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGASetRestartFlag(ctx, PGA_TRUE);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetRestartFrequencyValue.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetRestartFrequencyValue.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetRestartFrequencyValue.3	(revision 816)
@@ -0,0 +1,37 @@
+.TH PGASetRestartFrequencyValue 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetRestartFrequencyValue \- specifies the number of iterations of no
+change in the best string after which the algorithm should restart
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+numiter
+- number of changeless iterations
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetRestartFrequencyValue(ctx, numiter)
+PGAContext *ctx
+int numiter
+.fi
+.SH LOCATION
+restart.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGASetRestartFrequencyValue(ctx, 100);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetSelectType.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetSelectType.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetSelectType.3	(revision 816)
@@ -0,0 +1,40 @@
+.TH PGASetSelectType 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetSelectType \- specify the type of selection to use. Valid choices
+are PGA_SELECT_PROPORTIONAL, PGA_SELECT_SUS, PGA_SELECT_TOURNAMENT, and
+PGA_SELECT_PTOURNAMENT for proportional, stochastic universal selection,
+tournament, and probabilistic tournament selection, respectively.  The
+default is PGA_SELECT_TOURNAMENT.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+select_type
+- symbolic constant to specify selection type
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetSelectType(ctx, select_type)
+PGAContext *ctx
+int select_type
+.fi
+.SH LOCATION
+select.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGASetSelectType(ctx, PGA_SELECT_SUS);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetUniformCrossoverProb.3
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetUniformCrossoverProb.3	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man3/PGASetUniformCrossoverProb.3	(revision 816)
@@ -0,0 +1,40 @@
+.TH PGASetUniformCrossoverProb 3 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetUniformCrossoverProb \- Probability used in uniform crossover
+to specify that an allele value value be selected from a particular
+parent. The default is 0.6.  The crossover type must have been set
+to PGA_CROSSOVER_UNIFORM with PGASetCrossoverType for this function
+call to have any effect.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- the crossover probability
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetUniformCrossoverProb(ctx, uniform_cross_prob)
+PGAContext *ctx
+double uniform_cross_prob
+.fi
+.SH LOCATION
+cross.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGASetUniformCrossoverProb(ctx,0.9);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man4/PGABuildDatatype.4
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man4/PGABuildDatatype.4	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man4/PGABuildDatatype.4	(revision 816)
@@ -0,0 +1,43 @@
+.TH PGABuildDatatype 4 "05/01/95" " " "PGAPack"
+.SH NAME
+PGABuildDatatype \- Build an MPI datatype for string p in population pop.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- index of an individual
+.PD 0
+.TP
+pop
+- symbolic constant of the population
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+MPI_Datatype  PGABuildDatatype(ctx, p, pop)
+PGAContext *ctx
+int p
+int pop
+.fi
+.SH LOCATION
+parallel.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int p;
+MPI_Datatype dt;
+:
+dt = PGABuildDatatype(ctx, p, PGA_NEWPOP);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man4/PGAGetCommunicator.4
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man4/PGAGetCommunicator.4	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man4/PGAGetCommunicator.4	(revision 816)
@@ -0,0 +1,37 @@
+.TH PGAGetCommunicator 4 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetCommunicator \- Returns the default communicator used when PGARun is
+called.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+MPI_Comm  PGAGetCommunicator(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+parallel.c
+.SH EXAMPLE
+.nf
+Example:
+MPI_Comm comm;
+PGAContext *ctx,
+double f(PGAContext *ctx, int p, int pop);
+:
+ctx = PGACreate(&argc, argv, PGA_DATATYPE_BINARY, 100, PGA_MAXIMIZE);
+PGASetUp(ctx);
+comm = PGAGetCommunicator(ctx);
+
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man4/PGAGetNumProcs.4
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man4/PGAGetNumProcs.4	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man4/PGAGetNumProcs.4	(revision 816)
@@ -0,0 +1,41 @@
+.TH PGAGetNumProcs 4 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetNumProcs \- Returns the size of communicator comm in processes.  If
+comm is NULL or a sequential version of PGAPack is used, PGAGetNumProcs()
+returns 1.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable structure pointer
+.PD 0
+.TP
+comm
+- an MPI communicator
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetNumProcs(ctx, comm)
+PGAContext *ctx
+MPI_Comm comm
+.fi
+.SH LOCATION
+parallel.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext  *ctx;
+:
+if (PGAGetNumProcs(ctx, MPI_COMM_WORLD) < 4) {
+printf("Too few processors for decent performance!\n");
+exit(-1);
+}
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man4/PGAGetRank.4
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man4/PGAGetRank.4	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man4/PGAGetRank.4	(revision 816)
@@ -0,0 +1,42 @@
+.TH PGAGetRank 4 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetRank \- Returns the rank of the processor in communicator comm.  If
+comm is NULL or a sequential version of PGAPack is used, PGAGetRank()
+returns 0.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable structure pointer
+.PD 0
+.TP
+comm
+- an MPI communicator
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetRank(ctx, comm)
+PGAContext *ctx
+MPI_Comm comm
+.fi
+.SH LOCATION
+parallel.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext  *ctx;
+int          rank;
+:
+rank = PGAGetRank(ctx, MPI_COMM_WORLD);
+if (rank == 0) {
+LetTheMasterDoSomething();
+}
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man4/PGAReceiveIndividual.4
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man4/PGAReceiveIndividual.4	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man4/PGAReceiveIndividual.4	(revision 816)
@@ -0,0 +1,63 @@
+.TH PGAReceiveIndividual 4 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAReceiveIndividual \- receive an individual from another process
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- contex variable
+.PD 0
+.TP
+p
+- index of an individual
+.PD 0
+.TP
+pop
+- symbolic constant of the population
+.PD 0
+.TP
+source
+- ID of the process from which to receive
+.PD 0
+.TP
+tag
+- MPI tag to look for
+.PD 0
+.TP
+status
+- pointer to an MPI status structure
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+side
+-effect.
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGAReceiveIndividual(ctx, p, pop, source, tag, comm, status)
+PGAContext *ctx
+int p
+int pop
+int source
+int tag
+MPI_Comm comm
+MPI_Status *status
+.fi
+.SH LOCATION
+parallel.c
+.SH EXAMPLE
+.nf
+Receive a string from the master process (rank == 0) with tag
+PGA_SR_STRINGTOEVAL, and place it into the first temporary location
+in PGA_NEWPOP.
+
+PGAContext *ctx;
+MPI_Comm    comm;
+MPI_Status  status;
+:
+PGAReceiveIndividual(ctx, PGA_TEMP1, PGA_NEWPOP, 0, PGA_SR_STRINGTOEVAL,
+comm, &status);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man4/PGASendIndividual.4
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man4/PGASendIndividual.4	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man4/PGASendIndividual.4	(revision 816)
@@ -0,0 +1,57 @@
+.TH PGASendIndividual 4 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASendIndividual \- transmit an individual to another process
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- index of an individual
+.PD 0
+.TP
+pop
+- symbolic constant of the population
+.PD 0
+.TP
+dest
+- ID of the process where this is going
+.PD 0
+.TP
+tag
+- MPI tag to send with the individual
+.PD 0
+.TP
+comm
+- MPI communicator
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASendIndividual(ctx, p, pop, dest, tag, comm)
+PGAContext *ctx
+int p
+int pop
+int dest
+int tag
+MPI_Comm comm
+.fi
+.SH LOCATION
+parallel.c
+.SH EXAMPLE
+.nf
+PGAContext *ctx;
+int p, dest;
+:
+dest = SelectAFreeProcessor();
+PGASendIndividual(ctx, p, PGA_NEWPOP, dest, PGA_SR_STRINGTOEVAL, comm);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man4/PGASendReceiveIndividual.4
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man4/PGASendReceiveIndividual.4	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man4/PGASendReceiveIndividual.4	(revision 816)
@@ -0,0 +1,91 @@
+.TH PGASendReceiveIndividual 4 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASendReceiveIndividual \- Send an individual to a process, while receiving
+a different individual from a different process.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+send_p
+- index of string to send
+.PD 0
+.TP
+send_pop
+- symbolic constant of population to send from
+.PD 0
+.TP
+dest
+- destination process
+.PD 0
+.TP
+send_tag
+- tag to send with
+.PD 0
+.TP
+recv_p
+- index of string to receive
+.PD 0
+.TP
+recv_pop
+- symbolic constant of population to receive from
+.PD 0
+.TP
+source
+- process to receive from
+.PD 0
+.TP
+recv_tag
+- tag to receive with
+.PD 0
+.TP
+comm
+- an MPI communicator
+.PD 0
+.TP
+status
+- pointer to the MPI status structure
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASendReceiveIndividual(ctx, send_p, send_pop, dest, send_tag, recv_p, recv_pop, source, recv_tag, comm, status)
+PGAContext *ctx
+int send_p
+int send_pop
+int dest
+int send_tag
+int recv_p
+int recv_pop
+int source
+int recv_tag
+MPI_Comm comm
+MPI_Status *status
+.fi
+.SH LOCATION
+parallel.c
+.SH EXAMPLE
+.nf
+Example:
+A dedicated process is being used to perform an optimization algorithm
+on the strings.  Send a new string, s, to the process, while receiving an
+optimized string, r, from it.
+
+PGAContext *ctx;
+MPI_Comm    comm;
+MPI_Status  status;
+int  s, r;
+:
+PGASendReceiveIndividual(ctx, s, PGA_NEWPOP, 1, PGA_SR_STRINGTOMODIFY,
+r, PGA_NEWPOP, 1, PGA_SR_MODIFIEDSTRING,
+comm, &status);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man4/PGASetCommunicator.4
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man4/PGASetCommunicator.4	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man4/PGASetCommunicator.4	(revision 816)
@@ -0,0 +1,44 @@
+.TH PGASetCommunicator 4 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetCommunicator \- Set the default communicator to use when PGARun is
+called.  Does not necessarily need to be the same as the number of
+processes in MPI_COMM_WORLD (which is the default).
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+comm
+- communicator to use
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetCommunicator(ctx, comm)
+PGAContext *ctx
+MPI_Comm comm
+.fi
+.SH LOCATION
+parallel.c
+.SH EXAMPLE
+.nf
+Example:
+MPI_Comm mycomm;
+PGAContext *ctx,
+double f(PGAContext *ctx, int p, int pop);
+:
+ctx = PGACreate(&argc, argv, PGA_DATATYPE_BINARY, 100, PGA_MAXIMIZE);
+PGASetCommunicator(ctx, mycomm);
+PGASetUp(ctx);
+PGARun(ctx, f);
+PGADestroy(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man5/PGACheckSum.5
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man5/PGACheckSum.5	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man5/PGACheckSum.5	(revision 816)
@@ -0,0 +1,43 @@
+.TH PGACheckSum 5 "05/01/95" " " "PGAPack"
+.SH NAME
+PGACheckSum \- maps a string to a number to be used a verification check
+PGA_DATATYPE_USER is not supported.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- string index
+.PD 0
+.TP
+pop
+- symbolic constant for the population
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGACheckSum(ctx, p, pop)
+PGAContext *ctx
+int p
+int pop
+.fi
+.SH LOCATION
+utility.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int p, sum;
+:
+sum = PGACheckSum(ctx, p, PGA_NEWPOP);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man5/PGAGetBestIndex.5
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man5/PGAGetBestIndex.5	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man5/PGAGetBestIndex.5	(revision 816)
@@ -0,0 +1,38 @@
+.TH PGAGetBestIndex 5 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetBestIndex \- returns the index of the string with the best evaluation
+function value in population pop
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+pop
+- symbolic constant of the population to find the best string in
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetBestIndex(ctx, pop)
+PGAContext *ctx
+int pop
+.fi
+.SH LOCATION
+utility.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int best;
+:
+best = PGAGetBestIndex(ctx,PGA_OLDPOP);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man5/PGAGetRandomSeed.5
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man5/PGAGetRandomSeed.5	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man5/PGAGetRandomSeed.5	(revision 816)
@@ -0,0 +1,32 @@
+.TH PGAGetRandomSeed 5 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetRandomSeed \- returns the integer to seed random numbers with
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetRandomSeed(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+random.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int seed;
+:
+seed = PGAGetRandomSeed(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man5/PGAGetWorstIndex.5
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man5/PGAGetWorstIndex.5	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man5/PGAGetWorstIndex.5	(revision 816)
@@ -0,0 +1,38 @@
+.TH PGAGetWorstIndex 5 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetWorstIndex \- returns the index of the string with the worst
+evaluation function value in population pop
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+pop
+- symbolic constant of the population to find the worst string in
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetWorstIndex(ctx, pop)
+PGAContext *ctx
+int pop
+.fi
+.SH LOCATION
+utility.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int worst;
+:
+worst = PGAGetWorstIndex(ctx,PGA_OLDPOP);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man5/PGAHammingDistance.5
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man5/PGAHammingDistance.5	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man5/PGAHammingDistance.5	(revision 816)
@@ -0,0 +1,39 @@
+.TH PGAHammingDistance 5 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAHammingDistance \- Calculates the mean Hamming distance for a population
+of binary strings.  For all other data types returns a value of 0.0 and
+prints a warning message.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+popindex
+- symbolic constant of the population for which the
+Hamming distance is to be calculated
+Output:
+The mean Hamming distance in the population
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+double  PGAHammingDistance(ctx, popindex)
+PGAContext *ctx
+int popindex
+.fi
+.SH LOCATION
+hamming.c
+.SH EXAMPLE
+.nf
+:
+hd = PGAHammingDistance(ctx, PGA_NEWPOP);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man5/PGAMean.5
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man5/PGAMean.5	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man5/PGAMean.5	(revision 816)
@@ -0,0 +1,42 @@
+.TH PGAMean 5 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAMean \- calculates the mean value of an array of elements
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+a
+- array to take the mean of
+.PD 0
+.TP
+n
+- number of elements in array a
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+double  PGAMean(ctx, a, n)
+PGAContext *ctx
+double *a
+int n
+.fi
+.SH LOCATION
+utility.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+double a[100], mean;
+:
+mean = PGAMean(ctx, a, 100);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man5/PGARandom01.5
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man5/PGARandom01.5	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man5/PGARandom01.5	(revision 816)
@@ -0,0 +1,42 @@
+.TH PGARandom01 5 "05/01/95" " " "PGAPack"
+.SH NAME
+PGARandom01 \- generates a uniform random number on the interval [0,1)
+If the second argument is 0 it returns the next random number in the
+sequence.  Otherwise, the second argument is used as a new seed for the
+population
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+newseed
+- either 0 to get the next random number, or nonzero
+to reseed
+Outputs:
+A random number on the interval [0,1)
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+double  PGARandom01(ctx, newseed)
+PGAContext *ctx
+int newseed
+.fi
+.SH LOCATION
+random.c
+.SH EXAMPLE
+.nf
+PGAContext *ctx;
+double r;
+:
+r = PGARandom01(ctx,0);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man5/PGARandomFlip.5
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man5/PGARandomFlip.5	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man5/PGARandomFlip.5	(revision 816)
@@ -0,0 +1,40 @@
+.TH PGARandomFlip 5 "05/01/95" " " "PGAPack"
+.SH NAME
+PGARandomFlip \- flip a biased coin and return PGA_TRUE if the coin is
+a "winner."  Otherwise, return PGA_FALSE.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- biased probability (.5 is a fair coin)
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGARandomFlip(ctx, p)
+PGAContext *ctx
+double p
+.fi
+.SH LOCATION
+random.c
+.SH EXAMPLE
+.nf
+Example:
+To return PGA_TRUE approximately seventy percent of the time, use
+
+PGAContext *ctx;
+int p;
+:
+PGARandomFlip(ctx, 0.7)
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man5/PGARandomGaussian.5
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man5/PGARandomGaussian.5	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man5/PGARandomGaussian.5	(revision 816)
@@ -0,0 +1,40 @@
+.TH PGARandomGaussian 5 "05/01/95" " " "PGAPack"
+.SH NAME
+PGARandomGaussian \- returns an approximation to a Gaussian random number
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+mean
+- the mean of the Gaussian distribution
+.PD 0
+.TP
+sigma
+- the standard deviation of the Gaussian distribution
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+double  PGARandomGaussian(ctx, mean, sigma)
+PGAContext *ctx
+double mean
+double sigma
+.fi
+.SH LOCATION
+random.c
+.SH EXAMPLE
+.nf
+Example:
+To generate a Gaussian random number with mean 0.0 and standard
+deviation 1.0 use
+
+PGAContext *ctx;
+:
+r = PGARandomGaussian(ctx, 0.0, 1.0);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man5/PGARandomInterval.5
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man5/PGARandomInterval.5	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man5/PGARandomInterval.5	(revision 816)
@@ -0,0 +1,44 @@
+.TH PGARandomInterval 5 "05/01/95" " " "PGAPack"
+.SH NAME
+PGARandomInterval \- returns a uniform random number on the specified
+interval
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+start
+- starting (integer) value of the interval
+.PD 0
+.TP
+end
+- ending   (integer) value of the interval
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGARandomInterval(ctx, start, end)
+PGAContext *ctx
+int start
+int end
+.fi
+.SH LOCATION
+random.c
+.SH EXAMPLE
+.nf
+Example:
+Generate a value uniformly random from the interval [0,99]
+
+PGAContext *ctx;
+:
+PGARandomInterval(ctx, 0, 99);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man5/PGARandomUniform.5
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man5/PGARandomUniform.5	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man5/PGARandomUniform.5	(revision 816)
@@ -0,0 +1,45 @@
+.TH PGARandomUniform 5 "05/01/95" " " "PGAPack"
+.SH NAME
+PGARandomUniform \- returns a uniform random number on the interval
+[start,end]
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+start
+- starting (double) value of the interval
+.PD 0
+.TP
+end
+- ending   (double) value of the interval
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+double  PGARandomUniform(ctx, start, end)
+PGAContext *ctx
+double start
+double end
+.fi
+.SH LOCATION
+random.c
+.SH EXAMPLE
+.nf
+Example:
+Generate a uniform random number on the interval [-0.5, 1.5]
+
+PGAContext *ctx;
+double r;
+:
+r = PGARandomUniform(ctx, -0.5, 1.5);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man5/PGARound.5
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man5/PGARound.5	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man5/PGARound.5	(revision 816)
@@ -0,0 +1,37 @@
+.TH PGARound 5 "05/01/95" " " "PGAPack"
+.SH NAME
+PGARound \- Mathematically round a double to an integer, using 0.5 as the
+cutoff value.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+x
+- the number to be rounded
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGARound(ctx, x)
+PGAContext *ctx
+double x
+.fi
+.SH LOCATION
+utility.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int y;
+y = PGARound(ctx, -78.6);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man5/PGASetRandomSeed.5
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man5/PGASetRandomSeed.5	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man5/PGASetRandomSeed.5	(revision 816)
@@ -0,0 +1,38 @@
+.TH PGASetRandomSeed 5 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetRandomSeed \- set a seed for the random number generator.  The
+default is to use a random seed.  Specifying a seed exlicitly allows
+for reproducibility of runs.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+seed
+- seed  for the random number generator
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetRandomSeed(ctx, seed)
+PGAContext *ctx
+int seed
+.fi
+.SH LOCATION
+random.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGASetRandomSeed(ctx,1);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man5/PGAStddev.5
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man5/PGAStddev.5	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man5/PGAStddev.5	(revision 816)
@@ -0,0 +1,48 @@
+.TH PGAStddev 5 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAStddev \- calculates the standard deviation of an array of elements
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+a
+- array to take the standard deviation of
+.PD 0
+.TP
+n
+- number of elements in array a
+.PD 0
+.TP
+mean
+- the mean of the elements in array a
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+double  PGAStddev(ctx, a, n, mean)
+PGAContext *ctx
+double *a
+int n
+double mean
+.fi
+.SH LOCATION
+utility.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+double a[100], mean, sigma;
+:
+mean  = PGAMean(ctx, a, 100);
+sigma = PGAStddev(ctx, a, 100, mean);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man6/PGAError.6
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man6/PGAError.6	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man6/PGAError.6	(revision 816)
@@ -0,0 +1,57 @@
+.TH PGAError 6 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAError \- reports error messages.  Prints out the message supplied, and
+the value of a piece of data.  Terminates if PGA_FATAL.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+msg
+- the error message to print
+.PD 0
+.TP
+level
+- PGA_WARNING or PGA_FATAL to indicate the error's severity
+.PD 0
+.TP
+datatype
+- the data type of the following argument
+.PD 0
+.TP
+data
+- the address of the data to be written out, cast as a void
+pointer
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGAError(ctx, msg, level, datatype, data)
+PGAContext *ctx
+char *msg
+int level
+int datatype
+void *data
+.fi
+.SH LOCATION
+system.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int         val;
+:
+PGAError(ctx, "Some Non Fatal Error: val = ", PGA_WARNING, PGA_INT,
+(void *) &val);
+:
+PGAError(ctx, "A Fatal Error!", PGA_FATAL, PGA_VOID, NULL);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man6/PGAGetMaxMachineDoubleValue.6
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man6/PGAGetMaxMachineDoubleValue.6	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man6/PGAGetMaxMachineDoubleValue.6	(revision 816)
@@ -0,0 +1,33 @@
+.TH PGAGetMaxMachineDoubleValue 6 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetMaxMachineDoubleValue \- returns the largest double of the current
+machine
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+double  PGAGetMaxMachineDoubleValue(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+system.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+double big;
+:
+big = PGAGetMaxMachineDoubleValue(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man6/PGAGetMaxMachineIntValue.6
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man6/PGAGetMaxMachineIntValue.6	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man6/PGAGetMaxMachineIntValue.6	(revision 816)
@@ -0,0 +1,33 @@
+.TH PGAGetMaxMachineIntValue 6 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetMaxMachineIntValue \- returns the largest integer of the current
+machine
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetMaxMachineIntValue(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+system.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int intmax;
+:
+intmax = PGAGetMaxMachineIntValue(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man6/PGAGetMinMachineDoubleValue.6
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man6/PGAGetMinMachineDoubleValue.6	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man6/PGAGetMinMachineDoubleValue.6	(revision 816)
@@ -0,0 +1,33 @@
+.TH PGAGetMinMachineDoubleValue 6 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetMaxMachineDoubleValue \- returns the smallest double of the current
+machine
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+double  PGAGetMinMachineDoubleValue(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+system.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+double small;
+:
+small = PGAGetMinMachineDoubleValue(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man6/PGAGetMinMachineIntValue.6
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man6/PGAGetMinMachineIntValue.6	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man6/PGAGetMinMachineIntValue.6	(revision 816)
@@ -0,0 +1,33 @@
+.TH PGAGetMinMachineIntValue 6 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetMaxMachineIntValue \- returns the smallest integer of the current
+machine
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetMinMachineIntValue(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+system.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int intmin;
+:
+intmin = PGAGetMinMachineIntValue(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man7/PGAGetPrintFrequencyValue.7
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man7/PGAGetPrintFrequencyValue.7	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man7/PGAGetPrintFrequencyValue.7	(revision 816)
@@ -0,0 +1,32 @@
+.TH PGAGetPrintFrequencyValue 7 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetPrintFrequencyValue \- returns how often to print statistics reports
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetPrintFrequencyValue(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+report.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int freq;
+:
+freq = PGAGetPrintFrequencyValue(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man7/PGAPrintContextVariable.7
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man7/PGAPrintContextVariable.7	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man7/PGAPrintContextVariable.7	(revision 816)
@@ -0,0 +1,37 @@
+.TH PGAPrintContextVariable 7 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAPrintContextVariable \- prints the value of all the fields in the context
+variable.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+fp
+- file pointer to print the output to
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGAPrintContextVariable(ctx, fp)
+PGAContext *ctx
+FILE *fp
+.fi
+.SH LOCATION
+report.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGAPrintContextVariable(ctx, stdout);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man7/PGAPrintIndividual.7
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man7/PGAPrintIndividual.7	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man7/PGAPrintIndividual.7	(revision 816)
@@ -0,0 +1,48 @@
+.TH PGAPrintIndividual 7 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAPrintIndividual \- prints the allele values of a string and associated
+fields (evaluation, fitness, etc.) of a string
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+fp
+- file pointer to print the output to
+.PD 0
+.TP
+p
+- string index
+.PD 0
+.TP
+pop
+- symbolic constant of the population string p is in
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGAPrintIndividual(ctx, fp, p, pop)
+PGAContext *ctx
+FILE *fp
+int p
+int pop
+.fi
+.SH LOCATION
+report.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int p;
+:
+PGAPrintIndividual(ctx, stdout, p, PGA_NEWPOP);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man7/PGAPrintPopulation.7
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man7/PGAPrintPopulation.7	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man7/PGAPrintPopulation.7	(revision 816)
@@ -0,0 +1,42 @@
+.TH PGAPrintPopulation 7 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAPrintPopulation \- Calls PGAPrintIndividual to print each member of a
+population
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+fp
+- file pointer to print the output to
+.PD 0
+.TP
+pop
+- symbolic constant of the population to be printed
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGAPrintPopulation(ctx, fp, pop)
+PGAContext *ctx
+FILE *fp
+int pop
+.fi
+.SH LOCATION
+report.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGAPrintPopulation(ctx, stdout, PGA_NEWPOP);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man7/PGAPrintReport.7
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man7/PGAPrintReport.7	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man7/PGAPrintReport.7	(revision 816)
@@ -0,0 +1,43 @@
+.TH PGAPrintReport 7 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAPrintReport \- prints genetic algorithm statistics.  The statistics
+that are printed are determined by PGASetPrintOptions().
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+fp
+- file pointer to print the output to
+.PD 0
+.TP
+pop
+- symbolic constant of the population whose statistics are printed
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGAPrintReport(ctx, fp, pop)
+PGAContext *ctx
+FILE *fp
+int pop
+.fi
+.SH LOCATION
+report.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int p;
+:
+PGAPrintReport(ctx, stdout, PGA_NEWPOP);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man7/PGAPrintString.7
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man7/PGAPrintString.7	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man7/PGAPrintString.7	(revision 816)
@@ -0,0 +1,47 @@
+.TH PGAPrintString 7 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAPrintString \- write the allele values in a string to a file
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+fp
+- pointer to file to write the string to
+.PD 0
+.TP
+p
+- index of the string to write out
+.PD 0
+.TP
+pop
+- symbolic constant of the population string p is in
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGAPrintString(ctx, file, p, pop)
+PGAContext *ctx
+FILE *file
+int p
+int pop
+.fi
+.SH LOCATION
+report.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int p;
+:
+PGAPrintString(ctx, stdout, p, PGA_OLDPOP);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man7/PGASetPrintFrequencyValue.7
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man7/PGASetPrintFrequencyValue.7	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man7/PGASetPrintFrequencyValue.7	(revision 816)
@@ -0,0 +1,38 @@
+.TH PGASetPrintFrequencyValue 7 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetPrintFrequencyValue \- Specifies the frequency with which genetic
+algorithm statistics are reported.  The default is every 10 GA iterations.
+Used only if PGARun() is used to run the GA.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+print_freq
+- the genetic algorithm population size to use
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetPrintFrequencyValue(ctx, print_freq)
+PGAContext *ctx
+int print_freq
+.fi
+.SH LOCATION
+report.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGASetPrintFrequencyValue(ctx,1);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man7/PGASetPrintOptions.7
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man7/PGASetPrintOptions.7	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man7/PGASetPrintOptions.7	(revision 816)
@@ -0,0 +1,43 @@
+.TH PGASetPrintOptions 7 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetPrintOptions \- set flags to indicate what GA statistics should be
+printed whenever output is printed.  May be called more than once to
+specify different report options.  Valid choices are PGA_REPORT_AVERAGE,
+PGA_REPORT_OFFLINE, PGA_REPORT_ONLINE, PGA_REPORT_WORST, PGA_REPORT_HAMMING,
+and PGA_REPORT_STRING to specify offline analysis, online analysis, the
+worst string in the population, the Hamming distance of the population, and
+the actual allele values of the best string.  The best string is always
+printed. 
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+option
+- symbolic constant to specify a print option
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetPrintOptions(ctx, option)
+PGAContext *ctx
+int option
+.fi
+.SH LOCATION
+report.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGASetPrintOptions(ctx, PGA_REPORT_WORST);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGAChange.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGAChange.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGAChange.8	(revision 816)
@@ -0,0 +1,52 @@
+.TH PGAChange 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAChange \- Repeatedly apply mutation to a string (with an increasing
+mutation rate) until one or more mutations have occurred.  This routine is
+usually used with PGADuplicate to modify a duplicate string.  It is not
+intended to replace PGAMutation
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- string index
+.PD 0
+.TP
+pop
+- symbolic constant of the population containing string p
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGAChange(ctx, p, pop)
+PGAContext *ctx
+int p
+int pop
+.fi
+.SH LOCATION
+duplcate.c
+.SH EXAMPLE
+.nf
+Example:
+Change any string in PGA_NEWPOP that is an exact copy of a string
+in PGA_OLDPOP.  To be complete, we should check the population again
+if any changes are made; for simplicity, we don't.
+
+PGAContext *ctx;
+int b, n;
+:
+n  = PGAGetPopsize(ctx);
+for (b=0; b<n; b++)
+if (PGADuplicate(ctx, b, PGA_NEWPOP, PGA_OLDPOP, n))
+PGAChange(ctx, b, PGA_NEWPOP);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGACheckStoppingConditions.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGACheckStoppingConditions.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGACheckStoppingConditions.8	(revision 816)
@@ -0,0 +1,33 @@
+.TH PGACheckStoppingConditions 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGACheckStoppingConditions \- returns boolean to indicate if the PGAPack
+termination conditions -- PGA_STOP_MAXITER, PGA_STOP_TOOSIMILAR, 
+PGA_STOP_NOCHANGE -- have been met.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGACheckStoppingConditions(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+stop.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGACheckStoppingConditions(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGACopyIndividual.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGACopyIndividual.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGACopyIndividual.8	(revision 816)
@@ -0,0 +1,53 @@
+.TH PGACopyIndividual 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGACopyIndividual \- copies string p1 in population pop1 to position p2 in
+population pop2
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p1
+- string to copy
+.PD 0
+.TP
+pop1
+- symbolic constant of population containing string p1
+.PD 0
+.TP
+p2
+- string to copy p1 to
+.PD 0
+.TP
+pop2
+- symbolic constant of population containing string p2
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGACopyIndividual(ctx, p1, pop1, p2, pop2)
+PGAContext *ctx
+int p1
+int pop1
+int p2
+int pop2
+.fi
+.SH LOCATION
+utility.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int i,j;
+:
+PGACopyIndividual(ctx, i, PGA_OLDPOP, j, PGA_NEWPOP);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGACreate.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGACreate.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGACreate.8	(revision 816)
@@ -0,0 +1,90 @@
+.TH PGACreate 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGACreate \- creates an uninitialized context variable.  The Fortran version
+of this function call contains only the last three arguments
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+argc
+- address of the count of the number of command line arguments.
+.PD 0
+.TP
+argv
+- array of command line arguments.
+.PD 0
+.TP
+datatype
+- the data type used for the strings.  Must be one of
+PGA_DATATYPE_BINARY, PGA_DATATYPE_CHARACTER,
+PGA_DATATYPE_INTEGER, PGA_DATATYPE_REAL, or PGA_DATATYPE_USER
+.PD 0
+.TP
+binary
+-valued, character-valued, integer-valued,
+.PD 0
+.TP
+real
+-valued, or a user-defined datatype, respectively.
+.PD 0
+.TP
+len
+- the string length (number of genes).
+.PD 0
+.TP
+maxormin
+- the direction of optimization. Must be one of PGA_MAXIMIZE or
+PGA_MINIMIZE for maximization or minimization, respectively.
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+PGAContext * PGACreate(argc, argv, datatype, len, maxormin)
+int *argc
+char **argv
+int datatype
+int len
+int maxormin
+.fi
+.SH LOCATION
+create.c
+.SH EXAMPLE
+.nf
+Example:
+
+In C:
+void main(int argc, char **argv) {
+PGAContext *ctx;
+:
+ctx = PGACreate(&argc, argv, PGA_DATATYPE_BINARY, 100, PGA_MAXIMIZE);
+:
+//  Set options here
+:
+PGASetUp(ctx);
+:
+//  Run the GA here
+:
+PGADestroy(ctx);
+}
+
+In FORTRAN:
+integer ctx
+:
+ctx = PGACreate(PGA_DATATYPE_BINARY, 100, PGA_MAXIMIZE)
+:
+c       Set options here
+:
+call PGASetUp(ctx)
+:
+c       Run the GA here
+:
+call PGADestroy(ctx)
+stop
+end
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGADestroy.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGADestroy.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGADestroy.8	(revision 816)
@@ -0,0 +1,32 @@
+.TH PGADestroy 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGADestroy \- deallocate memory for this instance of PGAPack, if this context
+initialized MPI, finalize MPI as well.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGADestroy(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+system.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGADestroy(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGADone.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGADone.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGADone.8	(revision 816)
@@ -0,0 +1,38 @@
+.TH PGADone 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGADone \- Returns PGA_TRUE if the stopping conditions have been met,
+otherwise returns false.  Calls exactly one of the user defined C or
+fortran or system (PGACheckStoppingConditions) stopping condition functions.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+comm
+- an MPI communicator
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGADone(ctx, comm)
+PGAContext *ctx
+MPI_Comm comm
+.fi
+.SH LOCATION
+stop.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGADone(ctx, comm);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGADuplicate.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGADuplicate.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGADuplicate.8	(revision 816)
@@ -0,0 +1,78 @@
+.TH PGADuplicate 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGADuplicate \- determines if a specified string is a duplicate of one
+already in an existing population
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+p
+- string index
+.PD 0
+.TP
+pop1
+- symbolic constant of the population containing string p
+.PD 0
+.TP
+pop2
+- symbolic constant of the (possibly partial) population containing
+strings to compare string p against
+.PD 0
+.TP
+n
+- the number of strings in pop2 to compare string p against
+.PD 0
+.TP
+n
+-1)
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGADuplicate(ctx, p, pop1, pop2, n)
+PGAContext *ctx
+int p
+int pop1
+int pop2
+int n
+.fi
+.SH LOCATION
+duplcate.c
+.SH EXAMPLE
+.nf
+0,...,n-1 in population pop2.  Otherwise returns PGA_FALSE
+
+Example:
+Change any string in PGA_NEWPOP that is an exact copy of a string
+in PGA_OLDPOP.
+
+PGAContext *ctx;
+int b, n;
+:
+n  = PGAGetPopsize(ctx);
+for (b=0; b<n; b++)
+if (PGADuplicate(ctx, b, PGA_NEWPOP, PGA_OLDPOP, n))
+PGAChange(ctx, b, PGA_NEWPOP);
+
+
+Check if the best string in population PGA_OLDPOP is a duplicate of any
+of the strings in the first half of population PGA_NEWPOP.
+
+PGAContext *ctx;
+int b, n;
+:
+b  = PGAGetBestIndex(ctx, PGA_OLDPOP);
+n  = PGAGetPopsize(ctx) / 2;
+if (PGADuplicate(ctx, b, PGA_OLDPOP, PGA_NEWPOP, n))
+printf("A duplicate!\n");
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetDataType.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetDataType.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetDataType.8	(revision 816)
@@ -0,0 +1,49 @@
+.TH PGAGetDataType 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetDataType \- Returns the data type used by the given context.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetDataType(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+pga.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int datatype;
+:
+datatype = PGAGetDataType(ctx);
+switch (datatype) {
+case PGA_DATATYPE_BINARY:
+printf("Data Type = PGA_DATATYPE_BINARY\n");
+break;
+case PGA_DATATYPE_CHARACTER:
+printf("Data Type = PGA_DATATYPE_CHARACTER\n");
+break;
+case PGA_DATATYPE_INTEGER:
+printf("Data Type = PGA_DATATYPE_INTEGER\n");
+break;
+case PGA_DATATYPE_REAL:
+printf("Data Type = PGA_DATATYPE_REAL\n");
+break;
+case PGA_DATATYPE_USER:
+printf("Data Type = PGA_DATATYPE_USER\n");
+break;
+}
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetGAIterValue.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetGAIterValue.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetGAIterValue.8	(revision 816)
@@ -0,0 +1,33 @@
+.TH PGAGetGAIterValue 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetGAIterValue \- returns the number of the current genetic
+algorithm generation
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetGAIterValue(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+pga.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int g;
+:
+g = PGAGetGAIterValue(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetMaxGAIterValue.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetMaxGAIterValue.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetMaxGAIterValue.8	(revision 816)
@@ -0,0 +1,32 @@
+.TH PGAGetMaxGAIterValue 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetMaxGAIterValue \- Returns the maximum number of iterations to run
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetMaxGAIterValue(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+stop.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int maxiter;
+:
+maxiter = PGAGetMaxGAIterValue(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetMutationAndCrossoverFlag.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetMutationAndCrossoverFlag.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetMutationAndCrossoverFlag.8	(revision 816)
@@ -0,0 +1,41 @@
+.TH PGAGetMutationAndCrossoverFlag 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetMutationAndCrossoverFlag \- Returns true if mutation occurs only
+when crossover does.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+crossed
+-over strings.
+Otherwise, returns PGA_FALSE
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetMutationAndCrossoverFlag(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+pga.c
+.SH EXAMPLE
+.nf
+PGAContext *ctx;
+int mutatetype;
+:
+mutatetype = PGAGetMutationAndCrossoverFlag(ctx);
+switch (mutatetype) {
+case PGA_TRUE:
+printf("Mutating strings only after crossover\n");
+break;
+case PGA_FALSE:
+printf("Only mutating strings not undergoing crossover\n");
+break;
+}
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetMutationOrCrossoverFlag.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetMutationOrCrossoverFlag.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetMutationOrCrossoverFlag.8	(revision 816)
@@ -0,0 +1,41 @@
+.TH PGAGetMutationOrCrossoverFlag 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetMutationOrCrossoverFlag \- Returns true if mutation only occurs when
+crossover does not.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetMutationOrCrossoverFlag(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+pga.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int mutatetype;
+:
+mutatetype = PGAGetMutationOrCrossoverFlag(ctx);
+switch (mutatetype) {
+case PGA_TRUE:
+printf("Only mutating strings not undergoing crossover\n");
+break;
+case PGA_FALSE:
+printf("Mutating strings only after crossover\n");
+break;
+}
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetNoDuplicatesFlag.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetNoDuplicatesFlag.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetNoDuplicatesFlag.8	(revision 816)
@@ -0,0 +1,41 @@
+.TH PGAGetNoDuplicatesFlag 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetNoDuplicatesFlag \- Returns PGA_TRUE if duplicates are not allowed,
+else returns PGA_FALSE.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetNoDuplicatesFlag(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+duplcate.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int nodups;
+:
+nodups = PGAGetNoDuplicatesFlag(ctx);
+switch (nodups) {
+case PGA_TRUE:
+printf("Duplicate strings not allowed in population\n");
+break;
+case PGA_FALSE:
+printf("Duplicate strings allowed in population\n");
+break;
+}
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetNumReplaceValue.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetNumReplaceValue.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetNumReplaceValue.8	(revision 816)
@@ -0,0 +1,33 @@
+.TH PGAGetNumReplaceValue 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetNumReplaceValue \- Returns the maximum number of strings to replace
+each generation.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetNumReplaceValue(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+pop.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int numreplace;
+:
+numreplace = PGAGetNumReplaceValue(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetOptDirFlag.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetOptDirFlag.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetOptDirFlag.8	(revision 816)
@@ -0,0 +1,41 @@
+.TH PGAGetOptDirFlag 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetOptDirFlag \- Returns a symbolic constant that represents the
+direction of optimization
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetOptDirFlag(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+pga.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int optdir;
+:
+optdir = PGAGetOptDirFlag(ctx);
+switch (optdir) {
+case PGA_MAXIMIZE:
+printf("Optimization direction = PGA_MAXIMIZE\n");
+break;
+case PGA_MINIMIZE:
+printf("Optimization direction = PGA_MINIMIZE\n");
+break;
+}
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetPopReplaceType.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetPopReplaceType.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetPopReplaceType.8	(revision 816)
@@ -0,0 +1,44 @@
+.TH PGAGetPopReplaceType 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetPopReplaceType \- returns the symbolic constant used to determine
+which strings to copy from the old population to the new population.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetPopReplaceType(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+pop.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int popreplace;
+:
+popreplace = PGAGetPopReplaceType(ctx);
+switch (popreplace) {
+case PGA_POPREPL_BEST:
+printf("Replacement Strategy = PGA_POPREPL_BEST\n");
+break;
+case PGA_POPREPL_RANDOM_REP:
+printf("Replacement Strategy = PGA_POPREPL_RANDOM_REP\n");
+break;
+case PGA_POPREPL_RANDOM_NOREP:
+printf("Replacement Strategy = PGA_POPREPL_RANDOM_NOREP\n");
+break;
+}
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetPopSize.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetPopSize.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetPopSize.8	(revision 816)
@@ -0,0 +1,32 @@
+.TH PGAGetPopSize 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetPopSize \- Returns the population size
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetPopSize(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+pop.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int popsize;
+:
+popsize = PGAGetPopSize(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetSortedPopIndex.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetSortedPopIndex.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetSortedPopIndex.8	(revision 816)
@@ -0,0 +1,47 @@
+.TH PGAGetSortedPopIndex 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetSortedPopIndex \- returns a population string index from the array
+created by PGASortPop().
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+n
+- specified which index element is to be returned.
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetSortedPopIndex(ctx, n)
+PGAContext *ctx
+int n
+.fi
+.SH LOCATION
+pop.c
+.SH EXAMPLE
+.nf
+Example:
+Copy the five best strings from the old population into the new
+population.  The rest of the new population will be created by
+recombination, and is not shown.
+
+PGAContext *ctx;
+int i,j;
+:
+PGASetPopReplaceType(ctx,PGA_POPREPL_BEST)
+PGASortPop(ctx, PGA_OLDPOP);
+for ( i=0; i < 5; i++) {
+j = PGAGetSortedPopIndex(ctx, i);
+PGACopyIndividual (ctx, j, PGA_OLDPOP, i, PGA_NEWPOP);
+:
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetStoppingRuleType.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetStoppingRuleType.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetStoppingRuleType.8	(revision 816)
@@ -0,0 +1,39 @@
+.TH PGAGetStoppingRuleType 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetStoppingRuleType \- Returns a symbolic constant that defines the
+termination criteria.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetStoppingRuleType(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+stop.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int stop;
+:
+stop = PGAGetStoppingRuleType(ctx);
+if (stop & PGA_STOP_MAXITER)
+printf("Stopping Rule = PGA_STOP_MAXITER\n");
+if (stop & PGA_STOP_NOCHANGE)
+printf("Stopping Rule = PGA_STOP_NOCHANGE\n");
+if (stop & PGA_STOP_TOOSIMILAR)
+printf("Stopping Rule = PGA_STOP_TOOSIMILAR\n");
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetStringLength.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetStringLength.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGAGetStringLength.8	(revision 816)
@@ -0,0 +1,32 @@
+.TH PGAGetStringLength 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAGetStringLength \- Returns the string length
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+int  PGAGetStringLength(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+pga.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+int stringlen;
+:
+stringlen = PGAGetStringLength(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGARun.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGARun.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGARun.8	(revision 816)
@@ -0,0 +1,42 @@
+.TH PGARun 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGARun \- Highest level routine to execute the genetic algorithm.  It
+is called after PGACreate and PGASetup have been called.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+evaluate
+- a pointer to the user's evaluation function, which must
+have the calling sequence shown in the example.
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGARun(ctx, ctx)
+PGAContext *ctx
+double (*evaluate)(PGAContext *c, int p, int pop)
+.fi
+.SH LOCATION
+pga.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx,
+double f(PGAContext *ctx, int p, int pop);
+:
+ctx = PGACreate(&argc, argv, PGA_DATATYPE_BINARY, 100, PGA_MAXIMIZE);
+PGASetUp(ctx);
+PGARun(ctx, f);
+PGADestroy(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGARunGM.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGARunGM.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGARunGM.8	(revision 816)
@@ -0,0 +1,46 @@
+.TH PGARunGM 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGARunGM \- High-level routine to execute the genetic algorithm using the
+global model.  It is called after PGACreate and PGASetup have been called.
+If a NULL communicator is given, a sequential execution method is used,
+otherwise, work is divided among the processors in the communicator.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+evaluate
+- a pointer to the user's evaluation function, which must
+have the calling sequence shown in the example.
+.PD 0
+.TP
+comm
+- an MPI communicator
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGARunGM(ctx, ctx, comm)
+PGAContext *ctx
+double (*f)(PGAContext *, int, int)
+MPI_Comm comm
+.fi
+.SH LOCATION
+parallel.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+double f(PGAContext *ctx, int p, int pop);
+:
+PGARunGM(ctx, f, MPI_COMM_WORLD);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGARunMutationAndCrossover.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGARunMutationAndCrossover.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGARunMutationAndCrossover.8	(revision 816)
@@ -0,0 +1,41 @@
+.TH PGARunMutationAndCrossover 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGARunMutationAndCrossover \- Performs crossover and mutation from one
+population to create the next.  Assumes PGASelect has been called.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+oldpop
+- symbolic constant of old population
+.PD 0
+.TP
+newpop
+- symbolic constant of new population
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+side
+-effect.
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGARunMutationAndCrossover(ctx, oldpop, newpop)
+PGAContext *ctx
+int oldpop
+int newpop
+.fi
+.SH LOCATION
+pga.c
+.SH EXAMPLE
+.nf
+PGAContext *ctx,
+:
+PGARunMutationAndCrossover(ctx, PGA_OLDPOP, PGA_NEWPOP);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGARunMutationOrCrossover.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGARunMutationOrCrossover.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGARunMutationOrCrossover.8	(revision 816)
@@ -0,0 +1,41 @@
+.TH PGARunMutationOrCrossover 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGARunMutationOrCrossover \- Performs crossover or mutation (but not both)
+from one populationto create the next.  Assumes PGASelect has been called.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+oldpop
+- symbolic constant of old population
+.PD 0
+.TP
+newpop
+- symbolic constant of new population
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+side
+-effect.
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGARunMutationOrCrossover(ctx, oldpop, newpop)
+PGAContext *ctx
+int oldpop
+int newpop
+.fi
+.SH LOCATION
+pga.c
+.SH EXAMPLE
+.nf
+PGAContext *ctx,
+:
+PGARunMutationOrCrossover(ctx, PGA_OLDPOP, PGA_NEWPOP);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetMaxGAIterValue.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetMaxGAIterValue.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetMaxGAIterValue.8	(revision 816)
@@ -0,0 +1,38 @@
+.TH PGASetMaxGAIterValue 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetMaxGAIterValue \- specify the maximum number of iterations for the
+stopping rule PGA_STOP_MAXITER (which, by itself, is the default stopping
+rule and is always in effect).  The default value is 1000 iterations.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+maxiter
+- the maximum number of GA iterations to run before stopping
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetMaxGAIterValue(ctx, maxiter)
+PGAContext *ctx
+int maxiter
+.fi
+.SH LOCATION
+stop.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGASetMaxGAIterValue(ctx,5000);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetMaxNoChangeValue.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetMaxNoChangeValue.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetMaxNoChangeValue.8	(revision 816)
@@ -0,0 +1,40 @@
+.TH PGASetMaxNoChangeValue 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetMaxNoChangeValue \- specifiy maximum number of iterations of no change
+in the evaluation function value of the best string before stopping.  The
+default value is 50.  The stopping rule PGA_STOP_NOCHANGE must have been
+set by PGASetStoppingRuleType for this function call to have any effect.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+maxiter
+- the maximum number of GA iterations allowed with no change
+in the best evaluation function value.
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetMaxNoChangeValue(ctx, max_no_change)
+PGAContext *ctx
+int max_no_change
+.fi
+.SH LOCATION
+stop.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGASetMaxGAIterValue(ctx,5000);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetMaxSimilarityValue.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetMaxSimilarityValue.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetMaxSimilarityValue.8	(revision 816)
@@ -0,0 +1,41 @@
+.TH PGASetMaxSimilarityValue 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetMaxSimilarityValue \- Specifiy the maximum percent of homogeneity of
+the population before stopping.  The similarity measure is the same
+evaluation function value.  The default value is 95 percent.  The stopping
+rule PGA_STOP_TOOSIMILAR must have been set by PGASetStoppingRuleType for
+this function call to have any effect.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+max_similarity
+- the maximum percent of the population that can share
+the same evaluation function value
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetMaxSimilarityValue(ctx, max_similarity)
+PGAContext *ctx
+int max_similarity
+.fi
+.SH LOCATION
+stop.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGASetMaxSimilarityValue(ctx,99);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetMutationAndCrossoverFlag.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetMutationAndCrossoverFlag.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetMutationAndCrossoverFlag.8	(revision 816)
@@ -0,0 +1,40 @@
+.TH PGASetMutationAndCrossoverFlag 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetMutationAndCrossoverFlag \- A boolean flag to indicate if
+recombination uses both crossover and mutation on selected strings
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+flag
+- PGA_TRUE (default) or PGA_FALSE
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetMutationAndCrossoverFlag(ctx, flag)
+PGAContext *ctx
+int flag
+.fi
+.SH LOCATION
+pga.c
+.SH EXAMPLE
+.nf
+Example:
+Set the genetic algorithm to use both crossover and mutation when
+reproducing strings.
+
+PGAContext *ctx;
+:
+PGASetMutationAndCrossoverFlag(ctx,PGA_FALSE);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetMutationOrCrossoverFlag.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetMutationOrCrossoverFlag.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetMutationOrCrossoverFlag.8	(revision 816)
@@ -0,0 +1,40 @@
+.TH PGASetMutationOrCrossoverFlag 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetMutationOrCrossoverFlag \- A boolean flag to indicate if recombination
+uses exactly one of crossover or mutation on selected strings.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+flag
+- PGA_TRUE (default) or PGA_FALSE
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetMutationOrCrossoverFlag(ctx, flag)
+PGAContext *ctx
+int flag
+.fi
+.SH LOCATION
+pga.c
+.SH EXAMPLE
+.nf
+Example:
+Set the genetic algorithm to use mutation only when crossover is
+not used.
+
+PGAContext *ctx;
+:
+PGASetMutationOrCrossoverFlag(ctx,PGA_FALSE);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetNoDuplicatesFlag.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetNoDuplicatesFlag.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetNoDuplicatesFlag.8	(revision 816)
@@ -0,0 +1,40 @@
+.TH PGASetNoDuplicatesFlag 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetNoDuplicatesFlag \- A boolean flag to indicate if duplicate strings are
+allowed in the population. Valid choices are PGA_TRUE and PGA_FALSE.  The
+default is PGA_FALSE -- allow duplicates.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+flag
+- PGA_TRUE or PGA_FALSE
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetNoDuplicatesFlag(ctx, no_dup)
+PGAContext *ctx
+int no_dup
+.fi
+.SH LOCATION
+duplcate.c
+.SH EXAMPLE
+.nf
+Example:
+Set the NoDuplicates flag to require that all strings are unique.
+
+PGAContext *ctx;
+:
+PGASetNoDuplicatesFlag(ctx,PGA_TRUE);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetNumReplaceValue.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetNumReplaceValue.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetNumReplaceValue.8	(revision 816)
@@ -0,0 +1,37 @@
+.TH PGASetNumReplaceValue 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetNumReplaceValue \- specifies the number of new strings to create each
+generation.  The default is ten percent of the population size
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+pop_replace
+- the genetic algorithm population size to use
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetNumReplaceValue(ctx, pop_replace)
+PGAContext *ctx
+int pop_replace
+.fi
+.SH LOCATION
+pop.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGASetNumReplaceValue(ctx, 35);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetPopReplaceType.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetPopReplaceType.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetPopReplaceType.8	(revision 816)
@@ -0,0 +1,42 @@
+.TH PGASetPopReplaceType 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetPopReplaceType \- Choose method of sorting strings to copy from old
+population to new population.  Valid choices are PGA_POPREPL_BEST,
+PGA_POPREPL_RANDOM_NOREP, or PGA_POPREPL_RANDOM_REP for copying the best
+strings, or  random string, with or without replacement, respectively,
+from the old population into the new population. The default is
+PGA_POPREPL_BEST.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+pop_replace
+- symbolic constant to specify the population replacement
+strategy
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetPopReplaceType(ctx, pop_replace)
+PGAContext *ctx
+int pop_replace
+.fi
+.SH LOCATION
+pop.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGASetPopReplaceType(ctx, PGA_POPREPL_RANDOM_NOREP);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetPopSize.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetPopSize.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetPopSize.8	(revision 816)
@@ -0,0 +1,37 @@
+.TH PGASetPopSize 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetPopSize \- Specifies the size of the genetic algorithm population.
+The default population size is 100.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+popsize
+- the genetic algorithm population size to use
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetPopSize(ctx, popsize)
+PGAContext *ctx
+int popsize
+.fi
+.SH LOCATION
+pop.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGASetPopSize(ctx, 200);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetStoppingRuleType.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetStoppingRuleType.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetStoppingRuleType.8	(revision 816)
@@ -0,0 +1,42 @@
+.TH PGASetStoppingRuleType 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetStoppingRuleType \- specify a stopping criterion.  If called more than
+once the different stopping criterion are ORed together.  Valid choices
+are PGA_STOP_MAXITER, PGA_STOP_TOOSIMILAR, or PGA_STOP_NOCHANGE to
+specify iteration limit reached, population too similar, or no change in
+the best solution found in a given number of iterations, respectively.
+The default is to stop when a maximum iteration limit is reached (by
+default, 1000 iterations).
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+stoprule
+- symbolic constant to specify stopping rule
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetStoppingRuleType(ctx, stoprule)
+PGAContext *ctx
+int stoprule
+.fi
+.SH LOCATION
+stop.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGASetStoppingRuleType(ctx, PGA_STOP_TOOSIMILAR);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetUp.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetUp.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetUp.8	(revision 816)
@@ -0,0 +1,37 @@
+.TH PGASetUp 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetUp \- set all uninitialized variables to default values and initialize
+some internal arrays.  Must be called after PGACreate() and before the GA
+is started.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetUp(ctx)
+PGAContext *ctx
+.fi
+.SH LOCATION
+create.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGACreate(ctx, ...);
+:
+//  Set options here
+:
+PGASetUp(ctx);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetUserFunction.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetUserFunction.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGASetUserFunction.8	(revision 816)
@@ -0,0 +1,61 @@
+.TH PGASetUserFunction 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetUserFunction \- specifies the name of a user-written function
+call to provide a specific GA capability (e.g., crossover,
+mutation, etc.).  This function MUST be used when using a non-native
+datatype and must be called once for each of:
+PGA_USERFUNCTION_CREATESTRING     -- String creation
+PGA_USERFUNCTION_MUTATION         -- Mutation
+PGA_USERFUNCTION_CROSSOVER        -- Crossover
+PGA_USERFUNCTION_PRINTSTRING      -- String Output
+PGA_USERFUNCTION_COPYSTRING       -- Duplication
+PGA_USERFUNCTION_DUPLICATE        -- Duplicate Checking
+PGA_USERFUNCTION_INITSTRING       -- Initialization
+PGA_USERFUNCTION_BUILDDATATYPE    -- MPI Datatype creation
+PGA_USERFUNCTION_STOPCOND         -- Stopping conditions
+PGA_USERFUNCTION_ENDOFGEN         -- Auxiliary functions at the end
+of each generation
+It MAY be called when using a native datatype to replace the built-in
+functions PGAPack has for that datatype (For example, if the Integer data
+type is used for a traveling salesperson problem, the user may want to
+provide their own custom crossover operator).  See the user guide and the
+examples in the examples directory for more details.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+constant
+- symbolic constant of the user function to set
+.PD 0
+.TP
+f
+- name of the function to use
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetUserFunction(ctx, constant, f)
+PGAContext *ctx
+int constant
+void *f
+.fi
+.SH LOCATION
+user.c
+.SH EXAMPLE
+.nf
+Example:
+void MyStringInit(PGAContext *, void *);
+PGAContext *ctx;
+:
+PGASetUserFunction(ctx, PGA_USERFUNCTION_INITSTRING, MyStringInit);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGASortPop.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGASortPop.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGASortPop.8	(revision 816)
@@ -0,0 +1,57 @@
+.TH PGASortPop 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGASortPop \- Creates an (internal) array of indices according to one of
+three criteria.  If PGA_POPREPL_BEST is used (the default) the array is
+sorted from most fit to least fit.  If PGA_POPREPL_RANDOM_REP is
+used the indices in the array are selected randomly with replacement.
+If PGA_POPREPL_RANDOM_NOREP is used the indices in the array are selected
+randomly without replacement.  The function PGASetPopReplaceType() is used
+to specify which strategy is used.  The indices of the sorted population
+members may then be accessed from the internal array via
+PGAGetSortedPopIndex().  This routine is typically used during population
+replacement.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+popindex
+- symbolic constant of the population from which to create
+the srted array.
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASortPop(ctx, pop)
+PGAContext *ctx
+int pop
+.fi
+.SH LOCATION
+pop.c
+.SH EXAMPLE
+.nf
+Example:
+Copy the five best strings from the old population into the new
+population.  The rest of the new population will be created by
+recombination, and is not shown.
+
+PGAContext *ctx;
+int i,j;
+:
+PGASetPopReplaceType(ctx,PGA_POPREPL_BEST)
+:
+PGASortPop(ctx, PGA_OLDPOP);
+for ( i=0; i < 5; i++) {
+j = PGAGetSortedPopIndex(ctx, i);
+PGACopyIndividual (ctx, j, PGA_OLDPOP, i, PGA_NEWPOP);
+:
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/man8/PGAUpdateGeneration.8
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/man8/PGAUpdateGeneration.8	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/man8/PGAUpdateGeneration.8	(revision 816)
@@ -0,0 +1,39 @@
+.TH PGAUpdateGeneration 8 "05/01/95" " " "PGAPack"
+.SH NAME
+PGAUpdateGeneration \- updates internal data structures for the next
+genetic algorithm iteration, and checks if the termination conditions, both
+user and PGAPack, have been met.  This routine must be called by both
+master and slave processes at the end of each GA generation.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+comm
+- an MPI communicator
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGAUpdateGeneration(ctx, comm)
+PGAContext *ctx
+MPI_Comm comm
+.fi
+.SH LOCATION
+pga.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGAUpdateGeneration(ctx, MPI_COMM_WORLD);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/mandesc
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/mandesc	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/mandesc	(revision 816)
@@ -0,0 +1,11 @@
+no default sections
+1(1)Fitness & Evaluation
+2(2)Initialization
+3(3)Operators
+4(4)Parallel
+5(5)Utility
+6(6)System
+7(7)Reporting
+8(8)Generation
+l(l)Debugging
+
Index: trunk/optimizer/src/pgapack/pgapack/man/manl/PGAClearDebugLevel.l
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/manl/PGAClearDebugLevel.l	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/manl/PGAClearDebugLevel.l	(revision 816)
@@ -0,0 +1,37 @@
+.TH PGAClearDebugLevel l "05/01/95" " " "PGAPack"
+.SH NAME
+PGAClearDebugLevel \- Turn off a debul level.  Only valid if PGAPack
+was compiled to include debugging calls.  See the user guide for details.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+level
+- the debug level to set to PGA_FALSE.
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGAClearDebugLevel(ctx, level)
+PGAContext *ctx
+int level
+.fi
+.SH LOCATION
+debug.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGAClearDebugLevel(ctx, 70)
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/manl/PGAClearDebugLevelByName.l
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/manl/PGAClearDebugLevelByName.l	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/manl/PGAClearDebugLevelByName.l	(revision 816)
@@ -0,0 +1,35 @@
+.TH PGAClearDebugLevelByName l "05/01/95" " " "PGAPack"
+.SH NAME
+PGAClearDebugLevelByName \- Turn off debugging of the named function.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+funcname
+- name of the function to turn on debugging output
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGAClearDebugLevelByName(ctx, funcname)
+PGAContext *ctx
+char *funcname
+.fi
+.SH LOCATION
+debug.c
+.SH EXAMPLE
+.nf
+PGAContext *ctx;
+:
+PGAClearDebugLevelByName(ctx, "PGAGetBinaryAllele");
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/manl/PGADebugPrint.l
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/manl/PGADebugPrint.l	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/manl/PGADebugPrint.l	(revision 816)
@@ -0,0 +1,68 @@
+.TH PGADebugPrint l "05/01/95" " " "PGAPack"
+.SH NAME
+PGADebugPrint \- Write debugging information
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+level
+- a symbolic constant that maps to the type of print requested
+(e.g., an entry or exit print).  Valid values are
+PGA_DEBUG_ENTERED, PGA_DEBUG_EXIT, PGA_DEBUG_MALLOC,
+PGA_DEBUG_PRINTVAR, PGA_DEBUG_SEND, and PGA_DEBUG_RECV.
+.PD 0
+.TP
+funcname
+- the name of the function that called this routine
+.PD 0
+.TP
+msg
+- message to print
+.PD 0
+.TP
+datatype
+- a symbolic constant that maps to the data type of the
+parameter data.  Valid choices are PGA_INT, PGA_DOUBLE,
+PGA_CHAR and PGA_VOID (no data).
+.PD 0
+.TP
+data
+- a pointer, whose contents will be interpreted based upon the
+datatype parameter (or NULL, if PGA_VOID).
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGADebugPrint(ctx, level, funcname, msg, datatype, data)
+PGAContext *ctx
+int level
+char *funcname
+char *msg
+int datatype
+void *data
+.fi
+.SH LOCATION
+debug.c
+.SH EXAMPLE
+.nf
+Example:
+If the debugging level includes printing variables (level 82), print the
+value of the integer variable num as a debugging tool in the routine
+Add2Nums
+
+PGAContext *ctx;
+int num;
+:
+PGADebugPrint(ctx, PGA_DEBUG_PRINTVAR, "Add2Nums", "num = ", PGA_INT,
+(void *) &num);
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/manl/PGASetDebugLevel.l
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/manl/PGASetDebugLevel.l	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/manl/PGASetDebugLevel.l	(revision 816)
@@ -0,0 +1,37 @@
+.TH PGASetDebugLevel l "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetDebugLevel \- Turn on a debug level.  Only valid if PGAPack
+was compiled to include debugging calls.  See the user guide for details.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+level
+- the debug level to set to PGA_TRUE.
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetDebugLevel(ctx, level)
+PGAContext *ctx
+int level
+.fi
+.SH LOCATION
+debug.c
+.SH EXAMPLE
+.nf
+Example:
+PGAContext *ctx;
+:
+PGASetDebugLevel(ctx, 70)
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/man/manl/PGASetDebugLevelByName.l
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/man/manl/PGASetDebugLevelByName.l	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/man/manl/PGASetDebugLevelByName.l	(revision 816)
@@ -0,0 +1,35 @@
+.TH PGASetDebugLevelByName l "05/01/95" " " "PGAPack"
+.SH NAME
+PGASetDebugLevelByName \- Turn on debugging of the named function.
+.SH INPUT PARAMETERS
+.PD 0
+.TP
+ctx
+- context variable
+.PD 0
+.TP
+funcname
+- name of the function to turn on debugging output
+.PD 1
+.SH OUTPUT PARAMETERS
+.PD 0
+.TP
+none
+
+.PD 1
+.SH SYNOPSIS
+.nf
+#include "pgapack.h"
+void  PGASetDebugLevelByName(ctx, funcname)
+PGAContext *ctx
+char *funcname
+.fi
+.SH LOCATION
+debug.c
+.SH EXAMPLE
+.nf
+PGAContext *ctx;
+:
+PGASetDebugLevelByName(ctx, "PGAGetBinaryAllele");
+
+.fi
Index: trunk/optimizer/src/pgapack/pgapack/source/Makefile
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/Makefile	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/Makefile	(revision 816)
@@ -0,0 +1,130 @@
+# Generated automatically from Makefile.in by configure.
+CC          = cc
+PRECFLAGS   = -O 
+CPPFLAGS    = -I/Volumes/Data_mo/GENES/Software/pgapack/include -I/Volumes/Data_mo/GENES/Software/mpich-1.2.7p1/include/ -Dlinux -DWL=32 -DFORTRANUNDERSCORE -DOPTIMIZE 
+HEADERS     = /Volumes/Data_mo/GENES/Software/pgapack/include/pgapack.h
+PGA_LIB_DIR = ../lib/linux
+PGA_LIB     = pgaO
+RM          = /bin/rm -f
+OBJS        = $(PGA_LIB_DIR)/binary.o        \
+      $(PGA_LIB_DIR)/char.o          \
+      $(PGA_LIB_DIR)/cmdline.o       \
+      $(PGA_LIB_DIR)/create.o        \
+      $(PGA_LIB_DIR)/cross.o         \
+      $(PGA_LIB_DIR)/debug.o         \
+      $(PGA_LIB_DIR)/duplcate.o      \
+      $(PGA_LIB_DIR)/evaluate.o      \
+      $(PGA_LIB_DIR)/fitness.o       \
+      $(PGA_LIB_DIR)/hamming.o       \
+      $(PGA_LIB_DIR)/heap.o          \
+      $(PGA_LIB_DIR)/integer.o       \
+      $(PGA_LIB_DIR)/mutation.o      \
+      $(PGA_LIB_DIR)/parallel.o      \
+      $(PGA_LIB_DIR)/pga.o           \
+      $(PGA_LIB_DIR)/pop.o           \
+      $(PGA_LIB_DIR)/random.o        \
+      $(PGA_LIB_DIR)/real.o          \
+      $(PGA_LIB_DIR)/report.o        \
+      $(PGA_LIB_DIR)/restart.o       \
+      $(PGA_LIB_DIR)/select.o        \
+      $(PGA_LIB_DIR)/stop.o          \
+      $(PGA_LIB_DIR)/system.o        \
+      $(PGA_LIB_DIR)/user.o          \
+      $(PGA_LIB_DIR)/utility.o $(PGA_LIB_DIR)/f2c.o
+SHELL       = /bin/sh
+RANLIB      = ranlib
+
+CFLAGS      = -o $@ -c $(PRECFLAGS)
+COMPILE.c   = $(CC) $(CFLAGS) $(CPPFLAGS)
+
+########################################################
+#                    The Target                        #
+########################################################
+
+$(PGA_LIB_DIR)/lib$(PGA_LIB).a: $(OBJS)
+	ar ruv $(PGA_LIB_DIR)/lib$(PGA_LIB).a $(OBJS)
+	$(RANLIB) $(PGA_LIB_DIR)/lib$(PGA_LIB).a
+
+########################################################
+#                    The Source code                   #
+########################################################
+
+$(PGA_LIB_DIR)/binary.o: binary.c $(HEADERS)
+	$(COMPILE.c) binary.c
+
+$(PGA_LIB_DIR)/char.o: char.c $(HEADERS)
+	$(COMPILE.c) char.c
+
+$(PGA_LIB_DIR)/cmdline.o: cmdline.c $(HEADERS)
+	$(COMPILE.c) cmdline.c
+
+$(PGA_LIB_DIR)/create.o: create.c $(HEADERS)
+	$(COMPILE.c) create.c
+
+$(PGA_LIB_DIR)/cross.o: cross.c $(HEADERS)
+	$(COMPILE.c) cross.c
+
+$(PGA_LIB_DIR)/debug.o: debug.c $(HEADERS)
+	$(COMPILE.c) debug.c
+
+$(PGA_LIB_DIR)/duplcate.o: duplcate.c $(HEADERS)
+	$(COMPILE.c) duplcate.c
+
+$(PGA_LIB_DIR)/evaluate.o: evaluate.c $(HEADERS)
+	$(COMPILE.c) evaluate.c
+
+$(PGA_LIB_DIR)/fitness.o: fitness.c $(HEADERS)
+	$(COMPILE.c) fitness.c
+
+$(PGA_LIB_DIR)/f2c.o: f2c.c $(HEADERS)
+	$(COMPILE.c) f2c.c
+
+$(PGA_LIB_DIR)/hamming.o: hamming.c $(HEADERS)
+	$(COMPILE.c) hamming.c
+
+$(PGA_LIB_DIR)/heap.o: heap.c $(HEADERS)
+	$(COMPILE.c) heap.c
+
+$(PGA_LIB_DIR)/integer.o: integer.c $(HEADERS)
+	$(COMPILE.c) integer.c
+
+
+
+$(PGA_LIB_DIR)/mutation.o: mutation.c $(HEADERS)
+	$(COMPILE.c) mutation.c
+
+$(PGA_LIB_DIR)/parallel.o: parallel.c $(HEADERS)
+	$(COMPILE.c) parallel.c
+
+$(PGA_LIB_DIR)/pga.o: pga.c $(HEADERS)
+	$(COMPILE.c) pga.c
+
+$(PGA_LIB_DIR)/pop.o: pop.c $(HEADERS)
+	$(COMPILE.c) pop.c
+
+$(PGA_LIB_DIR)/random.o: random.c $(HEADERS)
+	$(COMPILE.c) random.c
+
+$(PGA_LIB_DIR)/real.o: real.c $(HEADERS)
+	$(COMPILE.c) real.c
+
+$(PGA_LIB_DIR)/report.o: report.c $(HEADERS)
+	$(COMPILE.c) report.c
+
+$(PGA_LIB_DIR)/restart.o: restart.c $(HEADERS)
+	$(COMPILE.c) restart.c
+
+$(PGA_LIB_DIR)/select.o: select.c $(HEADERS)
+	$(COMPILE.c) select.c
+
+$(PGA_LIB_DIR)/stop.o: stop.c $(HEADERS)
+	$(COMPILE.c) stop.c
+
+$(PGA_LIB_DIR)/system.o: system.c $(HEADERS)
+	$(COMPILE.c) system.c
+
+$(PGA_LIB_DIR)/user.o: user.c $(HEADERS)
+	$(COMPILE.c) user.c
+
+$(PGA_LIB_DIR)/utility.o: utility.c $(HEADERS)
+	$(COMPILE.c) utility.c
Index: trunk/optimizer/src/pgapack/pgapack/source/Makefile.in
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/Makefile.in	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/Makefile.in	(revision 816)
@@ -0,0 +1,104 @@
+CC          = @CC@
+PRECFLAGS   = @CFLAGS@
+CPPFLAGS    = @CPPFLAGS@
+HEADERS     = @HEADERS@
+PGA_LIB_DIR = @PGA_LIB_DIR@
+PGA_LIB     = @PGA_LIB@
+RM          = @RM@
+OBJS        = @OBJS@
+SHELL       = @SHELL@
+RANLIB      = @RANLIB@
+
+CFLAGS      = -o $@ -c $(PRECFLAGS)
+COMPILE.c   = $(CC) $(CFLAGS) $(CPPFLAGS)
+
+########################################################
+#                    The Target                        #
+########################################################
+
+$(PGA_LIB_DIR)/lib$(PGA_LIB).a: $(OBJS)
+	ar ruv $(PGA_LIB_DIR)/lib$(PGA_LIB).a $(OBJS)
+	$(RANLIB) $(PGA_LIB_DIR)/lib$(PGA_LIB).a
+
+########################################################
+#                    The Source code                   #
+########################################################
+
+$(PGA_LIB_DIR)/binary.o: binary.c $(HEADERS)
+	$(COMPILE.c) binary.c
+
+$(PGA_LIB_DIR)/char.o: char.c $(HEADERS)
+	$(COMPILE.c) char.c
+
+$(PGA_LIB_DIR)/cmdline.o: cmdline.c $(HEADERS)
+	$(COMPILE.c) cmdline.c
+
+$(PGA_LIB_DIR)/create.o: create.c $(HEADERS)
+	$(COMPILE.c) create.c
+
+$(PGA_LIB_DIR)/cross.o: cross.c $(HEADERS)
+	$(COMPILE.c) cross.c
+
+$(PGA_LIB_DIR)/debug.o: debug.c $(HEADERS)
+	$(COMPILE.c) debug.c
+
+$(PGA_LIB_DIR)/duplcate.o: duplcate.c $(HEADERS)
+	$(COMPILE.c) duplcate.c
+
+$(PGA_LIB_DIR)/evaluate.o: evaluate.c $(HEADERS)
+	$(COMPILE.c) evaluate.c
+
+$(PGA_LIB_DIR)/fitness.o: fitness.c $(HEADERS)
+	$(COMPILE.c) fitness.c
+
+@FORTWRAP@
+
+$(PGA_LIB_DIR)/hamming.o: hamming.c $(HEADERS)
+	$(COMPILE.c) hamming.c
+
+$(PGA_LIB_DIR)/heap.o: heap.c $(HEADERS)
+	$(COMPILE.c) heap.c
+
+$(PGA_LIB_DIR)/integer.o: integer.c $(HEADERS)
+	$(COMPILE.c) integer.c
+
+@MPICOMP@
+
+$(PGA_LIB_DIR)/mutation.o: mutation.c $(HEADERS)
+	$(COMPILE.c) mutation.c
+
+$(PGA_LIB_DIR)/parallel.o: parallel.c $(HEADERS)
+	$(COMPILE.c) parallel.c
+
+$(PGA_LIB_DIR)/pga.o: pga.c $(HEADERS)
+	$(COMPILE.c) pga.c
+
+$(PGA_LIB_DIR)/pop.o: pop.c $(HEADERS)
+	$(COMPILE.c) pop.c
+
+$(PGA_LIB_DIR)/random.o: random.c $(HEADERS)
+	$(COMPILE.c) random.c
+
+$(PGA_LIB_DIR)/real.o: real.c $(HEADERS)
+	$(COMPILE.c) real.c
+
+$(PGA_LIB_DIR)/report.o: report.c $(HEADERS)
+	$(COMPILE.c) report.c
+
+$(PGA_LIB_DIR)/restart.o: restart.c $(HEADERS)
+	$(COMPILE.c) restart.c
+
+$(PGA_LIB_DIR)/select.o: select.c $(HEADERS)
+	$(COMPILE.c) select.c
+
+$(PGA_LIB_DIR)/stop.o: stop.c $(HEADERS)
+	$(COMPILE.c) stop.c
+
+$(PGA_LIB_DIR)/system.o: system.c $(HEADERS)
+	$(COMPILE.c) system.c
+
+$(PGA_LIB_DIR)/user.o: user.c $(HEADERS)
+	$(COMPILE.c) user.c
+
+$(PGA_LIB_DIR)/utility.o: utility.c $(HEADERS)
+	$(COMPILE.c) utility.c
Index: trunk/optimizer/src/pgapack/pgapack/source/binary.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/binary.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/binary.c	(revision 816)
@@ -0,0 +1,897 @@
+/*
+ *  
+ *  ********************************************************************* 
+ *  (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+ *  *********************************************************************
+ *  
+ *  This software was authored by
+ *  
+ *  D. Levine
+ *  Mathematics and Computer Science Division Argonne National Laboratory
+ *  Argonne IL 60439
+ *  levine@mcs.anl.gov
+ *  (708) 252-6735
+ *  (708) 252-5986 (FAX)
+ *  
+ *  with programming assistance of participants in Argonne National 
+ *  Laboratory's SERS program.
+ *  
+ *  This program contains material protectable under copyright laws of the 
+ *  United States.  Permission is hereby granted to use it, reproduce it, 
+ *  to translate it into another language, and to redistribute it to 
+ *  others at no charge except a fee for transferring a copy, provided 
+ *  that you conspicuously and appropriately publish on each copy the 
+ *  University of Chicago's copyright notice, and the disclaimer of 
+ *  warranty and Government license included below.  Further, permission 
+ *  is hereby granted, subject to the same provisions, to modify a copy or 
+ *  copies or any portion of it, and to distribute to others at no charge 
+ *  materials containing or derived from the material.
+ *  
+ *  The developers of the software ask that you acknowledge its use in any 
+ *  document referencing work based on the  program, such as published 
+ *  research.  Also, they ask that you supply to Argonne National 
+ *  Laboratory a copy of any published research referencing work based on 
+ *  the software.
+ *  
+ *  Any entity desiring permission for further use must contact:
+ *  
+ *  J. Gleeson
+ *  Industrial Technology Development Center Argonne National Laboratory
+ *  Argonne IL 60439
+ *  gleesonj@smtplink.eid.anl.gov
+ *  (708) 252-6055
+ *  
+ *  ******************************************************************** 
+ *  DISCLAIMER
+ *  
+ *  THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+ *  OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+ *  THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+ *  WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+ *  RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+ *  INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+ *  INFRINGE PRIVATELY OWNED RIGHTS.
+ *  
+ *  ********************************************************************** 
+ *  GOVERNMENT LICENSE
+ *  
+ *  The Government is granted for itself and others acting on its behalf a 
+ *  paid-up, non-exclusive, irrevocable worldwide license in this computer 
+ *  software to reproduce, prepare derivative works, and perform publicly 
+ *  and display publicly.
+ */
+
+/*****************************************************************************
+*     File: binary.c: This file contains routines specific to the binary
+*                     datatype.
+*
+*     Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle,
+*              Brian P. Walenz
+*****************************************************************************/
+
+#include "pgapack.h"
+
+/*U****************************************************************************
+   PGASetBinaryAllele - sets a binary allele to the specified value.
+
+   Category: Fitness & Evaluation
+
+   Inputs:
+      ctx - context variable
+      p   - string index
+      pop - symbolic constant of the population the string is in
+      i   - allele index
+      val - binary value (either 1 or 0) to set the allele to
+
+   Outputs:
+      The allele is changed by side-effect.
+
+   Example:
+      Copies the alleles from member p in PGA_OLDPOP to member q PGA_NEWPOP.
+      Assumes strings are of the same length.
+
+      PGAContext *ctx;
+      int p, q, i;
+      :
+      for (i=PGAGetStringLength(ctx)-1; i>=0; i--)
+          PGASetBinaryAllele(ctx, q, PGA_NEWPOP, i,
+                             PGAGetBinaryAllele(ctx, p, PGA_OLDPOP, i))
+
+****************************************************************************U*/
+void PGASetBinaryAllele ( PGAContext *ctx, int p, int pop, int i, int val )
+{
+    int windex;        /* index of the computer word allele i is in      */
+    int bix;           /* bit position in word chrom[windex] of allele i */
+    PGAIndividual *ind;
+    PGABinary *chrom;
+
+    PGADebugEntered("PGASetBinaryAllele");
+    PGACheckDataType("PGAGetBinaryAllele", PGA_DATATYPE_BINARY);
+
+    INDEX( windex,bix,i,WL );
+    ind = PGAGetIndividual ( ctx, p, pop );
+    chrom = (PGABinary *)ind->chrom;
+    if ( val == 0 )
+        UNSET( bix, chrom[windex] );
+    else
+        SET( bix, chrom[windex] );
+
+    PGADebugExited("PGASetBinaryAllele");
+}
+
+/*U****************************************************************************
+   PGAGetBinaryAllele - returns the value of a (binary) allele in a
+   PGA_DATATYPE_BINARY string
+
+   Category: Fitness & Evaluation
+
+   Inputs:
+      ctx - context variable
+      p   - string index
+      pop - symbolic constant of the population the string is in
+      i   - allele index
+
+   Outputs:
+      The value of the ith allele of string p in population pop.
+
+   Example:
+      Copies the alleles from member p in PGA_OLDPOP to member q PGA_NEWPOP.
+      Assumes the strings are of the same length.
+
+      PGAContext *ctx;
+      int p, q, i;
+      :
+      for (i=PGAGetStringLength(ctx)-1; i>=0; i--)
+          PGASetBinaryAllele(ctx, q, PGA_NEWPOP, i,
+                             PGAGetBinaryAllele(ctx, p, PGA_OLDPOP, i))
+
+****************************************************************************U*/
+int PGAGetBinaryAllele ( PGAContext *ctx, int p, int pop, int i )
+{
+
+    int windex;        /* index of the computer word allele i is in      */
+    int bix;           /* bit position in word chrom[windex] of allele i */
+    PGAIndividual *ind;
+    PGABinary *chrom;
+
+    PGADebugEntered("PGAGetBinaryAllele");
+    PGACheckDataType("PGAGetBinaryAllele", PGA_DATATYPE_BINARY);
+
+    INDEX( windex,bix,i,WL );
+    ind = PGAGetIndividual ( ctx, p, pop );
+    chrom = (PGABinary *)ind->chrom;
+
+    PGADebugExited("PGAGetBinaryAllele");
+    return( BIT(bix, chrom[windex]) != 0 );
+}
+
+/*U****************************************************************************
+   PGASetBinaryInitProb - specify the probability of initializing an allele to
+   "1" when creating a PGA_DATATYPE_BINARY string.  The default value is 0.5.
+
+   Category: Initialization
+
+   Inputs:
+      ctx - context variable
+      p   - the binary initialization probability
+
+   Outputs:
+      None
+
+   Example:
+      Set approximately 1 percent of all binary alleles to "1" when randomly
+      initializing the population.
+
+      PGAContext *ctx;
+      :
+      PGASetBinaryInitProb(ctx, 0.01);
+
+****************************************************************************U*/
+void PGASetBinaryInitProb ( PGAContext *ctx, double probability )
+{
+    PGADebugEntered("PGASetBinaryInitProb");
+    PGAFailIfSetUp("PGASetBinaryInitProb");
+    PGACheckDataType("PGASetBinaryInitProb", PGA_DATATYPE_BINARY);
+
+     if ( (probability <= 1.0) && (probability >= 0.0) )
+          ctx->init.BinaryProbability = probability;
+     else
+          PGAError( ctx, "PGASetBinaryInitProb: Invalid value of probability:",
+                   PGA_FATAL, PGA_DOUBLE, (void *) &probability );
+
+    PGADebugExited("PGASetBinaryInitProb");
+}
+
+/*U***************************************************************************
+   PGAGetBinaryInitProb - Returns the probability that an allele will be
+   randomly initialized to "1" in a PGA_DATATYPE_BINARY string.
+
+   Category: Initialization
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      The probability that a bit will be randomly initialized to one
+
+   Example:
+      PGAContext *ctx;
+      double prob;
+      :
+      prob = PGAGetBinaryInitProb(ctx);
+
+***************************************************************************U*/
+double PGAGetBinaryInitProb (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetBinaryInitProb");
+    PGAFailIfNotSetUp("PGAGetBinaryInitProb");
+    PGACheckDataType("PGAGetBinaryInitProb", PGA_DATATYPE_BINARY);
+
+    PGADebugExited("PGAGetBinaryInitProb");
+    return(ctx->init.BinaryProbability);
+}
+
+
+/*I****************************************************************************
+   PGABinaryCreateString - Allocate a PGA_DATATYPE_BINARY string for member
+   p of population pop.  If initflag is PGA_TRUE, randomly initialize all
+   alleles, otherwise clear all alleles.
+
+   Inputs:
+      ctx      - context variable
+      p        - string index
+      pop      - symbolic constant of the population string p is in
+      initflag - a flag, if set, randomly initialize, else clear alleles
+
+   Outputs:
+      Member p in population pop is allocated and initialized.
+
+   Example:
+      Allocates and clears alleles for all strings in PGA_NEWPOP
+
+      PGAContext *ctx;
+      int p;
+      :
+      for (p=PGAGetPopSize(ctx)-1; p>=0; p--)
+          PGABinaryCreateString( ctx, p, PGA_NEWPOP, PGA_FALSE );
+
+****************************************************************************I*/
+void PGABinaryCreateString(PGAContext *ctx, int p, int pop, int initflag)
+{
+    int i, fp;
+    PGABinary *s;
+    PGAIndividual *new = PGAGetIndividual(ctx, p, pop);
+    
+    PGADebugEntered("PGABinaryCreateString");
+    PGADebugPrint( ctx, PGA_DEBUG_PRINTVAR, "PGABinaryCreateString",
+		  "initflag = ", PGA_INT, (void *) &initflag );
+    
+    new->chrom = (void *)malloc(ctx->ga.tw * sizeof(PGABinary));
+    if (new->chrom == NULL)
+	PGAError(ctx, "PGABinaryCreateString: No room to allocate "
+		 "new->chrom", PGA_FATAL, PGA_VOID, NULL);
+    
+    s = (PGABinary *)new->chrom;
+    if (initflag)
+	if (ctx->fops.InitString) {
+	    fp = ((p == PGA_TEMP1) || (p == PGA_TEMP2)) ? p : p+1;
+            (*ctx->fops.InitString)(&ctx, &fp, &pop);
+	} else {
+	    (*ctx->cops.InitString)(ctx, p, pop);
+	}
+    else
+	for ( i=0; i<ctx->ga.tw; i++ )
+	    s[i] = 0;
+    
+    PGADebugExited("PGABinaryCreateString");
+}
+
+/*I****************************************************************************
+   PGABinaryMutation - randomly mutates a bit with a specified probability.
+   This routine is called from PGAMutation.
+
+   Inputs:
+      ctx - context variable
+      p   - string index
+      pop - symbolic constant for the population string p is in
+      mr  - probability of mutating (toggling) a bit
+
+   Outputs:
+      Returns the number of mutations
+
+   Example:
+      Mutates string p in population PGA_NEWPOP with a probability of 0.001
+      for each bit.
+
+      PGAContext *ctx;
+      int p;
+      :
+      PGABinaryMutation( ctx, p, PGA_NEWPOP, .001 );
+
+****************************************************************************I*/
+int PGABinaryMutation( PGAContext *ctx, int p, int pop, double mr )
+{
+     int i,wi;
+     int count = 0;
+     PGABinary *c;
+
+     PGADebugEntered("PGABinaryMutation");
+
+     c = (PGABinary *)PGAGetIndividual(ctx, p, pop)->chrom;
+     for(wi=0; wi<ctx->ga.fw; wi++)
+          for(i=0; i<WL; ++i)
+               if ( PGARandomFlip(ctx, mr) )
+               {
+                    TOGGLE(i,c[wi]);
+                    count++;
+               }
+
+     /* clean up the partial word if eb > 0 */
+     if (ctx->ga.eb > 0 )
+          for(i=0;i<ctx->ga.eb;++i)
+               if ( PGARandomFlip(ctx, mr) )
+               {
+                    TOGGLE(i,c[ctx->ga.fw]);
+                    count++;
+               }
+
+    PGADebugExited("PGABinaryMutation");
+    return(count);
+
+}
+
+/*I****************************************************************************
+   PGABinaryOneptCrossover - performs one-point crossover on two parent strings
+   to create two children via side-effect
+
+   Inputs:
+      ctx  - context variable
+      p1   - the first parent string
+      p2   - the second parent string
+      pop1 - symbolic constant of the population containing p1 and p2
+      c1   - the first child string
+      c2   - the second child string
+      pop2 - symbolic constant of the population containing c1 and c2
+
+   Outputs:
+      None.
+
+   Example:
+      Performs crossover on the two parent strings m and d, producing
+      children s and b.
+
+      PGAContext *ctx;
+      int m, d, s, b;
+      :
+      PGABinaryOneptCrossover( ctx, m, d, PGA_OLDPOP, s, b, PGA_NEWPOP );
+
+****************************************************************************I*/
+void PGABinaryOneptCrossover(PGAContext *ctx, int p1, int p2, int pop1, int c1,
+                             int c2, int pop2)
+{
+    PGABinary *parent1 = (PGABinary *)PGAGetIndividual(ctx, p1, pop1)->chrom;
+    PGABinary *parent2 = (PGABinary *)PGAGetIndividual(ctx, p2, pop1)->chrom;
+    PGABinary *child1  = (PGABinary *)PGAGetIndividual(ctx, c1, pop2)->chrom;
+    PGABinary *child2  = (PGABinary *)PGAGetIndividual(ctx, c2, pop2)->chrom;
+
+    /*
+      If the bits are numbered from 0 as follows:
+
+      b   b   b   b   b   b   b   b          b  b
+      0   1   2   3   4   5   6   7         30 31
+
+      Then if the cross site is bit 5 (which is the sixth bit by our
+      numbering scheme) we would get
+
+      o   o   o   o   o   n   n   n          n  n
+      0   1   2   3   4   5   6   7         30 31
+
+      where o indicates the original bit and n is a new bit from the crossover
+      operator.
+    */
+
+    PGABinary mask;
+    int windex;   /* index of the word the crossover bit position is in */
+    int bix;      /* bit position to perform crossover (mod WL)         */
+    int i;
+    int xsite;
+
+    PGADebugEntered("PGABinaryOneptCrossover");
+
+    xsite = PGARandomInterval(ctx, 1,ctx->ga.StringLen-1);
+
+    INDEX(windex,bix,xsite,WL);
+
+    for(i=0;i<windex;i++) {
+        child1[i] = parent1[i];
+        child2[i] = parent2[i];
+    }
+
+    mask = ~0;
+    mask = mask >> bix;
+
+    child1[windex] = (~mask & parent1[windex])|(mask & parent2[windex]);
+    child2[windex] = (~mask & parent2[windex])|(mask & parent1[windex]);
+
+    for(i=windex+1;i<ctx->ga.tw;i++) {
+        child1[i] = parent2[i];
+        child2[i] = parent1[i];
+    }
+
+    PGADebugExited("PGABinaryOneptCrossover");
+}
+
+
+/*I****************************************************************************
+   PGABinaryTwoptCrossover - performs two-point crossover on two parent strings
+   producing two children via side-effect
+
+   Inputs:
+      ctx  - context variable
+      p1   - the first parent string
+      p2   - the second parent string
+      pop1 - symbolic constant of the population containing string p1 and p2
+      c1   - the first child string
+      c2   - the second child string
+      pop2 - symbolic constant of the population to contain string c1 and c2
+
+   Outputs:
+      None.
+
+   Example:
+      Performs crossover on the two parent strings m and d, producing
+      children s and b.
+
+      PGAContext *ctx;
+      int m, d, s, b;
+      :
+      PGABinaryTwoptCrossover( ctx, m, d, PGA_OLDPOP, s, b, PGA_NEWPOP );
+
+****************************************************************************I*/
+void PGABinaryTwoptCrossover(PGAContext *ctx, int p1, int p2, int pop1, int c1,
+                             int c2, int pop2)
+{
+    PGABinary *parent1 = (PGABinary *)PGAGetIndividual(ctx, p1, pop1)->chrom;
+    PGABinary *parent2 = (PGABinary *)PGAGetIndividual(ctx, p2, pop1)->chrom;
+    PGABinary *child1  = (PGABinary *)PGAGetIndividual(ctx, c1, pop2)->chrom;
+    PGABinary *child2  = (PGABinary *)PGAGetIndividual(ctx, c2, pop2)->chrom;
+
+    PGABinary mask, mask1, mask2;
+    int windex1, windex2;
+    int bix1, bix2;
+    int i;
+    int xsite1, xsite2;
+    int temp;
+
+    PGADebugEntered("PGABinaryTwoptCrossover");
+
+    /* pick two cross sites such that xsite2 > xsite1 */
+    xsite1 = PGARandomInterval(ctx, 1,ctx->ga.StringLen-1);
+    xsite2 = xsite1;
+    while ( xsite2 == xsite1 )
+        xsite2 = PGARandomInterval(ctx, 1,ctx->ga.StringLen-1);
+    if ( xsite1 > xsite2 ) {
+        temp   = xsite1;
+        xsite1 = xsite2;
+        xsite2 = temp;
+    }
+
+    INDEX(windex1,bix1,xsite1,WL);
+    INDEX(windex2,bix2,xsite2,WL);
+
+    if ( windex1 == windex2 ) {     /* both cross sites in the same word */
+
+        for(i=0;i<windex1;i++) {
+            child1[i] = parent1[i];
+            child2[i] = parent2[i];
+        }
+
+        mask1 = ~0;
+        if (bix1 == 0)
+             mask1 = 0;
+        else
+             mask1 = mask1 << (WL-bix1);
+        mask2 = ~0;
+        mask2 = mask2 >> bix2;
+        mask  = mask1 | mask2;
+
+        child1[windex1] = (mask & parent1[windex1])|(~mask & parent2[windex1]);
+        child2[windex1] = (mask & parent2[windex1])|(~mask & parent1[windex1]);
+
+        for(i=windex1+1;i<ctx->ga.tw;i++) {
+            child1[i] = parent1[i];
+            child2[i] = parent2[i];
+        }
+    }
+    else {                          /* cross sites in different words */
+
+        for(i=0;i<windex1;i++) {
+            child1[i] = parent1[i];
+            child2[i] = parent2[i];
+        }
+
+        mask = ~0;
+        mask = mask >> bix1;
+
+        child1[windex1] = (~mask & parent1[windex1])|(mask & parent2[windex1]);
+        child2[windex1] = (~mask & parent2[windex1])|(mask & parent1[windex1]);
+
+        for(i=windex1+1; i<windex2; i++) {
+            child1[i] = parent2[i];
+            child2[i] = parent1[i];
+        }
+
+        mask = ~0;
+        mask = mask >> bix2;
+
+        child1[windex2] = (mask & parent1[windex2])|(~mask & parent2[windex2]);
+        child2[windex2] = (mask & parent2[windex2])|(~mask & parent1[windex2]);
+
+        for(i=windex2+1; i<ctx->ga.tw; i++) {
+            child1[i] = parent1[i];
+            child2[i] = parent2[i];
+        }
+    }
+
+    PGADebugExited("PGABinaryTwoptCrossover");
+}
+
+
+/*I****************************************************************************
+   PGABinaryUniformCrossover - performs uniform crossover on two parent strings
+   producing two children via side-effect
+
+   Inputs:
+      ctx  - context variable
+      p1   - the first parent string
+      p2   - the second parent string
+      pop1 - symbolic constant of the population containing string p1 and p2
+      c1   - the first child string
+      c2   - the second child string
+      pop2 - symbolic constant of the population to contain string c1 and c2
+
+   Outputs:
+      None.
+
+   Example:
+      Performs crossover on the two parent strings m and d, producing
+      children s and b.
+
+      PGAContext *ctx;
+      int m, d, s, b;
+      :
+      PGABinaryUniformCrossover( ctx, m, d, PGA_OLDPOP, s, b, PGA_NEWPOP );
+
+****************************************************************************I*/
+void PGABinaryUniformCrossover(PGAContext *ctx, int p1, int p2, int pop1,
+                               int c1, int c2, int pop2)
+{
+     PGABinary *parent1 = (PGABinary *)PGAGetIndividual(ctx, p1, pop1)->chrom;
+     PGABinary *parent2 = (PGABinary *)PGAGetIndividual(ctx, p2, pop1)->chrom;
+     PGABinary *child1  = (PGABinary *)PGAGetIndividual(ctx, c1, pop2)->chrom;
+     PGABinary *child2  = (PGABinary *)PGAGetIndividual(ctx, c2, pop2)->chrom;
+     PGABinary mask;
+     int j,wi;
+
+    PGADebugEntered("PGABinaryUniformCrossover");
+
+    for(wi=0;wi<ctx->ga.tw;wi++) {
+        if ( parent1[wi] == parent2[wi] ) {
+            child1[wi] = parent1[wi];
+            child2[wi] = parent2[wi];
+        }
+        else {
+            mask = 0;
+            for (j=0;j<WL;j++)
+                if(PGARandomFlip(ctx, ctx->ga.UniformCrossProb))
+                    SET(j,mask);
+            child1[wi] = (mask & parent1[wi])|(~mask & parent2[wi]);
+            child2[wi] = (mask & parent2[wi])|(~mask & parent1[wi]);
+        }
+    }
+
+    PGADebugExited("PGABinaryUniformCrossover");
+}
+
+/*I****************************************************************************
+   PGABinaryPrintString - writes a bit string to a file.
+
+   Inputs:
+      ctx - context variable
+      fp  - file pointer to file to write bit string to
+      p   - index of the string to write out
+      pop - symbolic constant of the population string p is in
+
+   Outputs:
+      None.
+
+   Example:
+      Write string s to stdout.
+
+      PGAContext *ctx;
+      int s;
+      :
+      PGABinaryPrintString( ctx, stdout, s, PGA_NEWPOP );
+
+****************************************************************************I*/
+void PGABinaryPrintString( PGAContext *ctx, FILE *fp, int p, int pop )
+{
+     PGABinary *c = (PGABinary *)PGAGetIndividual(ctx, p, pop)->chrom;
+     int i;
+
+     PGADebugEntered("PGABinaryPrintString");
+
+     for( i=0; i<ctx->ga.fw; i++ ) {
+          fprintf(fp,"[ ");
+          PGABinaryPrint( ctx, fp, (c+i), WL );
+          fprintf(fp," ]\n");
+     }
+     if ( ctx->ga.eb > 0 ) {
+          fprintf(fp,"[ ");
+          PGABinaryPrint( ctx, fp, (c+ctx->ga.fw), ctx->ga.eb );
+          fprintf(fp," ]");
+     }
+
+     PGADebugExited("PGABinaryPrintString");
+}
+
+/*I****************************************************************************
+   PGABinaryCopyString - Copy one bit string to another
+
+   Inputs:
+      ctx  - context variable
+      p1   - string to copy
+      pop1 - symbolic constant of population containing string p1
+      p2   - string to copy p1 to
+      pop2 - symbolic constant of population containing string p2
+
+   Outputs:
+      None.
+
+   Example:
+      Copy bit string x to y (both are implicitly assumed to have the same
+      length).
+
+      PGAContext *ctx;
+      int x, y
+      :
+      PGABinaryCopyString ( ctx, x, PGA_OLDPOP, y, PGA_NEWPOP );
+
+****************************************************************************I*/
+void PGABinaryCopyString (PGAContext *ctx, int p1, int pop1, int p2, int pop2)
+{
+    PGABinary *source = (PGABinary *)PGAGetIndividual(ctx, p1, pop1)->chrom;
+    PGABinary *dest   = (PGABinary *)PGAGetIndividual(ctx, p2, pop2)->chrom;
+    int i;
+
+    PGADebugEntered("PGABinaryCopyString");
+
+    for (i = ctx->ga.tw-1; i>=0; i--)
+        dest[i] = source[i];
+
+    PGADebugExited("PGABinaryCopyString");
+}
+
+/*I****************************************************************************
+   PGABinaryDuplicate - Returns true if bit string a is a duplicate of bit
+   string b, else returns false.
+
+   Inputs:
+      ctx  - context variable
+      p1   - string index of the first string to compare
+      pop1 - symbolic constant of the population string p1 is in
+      p2   - string index of the second string to compare
+      pop2 - symbolic constant of the population string p2 is in
+
+   Outputs:
+      Returns true/false if strings are duplicates
+
+   Example:
+      Compare bit string x with y and print a message if they are the same.
+
+      PGAContext *ctx;
+      int x, y;
+      :
+      if ( PGABinaryDuplicate( ctx, x, PGA_NEWPOP, y, PGA_NEWPOP ) )
+          printf("strings are duplicates\n");
+
+****************************************************************************I*/
+int PGABinaryDuplicate( PGAContext *ctx, int p1, int pop1, int p2, int pop2)
+{
+     PGABinary *a = (PGABinary *)PGAGetIndividual(ctx, p1, pop1)->chrom;
+     PGABinary *b = (PGABinary *)PGAGetIndividual(ctx, p2, pop2)->chrom;
+     int wi;
+
+     PGADebugEntered("PGABinaryDuplicate");
+
+     wi = ctx->ga.tw-1;
+     if (a[0] == b[0])
+         for (; (wi>0) && (a[wi] == b[wi]); wi--);
+
+     PGADebugExited("PGABinaryDuplicate");
+
+     return((wi==0) ? PGA_TRUE : PGA_FALSE);
+}
+
+/*I****************************************************************************
+   PGABinaryInitString - randomly initialize a string of type PGABinary
+
+   Inputs:
+      ctx - context variable
+      p   - index of string to randomly initialize
+      pop - symbolic constant of the population string p is in
+
+   Outputs:
+
+   Example:
+      PGAContext *ctx;
+      int p;
+      :
+      PGABinaryInitString ( ctx, p, PGA_NEWPOP );
+
+****************************************************************************I*/
+void PGABinaryInitString(PGAContext *ctx, int p, int pop)
+{
+     PGABinary *c = (PGABinary *)PGAGetIndividual(ctx, p, pop)->chrom;
+     int i;
+     int windex;        /* index of the computer word allele i is in      */
+     int bix;           /* binary position in word chrom[windex] of allele i */
+
+     PGADebugEntered("PGABinaryInitString");
+
+     for (i = 0; i < ctx->ga.tw; i++)
+          c[i] = 0;
+     for (i = 0; i < ctx->ga.StringLen; i++)
+     {
+          INDEX(windex,bix,i,WL);
+          if ( PGARandomFlip(ctx, ctx->init.BinaryProbability) )
+               SET  ( bix, c[windex] );
+     }
+
+     PGADebugExited("PGABinaryInitString");
+}
+
+
+/*I****************************************************************************
+  PGABinaryBuildDatatype - Build an MPI_Datatype for a binary string
+  datatype.
+
+  Inputs:
+      ctx  - context variable
+      p    - index of the string to build a datatype from
+      pop  - symbolic constant of the population string p is in
+
+  Outputs:
+      MPI_Datatype.
+
+  Example:
+      Called only by MPI routines.  Not for user consumption.
+
+****************************************************************************I*/
+MPI_Datatype PGABinaryBuildDatatype(PGAContext *ctx, int p, int pop)
+{
+
+     int            counts[4];      /* Number of elements in each
+                                       block (array of integer) */
+     MPI_Aint       displs[4];      /* byte displacement of each
+                                       block (array of integer) */
+     MPI_Datatype   types[4];       /* type of elements in each block (array
+                                       of handles to datatype objects) */
+     MPI_Datatype   individualtype; /* new datatype (handle) */
+     PGAIndividual *traveller;      /* address of individual in question */
+
+     PGADebugEntered("PGABinaryBuildDatatype");
+
+     traveller = PGAGetIndividual(ctx, p, pop);
+     MPI_Address(&traveller->evalfunc, &displs[0]);
+     counts[0] = 1;
+     types[0]  = MPI_DOUBLE;
+
+     MPI_Address(&traveller->fitness, &displs[1]);
+     counts[1] = 1;
+     types[1]  = MPI_DOUBLE;
+
+     MPI_Address(&traveller->evaluptodate, &displs[2]);
+     counts[2] = 1;
+     types[2]  = MPI_INT;
+
+     MPI_Address(traveller->chrom, &displs[3]);
+     counts[3] = ctx->ga.tw;
+     types[3]  = MPI_UNSIGNED_LONG;
+
+     MPI_Type_struct(4, counts, displs, types, &individualtype);
+     MPI_Type_commit(&individualtype);
+
+     PGADebugExited("PGABinaryBuildDatatype");
+
+     return (individualtype);
+}
+
+
+/*I****************************************************************************
+   PGABinaryHammingDistance - Returns the Hamming distance between two strings
+
+   Inputs:
+      ctx - context variable
+      s1  - the first string to compare
+      s2  - the second string to compare
+
+   Outputs:
+      The Hamming distance between two strings
+
+   Example:
+      Returns the Hamming distance between bit strings x and y.
+
+      PGAContext *ctx;
+      PGABinary *x, *y;
+      int d;
+      :
+      d = PGABinaryHammingDistance( ctx, x, y );
+
+****************************************************************************I*/
+int PGABinaryHammingDistance ( PGAContext *ctx, PGABinary *s1, PGABinary *s2 )
+{
+    int        j, wi, distance;
+    PGABinary  t1, t2, mask;
+
+    PGADebugEntered("PGABinaryHammingDistance");
+
+    distance = 0;
+    for(wi=0; wi<ctx->ga.tw; wi++)  /* step through each word in the string */
+        if ( s1[wi] != s2[wi] ) {   /* if equal, no bits are different      */
+            /*fprintf(stdout,"s1[wi] = %x, s2[wi] = %x\n",s1[wi],s2[wi]);*/
+            mask = 1;
+            for(j=0;j<WL;++j) {     /* not equal, compare all bits          */
+                /* Build bit mask in position j. Mask bit from each         */
+                /* string into t1 and t2 and test if bits are the same      */
+                t1 = s1[wi] & mask;
+                t2 = s2[wi] & mask;
+                /*fprintf(stdout,"mask = %u, t1 = %u, t2 = %u, j = %d, wi = %d\n",mask,t1,t2,j,wi);*/
+                if ( t1 != t2 )
+                    distance++;
+                mask <<= 1;          /* shift mask 1 position */
+            }
+        }
+
+    PGADebugExited("PGABinaryHammingDistance");
+
+    return(distance);
+}
+
+/*I****************************************************************************
+   PGABinaryPrint - writes a bit string to a file.  Puts the binary
+   representation of the bit string pointed to by chrom into a character
+   string and writes that out. Assumes the maximum length of string to
+   print is WL, and that all bits are in the same word.
+
+   Inputs:
+      ctx   - context variable
+      fp    - file to write the bit string to
+      chrom - pointer to the bit string to write
+      nb    - number of bits to write out
+
+   Outputs:
+
+   Example:
+      Internal function.  Use PGABinaryPrintString to print a binary string.
+
+****************************************************************************I*/
+void PGABinaryPrint( PGAContext *ctx, FILE *fp, PGABinary *chrom, int nb )
+{
+     char *s, string[WL+1];
+     PGABinary mask;
+     int i;
+
+     PGADebugEntered("PGABinaryPrint");
+
+     mask = ((PGABinary)1)<<(WL-1);
+     s = string;
+     for(i=0; i<nb; mask>>=1,i++)              /* mask each bit and set the  */
+          *s++ = (mask&(*chrom)?'1':'0');      /* appropriate character      */
+     *s=0;                                     /* string terminator          */
+     fprintf(fp, "%s", string);                /* print out character string */
+
+     PGADebugExited("PGABinaryPrint");
+}
+
+
Index: trunk/optimizer/src/pgapack/pgapack/source/char.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/char.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/char.c	(revision 816)
@@ -0,0 +1,715 @@
+/*
+ *  
+ *  ********************************************************************* 
+ *  (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+ *  *********************************************************************
+ *  
+ *  This software was authored by
+ *  
+ *  D. Levine
+ *  Mathematics and Computer Science Division Argonne National Laboratory
+ *  Argonne IL 60439
+ *  levine@mcs.anl.gov
+ *  (708) 252-6735
+ *  (708) 252-5986 (FAX)
+ *  
+ *  with programming assistance of participants in Argonne National 
+ *  Laboratory's SERS program.
+ *  
+ *  This program contains material protectable under copyright laws of the 
+ *  United States.  Permission is hereby granted to use it, reproduce it, 
+ *  to translate it into another language, and to redistribute it to 
+ *  others at no charge except a fee for transferring a copy, provided 
+ *  that you conspicuously and appropriately publish on each copy the 
+ *  University of Chicago's copyright notice, and the disclaimer of 
+ *  warranty and Government license included below.  Further, permission 
+ *  is hereby granted, subject to the same provisions, to modify a copy or 
+ *  copies or any portion of it, and to distribute to others at no charge 
+ *  materials containing or derived from the material.
+ *  
+ *  The developers of the software ask that you acknowledge its use in any 
+ *  document referencing work based on the  program, such as published 
+ *  research.  Also, they ask that you supply to Argonne National 
+ *  Laboratory a copy of any published research referencing work based on 
+ *  the software.
+ *  
+ *  Any entity desiring permission for further use must contact:
+ *  
+ *  J. Gleeson
+ *  Industrial Technology Development Center Argonne National Laboratory
+ *  Argonne IL 60439
+ *  gleesonj@smtplink.eid.anl.gov
+ *  (708) 252-6055
+ *  
+ *  ******************************************************************** 
+ *  DISCLAIMER
+ *  
+ *  THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+ *  OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+ *  THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+ *  WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+ *  RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+ *  INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+ *  INFRINGE PRIVATELY OWNED RIGHTS.
+ *  
+ *  ********************************************************************** 
+ *  GOVERNMENT LICENSE
+ *  
+ *  The Government is granted for itself and others acting on its behalf a 
+ *  paid-up, non-exclusive, irrevocable worldwide license in this computer 
+ *  software to reproduce, prepare derivative works, and perform publicly 
+ *  and display publicly.
+ */
+
+/*****************************************************************************
+ *     FILE: char.c: This file contains the routines specific to the
+ *                    character datatype.
+ *
+ *     Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle,
+ *              Brian P. Walenz
+ *****************************************************************************/
+
+#include <pgapack.h>
+
+/*U****************************************************************************
+   PGASetCharacterAllele - sets the value of an allele in a
+   PGA_DATATYPE_CHARACTER string.
+
+   Category: Fitness & Evaluation
+
+   Inputs:
+      ctx - context variable
+      p   - string index
+      pop - symbolic constant of the population the string is in
+      i   - allele index
+      val - character value to set the allele to
+
+   Outputs:
+      The allele is changed by side-effect.
+
+   Example:
+      Copies the alleles from member p in PGA_OLDPOP to member q in PGA_NEWPOP.
+      Assumes the strings are of the same length.
+      
+      PGAContext *ctx;
+      int p, q, i;
+      :
+      for (i=PGAGetStringLength(ctx)-1; i>=0; i--)
+          PGASetCharacterAllele(ctx, q, PGA_NEWPOP, i,
+                                PGAGetCharacterAllele(ctx, p, PGA_OLDPOP, i))
+
+****************************************************************************U*/
+void PGASetCharacterAllele (PGAContext *ctx, int p, int pop, int i, char value)
+{
+    PGAIndividual *ind;
+
+    PGADebugEntered("PGASetCharacterAllele");
+    PGACheckDataType("PGASetCharacterAllele", PGA_DATATYPE_CHARACTER);
+ 
+    ind = PGAGetIndividual ( ctx, p, pop );
+    ((PGACharacter *)ind->chrom)[i] = value;
+    
+    PGADebugExited("PGASetCharacterAllele");
+}
+
+/*U****************************************************************************
+   PGAGetCharacterAllele: returns the value of character allele in a
+   PGA_DATATYPE_CHARACTER string
+
+   Category: Fitness & Evaluation
+
+   Inputs:
+      ctx - context variable
+      p   - string index
+      pop - symbolic constant of the population the string is in
+      i   - allele index
+
+   Outputs:
+      The value of allele i in string p.
+
+   Example:
+      Copies the alleles from member p in PGA_OLDPOP to member q in PGA_NEWPOP.
+      Assumes the strings are of the same length.
+
+      PGAContext *ctx;
+      int p, q, i;
+      :
+      for (i=PGAGetStringLength(ctx, p, PGA_NEWPOP)-1; i>=0; i--)
+          PGASetCharacterAllele(ctx, q, PGA_NEWPOP, i,
+                                PGAGetCharacterAllele(ctx, p, PGA_OLDPOP, i))
+
+****************************************************************************U*/
+char PGAGetCharacterAllele (PGAContext *ctx, int p, int pop, int i)
+{
+     PGAIndividual *ind;
+
+    PGADebugEntered("PGAGetCharacterAllele");
+     PGACheckDataType("PGAGetCharacterAllele", PGA_DATATYPE_CHARACTER);
+
+     ind = PGAGetIndividual ( ctx, p, pop );
+
+    PGADebugExited("PGAGetCharacterAllele");
+
+     return (((PGACharacter *)ind->chrom)[i]);
+}
+
+
+/*U****************************************************************************
+  PGASetCharacterInitType - sets a flag to specify whether the character
+  strings will be exclusively lowercase, exclusively uppercase, or a mixure
+  of both cases.  Legal flags are PGA_CINIT_UPPER, PGA_CINIT_LOWER, and
+  PGA_CINIT_MIXED.  Default is PGA_CINIT_LOWER.
+
+  Category: Initialization
+
+  Inputs:
+     ctx   - context variable
+     value - symbolic constant specifying which case
+
+  Outputs:
+
+  Example:
+     Set program to generate exclusively uppercase letters
+
+     PGAContext *ctx;
+     :
+     PGASetCharacterInitType(ctx, PGA_CINIT_UPPER);
+
+****************************************************************************U*/
+void PGASetCharacterInitType(PGAContext *ctx, int value)
+{
+    PGADebugEntered("PGASetCharacterInitType");
+     PGACheckDataType("PGASetCharacterInitType", PGA_DATATYPE_CHARACTER);
+
+     switch (value)
+     {
+     case PGA_CINIT_UPPER:
+     case PGA_CINIT_LOWER:
+     case PGA_CINIT_MIXED:
+          ctx->init.CharacterType = value;
+          break;
+     default:
+          PGAError(ctx, "PGASetCharacterInitType: Invalid case type:",
+                   PGA_FATAL, PGA_INT, (void *)&value);
+          break;
+     }
+
+    PGADebugExited("PGASetCharacterInitType");
+}
+
+/*I****************************************************************************
+   PGACharacterCreateString - Allocate memory for a string of type PGACharacter
+
+   Inputs:
+      ctx      - context variable
+      p        - string index
+      pop      - symbolic constant of the population string p is in
+      initflag - A true/false flag used in conjunction with ctx->ga.RandomInit
+                 to initialize the string either randomly or set to zero
+
+   Outputs:
+      Member p in population pop is allocated and initialized.
+
+   Example:
+      Allocates memory and assigns the address of the allocated memory to
+      the string field (ind->chrom) of the individual.  Additionally, the
+      string is initialized to zero.
+
+      PGAContext *ctx;
+      int p;
+      :
+      PGACharacterCreateString( ctx, p, PGA_NEWPOP, PGA_FALSE );
+
+****************************************************************************I*/
+void PGACharacterCreateString (PGAContext *ctx, int p, int pop, int InitFlag)
+{
+    int i, fp;
+    PGACharacter *c;
+    PGAIndividual *new = PGAGetIndividual(ctx, p, pop);
+    
+    PGADebugEntered("PGACharacterCreateString");
+    
+    new->chrom = (void *)malloc(ctx->ga.StringLen * sizeof(PGACharacter));
+    if (new->chrom == NULL)
+	PGAError(ctx, "PGACharacterCreateString: No room to allocate "
+		 "new->chrom", PGA_FATAL, PGA_VOID, NULL);
+    c = (PGACharacter *)new->chrom;
+    if (InitFlag)
+	if (ctx->fops.InitString) {
+	    fp = ((p == PGA_TEMP1) || (p == PGA_TEMP2)) ? p : p+1;
+	    (*ctx->fops.InitString)(&ctx, &fp, &pop);
+	} else {
+	    (*ctx->cops.InitString)(ctx, p, pop);
+	}
+    else
+	for (i=0; i<ctx->ga.StringLen; i++)
+	    c[i] = 0;
+    
+    PGADebugExited("PGACharacterCreateString");
+}
+
+/*I****************************************************************************
+   PGACharacterMutation - randomly mutates a character-valued gene with a
+   specified probability. This routine is called from PGAMutation.
+
+   Inputs:
+      ctx - context variable
+      p   - string index
+      pop - symbolic constant of the population string p is in
+      mr  - probability of mutating an character-valued gene
+
+   Outputs:
+      Returns the number of mutations
+
+   Example:
+      PGAContext *ctx;
+      int p;
+      int NumMutations;
+      :
+      NumMutations = PGACharacterMutation(ctx, p, PGA_NEWPOP, 0.01);
+****************************************************************************I*/
+int PGACharacterMutation( PGAContext *ctx, int p, int pop, double mr )
+{
+     PGACharacter *c;
+     int i, j;
+     int count = 0;
+
+    PGADebugEntered("PGACharacterMutation");
+
+     c = (PGACharacter *)PGAGetIndividual(ctx, p, pop)->chrom;
+     for(i=0; i<ctx->ga.StringLen; i++)
+          if ( PGARandomFlip(ctx, mr) )       /* randomly choose an allele   */
+          {
+               switch (ctx->init.CharacterType)
+               {
+               case PGA_CINIT_LOWER:
+                    c[i] = PGARandomInterval(ctx, 'a', 'z');
+                    break;
+               case PGA_CINIT_UPPER:
+                    c[i] = PGARandomInterval(ctx, 'A', 'Z');
+                    break;
+               case PGA_CINIT_MIXED:
+                    j = PGARandomInterval(ctx, 0, 51);
+                    if (j < 26)
+                         c[i] = 'A' + j;
+                    else
+                         c[i] = 'a' + j - 26;
+                    break;
+               }
+               count++;
+          }
+
+    PGADebugExited("PGACharacterMutation");
+
+     return (count);
+}
+
+/*I****************************************************************************
+   PGACharacterOneptCrossover - performs one-point crossover on two parent
+   strings producing two children via side-effect
+
+   Inputs:
+      ctx  - context variable
+      p1   - the first parent string
+      p2   - the second parent string
+      pop1 - symbolic constant of the population containing string p1 and p2
+      c1   - the first child string
+      c2   - the second child string
+      pop2 - symbolic constant of the population to contain string c1 and c2
+
+   Outputs:
+
+   Example:
+      Performs crossover on the two parent strings m and d, producing
+      children s and b.
+
+      PGAContext *ctx;
+      int m, d, s, b;
+      :
+      PGACharacterOneptCrossover( ctx, m, d, PGA_OLDPOP, s, b, PGA_NEWPOP );
+
+****************************************************************************I*/
+void PGACharacterOneptCrossover(PGAContext *ctx, int p1, int p2, int pop1,
+                                int c1, int c2, int pop2)
+{
+     PGACharacter *parent1, *parent2, *child1, *child2;
+     int i, xsite;
+
+    PGADebugEntered("PGACharacterOneptCrossover");
+
+     parent1 = (PGACharacter *)PGAGetIndividual(ctx, p1, pop1)->chrom;
+     parent2 = (PGACharacter *)PGAGetIndividual(ctx, p2, pop1)->chrom;
+     child1  = (PGACharacter *)PGAGetIndividual(ctx, c1, pop2)->chrom;
+     child2  = (PGACharacter *)PGAGetIndividual(ctx, c2, pop2)->chrom;
+     xsite = PGARandomInterval(ctx, 1,ctx->ga.StringLen-1);
+
+     for(i=0;i<xsite;i++)
+     {
+          child1[i] = parent1[i];
+          child2[i] = parent2[i];
+     }
+
+     for(i=xsite;i<ctx->ga.StringLen;i++)
+     {
+          child1[i] = parent2[i];
+          child2[i] = parent1[i];
+     }
+
+    PGADebugExited("PGACharacterOneptCrossover");
+}
+
+/*I****************************************************************************
+   PGACharacterTwoptCrossover - performs two-point crossover on two parent
+   strings producing two children via side-effect
+
+   Inputs:
+      ctx  - context variable
+      p1   - the first parent string
+      p2   - the second parent string
+      pop1 - symbolic constant of the population containing string p1 and p2
+      c1   - the first child string
+      c2   - the second child string
+      pop2 - symbolic constant of the population to contain string c1 and c2
+
+   Outputs:
+
+   Example:
+      Performs crossover on the two parent strings m and d, producing
+      children s and b.
+
+      PGAContext *ctx;
+      int m, d, s, b;
+      :
+      PGACharacterTwoptCrossover( ctx, m, d, PGA_OLDPOP, s, b, PGA_NEWPOP );
+
+****************************************************************************I*/
+void PGACharacterTwoptCrossover( PGAContext *ctx, int p1, int p2, int pop1,
+                              int c1, int c2, int pop2)
+{
+     PGACharacter *parent1, *parent2, *child1, *child2;
+     int i, temp, xsite1, xsite2;
+
+    PGADebugEntered("PGACharacterTwoptCrossover");
+
+     parent1 = (PGACharacter *)PGAGetIndividual(ctx, p1, pop1)->chrom;
+     parent2 = (PGACharacter *)PGAGetIndividual(ctx, p2, pop1)->chrom;
+     child1  = (PGACharacter *)PGAGetIndividual(ctx, c1, pop2)->chrom;
+     child2  = (PGACharacter *)PGAGetIndividual(ctx, c2, pop2)->chrom;
+     /* pick two cross sites such that xsite2 > xsite1 */
+     xsite1 = PGARandomInterval(ctx, 1,ctx->ga.StringLen-1);
+     xsite2 = xsite1;
+     while ( xsite2 == xsite1 )
+          xsite2 = PGARandomInterval(ctx, 1,ctx->ga.StringLen-1);
+     if ( xsite1 > xsite2 )
+     {
+          temp   = xsite1;
+          xsite1 = xsite2;
+          xsite2 = temp;
+     }
+
+     for(i=0;i<xsite1;i++)
+     {
+          child1[i] = parent1[i];
+          child2[i] = parent2[i];
+     }
+
+     for(i=xsite1;i<xsite2;i++)
+     {
+          child1[i] = parent2[i];
+          child2[i] = parent1[i];
+     }
+
+     for(i=xsite2;i<ctx->ga.StringLen;i++)
+     {
+          child1[i] = parent1[i];
+          child2[i] = parent2[i];
+     }
+
+    PGADebugExited("PGACharacterTwoptCrossover");
+}
+
+
+/*I****************************************************************************
+   PGACharacterUniformCrossover - performs uniform crossover on two parent
+   strings producing two children via side-effect
+
+   Inputs:
+      ctx  - context variable
+      p1   - the first parent string
+      p2   - the second parent string
+      pop1 - symbolic constant of the population containing string p1 and p2
+      c1   - the first child string
+      c2   - the second child string
+      pop2 - symbolic constant of the population to contain string c1 and c2
+
+   Outputs:
+
+   Example:
+      Performs crossover on the two parent strings m and d, producing
+      children s and b.
+
+      PGAContext *ctx;
+      int m, d, s, b;
+      :
+      PGACharacterUniformCrossover( ctx, m, d, PGA_OLDPOP, s, b, PGA_NEWPOP );
+
+****************************************************************************I*/
+void PGACharacterUniformCrossover(PGAContext *ctx, int p1, int p2, int pop1,
+                                int c1, int c2, int pop2)
+{
+     PGACharacter *parent1, *parent2, *child1, *child2;
+     int i;
+
+    PGADebugEntered("PGACharacterUniformCrossover");
+
+     parent1 = (PGACharacter *)PGAGetIndividual(ctx, p1, pop1)->chrom;
+     parent2 = (PGACharacter *)PGAGetIndividual(ctx, p2, pop1)->chrom;
+     child1  = (PGACharacter *)PGAGetIndividual(ctx, c1, pop2)->chrom;
+     child2  = (PGACharacter *)PGAGetIndividual(ctx, c2, pop2)->chrom;
+
+     for(i=0;i<ctx->ga.StringLen;i++)
+          if ( parent1[i] == parent2[i] )
+          {
+               child1[i] = parent1[i];
+               child2[i] = parent2[i];
+          }
+          else if (PGARandomFlip(ctx, ctx->ga.UniformCrossProb))
+          {
+               child1[i] = parent1[i];
+               child2[i] = parent2[i];
+          }
+          else
+          {
+               child1[i] = parent2[i];
+               child2[i] = parent1[i];
+          }
+
+    PGADebugExited("PGACharacterUniformCrossover");
+}
+
+/*I****************************************************************************
+   PGACharacterPrintString - writes a character-valued string to a file.
+
+   Inputs:
+      ctx - context variable
+      fp  - file pointer to file to write the string to
+      p   - index of the string to write out
+      pop - symbolic constant of the population string p is in
+
+   Outputs:
+
+   Example:
+      Write string s to stdout.
+
+      PGAContext *ctx;
+      int p;
+      :
+      PGACharacterPrintString( ctx, stdout, p, PGA_NEWPOP );
+
+****************************************************************************I*/
+void PGACharacterPrintString ( PGAContext *ctx, FILE *fp, int p, int pop)
+{
+    PGACharacter *c;
+    int           i, pos, len;
+
+    PGADebugEntered("PGACharacterPrintString");
+
+    c = (PGACharacter *)PGAGetIndividual(ctx, p, pop)->chrom;
+    len = PGAGetStringLength(ctx);
+
+    pos = 0;
+    while (len > 0) {
+      fprintf(fp, "#%5d: [", pos);
+      for (i=0; i<50 && len>0; i++,len--,c++)
+	fputc(*c, fp);
+      pos+=50;
+      fprintf(fp, "]\n");
+    }
+    fprintf(fp, "\n");
+    
+    PGADebugExited("PGACharacterPrintString");
+}
+
+/*I****************************************************************************
+   PGACharacterCopyString - Copy one character-valued string to another
+   Assumes the strings are of the same length.
+
+   Inputs:
+      ctx - context variable
+      p1   - string to copy
+      pop1 - symbolic constant of population containing string p1
+      p2   - string to copy p1 to
+      pop2 - symbolic constant of population containing string p2
+
+   Outputs:
+
+   Example:
+      Copy character string x to y (both are implicitly assumed to be the same
+      length)
+
+      PGAContext *ctx;
+      int x, y;
+      :
+      PGACharacterCopyString ( ctx, x, PGA_OLDPOP, y, PGA_NEWPOP );
+
+****************************************************************************I*/
+void PGACharacterCopyString (PGAContext *ctx, int p1, int pop1, int p2,
+                             int pop2)
+{
+     void *source, *dest;
+     int len;
+
+    PGADebugEntered("PGACharacterCopyString");
+
+     source = PGAGetIndividual(ctx, p1, pop1)->chrom;
+     dest   = PGAGetIndividual(ctx, p2, pop2)->chrom;
+     len    = PGAGetStringLength(ctx);
+     memcpy(dest, source, len * sizeof(PGACharacter));
+
+    PGADebugExited("PGACharacterCopyString");
+}
+
+/*I****************************************************************************
+   PGACharacterDuplicate - Returns true if string p1 in pop1 is a dublicate
+   of string p2 in pop2, else returns false.
+   Assumes the strings are the same length.
+
+   Inputs:
+      ctx - context variable
+      p1   - string index of the first string to compare
+      pop1 - symbolic constant of the population string p1 is in
+      p2   - string index of the second string to compare
+      pop2 - symbolic constant of the population string p2 is in
+
+   Outputs:
+      Returns true if strings are duplicates.
+
+   Example:
+      Compare string x with y to see if they are duplicates
+
+      PGAContext *ctx;
+      int x, y;
+      :
+      if ( PGACharacterDuplicate( ctx, x, PGA_NEWPOP, y, PGA_NEWPOP ) )
+          printf("strings are duplicates\n");
+
+****************************************************************************I*/
+int PGACharacterDuplicate( PGAContext *ctx, int p1, int pop1, int p2, int pop2)
+{
+     void *a, *b;
+     int len;
+
+    PGADebugEntered("PGACharacterDuplicate");
+
+     a = PGAGetIndividual(ctx, p1, pop1)->chrom;
+     b = PGAGetIndividual(ctx, p2, pop2)->chrom;
+     len = PGAGetStringLength(ctx);
+
+    PGADebugExited("PGACharacterDuplicate");
+
+     return (!memcmp(a, b, len * sizeof(PGACharacter)));
+}
+
+/*I****************************************************************************
+   PGACharacterInitString - randomly initialize a string of type PGACharacter
+
+   Inputs:
+      ctx   - context variable
+      p   - index of string to randomly initialize
+      pop - symbolic constant of the population string p is in
+
+   Outputs:
+
+   Example:
+      PGAContext *ctx;
+      int p;
+      :
+      PGACharacterInitString ( ctx, p, PGA_NEWPOP );
+
+****************************************************************************I*/
+void PGACharacterInitString(PGAContext *ctx, int p, int pop)
+{
+     int len, i, j;
+     PGACharacter *c;
+
+    PGADebugEntered("PGACharacterInitString");
+
+     len = ctx->ga.StringLen;
+     c = (PGACharacter *)PGAGetIndividual(ctx, p, pop)->chrom;
+     switch (ctx->init.CharacterType)
+     {
+     case PGA_CINIT_LOWER:
+          for (i = 0; i < len; i++)
+               c[i] = PGARandomInterval(ctx, 'a', 'z');
+          break;
+     case PGA_CINIT_UPPER:
+          for (i = 0; i < len; i++)
+               c[i] = PGARandomInterval(ctx, 'A', 'Z');
+          break;
+     case PGA_CINIT_MIXED:
+          for (i = 0; i < len; i++)
+          {
+               j = PGARandomInterval(ctx, 0, 51);
+               if (j < 26)
+                    c[i] = 'A' + j;
+               else
+                    c[i] = 'a' + j - 26;
+          }
+          break;
+     }
+    PGADebugExited("PGACharacterInitString");
+}
+
+/*I****************************************************************************
+  PGACharacterBuildDatatype - Build an MPI_Datatype for a character string.
+
+  Inputs:
+      ctx  - context variable
+      p    - index of the string to build a datatype from
+      pop  - symbolic constant of the population string p is in
+
+  Outputs:
+      MPI_Datatype
+
+  Example:
+      Called only by MPI routines.  Not for user consumption.
+
+****************************************************************************I*/
+MPI_Datatype PGACharacterBuildDatatype(PGAContext *ctx, int p, int pop)
+{
+
+     int            counts[4];      /* Number of elements in each
+                                       block (array of integer) */
+     MPI_Aint       displs[4];      /* byte displacement of each
+                                       block (array of integer) */
+     MPI_Datatype   types[4];       /* type of elements in each block (array
+                                       of handles to datatype objects) */
+     MPI_Datatype   individualtype; /* new datatype (handle) */
+     PGAIndividual *traveller;      /* address of individual in question */
+
+    PGADebugEntered("PGACharacterBuildDatatype");
+
+     traveller = PGAGetIndividual(ctx, p, pop);
+     MPI_Address(&traveller->evalfunc, &displs[0]);
+     counts[0] = 1;
+     types[0]  = MPI_DOUBLE;
+
+     MPI_Address(&traveller->fitness, &displs[1]);
+     counts[1] = 1;
+     types[1]  = MPI_DOUBLE;
+
+     MPI_Address(&traveller->evaluptodate, &displs[2]);
+     counts[2] = 1;
+     types[2]  = MPI_INT;
+
+     MPI_Address(traveller->chrom, &displs[3]);
+     counts[3] = ctx->ga.StringLen;
+     types[3]  = MPI_CHAR;
+
+     MPI_Type_struct(4, counts, displs, types, &individualtype);
+     MPI_Type_commit(&individualtype);
+
+    PGADebugExited("PGACharacterBuildDatatype");
+
+     return (individualtype);
+}
Index: trunk/optimizer/src/pgapack/pgapack/source/cmdline.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/cmdline.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/cmdline.c	(revision 816)
@@ -0,0 +1,280 @@
+/*
+ *  
+ *  ********************************************************************* 
+ *  (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+ *  *********************************************************************
+ *  
+ *  This software was authored by
+ *  
+ *  D. Levine
+ *  Mathematics and Computer Science Division Argonne National Laboratory
+ *  Argonne IL 60439
+ *  levine@mcs.anl.gov
+ *  (708) 252-6735
+ *  (708) 252-5986 (FAX)
+ *  
+ *  with programming assistance of participants in Argonne National 
+ *  Laboratory's SERS program.
+ *  
+ *  This program contains material protectable under copyright laws of the 
+ *  United States.  Permission is hereby granted to use it, reproduce it, 
+ *  to translate it into another language, and to redistribute it to 
+ *  others at no charge except a fee for transferring a copy, provided 
+ *  that you conspicuously and appropriately publish on each copy the 
+ *  University of Chicago's copyright notice, and the disclaimer of 
+ *  warranty and Government license included below.  Further, permission 
+ *  is hereby granted, subject to the same provisions, to modify a copy or 
+ *  copies or any portion of it, and to distribute to others at no charge 
+ *  materials containing or derived from the material.
+ *  
+ *  The developers of the software ask that you acknowledge its use in any 
+ *  document referencing work based on the  program, such as published 
+ *  research.  Also, they ask that you supply to Argonne National 
+ *  Laboratory a copy of any published research referencing work based on 
+ *  the software.
+ *  
+ *  Any entity desiring permission for further use must contact:
+ *  
+ *  J. Gleeson
+ *  Industrial Technology Development Center Argonne National Laboratory
+ *  Argonne IL 60439
+ *  gleesonj@smtplink.eid.anl.gov
+ *  (708) 252-6055
+ *  
+ *  ******************************************************************** 
+ *  DISCLAIMER
+ *  
+ *  THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+ *  OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+ *  THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+ *  WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+ *  RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+ *  INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+ *  INFRINGE PRIVATELY OWNED RIGHTS.
+ *  
+ *  ********************************************************************** 
+ *  GOVERNMENT LICENSE
+ *  
+ *  The Government is granted for itself and others acting on its behalf a 
+ *  paid-up, non-exclusive, irrevocable worldwide license in this computer 
+ *  software to reproduce, prepare derivative works, and perform publicly 
+ *  and display publicly.
+ */
+
+/*****************************************************************************
+*     FILE: cmdline.c: This file contains routines needed to parse the
+*                      command line.
+*
+*     Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle,
+*              Brian P. Walenz
+*****************************************************************************/
+
+#include "pgapack.h"
+
+extern char PGAProgram[100];
+#define bad_arg(a)    ( ((a)==NULL) || ((*(a)) == '-') )
+
+/*I****************************************************************************
+   PGAReadCmdLin - Code that looks at the arguments, recognizes any that
+   are for PGAPack, uses the arguments, and removes them from the command
+   line args.
+
+   Inputs:
+      ctx  - context variable
+      argc - address of the count of the number of command line argumen
+      argv - array of command line arguments
+
+   Outputs:
+      None
+
+   Example:
+      void main(int argc, char **argv) {
+          PGAContext *ctx;
+          :
+          PGAReadCmdLine(ctx, &argc, argv);
+      }
+
+****************************************************************************I*/
+void PGAReadCmdLine( PGAContext *ctx, int *argc, char **argv )
+{
+     int c;
+     char *s, **a;
+
+     
+     /* Put name of called program (according to the args) into PGAProgram */
+     s = (char *)  strrchr(*argv, '/');
+     if (s)
+          strcpy(PGAProgram, s + 1);
+     else
+          strcpy(PGAProgram, *argv);
+
+     /* Set all command line flags (except procgroup) to their defaults */
+
+     /* Move to last argument, so that we can go backwards. */
+     a = &argv[*argc - 1];
+
+     /*
+      * Loop backwards through arguments, catching the ones that start with
+      * '-'.  Backwards is more efficient when you are stripping things out.
+      */
+     for (c = (*argc); c > 1; c--, a--)
+     {
+          if (**a != '-')
+               continue;
+
+          if ( !strcmp(*a, "-pgadbg") || !strcmp(*a, "-pgadebug") )
+          {
+               if bad_arg(a[1])
+                    PGAUsage(ctx);
+#if OPTIMIZE==0
+               PGAParseDebugArg( ctx, a[1] );
+#endif
+               PGAStripArgs(a, argc, &c, 2);
+               continue;
+          }
+
+          if ( !strcmp(*a, "-pgaversion") )
+          {
+               PGAStripArgs(a, argc, &c, 1);
+               PGAPrintVersionNumber( ctx );
+	       PGADestroy(ctx);
+	       exit(-1);
+          }
+
+          if (!strcmp(*a, "-pgahelp") )
+          {
+               if (a[1] == NULL)
+                    PGAUsage(ctx);
+               else
+                    if (!strcmp(a[1], "debug"))
+                         PGAPrintDebugOptions(ctx);
+                    else
+                         fprintf(stderr, "Invalid option following"
+                                 "-pgahelp.\n");
+          }
+     }
+}
+
+#if OPTIMIZE==0
+/*I****************************************************************************
+   PGAParseDebugArg - routine to parse debug command line options, and set
+   the appropriate debug level (via PGASetDebugLevel).
+
+   Inputs:
+      ctx - context variable
+      st  - debug command line options
+
+   Outputs:
+      None
+
+   Example:
+      Internal function.  Called only by PGAReadCmdLine.
+
+****************************************************************************I*/
+void PGAParseDebugArg(PGAContext *ctx, char *st)
+{
+     int           num2index = 0, num1index = 0, index, num1 = 0, num2 = 0, x;
+     unsigned long length = strlen(st);
+     char          range = 0, num1ch[4], num2ch[4];
+
+
+     length--;
+     for(index=0; index <= length; index++)
+     {
+          if (!isdigit(st[index]) && st[index] != ',' && st[index] != '-')
+               PGAError(ctx, "PGASetDebugLevel: Invalid Debug Value:",
+                        PGA_FATAL, PGA_CHAR, (void *) st);
+          if (st[index] == '-')
+          {
+               range = 1;
+               num1ch[num1index] = '\0';
+               num1 = atoi(num1ch);
+               if (num1 < 0 || num1 > PGA_DEBUG_MAXFLAGS)
+                    PGAError(ctx,
+                             "PGASetDebugLevel: Lower Limit Out of Range:",
+                             PGA_FATAL, PGA_INT, (void *) &num1);
+               num1index = 0;
+          }
+          else
+          {
+               if (isdigit(st[index]))
+                    if (range)
+                         num2ch[num2index++] = st[index];
+                    else
+                         num1ch[num1index++] = st[index];
+               if (st[index] == ',' || index == length)
+               {
+                    if (range)
+                    {
+                         num2ch[num2index] = '\0';
+                         num2 = atoi(num2ch);
+                         if (num2 < 0 || num2 > PGA_DEBUG_MAXFLAGS)
+                              PGAError(ctx,
+                                       "PGASetDebugLevel: Upper Limit Out of"
+                                       " Range:",
+                                       PGA_FATAL, PGA_INT, (void *) &num2);
+                         if (num1 <= num2)
+                         {
+                              for (x = num1; x <= num2; x++)
+                              {
+                                   if (x == 212)
+                                        printf("%s %s\n", num1ch, num2ch);
+
+                                   PGASetDebugLevel(ctx, x);
+                              }
+
+                         }
+                         else
+                              PGAError(ctx,
+                                       "PGASetDebugLevel: Lower Limit Exceeds"
+                                       "Upper:", PGA_FATAL, PGA_INT,
+                                       (void *) &num1);
+                         num2index = 0;
+                         range = 0;
+                    }
+                    else
+                    {
+                         num1ch[num1index] = '\0';
+                         num1 = atoi(num1ch);
+                         if (num1 < 0 || num1 > PGA_DEBUG_MAXFLAGS)
+                              PGAError(ctx, "PGASetDebugLevel: Debug Number"
+                                       "Out of Range:", PGA_FATAL, PGA_INT,
+                                       (void *) &num1);
+                         if (num1 == 212)
+                              printf("%s\n", num1ch);
+
+                         PGASetDebugLevel(ctx, num1);
+                         num1index = 0;
+                    }
+               }
+          }
+     }
+}
+#endif
+
+/*I****************************************************************************
+   PGAStripArgs - code to strip arguments out of command list
+
+   Inputs:
+      argc - address of the count of the number of command line arguments
+      argv - array of command line arguments
+      c    -
+      num  -
+
+   Outputs:
+      None
+
+   Example:
+      Internal function.  Called only by PGAReadCmdLine.
+
+****************************************************************************I*/
+void PGAStripArgs(char **argv, int *argc, int *c, int num)
+{
+    char **a;
+    int i;
+
+    /* Strip out the argument. */
+    for (a = argv, i = (*c); i <= *argc; i++, a++)
+        *a = (*(a + num));
+    (*argc) -= num;
+}
Index: trunk/optimizer/src/pgapack/pgapack/source/create.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/create.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/create.c	(revision 816)
@@ -0,0 +1,975 @@
+/*
+ *  
+ *  ********************************************************************* 
+ *  (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+ *  *********************************************************************
+ *  
+ *  This software was authored by
+ *  
+ *  D. Levine
+ *  Mathematics and Computer Science Division Argonne National Laboratory
+ *  Argonne IL 60439
+ *  levine@mcs.anl.gov
+ *  (708) 252-6735
+ *  (708) 252-5986 (FAX)
+ *  
+ *  with programming assistance of participants in Argonne National 
+ *  Laboratory's SERS program.
+ *  
+ *  This program contains material protectable under copyright laws of the 
+ *  United States.  Permission is hereby granted to use it, reproduce it, 
+ *  to translate it into another language, and to redistribute it to 
+ *  others at no charge except a fee for transferring a copy, provided 
+ *  that you conspicuously and appropriately publish on each copy the 
+ *  University of Chicago's copyright notice, and the disclaimer of 
+ *  warranty and Government license included below.  Further, permission 
+ *  is hereby granted, subject to the same provisions, to modify a copy or 
+ *  copies or any portion of it, and to distribute to others at no charge 
+ *  materials containing or derived from the material.
+ *  
+ *  The developers of the software ask that you acknowledge its use in any 
+ *  document referencing work based on the  program, such as published 
+ *  research.  Also, they ask that you supply to Argonne National 
+ *  Laboratory a copy of any published research referencing work based on 
+ *  the software.
+ *  
+ *  Any entity desiring permission for further use must contact:
+ *  
+ *  J. Gleeson
+ *  Industrial Technology Development Center Argonne National Laboratory
+ *  Argonne IL 60439
+ *  gleesonj@smtplink.eid.anl.gov
+ *  (708) 252-6055
+ *  
+ *  ******************************************************************** 
+ *  DISCLAIMER
+ *  
+ *  THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+ *  OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+ *  THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+ *  WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+ *  RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+ *  INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+ *  INFRINGE PRIVATELY OWNED RIGHTS.
+ *  
+ *  ********************************************************************** 
+ *  GOVERNMENT LICENSE
+ *  
+ *  The Government is granted for itself and others acting on its behalf a 
+ *  paid-up, non-exclusive, irrevocable worldwide license in this computer 
+ *  software to reproduce, prepare derivative works, and perform publicly 
+ *  and display publicly.
+ */
+
+/*****************************************************************************
+*     FILE: create.c: This file contains functions to create and initialize
+*                     data structures and populations.
+*
+*     Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle,
+*              Brian P. Walenz
+*****************************************************************************/
+
+#include "pgapack.h"
+
+/*U****************************************************************************
+  PGACreate - creates an uninitialized context variable.  The Fortran version
+  of this function call contains only the last three arguments
+
+  Category: Generation
+
+  Inputs:
+     argc     - address of the count of the number of command line arguments.
+     argv     - array of command line arguments.
+     datatype - the data type used for the strings.  Must be one of
+                PGA_DATATYPE_BINARY, PGA_DATATYPE_CHARACTER,
+                PGA_DATATYPE_INTEGER, PGA_DATATYPE_REAL, or PGA_DATATYPE_USER
+                to specify binary-valued, character-valued, integer-valued,
+                real-valued, or a user-defined datatype, respectively.
+     len      - the string length (number of genes).
+     maxormin - the direction of optimization. Must be one of PGA_MAXIMIZE or
+                PGA_MINIMIZE for maximization or minimization, respectively.
+
+  Outputs:
+     A pointer to the context variable.
+
+  Example:
+
+     In C:
+     void main(int argc, char **argv) {
+         PGAContext *ctx;
+         :
+         ctx = PGACreate(&argc, argv, PGA_DATATYPE_BINARY, 100, PGA_MAXIMIZE);
+         :
+         //  Set options here
+         :
+         PGASetUp(ctx);
+         :
+         //  Run the GA here
+         :
+         PGADestroy(ctx);
+     }
+
+     In FORTRAN:
+             integer ctx
+             :
+             ctx = PGACreate(PGA_DATATYPE_BINARY, 100, PGA_MAXIMIZE)
+             :
+     c       Set options here
+             :
+             call PGASetUp(ctx)
+             :
+     c       Run the GA here
+             :
+             call PGADestroy(ctx)
+             stop
+             end
+
+****************************************************************************U*/
+PGAContext *PGACreate ( int *argc, char **argv,
+                        int datatype, int len, int maxormin )
+{
+    int i;
+    PGAContext *ctx;
+
+    ctx = (PGAContext *) malloc ( sizeof(PGAContext) );
+
+    /*  We cannot make PGA calls until we sort the FuncNameIndex below,
+     *  so we just manually print the (rather severe) error message.
+     */
+    if( ctx == NULL ) {
+	fprintf(stderr, "PGACreate: No room to allocate ctx\n");
+	exit(-1);
+    }
+
+    
+    /*  We use this (indirectly) in PGAReadCmdLine -- in processing
+     *  -pgahelp and -pgahelp debug.
+     */
+    MPI_Initialized (&ctx->par.MPIAlreadyInit);
+
+    /* Initialize MPI, only if it isn't already running (fortran)  */
+    if (!ctx->par.MPIAlreadyInit)
+         MPI_Init (argc, &argv);
+
+
+#if OPTIMIZE==0
+    /*  Sort the FuncNameIndex.  This allows us to use a binary search
+     *  for finding the function names.
+     */
+    PGASortFuncNameIndex(ctx);
+#endif
+
+    /* Initialize debug flags, then parse command line arguments.  */
+    for (i=0; i<PGA_DEBUG_MAXFLAGS; i++)
+        ctx->debug.PGADebugFlags[i] = PGA_FALSE;
+    PGAReadCmdLine( ctx, argc, argv );
+
+
+    /*  The context variable is now initialized enough to allow this
+     *  call to complete successfully.
+     */
+    PGADebugEntered("PGACreate");
+
+    /* required parameter 1: abstract data type */
+    switch (datatype)
+    {
+    case PGA_DATATYPE_BINARY:
+    case PGA_DATATYPE_INTEGER:
+    case PGA_DATATYPE_REAL:
+    case PGA_DATATYPE_CHARACTER:
+    case PGA_DATATYPE_USER:
+         ctx->ga.datatype  = datatype;
+         break;
+    default:
+         PGAError( ctx, "PGACreate: Invalid value of datatype:",
+                  PGA_FATAL, PGA_INT, (void *) &datatype );
+    };
+
+    /* required parameter 2: string string length */
+    if (len <= 1)
+        PGAError( ctx,  "PGACreate: Invalid value of len:",
+                  PGA_FATAL, PGA_INT, (void *) &len );
+    else
+        ctx->ga.StringLen = len;
+
+
+    /* required parameter 3: optimization direction */
+    switch (maxormin) {
+        case PGA_MAXIMIZE:
+        case PGA_MINIMIZE:
+          ctx->ga.optdir = maxormin;
+          break;
+        default:
+          PGAError( ctx, "PGACreate: Invalid value of optdir:",
+                    PGA_FATAL, PGA_INT, (void *) &maxormin );
+    };
+
+
+    /*  For datatype == PGA_DATATYPE_BINARY, set how many full words
+     *  are used in the packed representation, and how many extra bits
+     *  this leaves us with.  Finally, set how many total words are used;
+     *  if there are no extra bits, this is just the number of full words,
+     *  else, there is one more word used than the number of full words.
+     */
+    switch (datatype) {
+    case PGA_DATATYPE_BINARY:
+        ctx->ga.fw = ctx->ga.StringLen/WL;
+        ctx->ga.eb = ctx->ga.StringLen%WL;
+        if ( ctx->ga.eb == 0 )
+            ctx->ga.tw = ctx->ga.fw;
+        else
+            ctx->ga.tw = ctx->ga.fw+1;
+        break;
+    default:
+        ctx->ga.fw = PGA_UNINITIALIZED_INT;
+        ctx->ga.eb = PGA_UNINITIALIZED_INT;
+        ctx->ga.tw = PGA_UNINITIALIZED_INT;
+        break;
+    }
+
+    /*  Clear all the setting.  Later on, PGASetUp() will be called, and then
+     *  it will notice which setting are uninitialized, and set them to the
+     *  default value.
+     */
+    ctx->ga.PopSize            = PGA_UNINITIALIZED_INT;
+    ctx->ga.StoppingRule       = PGA_STOP_MAXITER;
+    ctx->ga.MaxIter            = PGA_UNINITIALIZED_INT;
+    ctx->ga.MaxNoChange        = PGA_UNINITIALIZED_INT;
+    ctx->ga.MaxSimilarity      = PGA_UNINITIALIZED_INT;
+    ctx->ga.NumReplace         = PGA_UNINITIALIZED_INT;
+    ctx->ga.CrossoverType      = PGA_UNINITIALIZED_INT;
+    ctx->ga.SelectType         = PGA_UNINITIALIZED_INT;
+    ctx->ga.FitnessType        = PGA_UNINITIALIZED_INT;
+    ctx->ga.FitnessMinType     = PGA_UNINITIALIZED_INT;
+    ctx->ga.MutationType       = PGA_UNINITIALIZED_INT;
+    ctx->ga.MutateOnlyNoCross  = PGA_UNINITIALIZED_INT;
+    ctx->ga.MutateRealValue    = PGA_UNINITIALIZED_DOUBLE;
+    ctx->ga.MutateIntegerValue = PGA_UNINITIALIZED_INT;
+    ctx->ga.MutateBoundedFlag  = PGA_UNINITIALIZED_INT;
+    ctx->ga.NoDuplicates       = PGA_UNINITIALIZED_INT;
+    ctx->ga.MutationProb       = PGA_UNINITIALIZED_DOUBLE;
+    ctx->ga.CrossoverProb      = PGA_UNINITIALIZED_DOUBLE;
+    ctx->ga.UniformCrossProb   = PGA_UNINITIALIZED_DOUBLE;
+    ctx->ga.PTournamentProb    = PGA_UNINITIALIZED_DOUBLE;
+    ctx->ga.FitnessRankMax     = PGA_UNINITIALIZED_DOUBLE;
+    ctx->ga.FitnessCmaxValue   = PGA_UNINITIALIZED_DOUBLE;
+    ctx->ga.PopReplace         = PGA_UNINITIALIZED_INT;
+    ctx->ga.iter               = 0;
+    ctx->ga.ItersOfSame        = 0;
+    ctx->ga.PercentSame        = 0;
+    ctx->ga.selected           = NULL;
+    ctx->ga.SelectIndex        = 0;
+    ctx->ga.restart            = PGA_UNINITIALIZED_INT;
+    ctx->ga.restartFreq        = PGA_UNINITIALIZED_INT;
+    ctx->ga.restartAlleleProb  = PGA_UNINITIALIZED_DOUBLE;
+
+    /* Operations */
+    ctx->cops.CreateString      = NULL;
+    ctx->cops.Mutation          = NULL;
+    ctx->cops.Crossover         = NULL;
+    ctx->cops.PrintString       = NULL;
+    ctx->cops.CopyString        = NULL;
+    ctx->cops.Duplicate         = NULL;
+    ctx->cops.InitString        = NULL;
+    ctx->cops.BuildDatatype     = NULL;
+    ctx->cops.StopCond           = NULL;
+    ctx->cops.EndOfGen          = NULL;
+
+    ctx->fops.Mutation          = NULL;
+    ctx->fops.Crossover         = NULL;
+    ctx->fops.PrintString       = NULL;
+    ctx->fops.CopyString        = NULL;
+    ctx->fops.Duplicate         = NULL;
+    ctx->fops.InitString        = NULL;
+    ctx->fops.StopCond          = NULL;
+    ctx->fops.EndOfGen          = NULL;
+
+    /* Parallel */
+    ctx->par.NumIslands        = PGA_UNINITIALIZED_INT;
+    ctx->par.NumDemes          = PGA_UNINITIALIZED_INT;
+    ctx->par.DefaultComm       = NULL;
+#ifdef FAKE_MPI
+    ctx->par.MPIStubLibrary    = PGA_TRUE;
+#else
+    ctx->par.MPIStubLibrary    = PGA_FALSE;
+#endif
+
+    /* Reporting */
+    ctx->rep.PrintFreq         = PGA_UNINITIALIZED_INT;
+    ctx->rep.PrintOptions      = 0;
+    ctx->rep.Online            = 0;
+    ctx->rep.Offline           = 0;
+    ctx->rep.Best              = PGA_UNINITIALIZED_DOUBLE;
+    ctx->rep.starttime         = PGA_UNINITIALIZED_INT;
+
+    /* System
+     *
+     *  If ctx->sys.UserFortran is not set to PGA_TRUE in pgacreate_ (the
+     *  fortran stub to PGACreate), the user program is in C.
+     */
+    if (ctx->sys.UserFortran != PGA_TRUE) 
+         ctx->sys.UserFortran  = PGA_FALSE;
+    ctx->sys.SetUpCalled       = PGA_FALSE;
+    ctx->sys.PGAMaxInt         = INT_MAX;
+    ctx->sys.PGAMinInt         = INT_MIN;
+    ctx->sys.PGAMaxDouble      = DBL_MAX;
+    ctx->sys.PGAMinDouble      = DBL_MIN;
+
+    /* Debug */
+    /* Set above before parsing command line arguments */
+
+    /* Initialization */
+    ctx->init.RandomInit        = PGA_UNINITIALIZED_INT;
+    ctx->init.BinaryProbability = PGA_UNINITIALIZED_DOUBLE;
+    ctx->init.RealType          = PGA_UNINITIALIZED_INT;
+    ctx->init.IntegerType       = PGA_UNINITIALIZED_INT;
+    ctx->init.CharacterType     = PGA_UNINITIALIZED_INT;
+    ctx->init.RandomSeed        = PGA_UNINITIALIZED_INT;
+
+    /*  Allocate and clear arrays to define the minimum and maximum values
+     *  allowed by integer and real datatypes.
+     */
+    switch (datatype)
+    {
+    case PGA_DATATYPE_INTEGER:
+         ctx->init.IntegerMax = (int *) malloc(len * sizeof(PGAInteger));
+         if (!ctx->init.IntegerMax)
+              PGAError(ctx, "PGACreate: No room to allocate:", PGA_FATAL,
+                       PGA_CHAR, (void *) "ctx->init.IntegerMax");
+         ctx->init.IntegerMin = (int *) malloc(len * sizeof(PGAInteger));
+         if (!ctx->init.IntegerMin)
+              PGAError(ctx, "PGACreate: No room to allocate:", PGA_FATAL,
+                       PGA_CHAR, (void *) "ctx->init.IntegerMin");
+         ctx->init.RealMax = NULL;
+         ctx->init.RealMin = NULL;
+         for (i = 0; i < len; i++)
+         {
+              ctx->init.IntegerMin[i] = PGA_UNINITIALIZED_INT;
+              ctx->init.IntegerMax[i] = PGA_UNINITIALIZED_INT;
+         }
+         break;
+    case PGA_DATATYPE_REAL:
+         ctx->init.RealMax = (PGAReal *) malloc(len * sizeof(PGAReal));
+         if (!ctx->init.RealMax)
+              PGAError(ctx, "PGACreate: No room to allocate:", PGA_FATAL,
+                       PGA_CHAR, (void *) "ctx->init.RealMax");
+         ctx->init.RealMin = (PGAReal *) malloc(len * sizeof(PGAReal));
+         if (!ctx->init.RealMin)
+              PGAError(ctx, "PGACreate: No room to allocate:", PGA_FATAL,
+                       PGA_CHAR, (void *) "ctx->init.RealMin");
+         ctx->init.IntegerMax = NULL;
+         ctx->init.IntegerMin = NULL;
+         for (i = 0; i < len; i++)
+         {
+              ctx->init.RealMin[i] = PGA_UNINITIALIZED_DOUBLE;
+              ctx->init.RealMax[i] = PGA_UNINITIALIZED_DOUBLE;
+         }
+         break;
+    default:
+         ctx->init.RealMax = NULL;
+         ctx->init.RealMin = NULL;
+         ctx->init.IntegerMax = NULL;
+         ctx->init.IntegerMin = NULL;
+         break;
+    }
+
+    PGADebugExited("PGACreate");
+
+    return(ctx);
+}
+
+
+/*U****************************************************************************
+  PGASetUp - set all uninitialized variables to default values and initialize
+  some internal arrays.  Must be called after PGACreate() and before the GA
+  is started.
+
+  Category: Generation
+
+  Inputs:
+     ctx - context variable
+
+  Outputs:
+     Uninitialized values in the context variable are set to defaults, and
+     set values are checked for legality.
+
+  Example:
+     PGAContext *ctx;
+     :
+     PGACreate(ctx, ...);
+     :
+     //  Set options here
+     :
+     PGASetUp(ctx);
+
+****************************************************************************U*/
+void PGASetUp ( PGAContext *ctx )
+{
+    /*  These are for temporary storage of datatype specific functions.
+     *  They allow some (understatement of the yesr!!) cleaning of the
+     *  code below.
+     */
+    void         (*CreateString)(PGAContext *, int, int, int);
+    int          (*Mutation)(PGAContext *, int, int, double);
+    void         (*Crossover)(PGAContext *, int, int, int, int, int, int);
+    void         (*PrintString)(PGAContext *, FILE *, int, int);
+    void         (*CopyString)(PGAContext *, int, int, int, int);
+    int          (*Duplicate)(PGAContext *, int, int, int, int);
+    void         (*InitString)(PGAContext *, int, int);
+    MPI_Datatype (*BuildDatatype)(PGAContext *, int, int);
+    int err=0, i;
+
+    PGADebugEntered("PGASetUp");
+    PGAFailIfSetUp("PGASetUp");
+
+    ctx->sys.SetUpCalled = PGA_TRUE;
+
+    if ( ctx->ga.datatype           == PGA_DATATYPE_BINARY   &&
+         ctx->ga.tw                 == PGA_UNINITIALIZED_INT )
+      PGAError( ctx,
+               "PGASetUp: Binary: Total Words (ctx->ga.tw) == UNINITIALIZED?",
+               PGA_FATAL, PGA_INT, (void *) &ctx->ga.tw );
+
+    if ( ctx->ga.datatype           == PGA_DATATYPE_BINARY  &&
+         ctx->ga.fw                 == PGA_UNINITIALIZED_INT )
+      PGAError( ctx,
+               "PGASetUp: Binary: Full Words (ctx->ga.fw) == UNINITIALIZED?",
+               PGA_FATAL, PGA_INT,  (void *) &ctx->ga.fw );
+
+    if ( ctx->ga.datatype           == PGA_DATATYPE_BINARY  &&
+         ctx->ga.eb                 == PGA_UNINITIALIZED_INT )
+      PGAError( ctx,
+               "PGASetUp: Binary: Empty Bits (ctx->ga.eb) == UNINITIALIZED?",
+               PGA_FATAL, PGA_INT, (void *) &ctx->ga.eb );
+
+    if ( ctx->ga.PopSize            == PGA_UNINITIALIZED_INT)
+      ctx->ga.PopSize                = 100;
+
+    if ( ctx->ga.MaxIter            == PGA_UNINITIALIZED_INT)
+         ctx->ga.MaxIter             = 1000;
+
+    if ( ctx->ga.MaxNoChange        == PGA_UNINITIALIZED_INT)
+         ctx->ga.MaxNoChange         = 100;
+
+    if ( ctx->ga.MaxSimilarity      == PGA_UNINITIALIZED_INT)
+         ctx->ga.MaxSimilarity       = 95;
+
+    if ( ctx->ga.NumReplace         == PGA_UNINITIALIZED_INT)
+         ctx->ga.NumReplace          = (int) ceil(ctx->ga.PopSize * 0.1);
+
+    if ( ctx->ga.NumReplace          > ctx->ga.PopSize)
+         PGAError(ctx, "PGASetUp: NumReplace > PopSize",
+                  PGA_FATAL, PGA_VOID, NULL);
+
+    if ( ctx->ga.CrossoverType      == PGA_UNINITIALIZED_INT)
+         ctx->ga.CrossoverType       = PGA_CROSSOVER_TWOPT;
+
+    if (ctx->ga.CrossoverType       == PGA_CROSSOVER_TWOPT &&
+        ctx->ga.StringLen == 2)
+         PGAError(ctx, "PGASetUp: Invalid Crossover type for string of length "
+                  "2", PGA_FATAL, PGA_INT, (void *) &ctx->ga.CrossoverType);
+
+    if ( ctx->ga.SelectType        == PGA_UNINITIALIZED_INT)
+         ctx->ga.SelectType         = PGA_SELECT_TOURNAMENT;
+
+    if ( ctx->ga.FitnessType       == PGA_UNINITIALIZED_INT)
+         ctx->ga.FitnessType        = PGA_FITNESS_RAW;
+
+    if ( ctx->ga.FitnessMinType    == PGA_UNINITIALIZED_INT)
+         ctx->ga.FitnessMinType     = PGA_FITNESSMIN_CMAX;
+
+    if ( ctx->ga.MutateOnlyNoCross == PGA_UNINITIALIZED_INT)
+         ctx->ga.MutateOnlyNoCross  = PGA_TRUE;
+
+    if ( ctx->ga.MutationProb      == PGA_UNINITIALIZED_DOUBLE)
+         ctx->ga.MutationProb       = 1. / ctx->ga.StringLen;
+
+    if ( ctx->ga.MutationType      == PGA_UNINITIALIZED_INT) {
+        switch (ctx->ga.datatype) {
+        case PGA_DATATYPE_BINARY:
+        case PGA_DATATYPE_CHARACTER:
+        case PGA_DATATYPE_USER:
+             /* leave PGA_UNINITIALIZED_INT for these data types */
+             break;
+        case PGA_DATATYPE_REAL:
+             ctx->ga.MutationType   = PGA_MUTATION_GAUSSIAN;
+             break;
+        case PGA_DATATYPE_INTEGER:
+             switch (ctx->init.IntegerType) {
+                 case PGA_UNINITIALIZED_INT:
+                 case PGA_IINIT_PERMUTE:
+                     ctx->ga.MutationType   = PGA_MUTATION_PERMUTE;
+                     break;
+                 case PGA_IINIT_RANGE:
+                     ctx->ga.MutationType   = PGA_MUTATION_RANGE;
+                     break;
+             }
+             break;
+        default:
+             PGAError( ctx, "PGASetup: Invalid value of ctx->ga.datatype:",
+                       PGA_FATAL, PGA_INT, (void *) &(ctx->ga.datatype) );
+         }
+    }
+
+    if (ctx->ga.MutateRealValue   == PGA_UNINITIALIZED_DOUBLE) {
+        switch (ctx->ga.MutationType) {
+        case PGA_MUTATION_GAUSSIAN:
+            ctx->ga.MutateRealValue   = 0.1;
+            break;
+        case PGA_MUTATION_UNIFORM:
+            ctx->ga.MutateRealValue   = 0.1;
+            break;
+        case PGA_MUTATION_CONSTANT:
+            ctx->ga.MutateRealValue   = 0.01;
+            break;
+        case PGA_MUTATION_RANGE:
+        default:
+            ctx->ga.MutateRealValue   = 0.0;
+        }
+    }
+
+    if ( ctx->ga.MutateIntegerValue == PGA_UNINITIALIZED_INT)
+         ctx->ga.MutateIntegerValue  = 1;
+
+    if ( ctx->ga.MutateBoundedFlag == PGA_UNINITIALIZED_INT)
+         ctx->ga.MutateBoundedFlag  = PGA_FALSE;
+
+    if ( ctx->ga.NoDuplicates      == PGA_UNINITIALIZED_INT)
+         ctx->ga.NoDuplicates       = PGA_FALSE;
+
+    if ( ctx->ga.NoDuplicates && ((ctx->ga.StoppingRule & PGA_STOP_TOOSIMILAR)
+                                   == PGA_STOP_TOOSIMILAR))
+         PGAError(ctx, "PGASetUp: No Duplicates inconsistent with Stopping "
+                  "Rule:", PGA_FATAL, PGA_INT, (void *) &ctx->ga.StoppingRule);
+
+    if ( ctx->ga.CrossoverProb     == PGA_UNINITIALIZED_DOUBLE)
+         ctx->ga.CrossoverProb      = 0.85;
+
+    if ( ctx->ga.UniformCrossProb  == PGA_UNINITIALIZED_DOUBLE)
+         ctx->ga.UniformCrossProb   = 0.6;
+
+    if ( ctx->ga.PTournamentProb   == PGA_UNINITIALIZED_DOUBLE)
+         ctx->ga.PTournamentProb    = 0.6;
+
+    if ( ctx->ga.FitnessRankMax    == PGA_UNINITIALIZED_DOUBLE)
+         ctx->ga.FitnessRankMax     = 1.2;
+
+    if ( ctx->ga.FitnessCmaxValue  == PGA_UNINITIALIZED_DOUBLE)
+         ctx->ga.FitnessCmaxValue   = 1.01;
+
+    if ( ctx->ga.PopReplace        == PGA_UNINITIALIZED_INT)
+         ctx->ga.PopReplace         = PGA_POPREPL_BEST;
+
+    if ( ctx->ga.restart           == PGA_UNINITIALIZED_INT)
+         ctx->ga.restart            = PGA_FALSE;
+
+    if ( ctx->ga.restartFreq       == PGA_UNINITIALIZED_INT)
+         ctx->ga.restartFreq        = 50;
+
+    if ( ctx->ga.restartAlleleProb == PGA_UNINITIALIZED_DOUBLE)
+         ctx->ga.restartAlleleProb = 0.5;
+
+
+/* ops */
+    /*  If no user supplied "done" function, use the built in one.
+     *  No need to check EndOfGen; they only get called if they
+     *  are defined.
+     */
+    if (((void *)ctx->cops.StopCond == (void *)PGADone) ||
+	((void *)ctx->fops.StopCond == (void *)PGADone))
+	PGAError( ctx,
+		 "PGASetUp: Using PGADone as the user stopping condition will"
+		 " result in an infinite loop!", PGA_FATAL, PGA_VOID, NULL);
+
+    switch (ctx->ga.datatype) {
+    case PGA_DATATYPE_BINARY:
+	CreateString  = PGABinaryCreateString;
+	BuildDatatype = PGABinaryBuildDatatype;
+	Mutation      = PGABinaryMutation;
+
+        switch (ctx->ga.CrossoverType) {
+	  case PGA_CROSSOVER_ONEPT:
+	    Crossover  = PGABinaryOneptCrossover;
+            break;
+	  case PGA_CROSSOVER_TWOPT:
+	    Crossover  = PGABinaryTwoptCrossover;
+            break;
+	  case PGA_CROSSOVER_UNIFORM:
+	    Crossover  = PGABinaryUniformCrossover;
+            break;
+        }
+	PrintString    = PGABinaryPrintString;
+	CopyString     = PGABinaryCopyString;
+	Duplicate      = PGABinaryDuplicate;
+	InitString     = PGABinaryInitString;
+        break;
+      case PGA_DATATYPE_INTEGER:
+        CreateString   = PGAIntegerCreateString;
+        BuildDatatype  = PGAIntegerBuildDatatype;
+        Mutation       = PGAIntegerMutation;
+        switch (ctx->ga.CrossoverType) {
+	  case PGA_CROSSOVER_ONEPT:
+	    Crossover  = PGAIntegerOneptCrossover;
+            break;
+	  case PGA_CROSSOVER_TWOPT:
+	    Crossover  = PGAIntegerTwoptCrossover;
+            break;
+	  case PGA_CROSSOVER_UNIFORM:
+	    Crossover  = PGAIntegerUniformCrossover;
+            break;
+        }
+	PrintString    = PGAIntegerPrintString;
+	CopyString     = PGAIntegerCopyString;
+	Duplicate      = PGAIntegerDuplicate;
+	InitString     = PGAIntegerInitString;
+        break;
+      case PGA_DATATYPE_REAL:
+	CreateString   = PGARealCreateString;
+	BuildDatatype  = PGARealBuildDatatype;
+	Mutation       = PGARealMutation;
+        switch (ctx->ga.CrossoverType) {
+	  case PGA_CROSSOVER_ONEPT:
+	    Crossover  = PGARealOneptCrossover;
+            break;
+	  case PGA_CROSSOVER_TWOPT:
+	    Crossover  = PGARealTwoptCrossover;
+            break;
+	  case PGA_CROSSOVER_UNIFORM:
+	    Crossover  = PGARealUniformCrossover;
+            break;
+        }
+	PrintString    = PGARealPrintString;
+	CopyString     = PGARealCopyString;
+	Duplicate      = PGARealDuplicate;
+	InitString     = PGARealInitString;
+        break;
+      case PGA_DATATYPE_CHARACTER:
+	CreateString   = PGACharacterCreateString;
+	BuildDatatype  = PGACharacterBuildDatatype;
+	Mutation       = PGACharacterMutation;
+        switch (ctx->ga.CrossoverType) {
+	  case PGA_CROSSOVER_ONEPT:
+	    Crossover  = PGACharacterOneptCrossover;
+            break;
+	  case PGA_CROSSOVER_TWOPT:
+	    Crossover  = PGACharacterTwoptCrossover;
+            break;
+	  case PGA_CROSSOVER_UNIFORM:
+	    Crossover  = PGACharacterUniformCrossover;
+            break;
+	}
+	PrintString    = PGACharacterPrintString;
+	CopyString     = PGACharacterCopyString;
+	Duplicate      = PGACharacterDuplicate;
+	InitString     = PGACharacterInitString;
+        break;
+      case PGA_DATATYPE_USER:
+        if (ctx->cops.CreateString == NULL)
+            PGAError( ctx,
+		     "PGASetUp: User datatype needs CreateString function:",
+                     PGA_WARNING, PGA_INT, (void *) &err );
+        if (ctx->cops.Mutation     == NULL)
+            PGAError( ctx,
+		     "PGASetUp: User datatype needs Mutation function:",
+                     PGA_WARNING, PGA_INT, (void *) &err );
+        if (ctx->cops.Crossover    == NULL)
+            PGAError( ctx,
+		     "PGASetUp: User datatype needs Crossover function:",
+                     PGA_WARNING, PGA_INT, (void *) &err );
+        if (ctx->cops.PrintString  == NULL)
+            PGAError( ctx,
+		     "PGASetUp: User datatype needs PrintString function:",
+                     PGA_WARNING, PGA_INT, (void *) &err );
+	if (ctx->cops.Duplicate    == NULL)
+            PGAError( ctx,
+		     "PGASetUp: User datatype needs Duplicate function:",
+                     PGA_WARNING, PGA_INT, (void *) &err );
+	if (ctx->cops.CopyString    == NULL)
+            PGAError( ctx,
+		     "PGASetUp: User datatype needs CopyString function:",
+                     PGA_WARNING, PGA_INT, (void *) &err );
+        if (ctx->cops.BuildDatatype == NULL)
+             PGAError(ctx,
+                      "PGASetUp: User datatype needs BuildDatatype "
+                      "function:", PGA_FATAL, PGA_INT, (void *) &err );
+        break;
+    }
+    if ((ctx->cops.Mutation     == NULL) && (ctx->fops.Mutation    == NULL))
+	ctx->cops.Mutation      = Mutation;
+    if ((ctx->cops.Crossover    == NULL) && (ctx->fops.Crossover   == NULL))
+	ctx->cops.Crossover     = Crossover;
+    if ((ctx->cops.PrintString  == NULL) && (ctx->fops.PrintString == NULL))
+	ctx->cops.PrintString   = PrintString;
+    if ((ctx->cops.Duplicate    == NULL) && (ctx->fops.Duplicate   == NULL))
+	ctx->cops.Duplicate     = Duplicate;
+    if ((ctx->cops.InitString   == NULL) && (ctx->fops.InitString  == NULL))
+	ctx->cops.InitString    = InitString;
+    if (ctx->cops.CreateString  == NULL) 
+	ctx->cops.CreateString  = CreateString;
+    if (ctx->cops.CopyString    == NULL)
+	ctx->cops.CopyString    = CopyString;
+    if (ctx->cops.BuildDatatype == NULL)
+	ctx->cops.BuildDatatype = BuildDatatype;
+    
+/* par */
+    if ( ctx->par.NumIslands       == PGA_UNINITIALIZED_INT)
+         ctx->par.NumIslands        = 1;
+    if ( ctx->par.NumDemes         == PGA_UNINITIALIZED_INT)
+         ctx->par.NumDemes          = 1;
+    if ( ctx->par.DefaultComm      == NULL )
+         ctx->par.DefaultComm       = MPI_COMM_WORLD;
+
+    
+
+/* rep */
+    if ( ctx->rep.PrintFreq == PGA_UNINITIALIZED_INT)
+         ctx->rep.PrintFreq  = 10;
+
+/* sys */
+    /* no more sets necessary here. */
+
+/* debug */
+
+/* init */
+    if ( ctx->init.RandomInit == PGA_UNINITIALIZED_INT)
+         ctx->init.RandomInit  = PGA_TRUE;
+
+    if ( ctx->init.BinaryProbability == PGA_UNINITIALIZED_DOUBLE)
+         ctx->init.BinaryProbability  = 0.5;
+
+    if ( ctx->init.RealType == PGA_UNINITIALIZED_INT)
+         ctx->init.RealType  = PGA_RINIT_RANGE;
+    if ( ctx->init.IntegerType == PGA_UNINITIALIZED_INT)
+         ctx->init.IntegerType  = PGA_IINIT_PERMUTE;
+    if ( ctx->init.CharacterType == PGA_UNINITIALIZED_INT)
+         ctx->init.CharacterType = PGA_CINIT_LOWER;
+
+    switch (ctx->ga.datatype)
+    {
+    case PGA_DATATYPE_INTEGER:
+         for (i = 0; i < ctx->ga.StringLen; i++)
+         {
+              if (ctx->init.IntegerMin[i] == PGA_UNINITIALIZED_INT)
+                   ctx->init.IntegerMin[i] = 0;
+              if (ctx->init.IntegerMax[i] == PGA_UNINITIALIZED_INT)
+                   ctx->init.IntegerMax[i] = ctx->ga.StringLen - 1;
+         }
+         break;
+    case PGA_DATATYPE_REAL:
+         for (i = 0; i < ctx->ga.StringLen; i++)
+         {
+              if (ctx->init.RealMin[i] == PGA_UNINITIALIZED_DOUBLE)
+                   ctx->init.RealMin[i] = 0.;
+              if (ctx->init.RealMax[i] == PGA_UNINITIALIZED_DOUBLE)
+                   ctx->init.RealMax[i] = 1.;
+         }
+         break;
+    }
+
+    /* If a seed was not specified, get one from a time of day call */
+    if ( ctx->init.RandomSeed == PGA_UNINITIALIZED_INT)
+         ctx->init.RandomSeed = (int)time(NULL);
+
+    /* seed random number generator with this process' unique seed */
+    ctx->init.RandomSeed += PGAGetRank(ctx, MPI_COMM_WORLD);
+    PGARandom01( ctx, ctx->init.RandomSeed );
+
+    ctx->ga.selected        = (int *)malloc( sizeof(int) * ctx->ga.PopSize );
+    if (ctx->ga.selected == NULL)
+         PGAError(ctx, "PGASetUp: No room to allocate ctx->ga.selected",
+                  PGA_FATAL, PGA_VOID, NULL);
+
+    ctx->ga.sorted          = (int *)malloc( sizeof(int) * ctx->ga.PopSize );
+    if (ctx->ga.sorted == NULL)
+         PGAError(ctx, "PGASetUp: No room to allocate ctx->ga.sorted",
+                  PGA_FATAL, PGA_VOID, NULL);
+
+    ctx->scratch.intscratch = (int *)malloc( sizeof(int) * ctx->ga.PopSize );
+    if (ctx->scratch.intscratch == NULL)
+         PGAError(ctx, "PGASetUp: No room to allocate ctx->scratch.intscratch",
+                  PGA_FATAL, PGA_VOID, NULL);
+
+    ctx->scratch.dblscratch = (double *)malloc(sizeof(double) * ctx->ga.PopSize);
+    if (ctx->scratch.dblscratch == NULL)
+         PGAError(ctx, "PGASetUp: No room to allocate ctx->scratch.dblscratch",
+                  PGA_FATAL, PGA_VOID, NULL);
+
+    PGACreatePop ( ctx , PGA_OLDPOP );
+    PGACreatePop ( ctx , PGA_NEWPOP );
+
+    ctx->rep.starttime = time(NULL);
+
+    PGADebugExited("PGASetUp");
+}
+
+/*U****************************************************************************
+   PGASetRandomInitFlag - A boolean flag to indicate whether to randomly
+   initialize alleles.  Legal values are PGA_TRUE and PGA_FALSE.  Default
+   is PGA_TRUE -- randomly initialize alleles.
+
+   Category: Initialization
+
+   Inputs:
+      ctx  - context variable
+      flag - either PGA_TRUE or PGA_FALSE
+
+   Outputs:
+      None
+
+   Example:
+      Set the initialization routine to initialize all alleles to zero
+
+      PGAContext *ctx;
+      :
+      PGASetRandomInitFlag(ctx,PGA_FALSE);
+
+****************************************************************************U*/
+void PGASetRandomInitFlag(PGAContext *ctx, int RandomBoolean)
+{
+    PGADebugEntered("PGASetRandomInitFlag");
+    PGAFailIfSetUp("PGASetRandomInitFlag");
+
+  switch (RandomBoolean) {
+    case PGA_TRUE:
+    case PGA_FALSE:
+      ctx->init.RandomInit = RandomBoolean;
+      break;
+    default:
+      PGAError(ctx, "PGASetRandomInitFlag: Invalid value of RandomBoolean:",
+               PGA_FATAL, PGA_INT, (void *) &RandomBoolean);
+      break;
+    }
+    PGADebugExited("PGASetRandomInitFlag");
+}
+
+/*U***************************************************************************
+   PGAGetRandomInitFlag - returns true/false to indicate whether or not
+   alleles are randomly initialized.
+
+   Category: Initialization
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      Returns PGA_TRUE if alleles are randomly initialized.
+      Otherwise, returns PGA_FALSE
+
+   Example:
+      PGAContext *ctx;
+      int raninit;
+      :
+      raninit = PGAGetRandomInitFlag(ctx);
+      switch (raninit) {
+      case PGA_TRUE:
+          printf("Population is randomly initialized\n");
+          break;
+      case PGA_FALSE:
+          printf("Population initialized to zero\n");
+          break;
+      }
+
+***************************************************************************U*/
+int PGAGetRandomInitFlag (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetRandomInitFlag");
+
+    PGAFailIfNotSetUp("PGAGetRandomInitFlag");
+
+    PGADebugExited("PGAGetRandomInitFlag");
+
+    return(ctx->init.RandomInit);
+}
+
+
+/*I****************************************************************************
+  PGACreatePop - allocates a population of individuals and calls
+  PGACreateIndividual to set up each one
+
+  Inputs:
+     ctx - context variable
+     pop - symbolic constant of the population to create
+
+  Outputs:
+     None
+
+  Example:
+     PGAContext *ctx;
+     :
+     PGACreatePop(ctx, PGA_NEWPOP);
+
+****************************************************************************I*/
+void PGACreatePop (PGAContext *ctx, int pop)
+{
+     int p, flag;
+
+    PGADebugEntered("PGACreatePop");
+
+     switch (pop)
+     {
+     case PGA_OLDPOP:
+          ctx->ga.oldpop = (PGAIndividual *)malloc(sizeof(PGAIndividual) *
+                                                   (ctx->ga.PopSize + 2));
+          if (ctx->ga.oldpop == NULL)
+               PGAError(ctx, "PGACreatePop: No room to allocate "
+                        "ctx->ga.oldpop", PGA_FATAL, PGA_VOID, NULL);
+          flag = ctx->init.RandomInit;
+          break;
+     case PGA_NEWPOP:
+          ctx->ga.newpop = (PGAIndividual *)malloc(sizeof(PGAIndividual) *
+                                                   (ctx->ga.PopSize + 2));
+          if (ctx->ga.newpop == NULL)
+               PGAError(ctx, "PGACreatePop: No room to allocate "
+                        "ctx->ga.newpop", PGA_FATAL, PGA_VOID, NULL);
+          flag = PGA_FALSE;
+          break;
+     default:
+          PGAError(ctx, "PGACreatePop: Invalid value of pop:", PGA_FATAL,
+                   PGA_INT, (void *) &pop );
+          break;
+     };
+     for (p = 0; p < ctx->ga.PopSize; p++)
+          PGACreateIndividual (ctx, p, pop, flag);
+     PGACreateIndividual (ctx, PGA_TEMP1, pop, PGA_FALSE);
+     PGACreateIndividual (ctx, PGA_TEMP2, pop, PGA_FALSE);
+
+    PGADebugExited("PGACreatePop");
+}
+
+
+/*I****************************************************************************
+  PGACreateIndividual - initialize to zero various data structures of an
+  individual and call the appropriate function to create and initialize the
+  string for the specific data type
+
+  Inputs:
+     ctx      - context variable
+     p        - string index
+     pop      - symbolic constant of the population string p is in
+     initflag - if the value is PGA_TRUE, the string is randomly initialized.
+                Otherwise it is set to zero.
+
+  Outputs:
+     None
+
+  Example:
+     PGAContext *ctx;
+     int p;
+     :
+     PGACreateIndividual(ctx, p, PGA_NEWPOP, PGA_TRUE);
+
+****************************************************************************I*/
+void PGACreateIndividual (PGAContext *ctx, int p, int pop, int initflag)
+{
+    PGAIndividual *ind = PGAGetIndividual(ctx, p, pop);
+
+    PGADebugEntered("PGACreateIndividual");
+
+    ind->evalfunc     = 0.0;
+    ind->fitness      = 0.0;
+    ind->evaluptodate = PGA_FALSE;
+
+    (*ctx->cops.CreateString)(ctx, p, pop, initflag);
+    
+    PGADebugExited("PGACreateIndividual");
+}
Index: trunk/optimizer/src/pgapack/pgapack/source/cross.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/cross.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/cross.c	(revision 816)
@@ -0,0 +1,350 @@
+/*
+ *  
+ *  ********************************************************************* 
+ *  (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+ *  *********************************************************************
+ *  
+ *  This software was authored by
+ *  
+ *  D. Levine
+ *  Mathematics and Computer Science Division Argonne National Laboratory
+ *  Argonne IL 60439
+ *  levine@mcs.anl.gov
+ *  (708) 252-6735
+ *  (708) 252-5986 (FAX)
+ *  
+ *  with programming assistance of participants in Argonne National 
+ *  Laboratory's SERS program.
+ *  
+ *  This program contains material protectable under copyright laws of the 
+ *  United States.  Permission is hereby granted to use it, reproduce it, 
+ *  to translate it into another language, and to redistribute it to 
+ *  others at no charge except a fee for transferring a copy, provided 
+ *  that you conspicuously and appropriately publish on each copy the 
+ *  University of Chicago's copyright notice, and the disclaimer of 
+ *  warranty and Government license included below.  Further, permission 
+ *  is hereby granted, subject to the same provisions, to modify a copy or 
+ *  copies or any portion of it, and to distribute to others at no charge 
+ *  materials containing or derived from the material.
+ *  
+ *  The developers of the software ask that you acknowledge its use in any 
+ *  document referencing work based on the  program, such as published 
+ *  research.  Also, they ask that you supply to Argonne National 
+ *  Laboratory a copy of any published research referencing work based on 
+ *  the software.
+ *  
+ *  Any entity desiring permission for further use must contact:
+ *  
+ *  J. Gleeson
+ *  Industrial Technology Development Center Argonne National Laboratory
+ *  Argonne IL 60439
+ *  gleesonj@smtplink.eid.anl.gov
+ *  (708) 252-6055
+ *  
+ *  ******************************************************************** 
+ *  DISCLAIMER
+ *  
+ *  THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+ *  OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+ *  THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+ *  WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+ *  RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+ *  INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+ *  INFRINGE PRIVATELY OWNED RIGHTS.
+ *  
+ *  ********************************************************************** 
+ *  GOVERNMENT LICENSE
+ *  
+ *  The Government is granted for itself and others acting on its behalf a 
+ *  paid-up, non-exclusive, irrevocable worldwide license in this computer 
+ *  software to reproduce, prepare derivative works, and perform publicly 
+ *  and display publicly.
+ */
+
+/*****************************************************************************
+*     FILE: crossover.c: This file contains the data structure neutral
+*                        crossover routines.
+*
+*     Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle,
+*              Brian P. Walenz
+*****************************************************************************/
+
+#include "pgapack.h"
+
+/*U****************************************************************************
+   PGACrossover - performs crossover on two parent strings to create two
+   child strings (via side-effect).  The type of crossover performed is
+   either the default or that specified by PGASetCrossoverType
+
+   Category: Operators
+
+   Inputs:
+      ctx  - context variable
+      p1   - the first parent string
+      p2   - the second parent string
+      pop1 - symbolic constant of the population containing string p1 and p2
+      c1   - the first child string
+      c2   - the second child string
+      pop2 - symbolic constant of the population to contain string c1 and c2
+
+   Outputs:
+      c1 and c2 in pop2 are children of p1 and p2 in pop1.  p1 and p2 are not
+      modified.
+
+   Example:
+      Perform crossover on the two parent strings mom and dad in population
+      PGA_OLDPOP, and insert the child strings, child1 and child1, in
+      population PGA_NEWPOP.
+
+      PGAContext *ctx;
+      int mom, dad, child1, child2;
+      :
+      PGACrossover(ctx, mom, dad, PGA_OLDPOP, child1, child2, PGA_NEWPOP);
+
+****************************************************************************U*/
+void PGACrossover ( PGAContext *ctx, int p1, int p2, int pop1,
+                    int c1, int c2, int pop2 )
+{
+    int fp1, fp2, fc1, fc2;
+
+    PGADebugEntered("PGACrossover");
+    PGADebugPrint( ctx, PGA_DEBUG_PRINTVAR, "PGACrossover", " p1 = ",
+		  PGA_INT, (void *) &p1 );
+    PGADebugPrint( ctx, PGA_DEBUG_PRINTVAR, "PGACrossover", " p2 = ",
+		  PGA_INT, (void *) &p2 );
+    PGADebugPrint( ctx, PGA_DEBUG_PRINTVAR, "PGACrossover", " c1 = ",
+		  PGA_INT, (void *) &c1 );
+    PGADebugPrint( ctx, PGA_DEBUG_PRINTVAR, "PGACrossover", " c2 = ",
+		  PGA_INT, (void *) &c2 );
+
+    if (ctx->fops.Crossover) {
+	fp1 = ((p1 == PGA_TEMP1) || (p1 == PGA_TEMP2)) ? p1 : p1+1;
+	fp2 = ((p2 == PGA_TEMP1) || (p2 == PGA_TEMP2)) ? p2 : p2+1;
+	fc1 = ((c1 == PGA_TEMP1) || (c1 == PGA_TEMP2)) ? c1 : c1+1;
+	fc2 = ((c2 == PGA_TEMP1) || (c2 == PGA_TEMP2)) ? c2 : c2+1;
+	(*ctx->fops.Crossover)(&ctx, &fp1, &fp2, &pop1, &fc1, &fc2, &pop2);
+    } else {
+	(*ctx->cops.Crossover)(ctx, p1, p2, pop1, c1, c2, pop2);
+    }
+
+    PGASetEvaluationUpToDateFlag(ctx, c1, pop2, PGA_FALSE);
+    PGASetEvaluationUpToDateFlag(ctx, c2, pop2, PGA_FALSE);
+    
+    PGADebugExited("PGACrossover");
+}
+
+/*U***************************************************************************
+   PGAGetCrossoverType - Returns the type of crossover selected
+
+   Category: Operators
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      Returns the integer corresponding to the symbolic constant
+      used to specify the crossover type
+
+   Example:
+      PGAContext *ctx;
+      int crosstype;
+      :
+      crosstype = PGAGetCrossoverType(ctx);
+      switch (crosstype) {
+      case PGA_CROSSOVER_ONEPT:
+          printf("Crossover Type = PGA_CROSSOVER_ONEPT\n");
+          break;
+      case PGA_CROSSOVER_TWOPT:
+          printf("Crossover Type = PGA_CROSSOVER_TWOPT\n");
+          break;
+      case PGA_CROSSOVER_UNIFORM:
+          printf("Crossover Type = PGA_CROSSOVER_UNIFORM\n");
+          break;
+      }
+
+***************************************************************************U*/
+int PGAGetCrossoverType (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetCrossoverType");
+
+    PGAFailIfNotSetUp("PGAGetCrossoverType");
+
+    PGADebugExited("PGAGetCrossoverType");
+
+    return(ctx->ga.CrossoverType);
+}
+
+/*U***************************************************************************
+   PGAGetCrossoverProb - Returns the crossover probability
+
+   Category: Operators
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      The crossover probability
+
+   Example:
+      PGAContext *ctx;
+      double pc;
+      :
+      pc = PGAGetCrossoverProb(ctx);
+
+***************************************************************************U*/
+double PGAGetCrossoverProb (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetCrossoverProb");
+
+    PGAFailIfNotSetUp("PGAGetCrossoverProb");
+
+    PGADebugExited("PGAGetCrossoverProb");
+
+    return(ctx->ga.CrossoverProb);
+}
+
+/*U***************************************************************************
+   PGAGetUniformCrossoverProb - returns the probability of a bit being
+   selected from the first child string in uniform crossover
+
+   Category: Operators
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      The uniform crossover probability
+
+   Example:
+      PGAContext *ctx;
+      double pu;
+      :
+      pu = PGAGetUniformCrossoverProb(ctx);
+
+***************************************************************************U*/
+double PGAGetUniformCrossoverProb (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetUniformCrossoverProb");
+
+    PGAFailIfNotSetUp("PGAGetUniformCrossoverProb");
+
+    PGADebugExited("PGAGetUniformCrossoverProb");
+
+    return(ctx->ga.UniformCrossProb);
+}
+
+/*U****************************************************************************
+   PGASetCrossoverType - specify the type of crossover to use. Valid choices
+   are PGA_CROSSOVER_ONEPT, PGA_CROSSOVER_TWOPT, or PGA_CROSSOVER_UNIFORM for
+   one-point, two-point, and uniform crossover, respectively.  The default is
+   PGA_CROSSOVER_TWOPT.
+
+   Category: Operators
+
+   Inputs:
+      ctx            - context variable
+      crossover_type - symbolic constant to specify crossover type
+
+   Outputs:
+      None
+
+   Example:
+      Use uniform crossover when crossingover strings.
+
+      PGAContext *ctx;
+      :
+      PGASetCrossoverType(ctx, PGA_CROSSOVER_UNIFORM);
+
+****************************************************************************U*/
+void PGASetCrossoverType (PGAContext *ctx, int crossover_type)
+{
+
+    PGADebugEntered("PGASetCrossoverType");
+
+    switch (crossover_type) {
+        case PGA_CROSSOVER_ONEPT:
+        case PGA_CROSSOVER_TWOPT:
+        case PGA_CROSSOVER_UNIFORM:
+            ctx->ga.CrossoverType = crossover_type;
+            break;
+        default:
+            PGAError( ctx,
+                     "PGASetCrossoverType: Invalid value of crossover_type:",
+                      PGA_FATAL, PGA_INT, (void *) &crossover_type );
+    };
+
+    PGADebugExited("PGASetCrossoverType");
+}
+
+
+/*U****************************************************************************
+   PGASetCrossoverProb - Probability that a selected string will undergo
+   crossover.  The default is 0.85.
+
+   Category: Operators
+
+   Inputs:
+      ctx - context variable
+      p   - the crossover probability
+
+   Outputs:
+      None
+
+   Example:
+      Make crossover happen infrequently.
+
+      PGAContext *ctx;
+      :
+      PGASetCrossoverProb(ctx,0.001);
+
+****************************************************************************U*/
+void PGASetCrossoverProb( PGAContext *ctx, double crossover_prob)
+{
+    PGADebugEntered("PGASetCrossoverProb");
+
+    if ((crossover_prob < 0.0) || (crossover_prob > 1.0))
+        PGAError ( ctx,
+                  "PGASetCrossoverProb: Invalid value of crossover_prob:",
+                   PGA_FATAL, PGA_DOUBLE, (void *) &crossover_prob);
+    else
+        ctx->ga.CrossoverProb = crossover_prob;
+
+    PGADebugExited("PGASetCrossoverProb");
+}
+
+/*U****************************************************************************
+   PGASetUniformCrossoverProb - Probability used in uniform crossover
+   to specify that an allele value value be selected from a particular
+   parent. The default is 0.6.  The crossover type must have been set
+   to PGA_CROSSOVER_UNIFORM with PGASetCrossoverType for this function
+   call to have any effect.
+
+   Category: Operators
+
+   Inputs:
+      ctx - context variable
+      p   - the crossover probability
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx;
+      :
+      PGASetUniformCrossoverProb(ctx,0.9);
+
+****************************************************************************U*/
+void PGASetUniformCrossoverProb( PGAContext *ctx, double uniform_cross_prob)
+{
+    PGADebugEntered("PGASetUniformCrossoverProb");
+
+    if ((uniform_cross_prob < 0.0) || (uniform_cross_prob > 1.0))
+        PGAError ( ctx,
+                  "PGASetUniformCrossoverProb: Invalid value of "
+                  "uniform_cross_prob:", PGA_FATAL, PGA_DOUBLE,
+                  (void *) &uniform_cross_prob);
+    else
+        ctx->ga.UniformCrossProb = uniform_cross_prob;
+
+    PGADebugExited("PGASetUniformCrossoverProb");
+}
Index: trunk/optimizer/src/pgapack/pgapack/source/debug.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/debug.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/debug.c	(revision 816)
@@ -0,0 +1,1573 @@
+/*
+ *  
+ *  ********************************************************************* 
+ *  (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+ *  *********************************************************************
+ *  
+ *  This software was authored by
+ *  
+ *  D. Levine
+ *  Mathematics and Computer Science Division Argonne National Laboratory
+ *  Argonne IL 60439
+ *  levine@mcs.anl.gov
+ *  (708) 252-6735
+ *  (708) 252-5986 (FAX)
+ *  
+ *  with programming assistance of participants in Argonne National 
+ *  Laboratory's SERS program.
+ *  
+ *  This program contains material protectable under copyright laws of the 
+ *  United States.  Permission is hereby granted to use it, reproduce it, 
+ *  to translate it into another language, and to redistribute it to 
+ *  others at no charge except a fee for transferring a copy, provided 
+ *  that you conspicuously and appropriately publish on each copy the 
+ *  University of Chicago's copyright notice, and the disclaimer of 
+ *  warranty and Government license included below.  Further, permission 
+ *  is hereby granted, subject to the same provisions, to modify a copy or 
+ *  copies or any portion of it, and to distribute to others at no charge 
+ *  materials containing or derived from the material.
+ *  
+ *  The developers of the software ask that you acknowledge its use in any 
+ *  document referencing work based on the  program, such as published 
+ *  research.  Also, they ask that you supply to Argonne National 
+ *  Laboratory a copy of any published research referencing work based on 
+ *  the software.
+ *  
+ *  Any entity desiring permission for further use must contact:
+ *  
+ *  J. Gleeson
+ *  Industrial Technology Development Center Argonne National Laboratory
+ *  Argonne IL 60439
+ *  gleesonj@smtplink.eid.anl.gov
+ *  (708) 252-6055
+ *  
+ *  ******************************************************************** 
+ *  DISCLAIMER
+ *  
+ *  THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+ *  OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+ *  THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+ *  WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+ *  RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+ *  INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+ *  INFRINGE PRIVATELY OWNED RIGHTS.
+ *  
+ *  ********************************************************************** 
+ *  GOVERNMENT LICENSE
+ *  
+ *  The Government is granted for itself and others acting on its behalf a 
+ *  paid-up, non-exclusive, irrevocable worldwide license in this computer 
+ *  software to reproduce, prepare derivative works, and perform publicly 
+ *  and display publicly.
+ */
+
+/*****************************************************************************
+*     FILE: debug.c: This file contains routines for debugging
+*
+*     Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle,
+*              Brian P. Walenz
+******************************************************************************/
+
+#include "pgapack.h"
+
+/******************************************************************************
+ We need two numbering schemes:
+
+   (1) A list of debug levels (numbers) the user types to get certain types
+       of prints
+   (2) A unique integer debug value for each routine
+
+ The way this works is that the user specified debug level, which we
+ arbitrarily restrict to be an integer between 1--100, is mapped to a
+ set of actual debug values which are in the range of 101--inf
+
+ Note that the set of debuglevels we define for the user are between 0--100,
+ and that all *real* values for a routine (each routine has a debug value
+ associated with it) are > 100 and < PGA_DEBUG_NUMFLAGS
+
+  0 Trace all debug prints
+
+  1 Reserved for the user
+    :                   :
+ 10 Reserved for the user
+ 11 Trace high-level functions
+ 12 Trace all function entries
+ 13 Trace all function exits
+
+ 20 Trace high-level parallel functions
+ 21 Trace all parallel functions
+ 22 Trace all send calls (PGA_DEBUG_SEND)
+ 23 Trace all receive calls (PGA_DEBUG_RECV)
+
+ 30 Trace BINARY    functions
+ 32 Trace INTEGER   functions
+ 34 Trace REAL      functions
+ 36 Trace CHARACTER functions
+
+ 40 Trace population creation functions
+ 42 Trace select functions
+ 44 Trace mutation functions
+ 46 Trace crossover functions
+ 48 Trace function evaluation functions
+ 50 Trace fitness calculation  functions
+ 52 Trace duplicate checking functions
+ 54 Trace restart functions
+ 56 Trace reporting functions
+ 58 Trace stopping functions
+ 60 Trace sorting functions
+ 62 Trace random number functions
+ 64 Trace system routines
+ 66 Trace utility functions
+
+ 80 Trace memory allocations
+ 82 Trace variable print statements
+******************************************************************************/
+
+#if OPTIMIZE==0
+typedef struct
+{
+        char    PGAFuncName[36];
+        int     PGAFuncNum;
+} PGAFuncRec;
+
+int        PGANumFcns;
+
+PGAFuncRec PGAFuncIndex[PGA_DEBUG_MAXPGAPACKFUNCTIONS] =
+{
+/* Binary Routines 100 - 149 */
+        { "PGABinaryCreateString",          100 },
+        { "PGABinaryMutation",              101 },
+        { "PGABinaryOneptCrossover",        102 },
+        { "PGABinaryTwoptCrossover",        103 },
+        { "PGABinaryUniformCrossover",      104 },
+        { "PGABinaryPrintString",           105 },
+        { "PGABinaryCopyString",            106 },
+        { "PGABinaryDuplicate",             107 },
+        { "PGABinaryInitString",            108 },
+        { "PGABinaryBuildDatatype",         109 },
+        { "PGASetBinaryAllele",             110 },
+        { "PGAGetBinaryAllele",             111 },
+        { "PGABinaryHammingDistance",       120 },
+        { "PGABinaryPrint",                 121 },
+        { "PGAGetBinaryInitProb",           122 },
+        { "PGASetBinaryInitProb",           123 },
+
+/* Integer Routines 150 - 199 */
+        { "PGAIntegerCreateString",         150 },
+        { "PGAIntegerMutation",             151 },
+        { "PGAIntegerOneptCrossover",       152 },
+        { "PGAIntegerTwoptCrossover",       153 },
+        { "PGAIntegerUniformCrossover",     154 },
+        { "PGAIntegerPrintString",          155 },
+        { "PGAIntegerCopyString",           156 },
+        { "PGAIntegerDuplicate",            157 },
+        { "PGAIntegerInitString",           158 },
+        { "PGAIntegerBuildDatatype",        159 },
+        { "PGASetIntegerAllele",            160 },
+        { "PGAGetIntegerAllele",            161 },
+        { "PGASetIntegerInitPermute",       170 },
+        { "PGASetIntegerInitRange",         171 },
+        { "PGAGetIntegerInitType",          172 },
+        { "PGAGetMinIntegerInitValue",      173 },
+        { "PGAGetMaxIntegerInitValue",      174 },
+
+/* Real Routines 200 - 249 */
+        { "PGARealCreateString",            200 },
+        { "PGARealMutation",                201 },
+        { "PGARealOneptCrossover",          202 },
+        { "PGARealTwoptCrossover",          203 },
+        { "PGARealUniformCrossover",        204 },
+        { "PGARealPrintString",             205 },
+        { "PGARealCopyString",              206 },
+        { "PGARealDuplicate",               207 },
+        { "PGARealInitString",              208 },
+        { "PGARealBuildDatatype",           209 },
+        { "PGASetRealAllele",               210 },
+        { "PGAGetRealAllele",               211 },
+        { "PGASetRealInitPercent",          220 },
+        { "PGASetRealInitRange",            221 },
+        { "PGAGetMinRealInitValue",         222 },
+        { "PGAGetMaxRealInitValue",         223 },
+
+/* Character Routines 250 - 299 */
+        { "PGACharacterCreateString",       250 },
+        { "PGACharacterMutation",           251 },
+        { "PGACharacterOneptCrossover",     252 },
+        { "PGACharacterTwoptCrossover",     253 },
+        { "PGACharacterUniformCrossover",   254 },
+        { "PGACharacterPrintString",        255 },
+        { "PGACharacterCopyString",         256 },
+        { "PGACharacterDuplicate",          257 },
+        { "PGACharacterInitString",         258 },
+        { "PGACharacterBuildDatatype",      259 },
+        { "PGASetCharacterAllele",          260 },
+        { "PGAGetCharacterAllele",          261 },
+        { "PGASetCharacterInitType",        270 },
+
+/* Operators Routines 300 - 499 */
+        /* create.c */
+        { "PGACreate",                      300 },
+        { "PGASetUp",                       301 },
+        { "PGACreatePop",                   302 },
+        { "PGACreateIndividual",            303 },
+        { "PGAGetRandomInitFlag",           304 },
+        { "PGASetRandomInitFlag",           305 },
+
+        /* cross.c */
+        { "PGACrossover",                   310 },
+        { "PGAGetCrossoverType",            311 },
+        { "PGAGetCrossoverProb",            312 },
+        { "PGAGetUniformCrossoverProb",     313 },
+        { "PGASetCrossoverType",            314 },
+        { "PGASetCrossoverProb",            315 },
+        { "PGASetUniformCrossoverProb",     316 },
+
+        /* pop.c */
+        { "PGASortPop",                     320 },
+        { "PGAGetPopSize",                  321 },
+        { "PGAGetNumReplaceValue",          322 },
+        { "PGAGetPopReplaceType",           323 },
+        { "PGAGetSortedPopIndex",           324 },
+        { "PGASetPopSize",                  325 },
+        { "PGASetNumReplaceValue",          326 },
+        { "PGASetPopReplaceType",           327 },
+
+        /* mutation.c */
+        { "PGAMutate",                      330 },
+        { "PGAGetMutationType",             331 },
+        { "PGAGetMutationRealValue",        332 },
+        { "PGAGetMutationIntegerValue",     333 },
+        { "PGAGetMutationProb",             334 },
+        { "PGASetMutationType",             335 },
+        { "PGASetMutationRealValue",        336 },
+        { "PGASetMutationIntegerValue",     337 },
+        { "PGASetMutationProb",             338 },
+        { "PGASetMutationBoundedFlag",      400 },  /* 400--499 */
+        { "PGAGetMutationBoundedFlag",      401 },  /* 400--499 */
+
+        /* duplcate.c */
+        { "PGADuplicate",                   340 },
+        { "PGAChange",                      341 },
+        { "PGASetNoDuplicatesFlag",         342 },
+        { "PGAGetNoDuplicatesFlag",         343 },
+
+        /* pga.c */
+        { "PGARunMutationAndCrossover",     350 },
+        { "PGARunMutationOrCrossover",      351 },
+        { "PGAUpdateGeneration",            352 },
+        { "PGAGetDataType",                 353 },
+        { "PGAGetOptDirFlag",               354 },
+        { "PGAGetStringLength",             355 },
+        { "PGAGetGAIterValue",              356 },
+        { "PGAGetMutationOrCrossoverFlag",  357 },
+        { "PGAGetMutationAndCrossoverFlag", 358 },
+        { "PGASetMutationOrCrossoverFlag",  359 },
+        { "PGASetMutationAndCrossoverFlag", 360 },
+        { "PGARun",                         361 },
+
+        /* restart.c */
+        { "PGARestart",                     370 },
+        { "PGAGetRestartFlag",              371 },
+        { "PGAGetRestartFrequencyValue",    372 },
+        { "PGAGetRestartAlleleChangeProb",  373 },
+        { "PGASetRestartFlag",              374 },
+        { "PGASetRestartFrequencyValue",    375 },
+        { "PGASetRestartAlleleChangeProb",  376 },
+
+        /* select.c */
+        { "PGASelect",                      380 },
+        { "PGASelectProportional",          381 },
+        { "PGASelectSUS",                   382 },
+        { "PGASelectTournament",            383 },
+        { "PGASelectPTournament",           384 },
+        { "PGASelectNextIndex",             385 },
+        { "PGAGetSelectType",               386 },
+        { "PGAGetPTournamentProb",          387 },
+        { "PGASetSelectType",               388 },
+        { "PGASetPTournamentProb",          389 },
+
+        /* stop.c */
+        { "PGAGetStoppingRuleType",         390 },
+        { "PGASetStoppingRuleType",         391 },
+        { "PGAGetMaxGAIterValue",           392 },
+        { "PGASetMaxGAIterValue",           393 },
+        { "PGACheckStoppingConditions",     394 },
+        { "PGASetMaxNoChangeValue",         395 },
+        { "PGASetMaxSimilarityValue",       396 },
+	{ "PGADone",                        397 },
+
+/* Fitness and Evaluation Routines 500 - 599 */
+        /* evaluate.c */
+        { "PGAGetRealFromBinary",           500 },
+        { "PGAGetRealFromGrayCode",         501 },
+        { "PGAEncodeRealAsBinary",          502 },
+        { "PGAEncodeRealAsGrayCode",        503 },
+        { "PGAMapIntegerToReal",            504 },
+        { "PGAMapRealToInteger",            505 },
+        { "PGAEncodeIntegerAsBinary",       506 },
+        { "PGAEncodeIntegerAsGrayCode",     507 },
+        { "PGAGetIntegerFromBinary",        508 },
+        { "PGAGetIntegerFromGrayCode",      509 },
+        { "PGAEvaluate",                    510 },
+	{ "PGAEvaluateSeq",                 515 },
+	{ "PGAEvaluateCoop",                516 },
+	{ "PGAEvaluateSlave",               517 },
+        { "PGASetEvaluation",               511 },
+        { "PGASetEvaluationUpToDateFlag",   512 },
+        { "PGAGetEvaluation",               513 },
+        { "PGAGetEvaluationUpToDateFlag",   514 },
+
+        /* fitness.c */
+        { "PGAFitness",                     520 },
+        { "PGAFitnessLinearNormal",         521 },
+        { "PGAFitnessLinearRank",           522 },
+        { "PGAFitnessMinReciprocal",        523 },
+        { "PGAFitnessMinCmax",              524 },
+        { "PGARank",                        525 },
+        { "PGAGetFitness",                  526 },
+        { "PGAGetFitnessType",              527 },
+        { "PGAGetFitnessMinType",           528 },
+        { "PGAGetMaxFitnessRank",           529 },
+        { "PGASetFitnessType",              530 },
+        { "PGASetFitnessMinType",           531 },
+        { "PGASetMaxFitnessRank",           532 },
+        { "PGASetFitnessCmaxValue",         533 },
+        { "PGAGetFitnessCmaxValue",         534 },
+
+/* Parallel Routines 600 - 699 */
+        { "PGABuildDatatype",               600 },
+        { "PGASendIndividual",              601 },
+        { "PGAReceiveIndividual",           602 },
+        { "PGASendReceiveIndividual",       603 },
+        { "PGAEvaluateMS",                  605 },
+        { "PGAGetRank",                     607 },
+        { "PGAGetNumProcs",                 608 },
+        { "PGASetCommunicator",             609 },
+        { "PGAGetCommunicator",             610 },
+        { "PGASetNumIslands",               611 },
+        { "PGAGetNumIslands",               612 },
+        { "PGASetNumDemes",                 613 },
+        { "PGAGetNumDemes",                 614 },
+        { "PGARunGM",                       615 },
+        { "PGARunIM",                       616 },
+        { "PGARunNM",                       617 },
+
+/* System and Utility 700 - 799 */
+        /* system.c */
+        { "PGAError",                       700 },
+        { "PGAUsage",                       702 },
+        { "PGAPrintVersionNumber",          703 },
+        { "PGAGetMaxMachineIntValue",       704 },
+        { "PGAGetMinMachineIntValue",       705 },
+        { "PGAGetMaxMachineDoubleValue",    706 },
+        { "PGAGetMinMachineDoubleValue",    707 },
+        { "PGADestroy",                     708 },
+
+        /* utility.c */
+        { "PGAMean",                        710 },
+        { "PGAStddev",                      711 },
+        { "PGACopyIndividual",              712 },
+        { "PGARound",                       713 },
+        { "PGACheckSum",                    714 },
+        { "PGAGetWorstIndex",               715 },
+        { "PGAGetBestIndex",                716 },
+        { "PGAGetIndividual",               717 },
+        { "PGAUpdateAverage",               718 },
+        { "PGAUpdateOnline",                719 },
+        { "PGAUpdateOffline",               720 },
+        { "PGAComputeSimilarity",           721 },
+
+        /* cmdline.c */
+        { "PGAReadCmdLine",                 730 },
+        { "PGAParseDebugArg",               731 },
+        { "PGAStripArgs",                   732 },
+
+        /* debug.c */
+        { "PGADebugPrint",                  740 },
+        { "PGAGetDebugFlag",                741 },
+        { "PGAPrintDebugOptions",           743 },
+        { "PGASetDebugLevel",               744 },
+
+        /* random.c */
+        { "PGARandomFlip",                  750 },
+        { "PGARandomInterval",              751 },
+        { "PGARandom01",                    752 },
+        { "PGARandomUniform",               753 },
+        { "PGARandomGaussian",              754 },
+        { "PGAGetRandomSeed",               755 },
+        { "PGASetRandomSeed",               756 },
+
+/* Miscellaneous Routines 800 - 899 */
+        /* hamming.c */
+        { "PGAHammingDistance",             800 },
+
+        /* heap.c */
+        { "PGADblHeapSort",                 810 },
+        { "PGADblHeapify",                  811 },
+        { "PGADblAdjustHeap",               812 },
+        { "PGAIntHeapSort",                 813 },
+        { "PGAIntHeapify",                  814 },
+        { "PGAIntAdjustHeap",               815 },
+
+        /* report.c */
+        { "PGAPrintPopulation",             820 },
+        { "PGAPrintIndividual",             821 },
+        { "PGAPrintReport",                 822 },
+        { "PGAPrintContextVariable",        823 },
+        { "PGAPrintString",                 824 },
+        { "PGAGetPrintFrequencyValue",      825 },
+        { "PGASetPrintFrequencyValue",      826 },
+        { "PGASetPrintOptions",             827 },
+
+        /* user.c */
+        { "PGASetUserFunction",             830 }
+};
+
+
+/*I****************************************************************************
+   PGASortDebugIndex - Sort the index of function names alphabetically.
+
+   Inputs:
+
+   Output:
+
+   Example:
+
+****************************************************************************I*/
+void PGASortFuncNameIndex(PGAContext *ctx)
+{
+
+    /*  See how many functions are in the index */
+    for (PGANumFcns=0; PGAFuncIndex[PGANumFcns].PGAFuncName[0]; PGANumFcns++) ;
+
+    qsort(PGAFuncIndex, PGANumFcns, sizeof(PGAFuncRec),
+	  (int (*) (const void *, const void *)) &strcmp);
+}
+
+
+/*U****************************************************************************
+  PGADebugPrint - Write debugging information
+
+  Category: Debugging
+
+  Inputs:
+     ctx       - context variable
+     level     - a symbolic constant that maps to the type of print requested
+                 (e.g., an entry or exit print).  Valid values are
+                 PGA_DEBUG_ENTERED, PGA_DEBUG_EXIT, PGA_DEBUG_MALLOC,
+                 PGA_DEBUG_PRINTVAR, PGA_DEBUG_SEND, and PGA_DEBUG_RECV.
+     funcname  - the name of the function that called this routine
+     msg       - message to print
+     datatype  - a symbolic constant that maps to the data type of the
+                 parameter data.  Valid choices are PGA_INT, PGA_DOUBLE,
+                 PGA_CHAR and PGA_VOID (no data).
+     data      - a pointer, whose contents will be interpreted based upon the
+                 datatype parameter (or NULL, if PGA_VOID).
+
+  Outputs:
+     The debugging information is printed to stderr.
+
+  Example:
+     If the debugging level includes printing variables (level 82), print the
+     value of the integer variable num as a debugging tool in the routine
+     Add2Nums
+
+     PGAContext *ctx;
+     int num;
+     :
+     PGADebugPrint(ctx, PGA_DEBUG_PRINTVAR, "Add2Nums", "num = ", PGA_INT,
+                   (void *) &num);
+
+****************************************************************************U*/
+void PGADebugPrint( PGAContext *ctx, int level, char *funcname,
+                   char *msg, int datatype, void *data )
+{
+     int rank;
+
+     /*  Added check if level > 10 so that PGAGetDebugFlag is only called
+      *  if it is _not_ a user debug level.
+      */
+
+     if (ctx->debug.PGADebugFlags[0]     ||
+         ctx->debug.PGADebugFlags[level] ||
+         ((level > 10) && PGAGetDebugFlag (ctx, funcname)))
+     {
+          MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+          switch (datatype)
+          {
+          case PGA_VOID:
+               fprintf(stdout, "%4d: %-32s: %s\n", rank, funcname, msg);
+               break;
+          case PGA_INT:
+               switch (*(int *) data)
+               {
+               case PGA_TEMP1:
+                    fprintf(stdout, "%4d: %-32s: %s PGA_TEMP1\n", rank,
+                            funcname, msg);
+                    break;
+               case PGA_TEMP2:
+                    fprintf(stdout, "%4d: %-32s: %s PGA_TEMP2\n", rank,
+                            funcname, msg);
+                    break;
+               case PGA_OLDPOP:
+                    fprintf(stdout, "%4d: %-32s: %s PGA_OLDPOP\n", rank,
+                            funcname, msg);
+                    break;
+               case PGA_NEWPOP:
+                    fprintf(stdout, "%4d: %-32s: %s PGA_NEWPOP\n", rank,
+                            funcname, msg);
+                    break;
+               default:
+                    fprintf(stdout, "%4d: %-32s: %s %d\n", rank, funcname, msg,
+                            *(int *) data);
+                    break;
+               }
+               break;
+          case PGA_DOUBLE:
+               fprintf(stdout, "%4d: %-32s: %s %e\n", rank,
+                       funcname, msg, *(double *) data);
+               break;
+          case PGA_CHAR:
+               fprintf(stdout, "%4d: %-32s: %s %s\n", rank,
+                       funcname, msg,  (char *) data);
+               break;
+          default:
+               fprintf(stderr, "PGADebugPrint: Invalid value of datatype: %d",
+                       datatype);
+               exit(-1);
+               break;
+          }
+     }
+}
+
+/*U****************************************************************************
+   PGASetDebugLevel - Turn on a debug level.  Only valid if PGAPack
+   was compiled to include debugging calls.  See the user guide for details.
+
+   Category: Debugging
+
+   Inputs:
+      ctx   - context variable
+      level - the debug level to set to PGA_TRUE.
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx;
+      :
+      PGASetDebugLevel(ctx, 70)
+
+****************************************************************************U*/
+void PGASetDebugLevel(PGAContext *ctx, int level)
+{
+    if ((level < 11) || (level > 100)) {
+        ctx->debug.PGADebugFlags[level] = PGA_TRUE;
+    } else {
+        /*  Call the appropriate routine to clear the set of levels.  */
+        switch (level) {
+        case 11:  PGASetDebugFlag11(ctx, PGA_TRUE); break;
+        case 20:  PGASetDebugFlag20(ctx, PGA_TRUE); break;
+        case 21:  PGASetDebugFlag21(ctx, PGA_TRUE); break;
+        case 30:  PGASetDebugFlag30(ctx, PGA_TRUE); break;
+        case 32:  PGASetDebugFlag32(ctx, PGA_TRUE); break;
+        case 34:  PGASetDebugFlag34(ctx, PGA_TRUE); break;
+        case 36:  PGASetDebugFlag36(ctx, PGA_TRUE); break;
+        case 40:  PGASetDebugFlag40(ctx, PGA_TRUE); break;
+        case 42:  PGASetDebugFlag42(ctx, PGA_TRUE); break;
+        case 44:  PGASetDebugFlag44(ctx, PGA_TRUE); break;
+        case 46:  PGASetDebugFlag46(ctx, PGA_TRUE); break;
+        case 48:  PGASetDebugFlag48(ctx, PGA_TRUE); break;
+        case 50:  PGASetDebugFlag50(ctx, PGA_TRUE); break;
+        case 52:  PGASetDebugFlag52(ctx, PGA_TRUE); break;
+        case 54:  PGASetDebugFlag54(ctx, PGA_TRUE); break;
+        case 56:  PGASetDebugFlag56(ctx, PGA_TRUE); break;
+        case 58:  PGASetDebugFlag58(ctx, PGA_TRUE); break;
+        case 60:  PGASetDebugFlag60(ctx, PGA_TRUE); break;
+        case 62:  PGASetDebugFlag62(ctx, PGA_TRUE); break;
+        case 64:  PGASetDebugFlag64(ctx, PGA_TRUE); break;
+        case 66:  PGASetDebugFlag66(ctx, PGA_TRUE); break;
+        }
+    }
+}
+
+/*U****************************************************************************
+   PGAClearDebugLevel - Turn off a debul level.  Only valid if PGAPack
+   was compiled to include debugging calls.  See the user guide for details.
+
+   Category: Debugging
+
+   Inputs:
+      ctx   - context variable
+      level - the debug level to set to PGA_FALSE.
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx;
+      :
+      PGAClearDebugLevel(ctx, 70)
+
+****************************************************************************U*/
+void PGAClearDebugLevel(PGAContext *ctx, int level)
+{
+    if ((level < 11) || (level > 100)) {
+        ctx->debug.PGADebugFlags[level] = PGA_FALSE;
+    } else {
+        /*  Call the appropriate routine to clear the set of levels.  */
+        switch (level) {
+        case 11:  PGASetDebugFlag11(ctx, PGA_FALSE); break;
+        case 20:  PGASetDebugFlag20(ctx, PGA_FALSE); break;
+        case 21:  PGASetDebugFlag21(ctx, PGA_FALSE); break;
+        case 30:  PGASetDebugFlag30(ctx, PGA_FALSE); break;
+        case 32:  PGASetDebugFlag32(ctx, PGA_FALSE); break;
+        case 34:  PGASetDebugFlag34(ctx, PGA_FALSE); break;
+        case 36:  PGASetDebugFlag36(ctx, PGA_FALSE); break;
+        case 40:  PGASetDebugFlag40(ctx, PGA_FALSE); break;
+        case 42:  PGASetDebugFlag42(ctx, PGA_FALSE); break;
+        case 44:  PGASetDebugFlag44(ctx, PGA_FALSE); break;
+        case 46:  PGASetDebugFlag46(ctx, PGA_FALSE); break;
+        case 48:  PGASetDebugFlag48(ctx, PGA_FALSE); break;
+        case 50:  PGASetDebugFlag50(ctx, PGA_FALSE); break;
+        case 52:  PGASetDebugFlag52(ctx, PGA_FALSE); break;
+        case 54:  PGASetDebugFlag54(ctx, PGA_FALSE); break;
+        case 56:  PGASetDebugFlag56(ctx, PGA_FALSE); break;
+        case 58:  PGASetDebugFlag58(ctx, PGA_FALSE); break;
+        case 60:  PGASetDebugFlag60(ctx, PGA_FALSE); break;
+        case 62:  PGASetDebugFlag62(ctx, PGA_FALSE); break;
+        case 64:  PGASetDebugFlag64(ctx, PGA_FALSE); break;
+        case 66:  PGASetDebugFlag66(ctx, PGA_FALSE); break;
+        }
+    }
+}
+
+/*U****************************************************************************
+   PGASetDebugLevelByName - Turn on debugging of the named function.
+
+   Category: Debugging
+
+   Inputs:
+       ctx        - context variable
+       funcname   - name of the function to turn on debugging output
+
+   Outputs:
+
+   Example:
+       PGAContext *ctx;
+       :
+       PGASetDebugLevelByName(ctx, "PGAGetBinaryAllele");
+
+****************************************************************************U*/
+void PGASetDebugLevelByName(PGAContext *ctx, char *funcname)
+{
+    int  level;
+
+    level = PGAGetDebugLevelOfName(ctx, funcname);
+    ctx->debug.PGADebugFlags[level] = PGA_TRUE;
+}
+
+/*U****************************************************************************
+   PGAClearDebugLevelByName - Turn off debugging of the named function.
+
+   Category: Debugging
+
+   Inputs:
+       ctx        - context variable
+       funcname   - name of the function to turn on debugging output
+
+   Outputs:
+
+   Example:
+       PGAContext *ctx;
+       :
+       PGAClearDebugLevelByName(ctx, "PGAGetBinaryAllele");
+
+****************************************************************************U*/
+void PGAClearDebugLevelByName(PGAContext *ctx, char *funcname)
+{
+    int  level;
+
+    level = PGAGetDebugLevelOfName(ctx, funcname);
+    ctx->debug.PGADebugFlags[level] = PGA_FALSE;
+}
+
+
+/*I****************************************************************************
+   PGAGetDebugLevelOfName - returns the debug level of the named function
+   Internally, it performs a binary search on the run-time sorted list of
+   fucntions in PGAFuncIndex.
+
+   Inputs:
+       ctx       - context variable
+       funcname  - the name of the function
+
+   Outputs:
+       The debug level value of the function.  That is, PGAFuncNum associated
+       with funcname in PGAFuncIndex.
+
+   Example:
+
+
+****************************************************************************I*/
+int PGAGetDebugLevelOfName(PGAContext *ctx, char *funcname)
+{
+    int     l, h;
+    int     m, missing;
+
+    /*  Binary Search  */
+    l = 0;
+    h = PGANumFcns-1;
+    while (l <= h) {
+	m = (l+h)/2 + (l+h)%2;  /*  Actually, floor((l+h)/2)  */
+	missing = strcmp(funcname, PGAFuncIndex[m].PGAFuncName);
+
+        if (missing == 0) {
+            break;
+        } else {
+            if (missing < 0) {
+                h = m - 1;
+            } else {
+                l = m + 1;
+            }
+        }
+    }
+
+    if (missing) {
+	fprintf(stderr, "PGAGetDebugFlag: Function missing from "
+		"PGAFuncIndex: '%s'\n", funcname);
+	PGADestroy(ctx);
+	exit(-1);
+    } 
+
+    return(PGAFuncIndex[m].PGAFuncNum);
+}
+
+/*I****************************************************************************
+  PGAGetDebugFlag - checks whether the flag to do a debug print in routine
+  funcname has been set.  Returns PGA_TRUE if so, otherwise PGA_FALSE.
+  If the name is not in the function name database, an error message is
+  printed and the program terminates.
+
+  Inputs:
+     ctx      - context variable
+     funcname - name of the function in question
+
+  Outputs:
+
+  Example:
+     PGAContext *ctx;
+     int IsItSet;
+
+     IsItSet = PGAGetDebugFlag(ctx, "PGAGetDebugFlags");
+
+****************************************************************************I*/
+int PGAGetDebugFlag(PGAContext *ctx, char *funcname)
+{
+     int level;
+
+     level = PGAGetDebugLevelOfName(ctx, funcname);
+     return ctx->debug.PGADebugFlags[level];
+}
+
+
+/*I****************************************************************************
+   PGASetDebugFlag11 - Set the debug flags for all functions at debug level 11
+
+   Inputs:
+       ctx  - Context variable
+       Flag - PGA_TRUE to enable or PGA_FALSE to disable
+
+   Outputs:
+
+   Example:
+
+****************************************************************************I*/
+void PGASetDebugFlag11(PGAContext *ctx, int Flag)
+{
+   ctx->debug.PGADebugFlags[300] = Flag; /*PGACreate*/
+   ctx->debug.PGADebugFlags[301] = Flag; /*PGASetUp*/
+   ctx->debug.PGADebugFlags[304] = Flag; /*PGAGetRandomInitFlag*/
+   ctx->debug.PGADebugFlags[305] = Flag; /*PGASetRandomInitFlag*/
+
+   ctx->debug.PGADebugFlags[310] = Flag; /*PGACrossover*/
+   ctx->debug.PGADebugFlags[311] = Flag; /*PGAGetCrossoverType*/
+   ctx->debug.PGADebugFlags[312] = Flag; /*PGAGetCrossoverProb*/
+   ctx->debug.PGADebugFlags[313] = Flag; /*PGAGetUniformCrossoverProb*/
+   ctx->debug.PGADebugFlags[314] = Flag; /*PGASetCrossoverType*/
+   ctx->debug.PGADebugFlags[315] = Flag; /*PGASetCrossoverProb*/
+   ctx->debug.PGADebugFlags[316] = Flag; /*PGASetUniformCrossoverProb*/
+
+   ctx->debug.PGADebugFlags[320] = Flag; /*PGASort*/
+   ctx->debug.PGADebugFlags[321] = Flag; /*PGAGetPopSize*/
+   ctx->debug.PGADebugFlags[322] = Flag; /*PGAGetNumReplaceValue*/
+   ctx->debug.PGADebugFlags[323] = Flag; /*PGAGetPopReplaceType*/
+   ctx->debug.PGADebugFlags[325] = Flag; /*PGASetPopSize*/
+   ctx->debug.PGADebugFlags[326] = Flag; /*PGASetNumReplaceValue*/
+   ctx->debug.PGADebugFlags[327] = Flag; /*PGASetPopReplaceType*/
+
+   ctx->debug.PGADebugFlags[330] = Flag; /*PGAMutate*/
+   ctx->debug.PGADebugFlags[331] = Flag; /*PGAGetMutationType*/
+   ctx->debug.PGADebugFlags[332] = Flag; /*PGAGetMutationRealValue*/
+   ctx->debug.PGADebugFlags[333] = Flag; /*PGAGetMutationIntegerValue*/
+   ctx->debug.PGADebugFlags[334] = Flag; /*PGAGetMutationProb*/
+   ctx->debug.PGADebugFlags[335] = Flag; /*PGASetMutationType*/
+   ctx->debug.PGADebugFlags[336] = Flag; /*PGASetMutationRealValue*/
+   ctx->debug.PGADebugFlags[337] = Flag; /*PGASetMutationIntegerValue*/
+   ctx->debug.PGADebugFlags[338] = Flag; /*PGASetMutationProb*/
+   ctx->debug.PGADebugFlags[400] = Flag; /*PGASetMutationBoundedFlag*/
+   ctx->debug.PGADebugFlags[401] = Flag; /*PGAGetMutationBoundedFlag*/
+
+   ctx->debug.PGADebugFlags[340] = Flag; /*PGADuplicate*/
+   ctx->debug.PGADebugFlags[341] = Flag; /*PGAChange*/
+   ctx->debug.PGADebugFlags[342] = Flag; /*PGASetNoDuplicatesFlag*/
+   ctx->debug.PGADebugFlags[343] = Flag; /*PGAGetNoDuplicatesFlag*/
+
+   ctx->debug.PGADebugFlags[350] = Flag; /*PGARunMutationAndCrossover*/
+   ctx->debug.PGADebugFlags[351] = Flag; /*PGARunMutationOrCrossover*/
+   ctx->debug.PGADebugFlags[352] = Flag; /*PGAUpdateGeneration*/
+   ctx->debug.PGADebugFlags[353] = Flag; /*PGAGetDataType*/
+   ctx->debug.PGADebugFlags[354] = Flag; /*PGAGetOptDirFlag*/
+   ctx->debug.PGADebugFlags[355] = Flag; /*PGAGetStringLength*/
+   ctx->debug.PGADebugFlags[356] = Flag; /*PGAGetGAIterValue*/
+   ctx->debug.PGADebugFlags[357] = Flag; /*PGAGetMutationOrCrossoverFlag*/
+   ctx->debug.PGADebugFlags[358] = Flag; /*PGAGetMutationAndCrossoverFlag*/
+   ctx->debug.PGADebugFlags[359] = Flag; /*PGASetMutationOrCrossoverFlag*/
+   ctx->debug.PGADebugFlags[360] = Flag; /*PGASetMutationAndCrossoverFlag*/
+   ctx->debug.PGADebugFlags[361] = Flag; /*PGARun*/
+
+   ctx->debug.PGADebugFlags[370] = Flag; /*PGARestart*/
+   ctx->debug.PGADebugFlags[371] = Flag; /*PGAGetRestartFlag*/
+   ctx->debug.PGADebugFlags[372] = Flag; /*PGAGetRestartFrequencyValue*/
+   ctx->debug.PGADebugFlags[373] = Flag; /*PGAGetRestartAlleleChangeProb*/
+   ctx->debug.PGADebugFlags[374] = Flag; /*PGASetRestartFlag*/
+   ctx->debug.PGADebugFlags[375] = Flag; /*PGASetRestartFrequencyValue*/
+   ctx->debug.PGADebugFlags[376] = Flag; /*PGASetRestartAlleleChangeProb*/
+
+   ctx->debug.PGADebugFlags[380] = Flag; /*PGASelect*/
+   ctx->debug.PGADebugFlags[386] = Flag; /*PGAGetSelectType*/
+   ctx->debug.PGADebugFlags[387] = Flag; /*PGAGetPTournamentProb*/
+   ctx->debug.PGADebugFlags[388] = Flag; /*PGASetSelectType*/
+   ctx->debug.PGADebugFlags[389] = Flag; /*PGASetPTournamentProb*/
+
+   ctx->debug.PGADebugFlags[390] = Flag; /*PGAGetStoppingRuleType*/
+   ctx->debug.PGADebugFlags[391] = Flag; /*PGASetStoppingRuleType*/
+   ctx->debug.PGADebugFlags[392] = Flag; /*PGAGetMaxGAIterValue*/
+   ctx->debug.PGADebugFlags[393] = Flag; /*PGASetMaxGAIterValue*/
+   ctx->debug.PGADebugFlags[394] = Flag; /*PGACheckStoppingConditions*/
+   ctx->debug.PGADebugFlags[395] = Flag; /*PGASetMaxNoChangeValue*/
+   ctx->debug.PGADebugFlags[396] = Flag; /*PGASetMaxSimilarityValue*/
+   ctx->debug.PGADebugFlags[397] = Flag; /*PGADone*/
+
+   ctx->debug.PGADebugFlags[510] = Flag; /*PGAEvaluate*/
+
+   ctx->debug.PGADebugFlags[520] = Flag; /*PGAFitness*/
+   ctx->debug.PGADebugFlags[527] = Flag; /*PGAGetFitnessType*/
+   ctx->debug.PGADebugFlags[528] = Flag; /*PGAGetFitnessMinType*/
+   ctx->debug.PGADebugFlags[529] = Flag; /*PGAGetMaxFitnessRank*/
+   ctx->debug.PGADebugFlags[530] = Flag; /*PGASetFitnessType*/
+   ctx->debug.PGADebugFlags[531] = Flag; /*PGASetFitnessMinType*/
+   ctx->debug.PGADebugFlags[532] = Flag; /*PGASetMaxFitnessRank*/
+   ctx->debug.PGADebugFlags[533] = Flag; /*PGASetFitnessCmaxValue*/
+   ctx->debug.PGADebugFlags[534] = Flag; /*PGAGetFitnessCmaxValue*/
+
+   ctx->debug.PGADebugFlags[604] = Flag; /*PGARunMS*/
+   ctx->debug.PGADebugFlags[605] = Flag; /*PGAEvaluateMS*/
+   ctx->debug.PGADebugFlags[606] = Flag; /*PGAEvaluateDoneMS*/
+   ctx->debug.PGADebugFlags[607] = Flag; /*PGAGetRank*/
+   ctx->debug.PGADebugFlags[608] = Flag; /*PGAGetNumProcs*/
+   ctx->debug.PGADebugFlags[609] = Flag; /*PGASetCommunicator*/
+   ctx->debug.PGADebugFlags[610] = Flag; /*PGAGetCommunicator*/
+   ctx->debug.PGADebugFlags[611] = Flag; /*PGASetNumIslands*/
+   ctx->debug.PGADebugFlags[612] = Flag; /*PGAGetNumIslands*/
+   ctx->debug.PGADebugFlags[613] = Flag; /*PGASetNumDemes*/
+   ctx->debug.PGADebugFlags[614] = Flag; /*PGAGetNumDemes*/
+   ctx->debug.PGADebugFlags[615] = Flag; /*PGARunSeq*/
+   ctx->debug.PGADebugFlags[616] = Flag; /*PGARunIM*/
+   ctx->debug.PGADebugFlags[617] = Flag; /*PGARunNM*/
+
+   ctx->debug.PGADebugFlags[700] = Flag; /*PGAError*/
+   ctx->debug.PGADebugFlags[702] = Flag; /*PGAUsage*/
+   ctx->debug.PGADebugFlags[703] = Flag; /*PGAPrintVersionNumber*/
+   ctx->debug.PGADebugFlags[704] = Flag; /*PGAGetMaxMachineIntValue*/
+   ctx->debug.PGADebugFlags[705] = Flag; /*PGAGetMinMachineIntValue*/
+   ctx->debug.PGADebugFlags[706] = Flag; /*PGAGetMaxMachineRealValue*/
+   ctx->debug.PGADebugFlags[707] = Flag; /*PGAGetMinMachineRealValue*/
+   ctx->debug.PGADebugFlags[708] = Flag; /*PGADestroy*/
+
+   ctx->debug.PGADebugFlags[741] = Flag; /*PGAGetDebugFlag*/
+   ctx->debug.PGADebugFlags[742] = Flag; /*PGASetDebugFlag*/
+   ctx->debug.PGADebugFlags[743] = Flag; /*PGAPrintDebugOptions*/
+
+   ctx->debug.PGADebugFlags[800] = Flag; /*PGAHammingDistance*/
+
+   ctx->debug.PGADebugFlags[820] = Flag; /*PGAPrintPopulation*/
+   ctx->debug.PGADebugFlags[822] = Flag; /*PGAPrintReport*/
+   ctx->debug.PGADebugFlags[823] = Flag; /*PGAContextVariable*/
+   ctx->debug.PGADebugFlags[825] = Flag; /*PGAGetPrintFrequencyValue*/
+   ctx->debug.PGADebugFlags[826] = Flag; /*PGASetPrintFrequencyValue*/
+   ctx->debug.PGADebugFlags[827] = Flag; /*PGASetPrintOptions*/
+
+   ctx->debug.PGADebugFlags[830] = Flag; /*PGASetUserFunction*/
+}
+
+/*I****************************************************************************
+   PGASetDebugFlag20 - Set the debug flags for all functions at debug level 20
+
+   Inputs:
+       ctx  - Context variable
+       Flag - PGA_TRUE to enable or PGA_FALSE to disable
+
+   Outputs:
+
+   Example:
+
+****************************************************************************I*/
+void PGASetDebugFlag20(PGAContext *ctx, int Flag)
+{
+   ctx->debug.PGADebugFlags[604] = Flag; /*PGARunMS*/
+   ctx->debug.PGADebugFlags[605] = Flag; /*PGAEvaluateMS*/
+   ctx->debug.PGADebugFlags[606] = Flag; /*PGAEvaluateDoneMS*/
+   ctx->debug.PGADebugFlags[607] = Flag; /*PGAGetRank*/
+   ctx->debug.PGADebugFlags[608] = Flag; /*PGAGetNumProcs*/
+   ctx->debug.PGADebugFlags[609] = Flag; /*PGASetCommunicator*/
+   ctx->debug.PGADebugFlags[610] = Flag; /*PGAGetCommunicator*/
+   ctx->debug.PGADebugFlags[611] = Flag; /*PGASetNumIslands*/
+   ctx->debug.PGADebugFlags[612] = Flag; /*PGAGetNumIslands*/
+   ctx->debug.PGADebugFlags[613] = Flag; /*PGASetNumDemes*/
+   ctx->debug.PGADebugFlags[614] = Flag; /*PGAGetNumDemes*/
+   ctx->debug.PGADebugFlags[616] = Flag; /*PGARunIM*/
+   ctx->debug.PGADebugFlags[617] = Flag; /*PGARunNM*/
+}
+
+/*I****************************************************************************
+   PGASetDebugFlag21 - Set the debug flags for all functions at debug level 21
+
+   Inputs:
+       ctx  - Context variable
+       Flag - PGA_TRUE to enable or PGA_FALSE to disable
+
+   Outputs:
+
+   Example:
+
+****************************************************************************I*/
+void PGASetDebugFlag21(PGAContext *ctx, int Flag)
+{
+   ctx->debug.PGADebugFlags[600] = Flag; /*PGABuildDataType*/
+   ctx->debug.PGADebugFlags[601] = Flag; /*PGASendIndividual*/
+   ctx->debug.PGADebugFlags[602] = Flag; /*PGAReceiveIndividual*/
+   ctx->debug.PGADebugFlags[603] = Flag; /*PGASendReceiveIndividual*/
+   ctx->debug.PGADebugFlags[604] = Flag; /*PGARunMS*/
+   ctx->debug.PGADebugFlags[605] = Flag; /*PGAEvaluateMS*/
+   ctx->debug.PGADebugFlags[606] = Flag; /*PGAEvaluateDoneMS*/
+   ctx->debug.PGADebugFlags[607] = Flag; /*PGAGetRank*/
+   ctx->debug.PGADebugFlags[608] = Flag; /*PGAGetNumProcs*/
+   ctx->debug.PGADebugFlags[609] = Flag; /*PGASetCommunicator*/
+   ctx->debug.PGADebugFlags[610] = Flag; /*PGAGetCommunicator*/
+   ctx->debug.PGADebugFlags[611] = Flag; /*PGASetNumIslands*/
+   ctx->debug.PGADebugFlags[612] = Flag; /*PGAGetNumIslands*/
+   ctx->debug.PGADebugFlags[613] = Flag; /*PGASetNumDemes*/
+   ctx->debug.PGADebugFlags[614] = Flag; /*PGAGetNumDemes*/
+   ctx->debug.PGADebugFlags[616] = Flag; /*PGARunIM*/
+   ctx->debug.PGADebugFlags[617] = Flag; /*PGARunNM*/
+   ctx->debug.PGADebugFlags[714] = Flag; /*PGACheckSum*/
+}
+
+/*I****************************************************************************
+   PGASetDebugFlag30 - Set the debug flags for all functions at debug level 30
+
+   Inputs:
+       ctx  - Context variable
+       Flag - PGA_TRUE to enable or PGA_FALSE to disable
+
+   Outputs:
+
+   Example:
+
+****************************************************************************I*/
+void PGASetDebugFlag30(PGAContext *ctx, int Flag)
+{
+   ctx->debug.PGADebugFlags[100] = Flag; /*PGABinaryCreateString*/
+   ctx->debug.PGADebugFlags[101] = Flag; /*PGABinaryMutation*/
+   ctx->debug.PGADebugFlags[102] = Flag; /*PGABinaryOneptCrossover*/
+   ctx->debug.PGADebugFlags[103] = Flag; /*PGABinaryTwoptCrossover*/
+   ctx->debug.PGADebugFlags[104] = Flag; /*PGABinaryUniformCrossover*/
+   ctx->debug.PGADebugFlags[105] = Flag; /*PGABinaryPrintString*/
+   ctx->debug.PGADebugFlags[106] = Flag; /*PGABinaryCopyString*/
+   ctx->debug.PGADebugFlags[107] = Flag; /*PGABinaryDuplicate*/
+   ctx->debug.PGADebugFlags[108] = Flag; /*PGABinaryInitString*/
+   ctx->debug.PGADebugFlags[109] = Flag; /*PGABinaryBuildDatatype*/
+   ctx->debug.PGADebugFlags[110] = Flag; /*PGASetBinaryAllele*/
+   ctx->debug.PGADebugFlags[111] = Flag; /*PGAGetBinaryAllele*/
+   ctx->debug.PGADebugFlags[120] = Flag; /*PGABinaryHammingDistance*/
+   ctx->debug.PGADebugFlags[121] = Flag; /*PGABinaryPrint*/
+   ctx->debug.PGADebugFlags[122] = Flag; /*PGAGetBinaryInitProb*/
+   ctx->debug.PGADebugFlags[123] = Flag; /*PGASetBinaryInitProb*/
+}
+
+/*I****************************************************************************
+   PGASetDebugFlag32 - Set the debug flags for all functions at debug level 32
+
+   Inputs:
+       ctx  - Context variable
+       Flag - PGA_TRUE to enable or PGA_FALSE to disable
+
+   Outputs:
+
+   Example:
+
+****************************************************************************I*/
+void PGASetDebugFlag32(PGAContext *ctx, int Flag)
+{
+   ctx->debug.PGADebugFlags[150] = Flag; /*PGAIntegerCreateString*/
+   ctx->debug.PGADebugFlags[151] = Flag; /*PGAIntegerMutation*/
+   ctx->debug.PGADebugFlags[152] = Flag; /*PGAIntegerOneptCrossover*/
+   ctx->debug.PGADebugFlags[153] = Flag; /*PGAIntegerTwoptCrossover*/
+   ctx->debug.PGADebugFlags[154] = Flag; /*PGAIntegerUniformCrossover*/
+   ctx->debug.PGADebugFlags[155] = Flag; /*PGAIntegerPrintString*/
+   ctx->debug.PGADebugFlags[156] = Flag; /*PGAIntegerCopyString*/
+   ctx->debug.PGADebugFlags[157] = Flag; /*PGAIntegerDuplicate*/
+   ctx->debug.PGADebugFlags[158] = Flag; /*PGAIntegerInitString*/
+   ctx->debug.PGADebugFlags[159] = Flag; /*PGAIntegerBuildDatatype*/
+   ctx->debug.PGADebugFlags[160] = Flag; /*PGASetIntegerAllele*/
+   ctx->debug.PGADebugFlags[161] = Flag; /*PGAGetIntegerAllele*/
+   ctx->debug.PGADebugFlags[170] = Flag; /*PGASetIntegerInitPermute*/
+   ctx->debug.PGADebugFlags[171] = Flag; /*PGASetIntegerInitRange*/
+   ctx->debug.PGADebugFlags[172] = Flag; /*PGAGetIntegerInitType*/
+   ctx->debug.PGADebugFlags[173] = Flag; /*PGAGetMinIntegerInitValue*/
+   ctx->debug.PGADebugFlags[174] = Flag; /*PGAGetMaxIntegerInitValue*/
+   ctx->debug.PGADebugFlags[400] = Flag; /*PGASetMutationBoundedFlag*/
+   ctx->debug.PGADebugFlags[401] = Flag; /*PGAGetMutationBoundedFlag*/
+}
+
+/*I****************************************************************************
+   PGASetDebugFlag34 - Set the debug flags for all functions at debug level 34
+
+   Inputs:
+       ctx  - Context variable
+       Flag - PGA_TRUE to enable or PGA_FALSE to disable
+
+   Outputs:
+
+   Example:
+
+****************************************************************************I*/
+void PGASetDebugFlag34(PGAContext *ctx, int Flag)
+{
+   ctx->debug.PGADebugFlags[200] = Flag; /*PGARealCreateString*/
+   ctx->debug.PGADebugFlags[201] = Flag; /*PGARealMutation*/
+   ctx->debug.PGADebugFlags[202] = Flag; /*PGARealOneptCrossover*/
+   ctx->debug.PGADebugFlags[203] = Flag; /*PGARealTwoptCrossover*/
+   ctx->debug.PGADebugFlags[204] = Flag; /*PGARealUniformCrossover*/
+   ctx->debug.PGADebugFlags[205] = Flag; /*PGARealPrintString*/
+   ctx->debug.PGADebugFlags[206] = Flag; /*PGARealCopyString*/
+   ctx->debug.PGADebugFlags[207] = Flag; /*PGARealDuplicate*/
+   ctx->debug.PGADebugFlags[208] = Flag; /*PGARealInitString*/
+   ctx->debug.PGADebugFlags[209] = Flag; /*PGARealBuildDatatype*/
+   ctx->debug.PGADebugFlags[210] = Flag; /*PGASetRealAllele*/
+   ctx->debug.PGADebugFlags[211] = Flag; /*PGAGetRealAllele*/
+   ctx->debug.PGADebugFlags[220] = Flag; /*PGASetRealInitPercent*/
+   ctx->debug.PGADebugFlags[221] = Flag; /*PGASetRealInitRange*/
+   ctx->debug.PGADebugFlags[222] = Flag; /*PGAGetMinRealInitValue*/
+   ctx->debug.PGADebugFlags[223] = Flag; /*PGAGetMaxRealInitValue*/
+}
+
+/*I****************************************************************************
+   PGASetDebugFlag36 - Set the debug flags for all functions at debug level 36
+
+   Inputs:
+       ctx  - Context variable
+       Flag - PGA_TRUE to enable or PGA_FALSE to disable
+
+   Outputs:
+
+   Example:
+
+****************************************************************************I*/
+void PGASetDebugFlag36(PGAContext *ctx, int Flag)
+{
+   ctx->debug.PGADebugFlags[250] = Flag; /*PGACharacterCreateString*/
+   ctx->debug.PGADebugFlags[251] = Flag; /*PGACharacterMutation*/
+   ctx->debug.PGADebugFlags[252] = Flag; /*PGACharacterOneptCrossover*/
+   ctx->debug.PGADebugFlags[253] = Flag; /*PGACharacterTwoptCrossover*/
+   ctx->debug.PGADebugFlags[254] = Flag; /*PGACharacterUniformCrossover*/
+   ctx->debug.PGADebugFlags[255] = Flag; /*PGACharacterPrintString*/
+   ctx->debug.PGADebugFlags[256] = Flag; /*PGACharacterCopyString*/
+   ctx->debug.PGADebugFlags[257] = Flag; /*PGACharacterDuplicate*/
+   ctx->debug.PGADebugFlags[258] = Flag; /*PGACharacterInitString*/
+   ctx->debug.PGADebugFlags[259] = Flag; /*PGACharacterBuildDatatype*/
+   ctx->debug.PGADebugFlags[260] = Flag; /*PGASetCharacterAllele*/
+   ctx->debug.PGADebugFlags[261] = Flag; /*PGAGetCharacterAllele*/
+   ctx->debug.PGADebugFlags[270] = Flag; /*PGASetCharacterInitType*/
+}
+
+/*I****************************************************************************
+   PGASetDebugFlag40 - Set the debug flags for all functions at debug level 40
+
+   Inputs:
+       ctx  - Context variable
+       Flag - PGA_TRUE to enable or PGA_FALSE to disable
+
+   Outputs:
+
+   Example:
+
+****************************************************************************I*/
+void PGASetDebugFlag40(PGAContext *ctx, int Flag)
+{
+   ctx->debug.PGADebugFlags[100] = Flag; /*PGABinaryCreateString*/
+   ctx->debug.PGADebugFlags[108] = Flag; /*PGABinaryInitString*/
+   ctx->debug.PGADebugFlags[122] = Flag; /*PGAGetBinaryInitProb*/
+   ctx->debug.PGADebugFlags[123] = Flag; /*PGASetBinaryInitProb*/
+   ctx->debug.PGADebugFlags[250] = Flag; /*PGACharacterCreateString*/
+   ctx->debug.PGADebugFlags[258] = Flag; /*PGACharacterInitString*/
+   ctx->debug.PGADebugFlags[270] = Flag; /*PGASetCharacterInitType*/
+   ctx->debug.PGADebugFlags[300] = Flag; /*PGACreate*/
+   ctx->debug.PGADebugFlags[301] = Flag; /*PGASetUp*/
+   ctx->debug.PGADebugFlags[302] = Flag; /*PGACreatePop*/
+   ctx->debug.PGADebugFlags[303] = Flag; /*PGACreateIndividual*/
+   ctx->debug.PGADebugFlags[304] = Flag; /*PGAGetRandomInitFlag*/
+   ctx->debug.PGADebugFlags[305] = Flag; /*PGASetRandomInitFlag*/
+   ctx->debug.PGADebugFlags[150] = Flag; /*PGAIntegerCreateString*/
+   ctx->debug.PGADebugFlags[158] = Flag; /*PGAIntegerInitString*/
+   ctx->debug.PGADebugFlags[170] = Flag; /*PGASetIntegerInitPermute*/
+   ctx->debug.PGADebugFlags[171] = Flag; /*PGASetIntegerInitRange*/
+   ctx->debug.PGADebugFlags[172] = Flag; /*PGAGetIntegerInitType*/
+   ctx->debug.PGADebugFlags[173] = Flag; /*PGAGetMinIntegerInitValue*/
+   ctx->debug.PGADebugFlags[174] = Flag; /*PGAGetMaxIntegerInitValue*/
+   ctx->debug.PGADebugFlags[200] = Flag; /*PGARealCreateString*/
+   ctx->debug.PGADebugFlags[208] = Flag; /*PGARealInitString*/
+   ctx->debug.PGADebugFlags[220] = Flag; /*PGASetRealInitPercent*/
+   ctx->debug.PGADebugFlags[221] = Flag; /*PGASetRealInitRange*/
+   ctx->debug.PGADebugFlags[222] = Flag; /*PGAGetMinRealInitValue*/
+   ctx->debug.PGADebugFlags[223] = Flag; /*PGAGetMaxRealInitValue*/
+}
+
+/*I****************************************************************************
+   PGASetDebugFlag42 - Set the debug flags for all functions at debug level 42
+
+   Inputs:
+       ctx  - Context variable
+       Flag - PGA_TRUE to enable or PGA_FALSE to disable
+
+   Outputs:
+
+   Example:
+
+****************************************************************************I*/
+void PGASetDebugFlag42(PGAContext *ctx, int Flag)
+{
+   ctx->debug.PGADebugFlags[380] = Flag; /*PGASelect*/
+   ctx->debug.PGADebugFlags[381] = Flag; /*PGASelectProportional*/
+   ctx->debug.PGADebugFlags[382] = Flag; /*PGASelectSUS*/
+   ctx->debug.PGADebugFlags[383] = Flag; /*PGASelectTournament*/
+   ctx->debug.PGADebugFlags[384] = Flag; /*PGASelectPTournament*/
+   ctx->debug.PGADebugFlags[385] = Flag; /*PGASelectNextIndex*/
+   ctx->debug.PGADebugFlags[386] = Flag; /*PGAGetSelectType*/
+   ctx->debug.PGADebugFlags[387] = Flag; /*PGAGetPTournamentProb*/
+   ctx->debug.PGADebugFlags[388] = Flag; /*PGASetSelectType*/
+   ctx->debug.PGADebugFlags[389] = Flag; /*PGASetPTournamentProb*/
+}
+
+/*I****************************************************************************
+   PGASetDebugFlag44 - Set the debug flags for all functions at debug level 44
+
+   Inputs:
+       ctx  - Context variable
+       Flag - PGA_TRUE to enable or PGA_FALSE to disable
+
+   Outputs:
+
+   Example:
+
+****************************************************************************I*/
+void PGASetDebugFlag44(PGAContext *ctx, int Flag)
+{
+   ctx->debug.PGADebugFlags[101] = Flag; /*PGABinaryMutation*/
+   ctx->debug.PGADebugFlags[151] = Flag; /*PGAIntegerMutation*/
+   ctx->debug.PGADebugFlags[201] = Flag; /*PGARealMutation*/
+   ctx->debug.PGADebugFlags[251] = Flag; /*PGACharacterMutation*/
+   ctx->debug.PGADebugFlags[330] = Flag; /*PGAMutate*/
+   ctx->debug.PGADebugFlags[331] = Flag; /*PGAGetMutationType*/
+   ctx->debug.PGADebugFlags[332] = Flag; /*PGAGetMutationRealValue*/
+   ctx->debug.PGADebugFlags[333] = Flag; /*PGAGetMutationIntegerValue*/
+   ctx->debug.PGADebugFlags[334] = Flag; /*PGAGetMutationProb*/
+   ctx->debug.PGADebugFlags[335] = Flag; /*PGASetMutationType*/
+   ctx->debug.PGADebugFlags[336] = Flag; /*PGASetMutationRealValue*/
+   ctx->debug.PGADebugFlags[337] = Flag; /*PGASetMutationIntegerValue*/
+   ctx->debug.PGADebugFlags[338] = Flag; /*PGASetMutationProb*/
+   ctx->debug.PGADebugFlags[400] = Flag; /*PGASetMutationBoundedFlag*/
+   ctx->debug.PGADebugFlags[401] = Flag; /*PGAGetMutationBoundedFlag*/
+}
+
+/*I****************************************************************************
+   PGASetDebugFlag46 - Set the debug flags for all functions at debug level 46
+
+   Inputs:
+       ctx  - Context variable
+       Flag - PGA_TRUE to enable or PGA_FALSE to disable
+
+   Outputs:
+
+   Example:
+
+****************************************************************************I*/
+void PGASetDebugFlag46(PGAContext *ctx, int Flag)
+{
+   ctx->debug.PGADebugFlags[102] = Flag; /*PGABinaryOneptCrossover*/
+   ctx->debug.PGADebugFlags[103] = Flag; /*PGABinaryTwoptCrossover*/
+   ctx->debug.PGADebugFlags[104] = Flag; /*PGABinaryUniformCrossover*/
+   ctx->debug.PGADebugFlags[152] = Flag; /*PGAIntegerOneptCrossover*/
+   ctx->debug.PGADebugFlags[153] = Flag; /*PGAIntegerTwoptCrossover*/
+   ctx->debug.PGADebugFlags[154] = Flag; /*PGAIntegerUniformCrossover*/
+   ctx->debug.PGADebugFlags[202] = Flag; /*PGARealOneptCrossover*/
+   ctx->debug.PGADebugFlags[203] = Flag; /*PGARealTwoptCrossover*/
+   ctx->debug.PGADebugFlags[204] = Flag; /*PGARealUniformCrossover*/
+   ctx->debug.PGADebugFlags[252] = Flag; /*PGACharacterOneptCrossover*/
+   ctx->debug.PGADebugFlags[253] = Flag; /*PGACharacterTwoptCrossover*/
+   ctx->debug.PGADebugFlags[254] = Flag; /*PGACharacterUniformCrossover*/
+   ctx->debug.PGADebugFlags[310] = Flag; /*PGACrossover*/
+   ctx->debug.PGADebugFlags[311] = Flag; /*PGAGetCrossoverType*/
+   ctx->debug.PGADebugFlags[312] = Flag; /*PGAGetCrossoverProb*/
+   ctx->debug.PGADebugFlags[313] = Flag; /*PGAGetUniformCrossoverProb*/
+   ctx->debug.PGADebugFlags[314] = Flag; /*PGASetCrossoverType*/
+   ctx->debug.PGADebugFlags[315] = Flag; /*PGASetCrossoverProb*/
+   ctx->debug.PGADebugFlags[316] = Flag; /*PGASetUniformCrossoverProb*/
+}
+
+/*I****************************************************************************
+   PGASetDebugFlag48 - Set the debug flags for all functions at debug level 48
+
+   Inputs:
+       ctx  - Context variable
+       Flag - PGA_TRUE to enable or PGA_FALSE to disable
+
+   Outputs:
+
+   Example:
+
+****************************************************************************I*/
+void PGASetDebugFlag48(PGAContext *ctx, int Flag)
+{
+   ctx->debug.PGADebugFlags[110] = Flag; /*PGASetBinaryAllele*/
+   ctx->debug.PGADebugFlags[111] = Flag; /*PGAGetBinaryAllele*/
+   ctx->debug.PGADebugFlags[160] = Flag; /*PGASetIntegerAllele*/
+   ctx->debug.PGADebugFlags[161] = Flag; /*PGAGetIntegerAllele*/
+   ctx->debug.PGADebugFlags[210] = Flag; /*PGASetRealAllele*/
+   ctx->debug.PGADebugFlags[211] = Flag; /*PGAGetRealAllele*/
+   ctx->debug.PGADebugFlags[260] = Flag; /*PGASetCharacterAllele*/
+   ctx->debug.PGADebugFlags[261] = Flag; /*PGAGetCharacterAllele*/
+   ctx->debug.PGADebugFlags[500] = Flag; /*PGAGetRealFromBinary*/
+   ctx->debug.PGADebugFlags[501] = Flag; /*PGAGetRealFromGrayCode*/
+   ctx->debug.PGADebugFlags[502] = Flag; /*PGAEncodeRealAsBinary*/
+   ctx->debug.PGADebugFlags[503] = Flag; /*PGAEncodeRealAsGrayCode*/
+   ctx->debug.PGADebugFlags[504] = Flag; /*PGAMapIntegerToReal*/
+   ctx->debug.PGADebugFlags[505] = Flag; /*PGAMapRealToInteger*/
+   ctx->debug.PGADebugFlags[506] = Flag; /*PGAEncodeIntegerAsBinary*/
+   ctx->debug.PGADebugFlags[507] = Flag; /*PGAEncodeIntegerAsGrayCode*/
+   ctx->debug.PGADebugFlags[508] = Flag; /*PGAGetIntegerFromBinary*/
+   ctx->debug.PGADebugFlags[509] = Flag; /*PGAGetIntegerFromGrayCode*/
+   ctx->debug.PGADebugFlags[510] = Flag; /*PGAEvaluate*/
+   ctx->debug.PGADebugFlags[511] = Flag; /*PGASetEvaluation*/
+   ctx->debug.PGADebugFlags[512] = Flag; /*PGASetEvaluationUpToDateFlag*/
+   ctx->debug.PGADebugFlags[513] = Flag; /*PGAGetEvaluation*/
+   ctx->debug.PGADebugFlags[514] = Flag; /*PGAGetEvaluationUpToDateFlag*/
+   ctx->debug.PGADebugFlags[605] = Flag; /*PGAEvaluateMS*/
+   ctx->debug.PGADebugFlags[715] = Flag; /*PGAGetWorstIndex*/
+   ctx->debug.PGADebugFlags[716] = Flag; /*PGAGetBestIndex*/
+}
+
+/*I****************************************************************************
+   PGASetDebugFlag50 - Set the debug flags for all functions at debug level 50
+
+   Inputs:
+       ctx  - Context variable
+       Flag - PGA_TRUE to enable or PGA_FALSE to disable
+
+   Outputs:
+
+   Example:
+
+****************************************************************************I*/
+void PGASetDebugFlag50(PGAContext *ctx, int Flag)
+{
+   ctx->debug.PGADebugFlags[520] = Flag; /*PGAFitness*/
+   ctx->debug.PGADebugFlags[521] = Flag; /*PGAFitnessLinearNormal*/
+   ctx->debug.PGADebugFlags[522] = Flag; /*PGAFitnessLinearRank*/
+   ctx->debug.PGADebugFlags[523] = Flag; /*PGAFitnessMinReciprocal*/
+   ctx->debug.PGADebugFlags[524] = Flag; /*PGAFitnessMinCmax*/
+   ctx->debug.PGADebugFlags[525] = Flag; /*PGARank*/
+   ctx->debug.PGADebugFlags[526] = Flag; /*PGAGetFitness*/
+   ctx->debug.PGADebugFlags[527] = Flag; /*PGAGetFitnessType*/
+   ctx->debug.PGADebugFlags[528] = Flag; /*PGAGetFitnessMinType*/
+   ctx->debug.PGADebugFlags[529] = Flag; /*PGAGetMaxFitnessRank*/
+   ctx->debug.PGADebugFlags[530] = Flag; /*PGASetFitnessType*/
+   ctx->debug.PGADebugFlags[531] = Flag; /*PGASetFitnessMinType*/
+   ctx->debug.PGADebugFlags[532] = Flag; /*PGASetMaxFitnessRank*/
+   ctx->debug.PGADebugFlags[533] = Flag; /*PGASetFitnessCmaxValue*/
+   ctx->debug.PGADebugFlags[534] = Flag; /*PGAGetFitnessCmaxValue*/
+}
+
+/*I****************************************************************************
+   PGASetDebugFlag52 - Set the debug flags for all functions at debug level 52
+
+   Inputs:
+       ctx  - Context variable
+       Flag - PGA_TRUE to enable or PGA_FALSE to disable
+
+   Outputs:
+
+   Example:
+
+****************************************************************************I*/
+void PGASetDebugFlag52(PGAContext *ctx, int Flag)
+{
+   ctx->debug.PGADebugFlags[107] = Flag; /*PGABinaryDuplicate*/
+   ctx->debug.PGADebugFlags[157] = Flag; /*PGAIntegerDuplicate*/
+   ctx->debug.PGADebugFlags[207] = Flag; /*PGARealDuplicate*/
+   ctx->debug.PGADebugFlags[257] = Flag; /*PGACharacterDuplicate*/
+   ctx->debug.PGADebugFlags[340] = Flag; /*PGADuplicate*/
+   ctx->debug.PGADebugFlags[341] = Flag; /*PGAChange*/
+   ctx->debug.PGADebugFlags[342] = Flag; /*PGASetNoDuplicatesFlag*/
+   ctx->debug.PGADebugFlags[343] = Flag; /*PGAGetNoDuplicatesFlag*/
+}
+
+/*I****************************************************************************
+   PGASetDebugFlag54 - Set the debug flags for all functions at debug level 54
+
+   Inputs:
+       ctx  - Context variable
+       Flag - PGA_TRUE to enable or PGA_FALSE to disable
+
+   Outputs:
+
+   Example:
+
+****************************************************************************I*/
+void PGASetDebugFlag54(PGAContext *ctx, int Flag)
+{
+   ctx->debug.PGADebugFlags[370] = Flag; /*PGARestart*/
+   ctx->debug.PGADebugFlags[371] = Flag; /*PGAGetRestartFlag*/
+   ctx->debug.PGADebugFlags[372] = Flag; /*PGAGetRestartFrequencyValue*/
+   ctx->debug.PGADebugFlags[373] = Flag; /*PGAGetRestartAlleleChangeProb*/
+   ctx->debug.PGADebugFlags[374] = Flag; /*PGASetRestartFlag*/
+   ctx->debug.PGADebugFlags[375] = Flag; /*PGASetRestartFrequencyValue*/
+   ctx->debug.PGADebugFlags[376] = Flag; /*PGASetRestartAlleleChangeProb*/
+}
+
+/*I****************************************************************************
+   PGASetDebugFlag56 - Set the debug flags for all functions at debug level 56
+
+   Inputs:
+       ctx  - Context variable
+       Flag - PGA_TRUE to enable or PGA_FALSE to disable
+
+   Outputs:
+
+   Example:
+
+****************************************************************************I*/
+void PGASetDebugFlag56(PGAContext *ctx, int Flag)
+{
+   ctx->debug.PGADebugFlags[105] = Flag; /*PGABinaryPrintString*/
+   ctx->debug.PGADebugFlags[121] = Flag; /*PGABinaryPrint*/
+   ctx->debug.PGADebugFlags[155] = Flag; /*PGAIntegerPrintString*/
+   ctx->debug.PGADebugFlags[205] = Flag; /*PGARealPrintString*/
+   ctx->debug.PGADebugFlags[255] = Flag; /*PGACharacterPrintString*/
+   ctx->debug.PGADebugFlags[820] = Flag; /*PGAPrintPopulation*/
+   ctx->debug.PGADebugFlags[821] = Flag; /*PGAPrintIndividual*/
+   ctx->debug.PGADebugFlags[822] = Flag; /*PGAPrintReport*/
+   ctx->debug.PGADebugFlags[823] = Flag; /*PGAPrintContextVariable*/
+   ctx->debug.PGADebugFlags[824] = Flag; /*PGAPrintString*/
+   ctx->debug.PGADebugFlags[825] = Flag; /*PGAGetPrintFrequencyValue*/
+   ctx->debug.PGADebugFlags[826] = Flag; /*PGASetPrintFrequencyValue*/
+   ctx->debug.PGADebugFlags[827] = Flag; /*PGASetPrintOptions*/
+}
+
+/*I****************************************************************************
+   PGASetDebugFlag58 - Set the debug flags for all functions at debug level 58
+
+   Inputs:
+       ctx  - Context variable
+       Flag - PGA_TRUE to enable or PGA_FALSE to disable
+
+   Outputs:
+
+   Example:
+
+****************************************************************************I*/
+void PGASetDebugFlag58(PGAContext *ctx, int Flag)
+{
+   ctx->debug.PGADebugFlags[390] = Flag; /*PGAGetStoppingRuleType*/
+   ctx->debug.PGADebugFlags[391] = Flag; /*PGASetStoppingRuleType*/
+   ctx->debug.PGADebugFlags[392] = Flag; /*PGAGetMaxGAIterValue*/
+   ctx->debug.PGADebugFlags[393] = Flag; /*PGASetMaxGAIterValue*/
+   ctx->debug.PGADebugFlags[394] = Flag; /*PGACheckStoppingConditions*/
+   ctx->debug.PGADebugFlags[395] = Flag; /*PGASetMaxNoChangeValue*/
+   ctx->debug.PGADebugFlags[396] = Flag; /*PGASetMaxSimilarityValue*/
+   ctx->debug.PGADebugFlags[397] = Flag; /*PGADone*/
+}
+
+/*I****************************************************************************
+   PGASetDebugFlag60 - Set the debug flags for all functions at debug level 60
+
+   Inputs:
+       ctx  - Context variable
+       Flag - PGA_TRUE to enable or PGA_FALSE to disable
+
+   Outputs:
+
+   Example:
+
+****************************************************************************I*/
+void PGASetDebugFlag60(PGAContext *ctx, int Flag)
+{
+   ctx->debug.PGADebugFlags[320] = Flag; /*PGASortPop*/
+   ctx->debug.PGADebugFlags[324] = Flag; /*PGAGetSortedPopIndex*/
+   ctx->debug.PGADebugFlags[810] = Flag; /*PGADblHeapSort*/
+   ctx->debug.PGADebugFlags[811] = Flag; /*PGADblHeapify*/
+   ctx->debug.PGADebugFlags[812] = Flag; /*PGADblAdjustHeap*/
+   ctx->debug.PGADebugFlags[813] = Flag; /*PGAIntHeapSort*/
+   ctx->debug.PGADebugFlags[814] = Flag; /*PGAIntHeapify*/
+   ctx->debug.PGADebugFlags[815] = Flag; /*PGAIntAdjustHeap*/
+}
+
+/*I****************************************************************************
+   PGASetDebugFlag62 - Set the debug flags for all functions at debug level 62
+
+   Inputs:
+       ctx  - Context variable
+       Flag - PGA_TRUE to enable or PGA_FALSE to disable
+
+   Outputs:
+
+   Example:
+
+****************************************************************************I*/
+void PGASetDebugFlag62(PGAContext *ctx, int Flag)
+{
+   ctx->debug.PGADebugFlags[750] = Flag; /*PGARandomFlip*/
+   ctx->debug.PGADebugFlags[751] = Flag; /*PGARandomInterval*/
+   ctx->debug.PGADebugFlags[752] = Flag; /*PGARandom01*/
+   ctx->debug.PGADebugFlags[753] = Flag; /*PGARandomUniform*/
+   ctx->debug.PGADebugFlags[754] = Flag; /*PGARandomGaussian*/
+   ctx->debug.PGADebugFlags[755] = Flag; /*PGAGetRandomSeed*/
+   ctx->debug.PGADebugFlags[756] = Flag; /*PGASetRandomSeed*/
+}
+
+/*I****************************************************************************
+   PGASetDebugFlag64 - Set the debug flags for all functions at debug level 64
+
+   Inputs:
+       ctx  - Context variable
+       Flag - PGA_TRUE to enable or PGA_FALSE to disable
+
+   Outputs:
+
+   Example:
+
+****************************************************************************I*/
+void PGASetDebugFlag64(PGAContext *ctx, int Flag)
+{
+   ctx->debug.PGADebugFlags[700] = Flag; /*PGAError*/
+   ctx->debug.PGADebugFlags[702] = Flag; /*PGAUsage*/
+   ctx->debug.PGADebugFlags[703] = Flag; /*PGAPrintVersionNumber*/
+   ctx->debug.PGADebugFlags[704] = Flag; /*PGAGetMaxMachineIntValue*/
+   ctx->debug.PGADebugFlags[705] = Flag; /*PGAGetMinMachineIntValue*/
+   ctx->debug.PGADebugFlags[706] = Flag; /*PGAGetMaxMachineDoubleValue*/
+   ctx->debug.PGADebugFlags[707] = Flag; /*PGAGetMinMachineDoubleValue*/
+   ctx->debug.PGADebugFlags[708] = Flag; /*PGADestroy*/
+   ctx->debug.PGADebugFlags[730] = Flag; /*PGAReadCmdLine*/
+   ctx->debug.PGADebugFlags[731] = Flag; /*PGAParseDebugArg*/
+   ctx->debug.PGADebugFlags[732] = Flag; /*PGAStripArgs*/
+}
+
+/*I****************************************************************************
+   PGASetDebugFlag66 - Set the debug flags for all functions at debug level 66
+
+   Inputs:
+       ctx  - Context variable
+       Flag - PGA_TRUE to enable or PGA_FALSE to disable
+
+   Outputs:
+
+   Example:
+
+****************************************************************************I*/
+void PGASetDebugFlag66(PGAContext *ctx, int Flag)
+{
+   ctx->debug.PGADebugFlags[710] = Flag; /*PGAMean*/
+   ctx->debug.PGADebugFlags[711] = Flag; /*PGAStddev*/
+   ctx->debug.PGADebugFlags[712] = Flag; /*PGACopyIndividual*/
+   ctx->debug.PGADebugFlags[713] = Flag; /*PGARound*/
+   ctx->debug.PGADebugFlags[714] = Flag; /*PGACheckSum*/
+   ctx->debug.PGADebugFlags[715] = Flag; /*PGAGetWorstIndex*/
+   ctx->debug.PGADebugFlags[716] = Flag; /*PGAGetBestIndex*/
+   ctx->debug.PGADebugFlags[717] = Flag; /*PGAGetIndividual*/
+   ctx->debug.PGADebugFlags[718] = Flag; /*PGAUpdateAverage*/
+   ctx->debug.PGADebugFlags[719] = Flag; /*PGAUpdateOnline*/
+   ctx->debug.PGADebugFlags[720] = Flag; /*PGAUpdateOffline*/
+   ctx->debug.PGADebugFlags[721] = Flag; /*PGAComputeSimilarity*/
+}
+#endif
+
+/*I****************************************************************************
+   PGAPrintDebugOptions - prints the list of available debug options
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      list of available debug options
+
+   Example:
+      PGAContext ctx;
+      :
+      PGAPrintDebugOptions(ctx);
+      
+****************************************************************************I*/
+void PGAPrintDebugOptions(PGAContext *ctx)
+{
+    PGADebugEntered("PGAPrintDebugOptions");
+    
+#if OPTIMIZE==0
+    fprintf(stderr, "  0 Trace all debug prints\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "  1 Reserved for the user\n");
+    fprintf(stderr, "    :                   :\n");
+    fprintf(stderr, " 10 Reserved for the user\n");
+    fprintf(stderr, " 11 Trace high-level functions\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, " 20 Trace high-level parallel functions\n");
+    fprintf(stderr, " 21 Trace all parallel functions\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, " 30 Trace BINARY    functions\n");
+    fprintf(stderr, " 32 Trace INTEGER   functions\n");
+    fprintf(stderr, " 34 Trace REAL      functions\n");
+    fprintf(stderr, " 36 Trace CHARACTER functions\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, " 40 Trace population creation functions\n");
+    fprintf(stderr, " 42 Trace select functions\n");
+    fprintf(stderr, " 44 Trace mutation functions\n");
+    fprintf(stderr, " 46 Trace crossover functions\n");
+    fprintf(stderr, " 48 Trace function evaluation functions\n");
+    fprintf(stderr, " 50 Trace fitness calculation  functions\n");
+    fprintf(stderr, " 52 Trace duplicate checking functions\n");
+    fprintf(stderr, " 54 Trace restart functions\n");
+    fprintf(stderr, " 56 Trace reporting functions\n");
+    fprintf(stderr, " 58 Trace stopping functions\n");
+    fprintf(stderr, " 60 Trace sorting functions\n");
+    fprintf(stderr, " 62 Trace random number functions\n");
+    fprintf(stderr, " 64 Trace system routines\n");
+    fprintf(stderr, " 66 Trace utility functions\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, " 80 Trace memory allocations\n");
+    fprintf(stderr, " 82 Trace variable print statements\n");
+#else
+    fprintf(stderr, " Optimized version; no debug options.\n");
+#endif
+    PGADestroy(ctx);
+    exit(0);
+}
+
Index: trunk/optimizer/src/pgapack/pgapack/source/duplcate.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/duplcate.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/duplcate.c	(revision 816)
@@ -0,0 +1,298 @@
+/*
+ *  
+ *  ********************************************************************* 
+ *  (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+ *  *********************************************************************
+ *  
+ *  This software was authored by
+ *  
+ *  D. Levine
+ *  Mathematics and Computer Science Division Argonne National Laboratory
+ *  Argonne IL 60439
+ *  levine@mcs.anl.gov
+ *  (708) 252-6735
+ *  (708) 252-5986 (FAX)
+ *  
+ *  with programming assistance of participants in Argonne National 
+ *  Laboratory's SERS program.
+ *  
+ *  This program contains material protectable under copyright laws of the 
+ *  United States.  Permission is hereby granted to use it, reproduce it, 
+ *  to translate it into another language, and to redistribute it to 
+ *  others at no charge except a fee for transferring a copy, provided 
+ *  that you conspicuously and appropriately publish on each copy the 
+ *  University of Chicago's copyright notice, and the disclaimer of 
+ *  warranty and Government license included below.  Further, permission 
+ *  is hereby granted, subject to the same provisions, to modify a copy or 
+ *  copies or any portion of it, and to distribute to others at no charge 
+ *  materials containing or derived from the material.
+ *  
+ *  The developers of the software ask that you acknowledge its use in any 
+ *  document referencing work based on the  program, such as published 
+ *  research.  Also, they ask that you supply to Argonne National 
+ *  Laboratory a copy of any published research referencing work based on 
+ *  the software.
+ *  
+ *  Any entity desiring permission for further use must contact:
+ *  
+ *  J. Gleeson
+ *  Industrial Technology Development Center Argonne National Laboratory
+ *  Argonne IL 60439
+ *  gleesonj@smtplink.eid.anl.gov
+ *  (708) 252-6055
+ *  
+ *  ******************************************************************** 
+ *  DISCLAIMER
+ *  
+ *  THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+ *  OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+ *  THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+ *  WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+ *  RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+ *  INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+ *  INFRINGE PRIVATELY OWNED RIGHTS.
+ *  
+ *  ********************************************************************** 
+ *  GOVERNMENT LICENSE
+ *  
+ *  The Government is granted for itself and others acting on its behalf a 
+ *  paid-up, non-exclusive, irrevocable worldwide license in this computer 
+ *  software to reproduce, prepare derivative works, and perform publicly 
+ *  and display publicly.
+ */
+
+/*****************************************************************************
+*     FILE: duplicate.c: This file contains the routines that have to do with
+*                        testing for duplicate strings
+*
+*     Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle,
+*              Brian P. Walenz
+*****************************************************************************/
+
+#include "pgapack.h"
+
+/*U****************************************************************************
+  PGADuplicate - determines if a specified string is a duplicate of one
+  already in an existing population
+
+  Category: Generation
+
+  Inputs:
+     ctx  - context variable
+     p    - string index
+     pop1 - symbolic constant of the population containing string p
+     pop2 - symbolic constant of the (possibly partial) population containing
+            strings to compare string p against
+     n    - the number of strings in pop2 to compare string p against
+            (indexed 0,...,n-1)
+
+  Outputs:
+     Returns PGA_TRUE if PGAGetNoDuplicates() returns PGA_TRUE and
+     string p in population pop1 is a duplicate of at least one strings
+     0,...,n-1 in population pop2.  Otherwise returns PGA_FALSE
+
+  Example:
+     Change any string in PGA_NEWPOP that is an exact copy of a string
+     in PGA_OLDPOP.
+
+     PGAContext *ctx;
+     int b, n;
+     :
+     n  = PGAGetPopsize(ctx);
+     for (b=0; b<n; b++)
+         if (PGADuplicate(ctx, b, PGA_NEWPOP, PGA_OLDPOP, n))
+             PGAChange(ctx, b, PGA_NEWPOP);
+
+
+     Check if the best string in population PGA_OLDPOP is a duplicate of any
+     of the strings in the first half of population PGA_NEWPOP.
+
+     PGAContext *ctx;
+     int b, n;
+     :
+     b  = PGAGetBestIndex(ctx, PGA_OLDPOP);
+     n  = PGAGetPopsize(ctx) / 2;
+     if (PGADuplicate(ctx, b, PGA_OLDPOP, PGA_NEWPOP, n))
+         printf("A duplicate!\n");
+
+****************************************************************************U*/
+int PGADuplicate(PGAContext *ctx, int p, int pop1, int pop2, int n)
+{
+    int p2, fp;
+    int RetVal = PGA_FALSE;
+    
+    PGADebugEntered("PGADuplicate");
+    PGADebugPrint( ctx, PGA_DEBUG_PRINTVAR,"PGADuplicate", "p = ",
+		  PGA_INT, (void *) &p );
+    PGADebugPrint( ctx, PGA_DEBUG_PRINTVAR,"PGADuplicate", "pop1 = ",
+		  PGA_INT, (void *) &pop1 );
+    PGADebugPrint( ctx, PGA_DEBUG_PRINTVAR,"PGADuplicate", "pop2 = ",
+		  PGA_INT, (void *) &pop2 );
+    PGADebugPrint( ctx, PGA_DEBUG_PRINTVAR,"PGADuplicate", "n  = ",
+		  PGA_INT, (void *) &n );
+    
+    if (ctx->ga.NoDuplicates == PGA_TRUE) {
+	if (ctx->fops.Duplicate) {
+	    fp = ((p == PGA_TEMP1) || (p == PGA_TEMP2)) ? p : p+1;
+	    for (p2 = 1; p2 <= n; p2++)
+		if ((*ctx->fops.Duplicate)(&ctx, &fp, &pop1, &p2, &pop2)) {
+		    RetVal = PGA_TRUE;
+		    p2 = n+1;
+		}
+	} else {
+	    for (p2 = 0; p2 < n; p2++)
+		if ((*ctx->cops.Duplicate)(ctx, p, pop1, p2, pop2)) {
+		    RetVal = PGA_TRUE;
+		    p2 = n;
+		}
+	}
+    }
+    
+    PGADebugExited("PGADuplicate");
+    
+    return(RetVal);
+}
+
+
+/*U****************************************************************************
+  PGAChange - Repeatedly apply mutation to a string (with an increasing
+  mutation rate) until one or more mutations have occurred.  This routine is
+  usually used with PGADuplicate to modify a duplicate string.  It is not
+  intended to replace PGAMutation
+
+  Category: Generation
+
+  Inputs:
+     ctx  - context variable
+     p    - string index
+     pop  - symbolic constant of the population containing string p
+
+  Outputs:
+     Mutates string p in population pop via side effect.
+
+  Example:
+     Change any string in PGA_NEWPOP that is an exact copy of a string
+     in PGA_OLDPOP.  To be complete, we should check the population again
+     if any changes are made; for simplicity, we don't.
+
+     PGAContext *ctx;
+     int b, n;
+     :
+     n  = PGAGetPopsize(ctx);
+     for (b=0; b<n; b++)
+         if (PGADuplicate(ctx, b, PGA_NEWPOP, PGA_OLDPOP, n))
+             PGAChange(ctx, b, PGA_NEWPOP);
+
+****************************************************************************U*/
+void PGAChange( PGAContext *ctx, int p, int pop )
+{
+    int    changed = PGA_FALSE;
+    int    fp, nflips;
+    double mr;
+
+    PGADebugEntered("PGAChange");
+
+    mr = ctx->ga.MutationProb;
+
+    PGADebugPrint( ctx, PGA_DEBUG_PRINTVAR, "PGAChange", " mr = ",
+                   PGA_DOUBLE, (void *) &mr );
+
+    while (( changed == PGA_FALSE ) && (mr <= 1.0)) {
+	if (ctx->fops.Mutation) {
+	    fp = ((p == PGA_TEMP1) || (p == PGA_TEMP2)) ? p : p+1;
+            nflips = (*ctx->fops.Mutation)(&ctx, &fp, &pop, &mr);
+	} else {
+	    nflips = (*ctx->cops.Mutation)( ctx, p, pop, mr );
+	}
+
+        if ( nflips > 0 )
+            changed = PGA_TRUE;
+        else
+            mr = 1.1*mr;
+    }
+
+    if (changed == PGA_FALSE) {
+	PGAError(ctx, "Could not change string:", PGA_WARNING, PGA_VOID, NULL);
+	PGAPrintString(ctx, stderr, p, pop);
+    }
+
+    PGADebugExited("PGAChange");
+}
+
+/*U****************************************************************************
+   PGASetNoDuplicatesFlag - A boolean flag to indicate if duplicate strings are
+   allowed in the population. Valid choices are PGA_TRUE and PGA_FALSE.  The
+   default is PGA_FALSE -- allow duplicates.
+
+   Category: Generation
+
+   Inputs:
+      ctx  - context variable
+      flag - PGA_TRUE or PGA_FALSE
+
+   Outputs:
+      None
+
+   Example:
+      Set the NoDuplicates flag to require that all strings are unique.
+
+      PGAContext *ctx;
+      :
+      PGASetNoDuplicatesFlag(ctx,PGA_TRUE);
+
+****************************************************************************U*/
+void PGASetNoDuplicatesFlag( PGAContext *ctx, int no_dup)
+{
+    PGADebugEntered("PGASetNoDuplicatesFlag");
+
+    switch (no_dup) {
+        case PGA_TRUE:
+        case PGA_FALSE:
+            ctx->ga.NoDuplicates = no_dup;
+            break;
+        default:
+            PGAError ( ctx, "PGASetNoDuplicatesFlag: Invalid value of no_dup:",
+                       PGA_FATAL, PGA_INT, (void *) &no_dup);
+            break;
+    }
+
+    PGADebugExited("PGASetNoDuplicatesFlag");
+}
+
+/*U***************************************************************************
+   PGAGetNoDuplicatesFlag - Returns PGA_TRUE if duplicates are not allowed,
+   else returns PGA_FALSE.
+
+   Category: Generation
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      The value of the NoDuplicates flag.
+
+   Example:
+      PGAContext *ctx;
+      int nodups;
+      :
+      nodups = PGAGetNoDuplicatesFlag(ctx);
+      switch (nodups) {
+      case PGA_TRUE:
+          printf("Duplicate strings not allowed in population\n");
+          break;
+      case PGA_FALSE:
+          printf("Duplicate strings allowed in population\n");
+          break;
+      }
+
+***************************************************************************U*/
+int PGAGetNoDuplicatesFlag (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetNoDuplicatesFlag");
+
+    PGAFailIfNotSetUp("PGAGetNoDuplicatesFlag");
+
+    PGADebugExited("PGAGetNoDuplicatesFlag");
+
+    return(ctx->ga.NoDuplicates);
+}
Index: trunk/optimizer/src/pgapack/pgapack/source/evaluate.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/evaluate.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/evaluate.c	(revision 816)
@@ -0,0 +1,883 @@
+/*
+ *  
+ *  ********************************************************************* 
+ *  (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+ *  *********************************************************************
+ *  
+ *  This software was authored by
+ *  
+ *  D. Levine
+ *  Mathematics and Computer Science Division Argonne National Laboratory
+ *  Argonne IL 60439
+ *  levine@mcs.anl.gov
+ *  (708) 252-6735
+ *  (708) 252-5986 (FAX)
+ *  
+ *  with programming assistance of participants in Argonne National 
+ *  Laboratory's SERS program.
+ *  
+ *  This program contains material protectable under copyright laws of the 
+ *  United States.  Permission is hereby granted to use it, reproduce it, 
+ *  to translate it into another language, and to redistribute it to 
+ *  others at no charge except a fee for transferring a copy, provided 
+ *  that you conspicuously and appropriately publish on each copy the 
+ *  University of Chicago's copyright notice, and the disclaimer of 
+ *  warranty and Government license included below.  Further, permission 
+ *  is hereby granted, subject to the same provisions, to modify a copy or 
+ *  copies or any portion of it, and to distribute to others at no charge 
+ *  materials containing or derived from the material.
+ *  
+ *  The developers of the software ask that you acknowledge its use in any 
+ *  document referencing work based on the  program, such as published 
+ *  research.  Also, they ask that you supply to Argonne National 
+ *  Laboratory a copy of any published research referencing work based on 
+ *  the software.
+ *  
+ *  Any entity desiring permission for further use must contact:
+ *  
+ *  J. Gleeson
+ *  Industrial Technology Development Center Argonne National Laboratory
+ *  Argonne IL 60439
+ *  gleesonj@smtplink.eid.anl.gov
+ *  (708) 252-6055
+ *  
+ *  ******************************************************************** 
+ *  DISCLAIMER
+ *  
+ *  THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+ *  OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+ *  THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+ *  WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+ *  RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+ *  INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+ *  INFRINGE PRIVATELY OWNED RIGHTS.
+ *  
+ *  ********************************************************************** 
+ *  GOVERNMENT LICENSE
+ *  
+ *  The Government is granted for itself and others acting on its behalf a 
+ *  paid-up, non-exclusive, irrevocable worldwide license in this computer 
+ *  software to reproduce, prepare derivative works, and perform publicly 
+ *  and display publicly.
+ */
+
+/*****************************************************************************
+*     FILE: evaluate.c: This file contains routines specific to the evaluation
+*                       of the strings.
+*
+*     Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle,
+*              Brian P. Walenz
+*****************************************************************************/
+
+#include "pgapack.h"
+
+/*U****************************************************************************
+   PGASetEvaluation - Set the evaluation function value for a string to a
+   specified value.  Also sets the evaulation up to date flag to PGA_TRUE.
+
+   Category: Fitness & Evaluation
+
+   Inputs:
+      ctx  - context variable
+      p    - string index
+      pop  - symbolic constant of the population string p is in
+      val  - the (user) evaluation value to assign to string p
+
+   Outputs:
+      Sets the evaluation function value of string p and the EvalUpToDate
+      flag (to PGA_TRUE) via side effect
+
+   Example:
+      Set the evaluation function value of string p in population PGA_NEWPOP
+      to 123.456.
+
+      PGAContext *ctx;
+      int p;
+      :
+      PGASetEvaluation(ctx, p, PGA_NEWPOP, 123.456);
+
+****************************************************************************U*/
+void PGASetEvaluation ( PGAContext *ctx, int p, int pop, double val )
+{
+    PGAIndividual *ind;
+
+    PGADebugEntered("PGASetEvaluation");
+    PGADebugPrint( ctx, PGA_DEBUG_PRINTVAR,"PGASetEvaluation", "p = ",
+                   PGA_INT, (void *) &p );
+    PGADebugPrint( ctx, PGA_DEBUG_PRINTVAR,"PGASetEvaluation", "pop = ",
+                   PGA_INT, (void *) &pop );
+    PGADebugPrint( ctx, PGA_DEBUG_PRINTVAR,"PGASetEvaluation", "val = ",
+                   PGA_DOUBLE, (void *) &val );
+
+    ind               = PGAGetIndividual ( ctx, p, pop );
+    ind->evalfunc     = val;
+    ind->evaluptodate = PGA_TRUE;
+
+    PGADebugExited("PGASetEvaluation");
+}
+
+/*U***************************************************************************
+   PGAGetEvaluation - returns the evaluation function value for
+   string p in population pop
+
+   Category: Fitness & Evaluation
+
+   Inputs:
+      ctx - context variable
+      p   - string index
+      pop - symbolic constant of the population the string is in
+
+   Outputs:
+      The evaluation function value for string p in population pop
+
+   Example:
+      PGAContext *ctx;
+      int p;
+      double eval;
+      :
+      eval = PGAGetEvaluation(ctx, p, PGA_NEWPOP);
+
+***************************************************************************U*/
+double PGAGetEvaluation ( PGAContext *ctx, int p, int pop )
+{
+    PGAIndividual *ind;
+
+    PGADebugEntered("PGAGetEvaluation");
+    PGADebugPrint( ctx, PGA_DEBUG_PRINTVAR,"PGAGetEvaluation", "p = ",
+                   PGA_INT, (void *) &p );
+    PGADebugPrint( ctx, PGA_DEBUG_PRINTVAR,"PGAGetEvaluation", "pop = ",
+                   PGA_INT, (void *) &pop );
+
+    ind               = PGAGetIndividual ( ctx, p, pop );
+
+#ifndef OPTIMIZE
+    if (ind->evaluptodate != PGA_TRUE)
+	PGAError(ctx, "Evaluation not up to date.  Returning old evaluation.",
+                 PGA_WARNING, PGA_VOID, NULL);
+#endif
+
+    PGADebugExited("PGAGetEvaluation");
+    return(ind->evalfunc);
+}
+
+/*U****************************************************************************
+  PGASetEvaluationUpToDateFlag - sets the flag associated with a
+  string to PGA_TRUE or PGA_FLASE to indicate whether the evaluate
+  function value is out-of-date or not.  Note that this flag is always
+  set to PGA_TRUE when PGASetEvaluation is called.
+
+    Category: Fitness & Evaluation
+
+    Inputs:
+      ctx  - context variable
+      p    - string index
+      pop  - symbolic constant of the population string p is in
+      status - boolean for whether up-to-date
+
+   Outputs:
+      Sets the EvalUpToDate associated with the evaluation function value of
+      string p via side effect
+
+   Example:
+      Set the evaluation function flag for string p in population PGA_NEWPOP
+      to PGA_FALSE (as might happen after, for example, calling a hill-climbing
+      routine that modified this string).
+
+      PGAContext *ctx;
+      int p;
+      :
+      PGASetEvaluationUpToDateFlag(ctx, p, PGA_NEWPOP, PGA_FALSE);
+
+****************************************************************************U*/
+void PGASetEvaluationUpToDateFlag ( PGAContext *ctx, int p, int pop,
+                                   int status )
+{
+    PGAIndividual *ind;
+
+    PGADebugEntered("PGASetEvaluationUpToDateFlag");
+    PGADebugPrint( ctx, PGA_DEBUG_PRINTVAR,"PGASetEvaluationUpToDateFlag",
+                  "p = ", PGA_INT, (void *) &p );
+    PGADebugPrint( ctx, PGA_DEBUG_PRINTVAR,"PGASetEvaluationUpToDateFlag",
+                  "pop = ", PGA_INT, (void *) &pop );
+
+    ind = PGAGetIndividual ( ctx, p, pop );
+
+    switch(status) {
+    case PGA_TRUE:
+    case PGA_FALSE:
+      ind->evaluptodate = status;
+      break;
+    default:
+      PGAError(ctx, "PGASetEvaluationUpToDateFlag: Invalid value of status:",
+               PGA_FATAL, PGA_INT, (void *) &status);
+      break;
+    }
+
+    PGADebugExited("PGASetEvaluationUpToDateFlag");
+}
+
+/*U***************************************************************************
+  PGAGetEvaluationUpToDateFlag - returns true/false to indicate
+  whether the evaluate function value is up to date
+
+   Category: Fitness & Evaluation
+
+   Inputs:
+      ctx - context variable
+      p   - string index
+      pop - symbolic constant of the population the string is in
+
+   Outputs:
+      Returns PGA_TRUE if the evaluate function value is up to date.
+      Otherwise, returns PGA_FALSE
+
+   Example:
+      PGAContext *ctx;
+      int uptodate;
+      :
+      uptodate = PGAGetEvaluationUpToDateFlag(ctx);
+      switch (uptodate) {
+      case PGA_TRUE:
+          printf("Evaluation function value current\n");
+          break;
+      case PGA_FALSE:
+          printf("Evaluation function value out-of-date\n");
+          break;
+      }
+
+***************************************************************************U*/
+int PGAGetEvaluationUpToDateFlag ( PGAContext *ctx, int p, int pop )
+{
+    PGAIndividual *ind;
+
+    PGADebugEntered("PGAGetEvaluationUpToDateFlag");
+    PGADebugPrint( ctx, PGA_DEBUG_PRINTVAR,"PGAGetEvaluationUpToDateFlag",
+                  "p = ", PGA_INT, (void *) &p );
+    PGADebugPrint( ctx, PGA_DEBUG_PRINTVAR,"PGAGetEvaluationUpToDateFlag",
+                   "p = ", PGA_INT, (void *) &pop );
+
+    ind = PGAGetIndividual ( ctx, p, pop );
+
+    PGADebugExited("PGAGetEvaluationUpToDateFlag");
+    return(ind->evaluptodate);
+}
+
+/*U****************************************************************************
+  PGAGetRealFromBinary - Interpets a binary string as encoding a real value
+  and returns the real value it represents.
+
+  Category: Fitness & Evaluation
+
+  Inputs:
+      ctx   - context variable
+      p     - string index
+      pop   - symbolic constant of the population the string is in
+      start - starting bit position in the binary representation
+      end   - ending bit position in the binary representation
+      lower - lower bound of the interval the real number is defined on
+      upper - lower bound of the interval the real number is defined on
+
+  Outputs:
+      The real value encoded by the binary string
+
+  Example:
+      Decode a real value from the string p in population PGA_NEWPOP.  The
+      value to decode lies on the interval [-10,20] and is represented
+      using the 20 bits in bit positions 10--29.
+
+      double x;
+      :
+      x = PGAGetRealFromBinary(ctx, p, PGA_NEWPOP, 10, 29, -10.0, 20.0);
+
+****************************************************************************U*/
+double PGAGetRealFromBinary(PGAContext *ctx, int p, int pop, int start,
+                            int end, double lower, double upper)
+{
+     int length, sum;
+     double value;
+
+    PGADebugEntered("PGAGetRealFromBinary");
+     PGACheckDataType("PGAGetRealFromBinary", PGA_DATATYPE_BINARY);
+
+     length = end - start + 1;
+
+     if (start < 0)
+          PGAError(ctx, "PGAGetRealFromBinary: start less than 0:",
+                   PGA_FATAL, PGA_INT, (void *) &start);
+     if (end >= PGAGetStringLength(ctx))
+	 PGAError(ctx, "PGAGetRealFromBinary: end greater than string "
+                   "length:", PGA_FATAL, PGA_INT, (void *) &end);
+     if (start >= end)
+          PGAError(ctx, "PGAGetRealFromBinary: start exceeds end:",
+                   PGA_FATAL, PGA_INT, (void *) &start);
+     if (lower >= upper)
+          PGAError(ctx, "PGAGetRealFromBinary: lower exceeds upper:",
+                   PGA_FATAL, PGA_DOUBLE, (void *) &lower);
+
+     sum = PGAGetIntegerFromBinary(ctx, p, pop, start, end);
+     value = PGAMapIntegerToReal(ctx, sum, 0,
+                                 (length == sizeof(unsigned) * 8 - 1)
+                                 ? INT_MAX : (1u << length) - 1, lower, upper);
+
+    PGADebugExited("PGAGetRealFromBinary");
+
+     return(value);
+}
+
+/*U****************************************************************************
+  PGAGetRealFromGrayCode - interpets a binary reflected Gray code sequence in
+  a binary string as encoding a real value and returns the real value it
+  represents.
+
+  Category: Fitness & Evaluation
+
+  Inputs:
+      ctx   - context variable
+      p     - string index
+      pop   - symbolic constant of the population the string is in
+      start - starting bit position in the binary representation
+      end   - ending bit position in the binary representation
+      lower - lower bound of the interval the real number is defined on
+      upper - lower bound of the interval the real number is defined on
+
+  Outputs:
+      The real value encoded by the binary reflected Gray code sequence
+
+  Example:
+      Decode a real value from the string p in population PGA_NEWPOP.  The
+      value to decode lies on the interval [-10,20] and is represented
+      using the 20 bits in bit positions 10--29.
+
+      double x;
+      :
+      x = PGAGetRealFromGrayCode(ctx, p, PGA_NEWPOP, 10, 29, -10.0, 20.0);
+
+****************************************************************************U*/
+double PGAGetRealFromGrayCode(PGAContext *ctx, int p, int pop, int start,
+                                  int end, double lower, double upper)
+{
+     int length, sum;
+     double value;
+
+    PGADebugEntered("PGAGetRealFromGrayCode");
+     PGACheckDataType("PGAGetRealFromGrayCode", PGA_DATATYPE_BINARY);
+
+     length = end - start + 1;
+
+     if (start < 0)
+          PGAError(ctx, "PGAGetRealFromGrayCode: start less than 0:",
+                   PGA_FATAL, PGA_INT, (void *) &start);
+     if (end >= PGAGetStringLength(ctx))
+          PGAError(ctx, "PGAGetRealFromGrayCode: end greater than string "
+                   "length:", PGA_FATAL, PGA_INT, (void *) &end);
+     if (start >= end)
+          PGAError(ctx, "PGAGetRealFromGrayCode: start exceeds end:",
+                   PGA_FATAL, PGA_INT, (void *) &start);
+     if (lower >= upper)
+          PGAError(ctx, "PGAGetRealFromGrayCode: lower exceeds upper:",
+                   PGA_FATAL, PGA_DOUBLE, (void *) &lower);
+
+     sum = PGAGetIntegerFromGrayCode(ctx, p, pop, start, end);
+     value = PGAMapIntegerToReal(ctx, sum, 0,
+                                 (length == sizeof(unsigned) * 8 - 1)
+                                 ? INT_MAX : (1u << length) - 1, lower, upper);
+
+    PGADebugExited("PGAGetRealFromGrayCode");
+
+     return(value);
+}
+
+/*U****************************************************************************
+  PGAEncodeRealAsBinary - encodes a real value as a binary string
+
+  Category: Fitness & Evaluation
+
+  Inputs:
+      ctx   - context variable
+      p     - string index
+      pop   - symbolic constant of the population the string is in
+      start - starting bit position in p to encode val in
+      end   - ending bit position in p to encode val in
+      low   - lower bound of the interval the val is defined on
+      high  - lower bound of the interval the val is defined on
+      val   - the real number to be represented as a binary string
+
+  Outputs:
+      The string is modified by side-effect.
+
+  Example:
+      Encode 3.14 from the interval [0,10] in 30 bits in bit positions
+      0--29 in string p in population PGA_NEWPOP.
+
+      PGAContext *ctx;
+      int p;
+      :
+      PGAEncodeRealAsBinary(ctx, p, PGA_NEWPOP, 0, 29, 0.0, 10.0, 3.14);
+
+****************************************************************************U*/
+void PGAEncodeRealAsBinary(PGAContext *ctx, int p, int pop, int start,
+                               int end, double low, double high, double val)
+{
+     int length, d;
+
+    PGADebugEntered("PGAEncodeRealAsBinary");
+     PGACheckDataType("PGAEncodeRealAsBinary", PGA_DATATYPE_BINARY);
+
+     length = end - start + 1;
+     if (start < 0)
+          PGAError(ctx, "PGAEncodeRealAsBinary: start less than 0:",
+                   PGA_FATAL, PGA_INT, (void *) &start);
+     if (end >= PGAGetStringLength(ctx))
+          PGAError(ctx, "PGAEncodeRealAsBinary: end greater than string "
+                   "length:", PGA_FATAL, PGA_INT, (void *) &end);
+     if (start >= end)
+          PGAError(ctx, "PGAEncodeRealAsBinary: start exceeds end:",
+                   PGA_FATAL, PGA_INT, (void *) &start);
+     if (low >= high)
+          PGAError(ctx, "PGAEncodeRealAsBinary: low exceeds high:",
+                   PGA_FATAL, PGA_DOUBLE, (void *) &low);
+     if (val < low || val > high)
+          PGAError(ctx, "PGAEncodeRealAsBinary: val outside of bounds:",
+                   PGA_FATAL, PGA_DOUBLE, (void *) &val);
+
+     d = PGAMapRealToInteger(ctx, val, low, high, 0,
+                             (length == sizeof(unsigned) * 8 - 1)
+                             ? INT_MAX : (1u << length) - 1);
+     PGAEncodeIntegerAsBinary(ctx, p, pop, start, end, d);
+
+    PGADebugExited("PGAEncodeRealAsBinary");
+}
+
+/*U****************************************************************************
+  PGAEncodeRealAsGrayCode - encodes a real value as a binary reflected Gray
+  code sequence
+
+  Category: Fitness & Evaluation
+
+  Inputs:
+      ctx   - context variable
+      p     - string index
+      pop   - symbolic constant of the population the string is in
+      start - starting bit position in p to encode val in
+      end   - ending bit position in p to encode val in
+      low   - lower bound of the interval the val is defined on
+      high  - lower bound of the interval the val is defined on
+      val   - the real number to be represented as a binary string
+
+  Outputs:
+      The string is modified by side-effect.
+
+  Example:
+      Encode 3.14 from the interval [0,10] in 30 bits in bit positions
+      0--29 in string p in population PGA_NEWPOP as a binary reflected Gray
+      code sequence.
+
+      PGAContext *ctx;
+      int p;
+      :
+      PGAEncodeRealAsGrayCode(ctx, p, PGA_NEWPOP, 0, 29, 0.0, 10.0, 3.14);
+
+****************************************************************************U*/
+void PGAEncodeRealAsGrayCode(PGAContext *ctx, int p, int pop, int start,
+                              int end, double low, double high, double val)
+{
+     int length, d;
+
+    PGADebugEntered("PGAEncodeRealAsGrayCode");
+     PGACheckDataType("PGAEncodeRealAsGrayCode", PGA_DATATYPE_BINARY);
+
+     length = end - start + 1;
+     if (start < 0)
+          PGAError(ctx, "PGAEncodeRealAsGrayCode: start less than 0:",
+                   PGA_FATAL, PGA_INT, (void *) &start);
+     if (end >= PGAGetStringLength(ctx))
+          PGAError(ctx, "PGAEncodeRealAsGrayCode: end greater than string "
+                   "length:", PGA_FATAL, PGA_INT, (void *) &end);
+     if (start >= end)
+          PGAError(ctx, "PGAEncodeRealAsGrayCode: start exceeds end:",
+                   PGA_FATAL, PGA_INT, (void *) &start);
+     if (low >= high)
+          PGAError(ctx, "PGAEncodeRealAsGrayCode: low exceeds high:",
+                   PGA_FATAL, PGA_DOUBLE, (void *) &low);
+     if (val < low || val > high)
+          PGAError(ctx, "PGAEncodeRealAsGrayCode: val outside of bounds:",
+                   PGA_FATAL, PGA_DOUBLE, (void *) &val);
+
+     d = PGAMapRealToInteger(ctx, val, low, high, 0,
+                             (length == sizeof(unsigned) * 8 - 1) ? INT_MAX :
+                             (1u << length) - 1);
+     PGAEncodeIntegerAsGrayCode(ctx, p, pop, start, end, d);
+
+    PGADebugExited("PGAEncodeRealAsGrayCode");
+}
+
+
+/*U****************************************************************************
+  PGAGetIntegerFromBinary - interpets a binary string as encoding an integer
+  value and returns the integer value it represents.
+
+  Category: Fitness & Evaluation
+
+  Inputs:
+      ctx   - context variable
+      p     - string index
+      pop   - symbolic constant of the population the string is in
+      start - starting bit position in the binary representation
+      end   - ending bit position in the binary representation
+
+  Outputs:
+      The integer value encoded by the binary string
+
+  Example:
+      Get an integer j from bits 10--29 of string p in population PGA_NEWPOP.
+
+      PGAContext *ctx;
+      int j, p;
+      :
+      j = PGAGetIntegerFromBinary(ctx, p, PGA_NEWPOP, 10, 29);
+
+****************************************************************************U*/
+int PGAGetIntegerFromBinary(PGAContext *ctx, int p, int pop, int start,
+                                 int end)
+{
+     int length, i, val;
+     unsigned power2;
+
+    PGADebugEntered("PGAGetIntegerFromBinary");
+     PGACheckDataType("PGAGetIntegerFromBinary", PGA_DATATYPE_BINARY);
+
+     length = end - start + 1;
+     if (length > sizeof(int) * 8 - 1)
+          PGAError(ctx, "PGAGetIntegerFromBinary: length of bit string "
+                   "exceeds sizeof type int:", PGA_FATAL, PGA_INT,
+                   (void *) &length);
+     if (start < 0)
+          PGAError(ctx, "PGAGetIntegerFromBinary: start less than 0:",
+                   PGA_FATAL, PGA_INT, (void *) &start);
+     if (end >= PGAGetStringLength(ctx))
+          PGAError(ctx, "PGAGetIntegerFromBinary: end greater than string "
+                   "length:", PGA_FATAL, PGA_INT, (void *) &end);
+     if (start >= end)
+          PGAError(ctx, "PGAGetIntegerFromBinary: start exceeds end:",
+                   PGA_FATAL, PGA_INT, (void *) &start);
+
+     val = 0;
+     power2 = 1u << (length - 1);
+     for (i = start; i <= end; i++)
+     {
+          if (PGAGetBinaryAllele(ctx, p, pop, i))
+               val += power2;
+          power2 >>= 1;
+     }
+
+    PGADebugExited("PGAGetIntegerFromBinary");
+
+     return(val);
+}
+
+/*U****************************************************************************
+  PGAGetIntegerFromGrayCode - interpets a binary reflected Gray code sequence
+  as encoding an integer value and returns the integer value it represents.
+
+  Category: Fitness & Evaluation
+
+  Inputs:
+      ctx   - context variable
+      p     - string index
+      pop   - symbolic constant of the population the string is in
+      start - starting bit position in the binary representation
+      end   - ending bit position in the binary representation
+
+  Outputs:
+      The integer value encoded by the binary reflected Gray code sequence
+
+  Example:
+      Get an integer j from bits 10--29 of string p in population PGA_NEWPOP.
+      The string is encoded in Gray code.
+
+      PGAContext *ctx;
+      int j, p;
+      :
+      j = PGAGetIntegerFromGrayCode(ctx, p, PGA_NEWPOP, 10, 29);
+
+****************************************************************************U*/
+int PGAGetIntegerFromGrayCode(PGAContext *ctx, int p, int pop, int start,
+                                   int end)
+{
+     int length, *BitString, i, val;
+     unsigned power2;
+
+    PGADebugEntered("PGAGetIntegerFromGrayCode");
+     PGACheckDataType("PGAGetIntegerFromGrayCode", PGA_DATATYPE_BINARY);
+
+     length = end - start + 1;
+     if (length > sizeof(int) * 8 - 1)
+          PGAError(ctx, "PGAGetIntegerFromGrayCode: length of binary string "
+                   "exceeds size of type int:", PGA_FATAL, PGA_INT,
+                   (void *) &length);
+     if (start < 0)
+          PGAError(ctx, "PGAGetIntegerFromGrayCode: start less than 0:",
+                   PGA_FATAL, PGA_INT, (void *) &start);
+     if (end >= PGAGetStringLength(ctx))
+          PGAError(ctx, "PGAGetIntegerFromGrayCode: end greater than string "
+                   "length:", PGA_FATAL, PGA_INT, (void *) &end);
+     if (start >= end)
+          PGAError(ctx, "PGAGetIntegerFromGrayCode: start exceeds end:",
+                   PGA_FATAL, PGA_INT, (void *) &start);
+
+     BitString = (int *) malloc(length * sizeof(int));
+     if (!BitString)
+          PGAError(ctx, "PGAGetIntegerFromGrayCode: No room for BitString",
+                   PGA_FATAL, PGA_VOID, NULL);
+     BitString[0] = PGAGetBinaryAllele(ctx, p, pop, start);
+
+     for(i = 1; i < length; i++)
+          BitString[i] = BitString[i-1] ^ PGAGetBinaryAllele(ctx, p, pop,
+                                                             start + i);
+     val = 0;
+     power2 = 1u << (length - 1);
+     for (i = 0; i < length; i++)
+     {
+          if (BitString[i])
+               val += power2;
+          power2 >>= 1;
+     }
+     free(BitString);
+
+    PGADebugExited("PGAGetIntegerFromGrayCode");
+     return(val);
+}
+
+/*U****************************************************************************
+  PGAEncodeIntegerAsBinary - encodes an integer value as a binary string
+
+  Category: Fitness & Evaluation
+
+  Inputs:
+      ctx   - context variable
+      p     - string index
+      pop   - symbolic constant of the population the string is in
+      start - starting bit position in p to encode val in
+      end   - ending bit position in p to encode val in
+      val   - the integer value to be represented as a binary string
+
+  Outputs:
+      The string is modified by side-effect.
+
+  Example:
+      Encode an integer v in 20 bits in bit positions 0--19 in string p
+      in population PGA_NEWPOP.
+
+      PGAContext *ctx;
+      int v, p;
+      :
+      PGAEncodeIntegerAsBinary(ctx, p, PGA_NEWPOP, 0, 19, v);
+
+****************************************************************************U*/
+void PGAEncodeIntegerAsBinary(PGAContext *ctx, int p, int pop, int start,
+                              int end, int val)
+{
+     int length, i;
+     unsigned power2;
+
+    PGADebugEntered("PGAEncodeIntegerAsBinary");
+     PGACheckDataType("PGAEncodeIntegerAsBinary", PGA_DATATYPE_BINARY);
+
+     length = end - start + 1;
+
+     if (length > sizeof(int) * 8 - 1)
+          PGAError(ctx, "PGAEncodeIntegerAsBinary: length of bit string "
+                   "exceeds size of type int:", PGA_FATAL, PGA_INT,
+                   (void *) &length);
+     if (start < 0)
+          PGAError(ctx, "PGAEncodeIntegerAsBinary: start less than 0:",
+                   PGA_FATAL, PGA_INT, (void *) &start);
+     if (end >= PGAGetStringLength(ctx))
+          PGAError(ctx, "PGAEncodeIntegerAsBinary: end greater than string "
+                   "length:", PGA_FATAL, PGA_INT, (void *) &end);
+     if (start >= end)
+          PGAError(ctx, "PGAEncodeIntegerAsBinary: start exceeds end:",
+                   PGA_FATAL, PGA_INT, (void *) &start);
+     if ((val > (1u << length) - 1) && (length != sizeof(int) * 8) - 1)
+          PGAError(ctx, "PGAEncodeIntegerAsBinary: Integer too big for string "
+                   "length:", PGA_FATAL, PGA_INT, (void *) &val);
+     if (val < 0)
+          PGAError(ctx, "PGAEncodeIntegerAsBinary: Integer less than zero:",
+                   PGA_FATAL, PGA_INT, (void *) & val);
+
+     power2 = 1u << (length - 1);
+     for (i = 0; i < length; i++)
+     {
+          if (val >= power2)
+          {
+               PGASetBinaryAllele(ctx, p, pop, start + i, 1);
+               val -= power2;
+          }
+          else
+               PGASetBinaryAllele(ctx, p, pop, start + i, 0);
+          power2 >>= 1;
+     }
+
+    PGADebugExited("PGAEncodeIntegerAsBinary");
+}
+
+/*U****************************************************************************
+  PGAEncodeIntegerAsGrayCode - encodes a real value as a binary reflected
+  Gray code sequence
+
+  Category: Fitness & Evaluation
+
+  Inputs:
+      ctx   - context variable
+      p     - string index
+      pop   - symbolic constant of the population the string is in
+      start - starting bit position in p to encode val in
+      end   - ending bit position in p to encode val in
+      val   - the integer value to be represented as a binary reflected
+              Gray code sequence
+
+  Outputs:
+      The string is modified by side-effect.
+
+  Example:
+      Encode an integer v in 20 bits in bit positions  0--19 in string p in
+      population PGA_NEWPOP using Gray code.
+
+      PGAContext *ctx;
+      int v, p;
+      :
+      PGAEncodeIntegerAsGrayCode(ctx, p, PGA_NEWPOP, 0, 19, 7);
+
+****************************************************************************U*/
+void PGAEncodeIntegerAsGrayCode(PGAContext *ctx, int p, int pop, int start,
+                                int end, int val)
+{
+     int i, *bit, length;
+     unsigned power2;
+
+    PGADebugEntered("PGAEncodeIntegerAsGrayCode");
+     PGACheckDataType("PGAEncodeIntegerAsGrayCode", PGA_DATATYPE_BINARY);
+
+     length = end - start + 1;
+
+     if (length > sizeof(int) * 8 - 1)
+          PGAError(ctx, "PGAEncodeIntegerAsGrayCode: length of bit string"
+                   "exceeds size of type int:", PGA_FATAL, PGA_INT,
+                   (void *) &length);
+     if (start < 0)
+          PGAError(ctx, "PGAEncodeIntegerAsGrayCode: start less than 0:",
+                   PGA_FATAL, PGA_INT, (void *) &start);
+     if (end >= PGAGetStringLength(ctx))
+          PGAError(ctx, "PGAEncodeIntegerAsGrayCode: end greater than string "
+                   "length:", PGA_FATAL, PGA_INT, (void *) &end);
+     if (start >= end)
+          PGAError(ctx, "PGAEncodeIntegerAsGrayCode: start exceeds end:",
+                   PGA_FATAL, PGA_INT, (void *) &start);
+     if ((val > (1u << length) - 1) && (length != sizeof(int) * 8 - 1))
+          PGAError(ctx, "PGAEncodeIntegerAsGrayCode: Integer too big for "
+                   "string length:", PGA_FATAL, PGA_INT, (void *) &val);
+     if (val < 0)
+          PGAError(ctx, "PGAEncodeIntegerAsGrayCode: Integer less than zero:",
+                   PGA_FATAL, PGA_INT, (void *) &val);
+
+     bit = (int *) malloc(length * sizeof(int));
+     if (bit == NULL)
+          PGAError(ctx, "PGAEncodeIntegerAsGrayCode: No room to allocate bit",
+                   PGA_FATAL, PGA_VOID, NULL);
+     power2 = 1u << (length - 1);
+     for (i = 0; i < length; i++)
+     {
+          if (val >= power2)
+          {
+               bit[i] = 1;
+               val -= power2;
+          }
+          else
+               bit[i] = 0;
+          power2 >>= 1;
+     }
+     PGASetBinaryAllele(ctx, p, pop, start, bit[0]);
+     for(i = 1; i < length; i++)
+          PGASetBinaryAllele(ctx, p, pop, start + i, bit[i-1] ^ bit[i]);
+     free(bit);
+
+    PGADebugExited("PGAEncodeIntegerAsGrayCode");
+}
+
+
+/*I****************************************************************************
+   PGAMapIntegerToReal - Maps the value v defined on [a,b] to r defined on
+   [l,u].  In the context of PGAPack [a,b] is the discrete interval
+   [0,2^nbits-1] (i.e., the number of bits in a binary string) and [l,u]
+   represent the range of possible values of the real number r.
+
+   Inputs:
+      ctx      - context variable
+      v        - value from original interval (usually the decoded bit string)
+      a        - lower bound of integer interval (usually 0)
+      b        - upper bound of integer interval (usually 2^nbits-1)
+      l        - lower bound of real interval
+      u        - upper bound of real interval
+
+   Outputs:
+      Scaled value of v defined on [l,u]
+
+   Example:
+       Map a five bit (that is, an integer with a range of [0, 31]) integer v
+       to a real in the range [0, 3.14].
+
+       PGAContext *ctx;
+       double x;
+       int v;
+       :
+       x = PGAMapIntegerToReal(ctx, v, 0, 31, 0.0, 3.14);
+
+****************************************************************************I*/
+double PGAMapIntegerToReal (PGAContext *ctx, int v, int a, int b, double l,
+                            double u)
+{
+    PGADebugEntered("PGAMapIntegerToReal");
+
+    PGADebugExited("PGAMapIntegerToReal");
+
+     return((v-a) * (u-l) / (b-a) + l);
+}
+
+/*I****************************************************************************
+   PGAMapRealToInteger - Maps the value r defined on [l,u] to v defined on
+   [a,b].  In the context of PGAPack [a,b] is the discrete interval
+   [0,2^nbits-1] (i.e., the number of bits in a binary string) and [l,u]
+   represent the range of possible values of the real number r.
+
+   Inputs:
+      ctx      - context variable
+      r        - real value defined on [l,u]
+      l        - lower bound of real interval
+      u        - upper bound of real interval
+      a        - lower bound of integer interval (usually 0)
+      b        - upper bound of integer interval (usually 2^nbits-1)
+
+   Outputs:
+      Scaled value of r defined on [a,b]
+
+   Example:
+     Map the value r on the interval [0, 3.14] to a five bit integer v.
+
+     PGAContext *ctx;
+     double r;
+     int v;
+     :
+     v = PGAMapRealToInteger(ctx, r, 0.0, 3.14, 0, 31);
+
+****************************************************************************I*/
+int PGAMapRealToInteger(PGAContext *ctx, double r, double l, double u, int a,
+                        int b)
+{
+    PGADebugEntered("PGAMapRealToInteger");
+
+    PGADebugExited("PGAMapRealToInteger");
+
+     return PGARound(ctx, (b - a) * (r - l) / (u - l) + a);
+}
+
+
Index: trunk/optimizer/src/pgapack/pgapack/source/f2c.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/f2c.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/f2c.c	(revision 816)
@@ -0,0 +1,1817 @@
+/*
+ *  
+ *  ********************************************************************* 
+ *  (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+ *  *********************************************************************
+ *  
+ *  This software was authored by
+ *  
+ *  D. Levine
+ *  Mathematics and Computer Science Division Argonne National Laboratory
+ *  Argonne IL 60439
+ *  levine@mcs.anl.gov
+ *  (708) 252-6735
+ *  (708) 252-5986 (FAX)
+ *  
+ *  with programming assistance of participants in Argonne National 
+ *  Laboratory's SERS program.
+ *  
+ *  This program contains material protectable under copyright laws of the 
+ *  United States.  Permission is hereby granted to use it, reproduce it, 
+ *  to translate it into another language, and to redistribute it to 
+ *  others at no charge except a fee for transferring a copy, provided 
+ *  that you conspicuously and appropriately publish on each copy the 
+ *  University of Chicago's copyright notice, and the disclaimer of 
+ *  warranty and Government license included below.  Further, permission 
+ *  is hereby granted, subject to the same provisions, to modify a copy or 
+ *  copies or any portion of it, and to distribute to others at no charge 
+ *  materials containing or derived from the material.
+ *  
+ *  The developers of the software ask that you acknowledge its use in any 
+ *  document referencing work based on the  program, such as published 
+ *  research.  Also, they ask that you supply to Argonne National 
+ *  Laboratory a copy of any published research referencing work based on 
+ *  the software.
+ *  
+ *  Any entity desiring permission for further use must contact:
+ *  
+ *  J. Gleeson
+ *  Industrial Technology Development Center Argonne National Laboratory
+ *  Argonne IL 60439
+ *  gleesonj@smtplink.eid.anl.gov
+ *  (708) 252-6055
+ *  
+ *  ******************************************************************** 
+ *  DISCLAIMER
+ *  
+ *  THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+ *  OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+ *  THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+ *  WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+ *  RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+ *  INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+ *  INFRINGE PRIVATELY OWNED RIGHTS.
+ *  
+ *  ********************************************************************** 
+ *  GOVERNMENT LICENSE
+ *  
+ *  The Government is granted for itself and others acting on its behalf a 
+ *  paid-up, non-exclusive, irrevocable worldwide license in this computer 
+ *  software to reproduce, prepare derivative works, and perform publicly 
+ *  and display publicly.
+ */
+
+/*****************************************************************************
+*     FILE: f2c_interface.c
+*
+*     This file contains routines that are called by the Fortran version of
+*     the PGAPack calls.  They just make the call to the appropriate C
+*     routine.  Issues are:
+*         * Fortran's always passing by reference,
+*         * Using Fortran integers for holding C pointer values
+*         * Fortran's 1,...,n indexing vs. C's 0,...,n-1
+*           (this comes up in population member and allele indices)
+*         * Pointers to functions
+*         * File pointers
+*         * Characters strings
+*         * Variable length argument lists
+*
+*     We assume the Fortran compiler generates one of three symbol names for
+*     the external PGAPack routine, e.g.,  pgasetpopsize,  pgasetpopsize_, or
+*     PGASETPOPSIZE.  We use #ifdef's based on the appropriate routine to
+*     convert the canonical pgasetpopsize_ to the other two.  Since the real
+*     C routine is always mixed case we will never have a conflict.
+*
+*     Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle,
+*              Brian P. Walenz
+*****************************************************************************/
+
+#include "pgapack.h"
+
+#if defined(FORTRANCAP)
+#define pgasetbinaryallele_              PGASETBINARYALLELE
+#define pgagetbinaryallele_              PGAGETBINARYALLELE
+#define pgasetbinaryinitprob_            PGASETBINARYINITPROB
+#define pgagetbinaryinitprob_            PGAGETBINARYINITPROB
+#define pgasetcharacterallele_           PGASETCHARACTERALLELE
+#define pgagetcharacterallele_           PGAGETCHARACTERALLELE
+#define pgasetcharacterinittype_         PGASETCHARACTERINITTYPE
+#define pgacreate_                       PGACREATE
+#define pgasetup_                        PGASETUP
+#define pgasetrandominitflag_            PGASETRANDOMINITFLAG
+#define pgagetrandominitflag_            PGAGETRANDOMINITFLAG
+#define pgacrossover_                    PGACROSSOVER
+#define pgagetcrossovertype_             PGAGETCROSSOVERTYPE
+#define pgagetcrossoverprob_             PGAGETCROSSOVERPROB
+#define pgagetuniformcrossoverprob_      PGAGETUNIFORMCROSSOVERPROB
+#define pgasetcrossovertype_             PGASETCROSSOVERTYPE
+#define pgasetcrossoverprob_             PGASETCROSSOVERPROB
+#define pgasetuniformcrossoverprob_      PGASETUNIFORMCROSSOVERPROB
+#define pgadebugprint_                   PGADEBUGPRINT
+#define pgasetdebuglevel_                PGASETDEBUGLEVEL
+#define pgacleardebuglevel_              PGACLEARDEBUGLEVEL
+#define pgasetdebuglevelbyname_          PGASETDEBUGLEVELBYNAME
+#define pgacleardebuglevelbyname_        PGACLEARDEBUGLEVELBYNAME
+#define pgaduplicate_                    PGADUPLICATE
+#define pgachange_                       PGACHANGE
+#define pgasetnoduplicatesflag_          PGASETNODUPLICATESFLAG
+#define pgagetnoduplicatesflag_          PGAGETNODUPLICATESFLAG
+#define pgasetevaluation_                PGASETEVALUATION
+#define pgagetevaluation_                PGAGETEVALUATION
+#define pgasetevaluationuptodateflag_    PGASETEVALUATIONUPTODATEFLAG
+#define pgagetevaluationuptodateflag_    PGAGETEVALUATIONUPTODATEFLAG
+#define pgagetrealfrombinary_            PGAGETREALFROMBINARY
+#define pgagetrealfromgraycode_          PGAGETREALFROMGRAYCODE
+#define pgaencoderealasbinary_           PGAENCODEREALASBINARY
+#define pgaencoderealasgraycode_         PGAENCODEREALASGRAYCODE
+#define pgagetintegerfrombinary_         PGAGETINTEGERFROMBINARY
+#define pgagetintegerfromgraycode_       PGAGETINTEGERFROMGRAYCODE
+#define pgaencodeintegerasbinary_        PGAENCODEINTEGERASBINARY
+#define pgaencodeintegerasgraycode_      PGAENCODEINTEGERASGRAYCODE
+#define pgafitness_                      PGAFITNESS
+#define pgarank_                         PGARANK
+#define pgagetfitness_                   PGAGETFITNESS
+#define pgagetfitnesstype_               PGAGETFITNESSTYPE
+#define pgagetfitnessmintype_            PGAGETFITNESSMINTYPE
+#define pgagetmaxfitnessrank_            PGAGETMAXFITNESSRANK
+#define pgasetfitnesstype_               PGASETFITNESSTYPE
+#define pgasetfitnessmintype_            PGASETFITNESSMINTYPE
+#define pgasetmaxfitnessrank_            PGASETMAXFITNESSRANK
+#define pgasetfitnesscmaxvalue_          PGASETFITNESSCMAXVALUE
+#define pgagetfitnesscmaxvalue_          PGAGETFITNESSCMAXVALUE
+#define pgahammingdistance_              PGAHAMMINGDISTANCE
+#define pgasetintegerallele_             PGASETINTEGERALLELE
+#define pgagetintegerallele_             PGAGETINTEGERALLELE
+#define pgasetintegerinitpermute_        PGASETINTEGERINITPERMUTE
+#define pgasetintegerinitrange_          PGASETINTEGERINITRANGE
+#define pgagetintegerinittype_           PGAGETINTEGERINITTYPE
+#define pgagetminintegerinitvalue_       PGAGETMININTEGERINITVALUE
+#define pgagetmaxintegerinitvalue_       PGAGETMAXINTEGERINITVALUE
+#define pgamutate_                       PGAMUTATE
+#define pgasetmutationtype_              PGASETMUTATIONTYPE
+#define pgagetmutationtype_              PGAGETMUTATIONTYPE
+#define pgasetmutationrealvalue_         PGASETMUTATIONREALVALUE
+#define pgagetmutationrealvalue_         PGAGETMUTATIONREALVALUE
+#define pgasetmutationintegervalue_      PGASETMUTATIONINTEGERVALUE
+#define pgagetmutationintegervalue_      PGAGETMUTATIONINTEGERVALUE
+#define pgasetmutationboundedflag_       PGASETMUTATIONBOUNDEDFLAG
+#define pgagetmutationboundedflag_       PGAGETMUTATIONBOUNDEDFLAG
+#define pgasetmutationprob_              PGASETMUTATIONPROB
+#define pgagetmutationprob_              PGAGETMUTATIONPROB
+#define pgarungm_                        PGARUNGM
+#define pgaevaluate_                     PGAEVALUATE
+#define pgabuilddatatype_                PGABUILDDATATYPE
+#define pgasendindividual_               PGASENDINDIVIDUAL
+#define pgareceiveindividual_            PGARECEIVEINDIVIDUAL
+#define pgasendreceiveindividual_        PGASENDRECEIVEINDIVIDUAL
+#define pgagetrank_                      PGAGETRANK
+#define pgagetnumprocs_                  PGAGETNUMPROCS
+#define pgasetcommunicator_              PGASETCOMMUNICATOR
+#define pgagetcommunicator_              PGAGETCOMMUNICATOR
+#define pgarun_                          PGARUN
+#define pgarunmutationandcrossover_      PGARUNMUTATIONANDCROSSOVER
+#define pgarunmutationorcrossover_       PGARUNMUTATIONORCROSSOVER
+#define pgaupdategeneration_             PGAUPDATEGENERATION
+#define pgagetdatatype_                  PGAGETDATATYPE
+#define pgagetoptdirflag_                PGAGETOPTDIRFLAG
+#define pgagetstringlength_              PGAGETSTRINGLENGTH
+#define pgagetgaitervalue_               PGAGETGAITERVALUE
+#define pgasetmutationorcrossoverflag_   PGASETMUTATIONORCROSSOVERFLAG
+#define pgasetmutationandcrossoverflag_  PGASETMUTATIONANDCROSSOVERFLAG
+#define pgagetmutationorcrossoverflag_   PGAGETMUTATIONORCROSSOVERFLAG
+#define pgagetmutationandcrossoverflag_  PGAGETMUTATIONANDCROSSOVERFLAG
+#define pgasortpop_                      PGASORTPOP
+#define pgagetpopsize_                   PGAGETPOPSIZE
+#define pgagetnumreplacevalue_           PGAGETNUMREPLACEVALUE
+#define pgagetpopreplacetype_            PGAGETPOPREPLACETYPE
+#define pgagetsortedpopindex_            PGAGETSORTEDPOPINDEX
+#define pgasetpopsize_                   PGASETPOPSIZE
+#define pgasetnumreplacevalue_           PGASETNUMREPLACEVALUE
+#define pgasetpopreplacetype_            PGASETPOPREPLACETYPE
+#define pgarandomflip_                   PGARANDOMFLIP
+#define pgarandominterval_               PGARANDOMINTERVAL
+#define pgarandom01_                     PGARANDOM01
+#define pgarandomuniform_                PGARANDOMUNIFORM
+#define pgarandomgaussian_               PGARANDOMGAUSSIAN
+#define pgagetrandomseed_                PGAGETRANDOMSEED
+#define pgasetrandomseed_                PGASETRANDOMSEED
+#define pgasetrealallele_                PGASETREALALLELE
+#define pgagetrealallele_                PGAGETREALALLELE
+#define pgasetrealinitpercent_           PGASETREALINITPERCENT
+#define pgasetrealinitrange_             PGASETREALINITRANGE
+#define pgagetminrealinitvalue_          PGAGETMINREALINITVALUE
+#define pgagetmaxrealinitvalue_          PGAGETMAXREALINITVALUE
+#define pgagetrealinittype_              PGAGETREALINITTYPE
+#define pgaprintreport_                  PGAPRINTREPORT
+#define pgasetprintoptions_              PGASETPRINTOPTIONS
+#define pgasetprintfrequencyvalue_       PGASETPRINTFREQUENCYVALUE
+#define pgagetprintfrequencyvalue_       PGAGETPRINTFREQUENCYVALUE
+#define pgaprintpopulation_              PGAPRINTPOPULATION
+#define pgaprintindividual_              PGAPRINTINDIVIDUAL
+#define pgaprintstring_                  PGAPRINTSTRING
+#define pgaprintcontextvariable_         PGAPRINTCONTEXTVARIABLE
+#define pgarestart_                      PGARESTART
+#define pgasetrestartflag_               PGASETRESTARTFLAG
+#define pgagetrestartflag_               PGAGETRESTARTFLAG
+#define pgasetrestartfrequencyvalue_     PGASETRESTARTFREQUENCYVALUE
+#define pgagetrestartfrequencyvalue_     PGAGETRESTARTFREQUENCYVALUE
+#define pgasetrestartallelechangeprob_   PGASETRESTARTALLELECHANGEPROB
+#define pgagetrestartallelechangeprob_   PGAGETRESTARTALLELECHANGEPROB
+#define pgaselect_                       PGASELECT
+#define pgaselectnextindex_              PGASELECTNEXTINDEX
+#define pgasetselecttype_                PGASETSELECTTYPE
+#define pgagetselecttype_                PGAGETSELECTTYPE
+#define pgasetptournamentprob_           PGASETPTOURNAMENTPROB
+#define pgagetptournamentprob_           PGAGETPTOURNAMENTPROB
+#define pgadone_                         PGADONE
+#define pgacheckstoppingconditions_      PGACHECKSTOPPINGCONDITIONS
+#define pgasetstoppingruletype_          PGASETSTOPPINGRULETYPE
+#define pgagetstoppingruletype_          PGAGETSTOPPINGRULETYPE
+#define pgasetmaxgaitervalue_            PGASETMAXGAITERVALUE
+#define pgagetmaxgaitervalue_            PGAGETMAXGAITERVALUE
+#define pgasetmaxnochangevalue_          PGASETMAXNOCHANGEVALUE
+#define pgasetmaxsimilarityvalue_        PGASETMAXSIMILARITYVALUE
+#define pgaerror_                        PGAERROR
+#define pgadestroy_                      PGADESTROY
+#define pgagetmaxmachineintvalue_        PGAGETMAXMACHINEINTVALUE
+#define pgagetminmachineintvalue_        PGAGETMINMACHINEINTVALUE
+#define pgagetmaxmachinedoublevalue_     PGAGETMAXMACHINEDOUBLEVALUE
+#define pgagetminmachinedoublevalue_     PGAGETMINMACHINEDOUBLEVALUE
+#define pgausage_                        PGAUSAGE
+#define pgaprintversionnumber_           PGAPRINTVERSIONNUMBER
+#define pgasetuserfunction_              PGASETUSERFUNCTION
+#define pgamean_                         PGAMEAN
+#define pgastddev_                       PGASTDDEV
+#define pgaround_                        PGAROUND
+#define pgacopyindividual_               PGACOPYINDIVIDUAL
+#define pgachecksum_                     PGACHECKSUM
+#define pgagetworstindex_                PGAGETWORSTINDEX
+#define pgagetbestindex_                 PGAGETBESTINDEX
+
+#elif defined(FORTRANTWOUNDERSCORE)
+#define pgasetbinaryallele_              _pgasetbinaryallele_
+#define pgagetbinaryallele_              _pgagetbinaryallele_
+#define pgasetbinaryinitprob_            _pgasetbinaryinitprob_
+#define pgagetbinaryinitprob_            _pgagetbinaryinitprob_
+#define pgasetcharacterallele_           _pgasetcharacterallele_
+#define pgagetcharacterallele_           _pgagetcharacterallele_
+#define pgasetcharacterinittype_         _pgasetcharacterinittype_
+#define pgacreate_                       _pgacreate_
+#define pgasetup_                        _pgasetup_
+#define pgasetrandominitflag_            _pgasetrandominitflag_
+#define pgagetrandominitflag_            _pgagetrandominitflag_
+#define pgacrossover_                    _pgacrossover_
+#define pgagetcrossovertype_             _pgagetcrossovertype_
+#define pgagetcrossoverprob_             _pgagetcrossoverprob_
+#define pgagetuniformcrossoverprob_      _pgagetuniformcrossoverprob_
+#define pgasetcrossovertype_             _pgasetcrossovertype_
+#define pgasetcrossoverprob_             _pgasetcrossoverprob_
+#define pgasetuniformcrossoverprob_      _pgasetuniformcrossoverprob_
+#define pgadebugprint_                   _pgadebugprint_
+#define pgasetdebuglevel_                _pgasetdebuglevel_
+#define pgacleardebuglevel_              _pgacleardebuglevel_
+#define pgasetdebuglevelbyname_          _pgasetdebuglevelbyname_
+#define pgacleardebuglevelbyname_        _pgacleardebuglevelbyname_
+#define pgaduplicate_                    _pgaduplicate_
+#define pgachange_                       _pgachange_
+#define pgasetnoduplicatesflag_          _pgasetnoduplicatesflag_
+#define pgagetnoduplicatesflag_          _pgagetnoduplicatesflag_
+#define pgasetevaluation_                _pgasetevaluation_
+#define pgagetevaluation_                _pgagetevaluation_
+#define pgasetevaluationuptodateflag_    _pgasetevaluationuptodateflag_
+#define pgagetevaluationuptodateflag_    _pgagetevaluationuptodateflag_
+#define pgagetrealfrombinary_            _pgagetrealfrombinary_
+#define pgagetrealfromgraycode_          _pgagetrealfromgraycode_
+#define pgaencoderealasbinary_           _pgaencoderealasbinary_
+#define pgaencoderealasgraycode_         _pgaencoderealasgraycode_
+#define pgagetintegerfrombinary_         _pgagetintegerfrombinary_
+#define pgagetintegerfromgraycode_       _pgagetintegerfromgraycode_
+#define pgaencodeintegerasbinary_        _pgaencodeintegerasbinary_
+#define pgaencodeintegerasgraycode_      _pgaencodeintegerasgraycode_
+#define pgafitness_                      _pgafitness_
+#define pgarank_                         _pgarank_
+#define pgagetfitness_                   _pgagetfitness_
+#define pgagetfitnesstype_               _pgagetfitnesstype_
+#define pgagetfitnessmintype_            _pgagetfitnessmintype_
+#define pgagetmaxfitnessrank_            _pgagetmaxfitnessrank_
+#define pgasetfitnesstype_               _pgasetfitnesstype_
+#define pgasetfitnessmintype_            _pgasetfitnessmintype_
+#define pgasetmaxfitnessrank_            _pgasetmaxfitnessrank_
+#define pgasetfitnesscmaxvalue_          _pgasetfitnesscmaxvalue_
+#define pgagetfitnesscmaxvalue_          _pgagetfitnesscmaxvalue_
+#define pgahammingdistance_              _pgahammingdistance_
+#define pgasetintegerallele_             _pgasetintegerallele_
+#define pgagetintegerallele_             _pgagetintegerallele_
+#define pgasetintegerinitpermute_        _pgasetintegerinitpermute_
+#define pgasetintegerinitrange_          _pgasetintegerinitrange_
+#define pgagetintegerinittype_           _pgagetintegerinittype_
+#define pgagetminintegerinitvalue_       _pgagetminintegerinitvalue_
+#define pgagetmaxintegerinitvalue_       _pgagetmaxintegerinitvalue_
+#define pgamutate_                       _pgamutate_
+#define pgasetmutationtype_              _pgasetmutationtype_
+#define pgagetmutationtype_              _pgagetmutationtype_
+#define pgasetmutationrealvalue_         _pgasetmutationrealvalue_
+#define pgagetmutationrealvalue_         _pgagetmutationrealvalue_
+#define pgasetmutationintegervalue_      _pgasetmutationintegervalue_
+#define pgagetmutationintegervalue_      _pgagetmutationintegervalue_
+#define pgasetmutationboundedflag_       _pgasetmutationboundedflag_
+#define pgagetmutationboundedflag_       _pgagetmutationboundedflag_
+#define pgasetmutationprob_              _pgasetmutationprob_
+#define pgagetmutationprob_              _pgagetmutationprob_
+#define pgarungm_                        _pgarungm_
+#define pgaevaluate_                     _pgaevaluate_
+#define pgabuilddatatype_                _pgabuilddatatype_
+#define pgasendindividual_               _pgasendindividual_
+#define pgareceiveindividual_            _pgareceiveindividual_
+#define pgasendreceiveindividual_        _pgasendreceiveindividual_
+#define pgagetrank_                      _pgagetrank_
+#define pgagetnumprocs_                  _pgagetnumprocs_
+#define pgasetcommunicator_              _pgasetcommunicator_
+#define pgagetcommunicator_              _pgagetcommunicator_
+#define pgarun_                          _pgarun_
+#define pgarunmutationandcrossover_      _pgarunmutationandcrossover_
+#define pgarunmutationorcrossover_       _pgarunmutationorcrossover_
+#define pgaupdategeneration_             _pgaupdategeneration_
+#define pgagetdatatype_                  _pgagetdatatype_
+#define pgagetoptdirflag_                _pgagetoptdirflag_
+#define pgagetstringlength_              _pgagetstringlength_
+#define pgagetgaitervalue_               _pgagetgaitervalue_
+#define pgasetmutationorcrossoverflag_   _pgasetmutationorcrossoverflag_
+#define pgasetmutationandcrossoverflag_  _pgasetmutationandcrossoverflag_
+#define pgagetmutationorcrossoverflag_   _pgagetmutationorcrossoverflag_
+#define pgagetmutationandcrossoverflag_  _pgagetmutationandcrossoverflag_
+#define pgasortpop_                      _pgasortpop_
+#define pgagetpopsize_                   _pgagetpopsize_
+#define pgagetnumreplacevalue_           _pgagetnumreplacevalue_
+#define pgagetpopreplacetype_            _pgagetpopreplacetype_
+#define pgagetsortedpopindex_            _pgagetsortedpopindex_
+#define pgasetpopsize_                   _pgasetpopsize_
+#define pgasetnumreplacevalue_           _pgasetnumreplacevalue_
+#define pgasetpopreplacetype_            _pgasetpopreplacetype_
+#define pgarandomflip_                   _pgarandomflip_
+#define pgarandominterval_               _pgarandominterval_
+#define pgarandom01_                     _pgarandom01_
+#define pgarandomuniform_                _pgarandomuniform_
+#define pgarandomgaussian_               _pgarandomgaussian_
+#define pgagetrandomseed_                _pgagetrandomseed_
+#define pgasetrandomseed_                _pgasetrandomseed_
+#define pgasetrealallele_                _pgasetrealallele_
+#define pgagetrealallele_                _pgagetrealallele_
+#define pgasetrealinitpercent_           _pgasetrealinitpercent_
+#define pgasetrealinitrange_             _pgasetrealinitrange_
+#define pgagetminrealinitvalue_          _pgagetminrealinitvalue_
+#define pgagetmaxrealinitvalue_          _pgagetmaxrealinitvalue_
+#define pgagetrealinittype_              _pgagetrealinittype_
+#define pgaprintreport_                  _pgaprintreport_
+#define pgasetprintoptions_              _pgasetprintoptions_
+#define pgasetprintfrequencyvalue_       _pgasetprintfrequencyvalue_
+#define pgagetprintfrequencyvalue_       _pgagetprintfrequencyvalue_
+#define pgaprintpopulation_              _pgaprintpopulation_
+#define pgaprintindividual_              _pgaprintindividual_
+#define pgaprintstring_                  _pgaprintstring_
+#define pgaprintcontextvariable_         _pgaprintcontextvariable_
+#define pgarestart_                      _pgarestart_
+#define pgasetrestartflag_               _pgasetrestartflag_
+#define pgagetrestartflag_               _pgagetrestartflag_
+#define pgasetrestartfrequencyvalue_     _pgasetrestartfrequencyvalue_
+#define pgagetrestartfrequencyvalue_     _pgagetrestartfrequencyvalue_
+#define pgasetrestartallelechangeprob_   _pgasetrestartallelechangeprob_
+#define pgagetrestartallelechangeprob_   _pgagetrestartallelechangeprob_
+#define pgaselect_                       _pgaselect_
+#define pgaselectnextindex_              _pgaselectnextindex_
+#define pgasetselecttype_                _pgasetselecttype_
+#define pgagetselecttype_                _pgagetselecttype_
+#define pgasetptournamentprob_           _pgasetptournamentprob_
+#define pgagetptournamentprob_           _pgagetptournamentprob_
+#define pgadone_                         _pgadone_
+#define pgacheckstoppingconditions_      _pgacheckstoppingconditions_
+#define pgasetstoppingruletype_          _pgasetstoppingruletype_
+#define pgagetstoppingruletype_          _pgagetstoppingruletype_
+#define pgasetmaxgaitervalue_            _pgasetmaxgaitervalue_
+#define pgagetmaxgaitervalue_            _pgagetmaxgaitervalue_
+#define pgasetmaxnochangevalue_          _pgasetmaxnochangevalue_
+#define pgasetmaxsimilarityvalue_        _pgasetmaxsimilarityvalue_
+#define pgaerror_                        _pgaerror_
+#define pgadestroy_                      _pgadestroy_
+#define pgagetmaxmachineintvalue_        _pgagetmaxmachineintvalue_
+#define pgagetminmachineintvalue_        _pgagetminmachineintvalue_
+#define pgagetmaxmachinedoublevalue_     _pgagetmaxmachinedoublevalue_
+#define pgagetminmachinedoublevalue_     _pgagetminmachinedoublevalue_
+#define pgausage_                        _pgausage_
+#define pgaprintversionnumber_           _pgaprintversionnumber_
+#define pgasetuserfunction_              _pgasetuserfunction_
+#define pgamean_                         _pgamean_
+#define pgastddev_                       _pgastddev_
+#define pgaround_                        _pgaround_
+#define pgacopyindividual_               _pgacopyindividual_
+#define pgachecksum_                     _pgachecksum_
+#define pgagetworstindex_                _pgagetworstindex_
+#define pgagetbestindex_                 _pgagetbestindex_
+
+#elif !defined(FORTRANUNDERSCORE)
+#define pgasetbinaryallele_              pgasetbinaryallele
+#define pgagetbinaryallele_              pgagetbinaryallele
+#define pgasetbinaryinitprob_            pgasetbinaryinitprob
+#define pgagetbinaryinitprob_            pgagetbinaryinitprob
+#define pgasetcharacterallele_           pgasetcharacterallele
+#define pgagetcharacterallele_           pgagetcharacterallele
+#define pgasetcharacterinittype_         pgasetcharacterinittype
+#define pgacreate_                       pgacreate
+#define pgasetup_                        pgasetup
+#define pgasetrandominitflag_            pgasetrandominitflag
+#define pgagetrandominitflag_            pgagetrandominitflag
+#define pgacrossover_                    pgacrossover
+#define pgagetcrossovertype_             pgagetcrossovertype
+#define pgagetcrossoverprob_             pgagetcrossoverprob
+#define pgagetuniformcrossoverprob_      pgagetuniformcrossoverprob
+#define pgasetcrossovertype_             pgasetcrossovertype
+#define pgasetcrossoverprob_             pgasetcrossoverprob
+#define pgasetuniformcrossoverprob_      pgasetuniformcrossoverprob
+#define pgadebugprint_                   pgadebugprint
+#define pgasetdebuglevel_                pgasetdebuglevel
+#define pgacleardebuglevel_              pgacleardebuglevel
+#define pgasetdebuglevelbyname_          pgasetdebuglevelbyname
+#define pgacleardebuglevelbyname_        pgacleardebuglevelbyname
+#define pgaduplicate_                    pgaduplicate
+#define pgachange_                       pgachange
+#define pgasetnoduplicatesflag_          pgasetnoduplicatesflag
+#define pgagetnoduplicatesflag_          pgagetnoduplicatesflag
+#define pgasetevaluation_                pgasetevaluation
+#define pgagetevaluation_                pgagetevaluation
+#define pgasetevaluationuptodateflag_    pgasetevaluationuptodateflag
+#define pgagetevaluationuptodateflag_    pgagetevaluationuptodateflag
+#define pgagetrealfrombinary_            pgagetrealfrombinary
+#define pgagetrealfromgraycode_          pgagetrealfromgraycode
+#define pgaencoderealasbinary_           pgaencoderealasbinary
+#define pgaencoderealasgraycode_         pgaencoderealasgraycode
+#define pgagetintegerfrombinary_         pgagetintegerfrombinary
+#define pgagetintegerfromgraycode_       pgagetintegerfromgraycode
+#define pgaencodeintegerasbinary_        pgaencodeintegerasbinary
+#define pgaencodeintegerasgraycode_      pgaencodeintegerasgraycode
+#define pgafitness_                      pgafitness
+#define pgarank_                         pgarank
+#define pgagetfitness_                   pgagetfitness
+#define pgagetfitnesstype_               pgagetfitnesstype
+#define pgagetfitnessmintype_            pgagetfitnessmintype
+#define pgagetmaxfitnessrank_            pgagetmaxfitnessrank
+#define pgasetfitnesstype_               pgasetfitnesstype
+#define pgasetfitnessmintype_            pgasetfitnessmintype
+#define pgasetmaxfitnessrank_            pgasetmaxfitnessrank
+#define pgasetfitnesscmaxvalue_          pgasetfitnesscmaxvalue
+#define pgagetfitnesscmaxvalue_          pgagetfitnesscmaxvalue
+#define pgahammingdistance_              pgahammingdistance
+#define pgasetintegerallele_             pgasetintegerallele
+#define pgagetintegerallele_             pgagetintegerallele
+#define pgasetintegerinitpermute_        pgasetintegerinitpermute
+#define pgasetintegerinitrange_          pgasetintegerinitrange
+#define pgagetintegerinittype_           pgagetintegerinittype
+#define pgagetminintegerinitvalue_       pgagetminintegerinitvalue
+#define pgagetmaxintegerinitvalue_       pgagetmaxintegerinitvalue
+#define pgamutate_                       pgamutate
+#define pgasetmutationtype_              pgasetmutationtype
+#define pgagetmutationtype_              pgagetmutationtype
+#define pgasetmutationrealvalue_         pgasetmutationrealvalue
+#define pgagetmutationrealvalue_         pgagetmutationrealvalue
+#define pgasetmutationintegervalue_      pgasetmutationintegervalue
+#define pgagetmutationintegervalue_      pgagetmutationintegervalue
+#define pgasetmutationboundedflag_       pgasetmutationboundedflag
+#define pgagetmutationboundedflag_       pgagetmutationboundedflag
+#define pgasetmutationprob_              pgasetmutationprob
+#define pgagetmutationprob_              pgagetmutationprob
+#define pgarungm_                        pgarungm
+#define pgaevaluate_                     pgaevaluate
+#define pgabuilddatatype_                pgabuilddatatype
+#define pgasendindividual_               pgasendindividual
+#define pgareceiveindividual_            pgareceiveindividual
+#define pgasendreceiveindividual_        pgasendreceiveindividual
+#define pgagetrank_                      pgagetrank
+#define pgagetnumprocs_                  pgagetnumprocs
+#define pgasetcommunicator_              pgasetcommunicator
+#define pgagetcommunicator_              pgagetcommunicator
+#define pgarun_                          pgarun
+#define pgarunmutationandcrossover_      pgarunmutationandcrossover
+#define pgarunmutationorcrossover_       pgarunmutationorcrossover
+#define pgaupdategeneration_             pgaupdategeneration
+#define pgagetdatatype_                  pgagetdatatype
+#define pgagetoptdirflag_                pgagetoptdirflag
+#define pgagetstringlength_              pgagetstringlength
+#define pgagetgaitervalue_               pgagetgaitervalue
+#define pgasetmutationorcrossoverflag_   pgasetmutationorcrossoverflag
+#define pgasetmutationandcrossoverflag_  pgasetmutationandcrossoverflag
+#define pgagetmutationorcrossoverflag_   pgagetmutationorcrossoverflag
+#define pgagetmutationandcrossoverflag_  pgagetmutationandcrossoverflag
+#define pgasortpop_                      pgasortpop
+#define pgagetpopsize_                   pgagetpopsize
+#define pgagetnumreplacevalue_           pgagetnumreplacevalue
+#define pgagetpopreplacetype_            pgagetpopreplacetype
+#define pgagetsortedpopindex_            pgagetsortedpopindex
+#define pgasetpopsize_                   pgasetpopsize
+#define pgasetnumreplacevalue_           pgasetnumreplacevalue
+#define pgasetpopreplacetype_            pgasetpopreplacetype
+#define pgarandomflip_                   pgarandomflip
+#define pgarandominterval_               pgarandominterval
+#define pgarandom01_                     pgarandom01
+#define pgarandomuniform_                pgarandomuniform
+#define pgarandomgaussian_               pgarandomgaussian
+#define pgagetrandomseed_                pgagetrandomseed
+#define pgasetrandomseed_                pgasetrandomseed
+#define pgasetrealallele_                pgasetrealallele
+#define pgagetrealallele_                pgagetrealallele
+#define pgasetrealinitpercent_           pgasetrealinitpercent
+#define pgasetrealinitrange_             pgasetrealinitrange
+#define pgagetminrealinitvalue_          pgagetminrealinitvalue
+#define pgagetmaxrealinitvalue_          pgagetmaxrealinitvalue
+#define pgagetrealinittype_              pgagetrealinittype
+#define pgaprintreport_                  pgaprintreport
+#define pgasetprintoptions_              pgasetprintoptions
+#define pgasetprintfrequencyvalue_       pgasetprintfrequencyvalue
+#define pgagetprintfrequencyvalue_       pgagetprintfrequencyvalue
+#define pgaprintpopulation_              pgaprintpopulation
+#define pgaprintindividual_              pgaprintindividual
+#define pgaprintstring_                  pgaprintstring
+#define pgaprintcontextvariable_         pgaprintcontextvariable
+#define pgarestart_                      pgarestart
+#define pgasetrestartflag_               pgasetrestartflag
+#define pgagetrestartflag_               pgagetrestartflag
+#define pgasetrestartfrequencyvalue_     pgasetrestartfrequencyvalue
+#define pgagetrestartfrequencyvalue_     pgagetrestartfrequencyvalue
+#define pgasetrestartallelechangeprob_   pgasetrestartallelechangeprob
+#define pgagetrestartallelechangeprob_   pgagetrestartallelechangeprob
+#define pgaselect_                       pgaselect
+#define pgaselectnextindex_              pgaselectnextindex
+#define pgasetselecttype_                pgasetselecttype
+#define pgagetselecttype_                pgagetselecttype
+#define pgasetptournamentprob_           pgasetptournamentprob
+#define pgagetptournamentprob_           pgagetptournamentprob
+#define pgadone_                         pgadone
+#define pgacheckstoppingconditions_      pgacheckstoppingconditions
+#define pgasetstoppingruletype_          pgasetstoppingruletype
+#define pgagetstoppingruletype_          pgagetstoppingruletype
+#define pgasetmaxgaitervalue_            pgasetmaxgaitervalue
+#define pgagetmaxgaitervalue_            pgagetmaxgaitervalue
+#define pgasetmaxnochangevalue_          pgasetmaxnochangevalue
+#define pgasetmaxsimilarityvalue_        pgasetmaxsimilarityvalue
+#define pgaerror_                        pgaerror
+#define pgadestroy_                      pgadestroy
+#define pgagetmaxmachineintvalue_        pgagetmaxmachineintvalue
+#define pgagetminmachineintvalue_        pgagetminmachineintvalue
+#define pgagetmaxmachinedoublevalue_     pgagetmaxmachinedoublevalue
+#define pgagetminmachinedoublevalue_     pgagetminmachinedoublevalue
+#define pgausage_                        pgausage
+#define pgaprintversionnumber_           pgaprintversionnumber
+#define pgasetuserfunction_              pgasetuserfunction
+#define pgamean_                         pgamean
+#define pgastddev_                       pgastddev
+#define pgaround_                        pgaround
+#define pgacopyindividual_               pgacopyindividual
+#define pgachecksum_                     pgachecksum
+#define pgagetworstindex_                pgagetworstindex
+#define pgagetbestindex_                 pgagetbestindex
+#endif
+
+void pgasetbinaryallele_(PGAContext **ftx, int *p, int *pop, int *i,
+     int *val);
+int pgagetbinaryallele_(PGAContext **ftx, int *p, int *pop, int *i);
+void pgasetbinaryinitprob_(PGAContext **ftx, double *probability);
+double pgagetbinaryinitprob_(PGAContext **ftx);
+void pgasetcharacterallele_(PGAContext **ftx, int *p, int *pop, int *i,
+     char *val);
+void pgagetcharacterallele_(char *retval_ptr, int retval_len, PGAContext **ftx,
+     int *p, int *pop, int *i);
+void pgasetcharacterinittype_(PGAContext **ftx, int *value);
+unsigned long pgacreate_(int *datatype, int *len, int *maxormin);
+void pgasetup_(PGAContext **ftx);
+void pgasetrandominitflag_(PGAContext **ftx, int *RandomBoolean);
+int pgagetrandominitflag_(PGAContext **ftx);
+void pgacrossover_(PGAContext **ftx, int *m1, int *m2, int *oldpop, int *t1,
+     int *t2, int *newpop);
+int pgagetcrossovertype_(PGAContext **ftx);
+double pgagetcrossoverprob_(PGAContext **ftx);
+double pgagetuniformcrossoverprob_(PGAContext **ftx);
+void pgasetcrossovertype_(PGAContext **ftx, int *crossover_type);
+void pgasetcrossoverprob_(PGAContext **ftx, double *crossover_prob);
+void pgasetuniformcrossoverprob_(PGAContext **ftx,
+     double *uniform_cross_prob);
+void pgadebugprint_(PGAContext **ftx, int *level, char *funcname, char *msg,
+     int *datatype, void *data, int len1, int len2);
+void pgasetdebuglevel_(PGAContext **ftx, int *level);
+void pgacleardebuglevel_(PGAContext **ftx, int *level);
+void pgasetdebuglevelbyname_(PGAContext **ftx, char *name, int len);
+void pgacleardebuglevelbyname_(PGAContext **ftx, char *name, int len);
+int pgaduplicate_(PGAContext **ftx, int *j, int *pop1, int *pop2, int *n);
+void pgachange_(PGAContext **ftx, int *j, int *popindex);
+void pgasetnoduplicatesflag_(PGAContext **ftx, int *no_dup);
+int pgagetnoduplicatesflag_(PGAContext **ftx);
+void pgasetevaluation_( PGAContext **ftx, int *p, int *pop, double *val );
+double pgagetevaluation_(PGAContext **ftx, int *p, int *pop);
+void pgasetevaluationuptodateflag_(PGAContext **ftx, int *p, int *pop, int *status);
+int pgagetevaluationuptodateflag_(PGAContext **ftx, int *p, int *pop);
+double pgagetrealfrombinary_(PGAContext **ftx, int *p, int *pop,
+     int *start, int *end, double *lower, double *upper);
+double pgagetrealfromgraycode_(PGAContext **ftx, int *p, int *pop,
+     int *start, int *end, double *lower, double *upper);
+void pgaencoderealasbinary_(PGAContext **ftx, int *p, int *pop,
+     int *start, int *end, double *lower, double *upper,
+     double *value);
+void pgaencoderealasgraycode_(PGAContext **ftx, int *p, int *pop,
+     int *start, int *end, double *lower, double *upper,
+     double *value);
+int pgagetintegerfrombinary_(PGAContext **ftx, int *p, int *pop,
+     int *start, int *end);
+int pgagetintegerfromgraycode_(PGAContext **ftx, int *p, int *pop,
+     int *start, int *end);
+void pgaencodeintegerasbinary_(PGAContext **ftx, int *p, int *pop,
+     int*start, int *end, int *value);
+void pgaencodeintegerasgraycode_(PGAContext **ftx, int *p, int *pop,
+     int*start, int *end, int *value);
+void pgafitness_(PGAContext **ftx, int *popindex);
+int pgarank_(PGAContext **ftx, int *p, int *order, int *n);
+double pgagetfitness_(PGAContext **ftx, int *p, int *pop);
+int pgagetfitnesstype_(PGAContext **ftx);
+int pgagetfitnessmintype_(PGAContext **ftx);
+double pgagetmaxfitnessrank_(PGAContext **ftx);
+void pgasetfitnesstype_(PGAContext **ftx, int *fitness_type);
+void pgasetfitnessmintype_(PGAContext **ftx, int *fitness_type);
+void pgasetmaxfitnessrank_(PGAContext **ftx, double *fitness_rank_max);
+void pgasetfitnesscmaxvalue_(PGAContext **ftx, double *val);
+double pgagetfitnesscmaxvalue_(PGAContext **ftx);
+double pgahammingdistance_(PGAContext **ftx, int *popindex);
+void pgasetintegerallele_(PGAContext **ftx, int *p, int *pop, int *i,
+     int *val);
+int pgagetintegerallele_(PGAContext **ftx, int *p, int *pop, int *i);
+void pgasetintegerinitpermute_(PGAContext **ftx, int *min, int *max);
+void pgasetintegerinitrange_ (PGAContext **ftx, int *min, int *max);
+int pgagetintegerinittype_(PGAContext **ftx);
+int pgagetminintegerinitvalue_ (PGAContext **ftx, int *i);
+int pgagetmaxintegerinitvalue_ (PGAContext **ftx, int *i);
+void pgamutate_(PGAContext **ftx, int *p, int *pop);
+void pgasetmutationtype_(PGAContext **ftx, int *mutation_type);
+int pgagetmutationtype_(PGAContext **ftx);
+void pgasetmutationrealvalue_(PGAContext **ftx, double *val);
+double pgagetmutationrealvalue_(PGAContext **ftx);
+void pgasetmutationintegervalue_(PGAContext **ftx, int *val);
+int pgagetmutationintegervalue_(PGAContext **ftx);
+void pgasetmutationboundedflag_(PGAContext **ftx, int *val);
+int pgagetmutationboundedflag_(PGAContext **ftx);
+void pgasetmutationprob_(PGAContext **ftx, double *mutation_prob);
+double pgagetmutationprob_(PGAContext **ftx);
+void pgarungm_(PGAContext **ftx, double (*f)(PGAContext *, int, int),
+     MPI_Comm *comm);
+void pgaevaluate_(PGAContext **ftx, int *pop,
+     double (*f)(PGAContext *, int, int), MPI_Comm *comm);
+unsigned long pgabuilddatatype_(PGAContext **ftx, int *p, int *pop);
+void pgasendindividual_(PGAContext **ftx, int *p, int *pop, int *dest, int *tag, MPI_Comm *comm);
+void pgareceiveindividual_(PGAContext **ftx, int *p, int *pop, int *source, int *tag, MPI_Comm *comm, MPI_Status *status);
+void pgasendreceiveindividual_(PGAContext **ftx, int *send_p, int *send_pop, int *dest, int *send_tag, int *recv_p, int *recv_pop, int *source, int *recv_tag, MPI_Comm *comm, MPI_Status *status);
+int pgagetrank_(PGAContext **ftx, MPI_Comm *comm);
+int pgagetnumprocs_(PGAContext **ftx, MPI_Comm *comm);
+void pgasetcommunicator_(PGAContext **ftx, MPI_Comm *comm);
+MPI_Comm pgagetcommunicator_(PGAContext **ftx);
+void pgarun_(PGAContext **ftx,
+     double (*evaluate)(PGAContext *c, int p, int pop));
+void pgarunmutationandcrossover_(PGAContext **ftx, int *oldpop,
+     int *newpop);
+void pgarunmutationorcrossover_(PGAContext **ftx, int *oldpop, int *newpop);
+void pgaupdategeneration_(PGAContext **ftx, MPI_Comm *comm);
+int pgagetdatatype_(PGAContext **ftx);
+int pgagetoptdirflag_(PGAContext **ftx);
+int pgagetstringlength_(PGAContext **ftx);
+int pgagetgaitervalue_(PGAContext **ftx);
+void pgasetmutationorcrossoverflag_(PGAContext **ftx, int *flag);
+void pgasetmutationandcrossoverflag_(PGAContext **ftx, int *flag);
+int pgagetmutationorcrossoverflag_(PGAContext **ftx);
+int pgagetmutationandcrossoverflag_(PGAContext **ftx);
+void pgasortpop_(PGAContext **ftx, int *pop);
+int pgagetpopsize_(PGAContext **ftx);
+int pgagetnumreplacevalue_(PGAContext **ftx);
+int pgagetpopreplacetype_(PGAContext **ftx);
+int pgagetsortedpopindex_(PGAContext **ftx, int *n);
+void pgasetpopsize_(PGAContext **ftx, int *popsize);
+void pgasetnumreplacevalue_(PGAContext **ftx, int *pop_replace);
+void pgasetpopreplacetype_(PGAContext **ftx, int *pop_replace);
+int pgarandomflip_(PGAContext **ftx, double *p);
+int pgarandominterval_(PGAContext **ftx, int *start, int *end);
+double pgarandom01_(PGAContext **ftx, int *newseed);
+double pgarandomuniform_(PGAContext **ftx, double *start, double *end);
+double pgarandomgaussian_(PGAContext **ftx, double *mean, double *sigma);
+int pgagetrandomseed_(PGAContext **ftx);
+void pgasetrandomseed_(PGAContext **ftx, int *seed);
+void pgasetrealallele_(PGAContext **ftx, int *p, int *pop, int *i,
+     double *val);
+double pgagetrealallele_(PGAContext **ftx, int *p, int *pop, int *i);
+void pgasetrealinitpercent_(PGAContext **ftx, double *median, double *percent);
+void pgasetrealinitrange_ (PGAContext **ftx, double *min, double *max);
+double pgagetminrealinitvalue_(PGAContext **ftx, int *i);
+double pgagetmaxrealinitvalue_(PGAContext **ftx, int *i);
+int pgagetrealinittype_(PGAContext **ftx);
+void pgaprintreport_(PGAContext **ftx, char *name, int *pop, int len);
+void pgasetprintoptions_(PGAContext **ftx, int *option);
+void pgasetprintfrequencyvalue_(PGAContext **ftx, int *print_freq);
+int pgagetprintfrequencyvalue_(PGAContext **ftx);
+void pgaprintpopulation_(PGAContext **ftx, char *name, int *pop, int len);
+void pgaprintindividual_ (PGAContext **ftx, char *name, int *p,
+     int *pop, int len);
+void pgaprintstring_ (PGAContext **ftx, char *name, int *p,
+     int *pop, int len);
+void pgaprintcontextvariable_(PGAContext **ftx, char *name, int len);
+void pgarestart_(PGAContext **ftx, int *source_pop, int *dest_pop);
+void pgasetrestartflag_(PGAContext **ftx, int *val);
+int pgagetrestartflag_(PGAContext **ftx);
+void pgasetrestartfrequencyvalue_(PGAContext **ftx, int *numiter);
+int pgagetrestartfrequencyvalue_(PGAContext **ftx);
+void pgasetrestartallelechangeprob_(PGAContext **ftx, double *prob);
+double pgagetrestartallelechangeprob_(PGAContext **ftx);
+void pgaselect_(PGAContext **ftx, int *popix);
+int pgaselectnextindex_(PGAContext **ftx);
+void pgasetselecttype_(PGAContext **ftx, int *select_type);
+int pgagetselecttype_(PGAContext **ftx);
+void pgasetptournamentprob_(PGAContext **ftx, double *ptournament_prob);
+double pgagetptournamentprob_(PGAContext **ftx);
+int pgadone_(PGAContext **ftx, MPI_Comm *comm);
+int pgacheckstoppingconditions_(PGAContext **ftx);
+void pgasetstoppingruletype_(PGAContext **ftx, int *stoprule);
+int pgagetstoppingruletype_(PGAContext **ftx);
+void pgasetmaxgaitervalue_(PGAContext **ftx, int *maxiter);
+int pgagetmaxgaitervalue_(PGAContext **ftx);
+void pgasetmaxnochangevalue_(PGAContext **ftx, int *max_no_change);
+void pgasetmaxsimilarityvalue_(PGAContext **ftx, int *max_similarity);
+void pgaerror_(PGAContext **ftx, char *msg, int *level, int *datatype,
+     void **data, int len);
+void pgadestroy_(PGAContext **ftx);
+int pgagetmaxmachineintvalue_(PGAContext **ftx);
+int pgagetminmachineintvalue_(PGAContext **ftx);
+double pgagetmaxmachinedoublevalue_(PGAContext **ftx);
+double pgagetminmachinedoublevalue_(PGAContext **ftx);
+void pgausage_(PGAContext **ftx);
+void pgaprintversionnumber_(PGAContext **ftx);
+void pgasetuserfunction_(PGAContext **ftx, int *constant, void *f);
+double pgamean_(PGAContext **ftx, double *a, int *n);
+double pgastddev_(PGAContext **ftx, double *a, int *n, double *m);
+int pgaround_(PGAContext **ftx, double *x);
+void pgacopyindividual_(PGAContext **ftx, int *i, int *p1, int *j, int *p2);
+int pgachecksum_(PGAContext **ftx, int *p, int *pop);
+int pgagetworstindex_(PGAContext **ftx, int *pop);
+int pgagetbestindex_(PGAContext **ftx, int *pop);
+
+void pgasetbinaryallele_(PGAContext **ftx, int *p, int *pop, int *i,
+     int *val)
+{
+     PGASetBinaryAllele(*ftx,
+	   *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p : *p - 1,
+	   *pop, *i-1, *val);
+}
+
+int pgagetbinaryallele_(PGAContext **ftx, int *p, int *pop, int *i)
+{
+     return PGAGetBinaryAllele(*ftx,
+		  *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p : *p - 1,
+		  *pop, *i-1);
+}
+
+void pgasetbinaryinitprob_(PGAContext **ftx, double *probability)
+{
+     PGASetBinaryInitProb  (*ftx, *probability);
+}
+
+double pgagetbinaryinitprob_(PGAContext **ftx)
+{
+     return PGAGetBinaryInitProb  (*ftx);
+}
+
+void pgasetcharacterallele_(PGAContext **ftx, int *p, int *pop, int *i,
+     char *val)
+{
+     PGASetCharacterAllele(*ftx,
+	   *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p : *p - 1,
+	   *pop, *i-1, *val);
+}
+
+void pgagetcharacterallele_(char *retval_ptr, int retval_len, PGAContext **ftx,
+     int *p, int *pop, int *i)
+{
+     *retval_ptr = PGAGetCharacterAllele(*ftx,
+		  *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p : *p - 1,
+		  *pop, *i-1);
+}
+
+void pgasetcharacterinittype_(PGAContext **ftx, int *value)
+{
+     PGASetCharacterInitType  (*ftx, *value);
+}
+
+unsigned long pgacreate_(int *datatype, int *len, int *maxormin)
+{
+     int argc;
+     char *argv[1];
+     PGAContext *ctx;
+
+     argv[0] = "pgapack";
+     argc = 1;
+
+     ctx = PGACreate(&argc, argv, *datatype, *len, *maxormin);
+     ctx->sys.UserFortran = PGA_TRUE;
+
+     return (unsigned long)ctx;
+}
+
+void pgasetup_(PGAContext **ftx)
+{
+     PGASetUp  (*ftx);
+}
+
+void pgasetrandominitflag_(PGAContext **ftx, int *RandomBoolean)
+{
+     PGASetRandomInitFlag  (*ftx, *RandomBoolean);
+}
+
+int pgagetrandominitflag_(PGAContext **ftx)
+{
+     return PGAGetRandomInitFlag  (*ftx);
+}
+
+void pgacrossover_(PGAContext **ftx, int *m1, int *m2, int *oldpop, int *t1,
+     int *t2, int *newpop)
+{
+     PGACrossover (*ftx,
+		   *m1 == PGA_TEMP1 || *m1 == PGA_TEMP2 ? *m1 : *m1-1,
+		   *m2 == PGA_TEMP1 || *m2 == PGA_TEMP2 ? *m2 : *m2-1,
+		   *oldpop,
+		   *t1 == PGA_TEMP1 || *t1 == PGA_TEMP2 ? *t1 : *t1-1,
+		   *t2 == PGA_TEMP1 || *t2 == PGA_TEMP2 ? *t2 : *t2-1,
+		   *newpop);
+}
+
+int pgagetcrossovertype_(PGAContext **ftx)
+{
+     return PGAGetCrossoverType  (*ftx);
+}
+
+double pgagetcrossoverprob_(PGAContext **ftx)
+{
+     return PGAGetCrossoverProb  (*ftx);
+}
+
+double pgagetuniformcrossoverprob_(PGAContext **ftx)
+{
+     return PGAGetUniformCrossoverProb  (*ftx);
+}
+
+void pgasetcrossovertype_(PGAContext **ftx, int *crossover_type)
+{
+     PGASetCrossoverType  (*ftx, *crossover_type);
+}
+
+void pgasetcrossoverprob_(PGAContext **ftx, double *crossover_prob)
+{
+     PGASetCrossoverProb  (*ftx, *crossover_prob);
+}
+
+void pgasetuniformcrossoverprob_(PGAContext **ftx,
+     double *uniform_cross_prob)
+{
+     PGASetUniformCrossoverProb  (*ftx, *uniform_cross_prob);
+}
+
+#if OPTIMIZE==0
+void pgadebugprint_(PGAContext **ftx, int *level, char *funcname, char *msg,
+     int *datatype, void *data, int len1, int len2)
+/* FORTRAN implicitly passes the lengths of funcname and msg into len1
+   and len2, respectively */
+{
+     if (funcname[len1] != 0 || msg[len2] != 0)
+	  funcname[len1] = msg[len2] = 0;
+     PGADebugPrint(*ftx, *level, funcname, msg, *datatype, data );
+}
+#else
+void pgadebugprint_(PGAContext **ftx, int *level, char *funcname, char *msg,
+		    int *datatype, void *data, int len1, int len2)
+{
+     printf("PGADebugPrint is not supported in the optimized version of PGAPack.\n");
+}
+#endif
+
+#if OPTIMIZE==0
+void pgasetdebuglevel_(PGAContext **ftx, int *level)
+{
+    PGASetDebugLevel(*ftx, *level);
+}
+#else
+void pgasetdebuglevel_(PGAContext **ftx, int *level)
+{
+    printf("PGASetDebugLevel is not supported in the optimized version of PGAPack.\n");
+}
+#endif
+#if OPTIMIZE==0
+void pgacleardebuglevel_(PGAContext **ftx, int *level)
+{
+    PGAClearDebugLevel(*ftx, *level);
+}
+#else
+void pgacleardebuglevel_(PGAContext **ftx, int *level)
+{
+    printf("PGAClearDebugLevel is not supported in the optimized version of PGAPack.\n");
+}
+#endif
+#if OPTIMIZE==0
+void pgasetdebuglevelbyname_(PGAContext **ftx, char *name, int len)
+{
+    if (name[len] != 0)  name[len] = 0;
+    PGASetDebugLevelByName(*ftx, name);
+}
+#else
+void pgasetdebuglevelbyname_(PGAContext **ftx, char *name, int len)
+{
+    printf("PGASetDebugLevelByName is not supported in the optimized version of PGAPack.\n");
+}
+#endif
+#if OPTIMIZE==0
+void pgacleardebuglevelbyname_(PGAContext **ftx, char *name, int len)
+{
+    if (name[len] != 0)  name[len] = 0;
+    PGAClearDebugLevelByName(*ftx, name);
+}
+#else
+void pgacleardebuglevelbyname_(PGAContext **ftx, char *name, int len)
+{
+    printf("PGAClearDebugLevelByName is not supported in the optimized version of PGAPack.\n");
+}
+#endif
+int pgaduplicate_(PGAContext **ftx, int *j, int *pop1, int *pop2, int *n)
+{
+     return PGADuplicate(*ftx,
+		  *j == PGA_TEMP1 || *j == PGA_TEMP2 ? *j : *j-1,
+		  *pop1, *pop2, *n);
+}
+
+void pgachange_(PGAContext **ftx, int *j, int *popindex)
+{
+     PGAChange(*ftx,
+	   *j == PGA_TEMP1 || *j == PGA_TEMP2 ? *j : *j-1,
+	   *popindex);
+}
+
+void pgasetnoduplicatesflag_(PGAContext **ftx, int *no_dup)
+{
+     PGASetNoDuplicatesFlag  (*ftx, *no_dup);
+}
+
+int pgagetnoduplicatesflag_(PGAContext **ftx)
+{
+     return PGAGetNoDuplicatesFlag  (*ftx);
+}
+
+void pgasetevaluation_( PGAContext **ftx, int *p, int *pop, double *val )
+{
+     PGASetEvaluation(*ftx, *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p : *p-1,
+           *pop, *val );
+}
+
+double pgagetevaluation_(PGAContext **ftx, int *p, int *pop)
+{
+     return PGAGetEvaluation(*ftx, *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p : *p-1, *pop);
+}
+
+void pgasetevaluationuptodateflag_(PGAContext **ftx, int *p, int *pop, int *status)
+{
+     PGASetEvaluationUpToDateFlag(*ftx, *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p : *p-1,
+           *pop, *status);
+}
+
+int pgagetevaluationuptodateflag_(PGAContext **ftx, int *p, int *pop)
+{
+     return PGAGetEvaluationUpToDateFlag(*ftx, *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p : *p-1, *pop);
+}
+
+double pgagetrealfrombinary_(PGAContext **ftx, int *p, int *pop,
+     int *start, int *end, double *lower, double *upper)
+{
+     return PGAGetRealFromBinary(*ftx,
+          *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p :
+          *p - 1,
+          *pop, *start-1, *end-1, *lower, *upper);
+}
+
+double pgagetrealfromgraycode_(PGAContext **ftx, int *p, int *pop,
+     int *start, int *end, double *lower, double *upper)
+{
+     return PGAGetRealFromGrayCode(*ftx,
+          *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p :
+          *p - 1,
+          *pop, *start-1, *end-1, *lower, *upper);
+}
+
+void pgaencoderealasbinary_(PGAContext **ftx, int *p, int *pop,
+     int *start, int *end, double *lower, double *upper,
+     double *value)
+{
+     PGAEncodeRealAsBinary(*ftx,
+          *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p :
+          *p - 1,
+          *pop, *start-1, *end-1, *lower, *upper, *value);
+}
+
+void pgaencoderealasgraycode_(PGAContext **ftx, int *p, int *pop,
+     int *start, int *end, double *lower, double *upper,
+     double *value)
+{
+     PGAEncodeRealAsGrayCode(*ftx,
+          *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p :
+          *p - 1,
+          *pop, *start-1, *end-1, *lower, *upper, *value);
+}
+
+int pgagetintegerfrombinary_(PGAContext **ftx, int *p, int *pop,
+     int *start, int *end)
+{
+     return PGAGetIntegerFromBinary(*ftx,
+          *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p :
+          *p - 1,
+          *pop, *start-1, *end-1);
+}
+
+int pgagetintegerfromgraycode_(PGAContext **ftx, int *p, int *pop,
+     int *start, int *end)
+{
+     return PGAGetIntegerFromGrayCode(*ftx,
+          *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p :
+          *p - 1,
+          *pop, *start-1, *end-1);
+}
+
+void pgaencodeintegerasbinary_(PGAContext **ftx, int *p, int *pop,
+     int*start, int *end, int *value)
+{
+     PGAEncodeIntegerAsBinary(*ftx,
+          *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p :
+          *p - 1,
+          *pop, *start-1, *end-1, *value);
+}
+
+void pgaencodeintegerasgraycode_(PGAContext **ftx, int *p, int *pop,
+     int*start, int *end, int *value)
+{
+     PGAEncodeIntegerAsGrayCode(*ftx,
+          *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p :
+          *p - 1,
+          *pop, *start-1, *end-1, *value);
+}
+
+void pgafitness_(PGAContext **ftx, int *popindex)
+{
+     PGAFitness  (*ftx, *popindex);
+}
+
+int pgarank_(PGAContext **ftx, int *p, int *order, int *n)
+{
+    return PGARank(*ftx, *p-1, order, *n);
+}
+
+double pgagetfitness_(PGAContext **ftx, int *p, int *pop)
+{
+     return PGAGetFitness(*ftx, *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p : *p-1, *pop);
+}
+
+int pgagetfitnesstype_(PGAContext **ftx)
+{
+     return PGAGetFitnessType  (*ftx);
+}
+
+int pgagetfitnessmintype_(PGAContext **ftx)
+{
+     return PGAGetFitnessMinType  (*ftx);
+}
+
+double pgagetmaxfitnessrank_(PGAContext **ftx)
+{
+     return PGAGetMaxFitnessRank  (*ftx);
+}
+
+void pgasetfitnesstype_(PGAContext **ftx, int *fitness_type)
+{
+     PGASetFitnessType  (*ftx, *fitness_type);
+}
+
+void pgasetfitnessmintype_(PGAContext **ftx, int *fitness_type)
+{
+     PGASetFitnessMinType  (*ftx, *fitness_type);
+}
+
+void pgasetmaxfitnessrank_(PGAContext **ftx, double *fitness_rank_max)
+{
+     PGASetMaxFitnessRank  (*ftx, *fitness_rank_max);
+}
+
+void pgasetfitnesscmaxvalue_(PGAContext **ftx, double *val)
+{
+     PGASetFitnessCmaxValue  (*ftx, *val);
+}
+
+double pgagetfitnesscmaxvalue_(PGAContext **ftx)
+{
+     return PGAGetFitnessCmaxValue  (*ftx);
+}
+
+double pgahammingdistance_(PGAContext **ftx, int *popindex)
+{
+     return PGAHammingDistance  (*ftx, *popindex);
+}
+
+void pgasetintegerallele_(PGAContext **ftx, int *p, int *pop, int *i,
+     int *val)
+{
+     PGASetIntegerAllele(*ftx,
+	   *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p : *p - 1,
+	   *pop, *i-1, *val);
+}
+
+int pgagetintegerallele_(PGAContext **ftx, int *p, int *pop, int *i)
+{
+     return PGAGetIntegerAllele(*ftx,
+		  *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p : *p - 1,
+		  *pop, *i-1);
+}
+
+void pgasetintegerinitpermute_(PGAContext **ftx, int *min, int *max)
+{
+     PGASetIntegerInitPermute  (*ftx, *min, *max);
+}
+
+void pgasetintegerinitrange_ (PGAContext **ftx, int *min, int *max)
+{
+     PGASetIntegerInitRange(*ftx, min, max);
+}
+
+int pgagetintegerinittype_(PGAContext **ftx)
+{
+     return PGAGetIntegerInitType  (*ftx);
+}
+
+int pgagetminintegerinitvalue_ (PGAContext **ftx, int *i)
+{
+     return PGAGetMinIntegerInitValue(*ftx, *i-1);
+}
+
+int pgagetmaxintegerinitvalue_ (PGAContext **ftx, int *i)
+{
+     return PGAGetMaxIntegerInitValue(*ftx, *i-1);
+}
+
+void pgamutate_(PGAContext **ftx, int *p, int *pop)
+{
+     PGAMutate(*ftx,
+	   *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p : *p-1, *pop);
+}
+
+void pgasetmutationtype_(PGAContext **ftx, int *mutation_type)
+{
+     PGASetMutationType  (*ftx, *mutation_type);
+}
+
+int pgagetmutationtype_(PGAContext **ftx)
+{
+     return PGAGetMutationType  (*ftx);
+}
+
+void pgasetmutationrealvalue_(PGAContext **ftx, double *val)
+{
+     PGASetMutationRealValue  (*ftx, *val);
+}
+
+double pgagetmutationrealvalue_(PGAContext **ftx)
+{
+     return PGAGetMutationRealValue  (*ftx);
+}
+
+void pgasetmutationintegervalue_(PGAContext **ftx, int *val)
+{
+     PGASetMutationIntegerValue  (*ftx, *val);
+}
+
+int pgagetmutationintegervalue_(PGAContext **ftx)
+{
+     return PGAGetMutationIntegerValue  (*ftx);
+}
+
+void pgasetmutationboundedflag_(PGAContext **ftx, int *val)
+{
+     PGASetMutationBoundedFlag  (*ftx, *val);
+}
+
+int pgagetmutationboundedflag_(PGAContext **ftx)
+{
+     return PGAGetMutationBoundedFlag  (*ftx);
+}
+
+void pgasetmutationprob_(PGAContext **ftx, double *mutation_prob)
+{
+     PGASetMutationProb  (*ftx, *mutation_prob);
+}
+
+double pgagetmutationprob_(PGAContext **ftx)
+{
+     return PGAGetMutationProb  (*ftx);
+}
+
+void pgarungm_(PGAContext **ftx, double (*f)(PGAContext *, int, int),
+     MPI_Comm *comm)
+{
+     PGARunGM  (*ftx, (*f), *comm);
+}
+
+void pgaevaluate_(PGAContext **ftx, int *pop,
+     double (*f)(PGAContext *, int, int), MPI_Comm *comm)
+{
+     PGAEvaluate  (*ftx, *pop, (*f), *comm);
+}
+
+unsigned long pgabuilddatatype_(PGAContext **ftx, int *p, int *pop)
+{
+     return((unsigned long)PGABuildDatatype(*ftx, 
+                             *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p : *p - 1,
+                             *pop));
+}
+
+void pgasendindividual_(PGAContext **ftx, int *p, int *pop, int *dest, int *tag, MPI_Comm *comm)
+{
+     PGASendIndividual(*ftx, *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p : *p - 1,
+                       *pop, *dest, *tag, *comm);
+}
+
+void pgareceiveindividual_(PGAContext **ftx, int *p, int *pop, int *source, int *tag, MPI_Comm *comm, MPI_Status *status)
+{
+     PGAReceiveIndividual(*ftx, *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p : *p-1,
+                          *pop, *source, *tag, *comm, status);
+}
+
+void pgasendreceiveindividual_(PGAContext **ftx, int *send_p, int *send_pop, int *dest, int *send_tag, int *recv_p, int *recv_pop, int *source, int *recv_tag, MPI_Comm *comm, MPI_Status *status)
+{
+     PGASendReceiveIndividual(*ftx, 
+          *send_p == PGA_TEMP1 || *send_p == PGA_TEMP2 ? *send_p : *send_p - 1,
+          *send_pop, *dest, *send_tag, 
+          *recv_p == PGA_TEMP1 || *recv_p == PGA_TEMP2 ? *recv_p : *recv_p - 1,
+          *recv_pop, *source, *recv_tag, *comm, status);
+}
+
+int pgagetrank_(PGAContext **ftx, MPI_Comm *comm)
+{
+     return PGAGetRank  (*ftx, *comm);
+}
+
+int pgagetnumprocs_(PGAContext **ftx, MPI_Comm *comm)
+{
+     return PGAGetNumProcs  (*ftx, *comm);
+}
+
+void pgasetcommunicator_(PGAContext **ftx, MPI_Comm *comm)
+{
+     PGASetCommunicator  (*ftx, *comm);
+}
+
+MPI_Comm pgagetcommunicator_(PGAContext **ftx)
+{
+     return PGAGetCommunicator  (*ftx);
+}
+
+void pgarun_(PGAContext **ftx,
+     double (*evaluate)(PGAContext *c, int p, int pop))
+{
+     PGARun  (*ftx, (*evaluate));
+}
+
+void pgarunmutationandcrossover_(PGAContext **ftx, int *oldpop,
+     int *newpop)
+{
+     PGARunMutationAndCrossover  (*ftx, *oldpop, *newpop);
+}
+
+void pgarunmutationorcrossover_(PGAContext **ftx, int *oldpop, int *newpop)
+{
+     PGARunMutationOrCrossover  (*ftx, *oldpop, *newpop);
+}
+
+void pgaupdategeneration_(PGAContext **ftx, MPI_Comm *comm)
+{
+     PGAUpdateGeneration  (*ftx, *comm);
+}
+
+int pgagetdatatype_(PGAContext **ftx)
+{
+     return PGAGetDataType  (*ftx);
+}
+
+int pgagetoptdirflag_(PGAContext **ftx)
+{
+     return PGAGetOptDirFlag  (*ftx);
+}
+
+int pgagetstringlength_(PGAContext **ftx)
+{
+     return PGAGetStringLength  (*ftx);
+}
+
+int pgagetgaitervalue_(PGAContext **ftx)
+{
+     return PGAGetGAIterValue  (*ftx);
+}
+
+void pgasetmutationorcrossoverflag_(PGAContext **ftx, int *flag)
+{
+     PGASetMutationOrCrossoverFlag  (*ftx, *flag);
+}
+
+void pgasetmutationandcrossoverflag_(PGAContext **ftx, int *flag)
+{
+     PGASetMutationAndCrossoverFlag  (*ftx, *flag);
+}
+
+int pgagetmutationorcrossoverflag_(PGAContext **ftx)
+{
+     return PGAGetMutationOrCrossoverFlag  (*ftx);
+}
+
+int pgagetmutationandcrossoverflag_(PGAContext **ftx)
+{
+     return PGAGetMutationAndCrossoverFlag  (*ftx);
+}
+
+void pgasortpop_(PGAContext **ftx, int *pop)
+{
+     PGASortPop  (*ftx, *pop);
+}
+
+int pgagetpopsize_(PGAContext **ftx)
+{
+     return PGAGetPopSize  (*ftx);
+}
+
+int pgagetnumreplacevalue_(PGAContext **ftx)
+{
+     return PGAGetNumReplaceValue  (*ftx);
+}
+
+int pgagetpopreplacetype_(PGAContext **ftx)
+{
+     return PGAGetPopReplaceType  (*ftx);
+}
+
+int pgagetsortedpopindex_(PGAContext **ftx, int *n)
+{
+     return PGAGetSortedPopIndex(*ftx, *n-1);
+}
+
+void pgasetpopsize_(PGAContext **ftx, int *popsize)
+{
+     PGASetPopSize  (*ftx, *popsize);
+}
+
+void pgasetnumreplacevalue_(PGAContext **ftx, int *pop_replace)
+{
+     PGASetNumReplaceValue  (*ftx, *pop_replace);
+}
+
+void pgasetpopreplacetype_(PGAContext **ftx, int *pop_replace)
+{
+     PGASetPopReplaceType  (*ftx, *pop_replace);
+}
+
+int pgarandomflip_(PGAContext **ftx, double *p)
+{
+     return PGARandomFlip  (*ftx, *p);
+}
+
+int pgarandominterval_(PGAContext **ftx, int *start, int *end)
+{
+     return PGARandomInterval  (*ftx, *start, *end);
+}
+
+double pgarandom01_(PGAContext **ftx, int *newseed)
+{
+     return PGARandom01  (*ftx, *newseed);
+}
+
+double pgarandomuniform_(PGAContext **ftx, double *start, double *end)
+{
+     return PGARandomUniform  (*ftx, *start, *end);
+}
+
+double pgarandomgaussian_(PGAContext **ftx, double *mean, double *sigma)
+{
+     return PGARandomGaussian  (*ftx, *mean, *sigma);
+}
+
+int pgagetrandomseed_(PGAContext **ftx)
+{
+     return PGAGetRandomSeed  (*ftx);
+}
+
+void pgasetrandomseed_(PGAContext **ftx, int *seed)
+{
+     PGASetRandomSeed  (*ftx, *seed);
+}
+
+void pgasetrealallele_(PGAContext **ftx, int *p, int *pop, int *i,
+     double *val)
+{
+     PGASetRealAllele(*ftx,
+	   *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p : *p - 1,
+	   *pop, *i-1, *val);
+}
+
+double pgagetrealallele_(PGAContext **ftx, int *p, int *pop, int *i)
+{
+     return PGAGetRealAllele(*ftx,
+		  *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p : *p - 1,
+		  *pop, *i-1);
+}
+
+void pgasetrealinitpercent_(PGAContext **ftx, double *median, double *percent)
+{
+     PGASetRealInitPercent(*ftx, median, percent);
+}
+
+void pgasetrealinitrange_ (PGAContext **ftx, double *min, double *max)
+{
+     PGASetRealInitRange(*ftx, min, max);
+}
+
+double pgagetminrealinitvalue_(PGAContext **ftx, int *i)
+{
+     return PGAGetMinRealInitValue(*ftx, *i-1);
+}
+
+double pgagetmaxrealinitvalue_(PGAContext **ftx, int *i)
+{
+     return PGAGetMaxRealInitValue(*ftx, *i-1);
+}
+
+int pgagetrealinittype_(PGAContext **ftx)
+{
+     return PGAGetRealInitType  (*ftx);
+}
+
+void pgaprintreport_(PGAContext **ftx, char *name, int *pop, int len)
+/* FORTRAN implicitly passes the length of name into len. */
+{
+     FILE *fp;
+     if (name[len] != 0)
+	  name[len] = 0;
+     if (!strcmp(name, "STDOUT") || !strcmp(name, "stdout"))
+     {
+	  fp = stdout;
+	  PGAPrintReport(*ftx, fp, *pop);
+     }
+     else if (!strcmp(name, "STDERR") || !strcmp(name, "stderr"))
+     {
+	  fp = stderr;
+	  PGAPrintReport(*ftx, fp, *pop);
+     }
+     else
+     {
+	  fp = fopen(name, "a");
+	  if (!fp)
+	       PGAError(*ftx, "PGAPrintReport: Could not open file:",
+			     PGA_FATAL, PGA_CHAR, (void *) name);
+	  else
+	  {
+	       PGAPrintReport(*ftx, fp, *pop);
+	       fclose(fp);
+	  }
+     }
+}
+
+void pgasetprintoptions_(PGAContext **ftx, int *option)
+{
+     PGASetPrintOptions  (*ftx, *option);
+}
+
+void pgasetprintfrequencyvalue_(PGAContext **ftx, int *print_freq)
+{
+     PGASetPrintFrequencyValue  (*ftx, *print_freq);
+}
+
+int pgagetprintfrequencyvalue_(PGAContext **ftx)
+{
+     return PGAGetPrintFrequencyValue  (*ftx);
+}
+
+void pgaprintpopulation_(PGAContext **ftx, char *name, int *pop, int len)
+/* FORTRAN implicitly passes the length of name into len. */
+{
+     FILE *fp;
+     if (name[len] != 0)
+	  name[len] = 0;
+     if (!strcmp(name, "STDOUT") || !strcmp(name, "stdout"))
+     {
+	  fp = stdout;
+	  PGAPrintPopulation(*ftx, fp, *pop);
+     }
+     else if (!strcmp(name, "STDERR") || !strcmp(name, "stderr"))
+     {
+	  fp = stderr;
+	  PGAPrintPopulation(*ftx, fp, *pop);
+     }
+     else
+     {
+	  fp = fopen(name, "a");
+	  if (!fp)
+	       PGAError(*ftx, "PGAPrintPopulation: Could not open file:",
+			     PGA_FATAL, PGA_CHAR, (void *) name);
+	  else
+	  {
+	       PGAPrintPopulation(*ftx, fp, *pop);
+	       fclose(fp);
+	  }
+     }
+}
+
+void pgaprintindividual_ (PGAContext **ftx, char *name, int *p,
+     int *pop, int len)
+          /* FORTRAN implicitly passes the length of name into len. */
+{
+     FILE *fp;
+     if (name[len] != 0)
+	  name[len] = 0;
+     if (!strcmp(name, "STDOUT") || !strcmp(name, "stdout"))
+     {
+	  fp = stdout;
+	  PGAPrintIndividual(*ftx, fp, *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p : *p - 1,
+		*pop);
+     }
+     else if (!strcmp(name, "STDERR") || !strcmp(name, "stderr"))
+     {
+	  fp = stderr;
+	  PGAPrintIndividual(*ftx, fp, *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p : *p - 1,
+		*pop);
+     }
+     else
+     {
+	  fp = fopen(name, "a");
+	  if (!fp)
+	       PGAError(*ftx, "PGAPrintIndividual: Could not open file:",
+			     PGA_FATAL, PGA_CHAR, (void *) name);
+	  else
+	  {
+	       PGAPrintIndividual(*ftx, fp, *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p : *p - 1,
+		     *pop);
+	       fclose(fp);
+	  }
+     }
+}
+
+void pgaprintstring_ (PGAContext **ftx, char *name, int *p,
+     int *pop, int len)
+          /* FORTRAN implicitly passes the length of name into len. */
+{
+     FILE *fp;
+     if (name[len] != 0)
+	  name[len] = 0;
+     if (!strcmp(name, "STDOUT") || !strcmp(name, "stdout"))
+     {
+	  fp = stdout;
+	  PGAPrintString(*ftx, fp, *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p : *p - 1,
+		*pop);
+     }
+     else if (!strcmp(name, "STDERR") || !strcmp(name, "stderr"))
+     {
+	  fp = stderr;
+	  PGAPrintString(*ftx, fp, *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p : *p - 1,
+		*pop);
+     }
+     else
+     {
+	  fp = fopen(name, "a");
+	  if (!fp)
+	       PGAError(*ftx, "PGAPrintString: Could not open file:",
+			     PGA_FATAL, PGA_CHAR, (void *) name);
+	  else
+	  {
+	       PGAPrintString(*ftx, fp, *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p : *p - 1,
+		     *pop);
+	       fclose(fp);
+	  }
+     }
+}
+
+void pgaprintcontextvariable_(PGAContext **ftx, char *name, int len)
+/* FORTRAN implicitly passes the length of name into len. */
+{
+     FILE *fp;
+     if (name[len] != 0)
+	  name[len] = 0;
+     if (!strcmp(name, "STDOUT") || !strcmp(name, "stdout"))
+     {
+	  fp = stdout;
+	  PGAPrintContextVariable(*ftx, fp);
+     }
+     else if (!strcmp(name, "STDERR") || !strcmp(name, "stderr"))
+     {
+	  fp = stderr;
+	  PGAPrintContextVariable(*ftx, fp);
+     }
+     else
+     {
+	  fp = fopen(name, "a");
+	  if (!fp)
+	       PGAError(*ftx, "PGAPrintContextVariable: Could not open file:",
+			     PGA_FATAL, PGA_CHAR, (void *) name);
+	  else
+	  {
+	       PGAPrintContextVariable(*ftx, fp);
+	       fclose(fp);
+	  }
+     }
+}
+
+void pgarestart_(PGAContext **ftx, int *source_pop, int *dest_pop)
+{
+     PGARestart  (*ftx, *source_pop, *dest_pop);
+}
+
+void pgasetrestartflag_(PGAContext **ftx, int *val)
+{
+     PGASetRestartFlag  (*ftx, *val);
+}
+
+int pgagetrestartflag_(PGAContext **ftx)
+{
+     return PGAGetRestartFlag  (*ftx);
+}
+
+void pgasetrestartfrequencyvalue_(PGAContext **ftx, int *numiter)
+{
+     PGASetRestartFrequencyValue  (*ftx, *numiter);
+}
+
+int pgagetrestartfrequencyvalue_(PGAContext **ftx)
+{
+     return PGAGetRestartFrequencyValue  (*ftx);
+}
+
+void pgasetrestartallelechangeprob_(PGAContext **ftx, double *prob)
+{
+     PGASetRestartAlleleChangeProb  (*ftx, *prob);
+}
+
+double pgagetrestartallelechangeprob_(PGAContext **ftx)
+{
+     return PGAGetRestartAlleleChangeProb  (*ftx);
+}
+
+void pgaselect_(PGAContext **ftx, int *popix)
+{
+     PGASelect  (*ftx, *popix);
+}
+
+int pgaselectnextindex_(PGAContext **ftx)
+{
+     return PGASelectNextIndex  (*ftx);
+}
+
+void pgasetselecttype_(PGAContext **ftx, int *select_type)
+{
+     PGASetSelectType  (*ftx, *select_type);
+}
+
+int pgagetselecttype_(PGAContext **ftx)
+{
+     return PGAGetSelectType  (*ftx);
+}
+
+void pgasetptournamentprob_(PGAContext **ftx, double *ptournament_prob)
+{
+     PGASetPTournamentProb  (*ftx, *ptournament_prob);
+}
+
+double pgagetptournamentprob_(PGAContext **ftx)
+{
+     return PGAGetPTournamentProb  (*ftx);
+}
+
+int pgadone_(PGAContext **ftx, MPI_Comm *comm)
+{
+     return PGADone  (*ftx, *comm);
+}
+
+int pgacheckstoppingconditions_(PGAContext **ftx)
+{
+     return PGACheckStoppingConditions  (*ftx);
+}
+
+void pgasetstoppingruletype_(PGAContext **ftx, int *stoprule)
+{
+     PGASetStoppingRuleType  (*ftx, *stoprule);
+}
+
+int pgagetstoppingruletype_(PGAContext **ftx)
+{
+     return PGAGetStoppingRuleType  (*ftx);
+}
+
+void pgasetmaxgaitervalue_(PGAContext **ftx, int *maxiter)
+{
+     PGASetMaxGAIterValue  (*ftx, *maxiter);
+}
+
+int pgagetmaxgaitervalue_(PGAContext **ftx)
+{
+     return PGAGetMaxGAIterValue  (*ftx);
+}
+
+void pgasetmaxnochangevalue_(PGAContext **ftx, int *max_no_change)
+{
+     PGASetMaxNoChangeValue  (*ftx, *max_no_change);
+}
+
+void pgasetmaxsimilarityvalue_(PGAContext **ftx, int *max_similarity)
+{
+     PGASetMaxSimilarityValue  (*ftx, *max_similarity);
+}
+
+void pgaerror_(PGAContext **ftx, char *msg, int *level, int *datatype,
+     void **data, int len)
+/* FORTRAN implicitly passes the length of msg into len. */
+{
+     if (msg[len] != 0)
+	  msg[len] = 0;
+     PGAError (*ftx, msg, *level, *datatype, *data);
+}
+
+void pgadestroy_(PGAContext **ftx)
+{
+     PGADestroy  (*ftx);
+}
+
+int pgagetmaxmachineintvalue_(PGAContext **ftx)
+{
+     return PGAGetMaxMachineIntValue  (*ftx);
+}
+
+int pgagetminmachineintvalue_(PGAContext **ftx)
+{
+     return PGAGetMinMachineIntValue  (*ftx);
+}
+
+double pgagetmaxmachinedoublevalue_(PGAContext **ftx)
+{
+     return PGAGetMaxMachineDoubleValue  (*ftx);
+}
+
+double pgagetminmachinedoublevalue_(PGAContext **ftx)
+{
+     return PGAGetMinMachineDoubleValue  (*ftx);
+}
+
+void pgausage_(PGAContext **ftx)
+{
+     PGAUsage  (*ftx);
+}
+
+void pgaprintversionnumber_(PGAContext **ftx)
+{
+     PGAPrintVersionNumber  (*ftx);
+}
+
+void pgasetuserfunction_(PGAContext **ftx, int *constant, void *f)
+{
+     PGASetUserFunction(*ftx, *constant, f);
+}
+
+double pgamean_(PGAContext **ftx, double *a, int *n)
+{
+     return PGAMean(*ftx, a, *n);
+}
+
+double pgastddev_(PGAContext **ftx, double *a, int *n, double *m)
+{
+     return PGAStddev(*ftx, a, *n, *m);
+}
+
+int pgaround_(PGAContext **ftx, double *x)
+{
+     return PGARound  (*ftx, *x);
+}
+
+void pgacopyindividual_(PGAContext **ftx, int *i, int *p1, int *j, int *p2)
+{
+     PGACopyIndividual(*ftx,
+	   *i == PGA_TEMP1 || *i == PGA_TEMP2 ? *i : *i-1,
+	   *p1,
+	   *j == PGA_TEMP1 || *j == PGA_TEMP2 ? *j : *j-1,
+	   *p2);
+}
+
+int pgachecksum_(PGAContext **ftx, int *p, int *pop)
+{
+     return PGACheckSum(*ftx, *p == PGA_TEMP1 || *p == PGA_TEMP2 ? *p : *p-1, *pop);
+}
+
+int pgagetworstindex_(PGAContext **ftx, int *pop)
+{
+     return PGAGetWorstIndex(*ftx, *pop) + 1;
+}
+
+int pgagetbestindex_(PGAContext **ftx, int *pop)
+{
+     return PGAGetBestIndex(*ftx, *pop) + 1;
+}
+
Index: trunk/optimizer/src/pgapack/pgapack/source/fitness.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/fitness.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/fitness.c	(revision 816)
@@ -0,0 +1,764 @@
+/*
+ *  
+ *  ********************************************************************* 
+ *  (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+ *  *********************************************************************
+ *  
+ *  This software was authored by
+ *  
+ *  D. Levine
+ *  Mathematics and Computer Science Division Argonne National Laboratory
+ *  Argonne IL 60439
+ *  levine@mcs.anl.gov
+ *  (708) 252-6735
+ *  (708) 252-5986 (FAX)
+ *  
+ *  with programming assistance of participants in Argonne National 
+ *  Laboratory's SERS program.
+ *  
+ *  This program contains material protectable under copyright laws of the 
+ *  United States.  Permission is hereby granted to use it, reproduce it, 
+ *  to translate it into another language, and to redistribute it to 
+ *  others at no charge except a fee for transferring a copy, provided 
+ *  that you conspicuously and appropriately publish on each copy the 
+ *  University of Chicago's copyright notice, and the disclaimer of 
+ *  warranty and Government license included below.  Further, permission 
+ *  is hereby granted, subject to the same provisions, to modify a copy or 
+ *  copies or any portion of it, and to distribute to others at no charge 
+ *  materials containing or derived from the material.
+ *  
+ *  The developers of the software ask that you acknowledge its use in any 
+ *  document referencing work based on the  program, such as published 
+ *  research.  Also, they ask that you supply to Argonne National 
+ *  Laboratory a copy of any published research referencing work based on 
+ *  the software.
+ *  
+ *  Any entity desiring permission for further use must contact:
+ *  
+ *  J. Gleeson
+ *  Industrial Technology Development Center Argonne National Laboratory
+ *  Argonne IL 60439
+ *  gleesonj@smtplink.eid.anl.gov
+ *  (708) 252-6055
+ *  
+ *  ******************************************************************** 
+ *  DISCLAIMER
+ *  
+ *  THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+ *  OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+ *  THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+ *  WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+ *  RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+ *  INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+ *  INFRINGE PRIVATELY OWNED RIGHTS.
+ *  
+ *  ********************************************************************** 
+ *  GOVERNMENT LICENSE
+ *  
+ *  The Government is granted for itself and others acting on its behalf a 
+ *  paid-up, non-exclusive, irrevocable worldwide license in this computer 
+ *  software to reproduce, prepare derivative works, and perform publicly 
+ *  and display publicly.
+ */
+
+/*****************************************************************************
+*     FILE: fitness.c: This file contains the routines that have to do with
+*                      fitness calculations.
+*
+*     Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle,
+*              Brian P. Walenz
+*****************************************************************************/
+
+#include "pgapack.h"
+
+/*U****************************************************************************
+  PGAFitness - Maps the user's evaluation function value to a fitness value.
+  First, the user's evaluation function value is translated to all positive
+  values if any are negative.  Next, this positive sequence is translated to
+  a maximization problem if the user's optimization direction was minimization.
+  This positive sequence is then mapped to a fitness value using linear
+  ranking, linear normalization fitness, or the identity (i.e., the evaluation
+  function value).  This routine is usually used after PGAEvaluate is called.
+
+  Category: Fitness & Evaluation
+
+  Inputs:
+    ctx  - context variable
+    pop  - symbolic constant of the population to calculate fitness for
+
+  Outputs:
+     Calculates the fitness for each string in the population via side effect
+
+  Example:
+     Calculate the fitness of all strings in population PGA_NEWPOP after
+     calling PGAEvaluate to calculate the strings evaluation value.
+
+     double energy(PGAContext *ctx, int p, int pop);
+     PGAContext *ctx;
+     :
+     PGAEvaluate(ctx, PGA_NEWPOP, energy);
+     PGAFitness (ctx, PGA_NEWPOP);
+
+****************************************************************************U*/
+void PGAFitness ( PGAContext *ctx, int popindex )
+{
+    int i;
+    double mineval;
+    PGAIndividual *pop;
+
+    PGADebugEntered("PGAFitness");
+
+    /* set pointer to appropriate population */
+
+    switch (popindex) {
+    case PGA_OLDPOP:
+        pop = ctx->ga.oldpop;
+        break;
+    case PGA_NEWPOP:
+        pop = ctx->ga.newpop;
+        break;
+    default:
+        PGAError( ctx, "PGAFitness: Invalid value of popindex:",
+                  PGA_FATAL, PGA_INT, (void *) &popindex );
+        break;
+    }
+
+    /* make sure all evaluation function values are up-to-date */
+
+    for( i=0; i<ctx->ga.PopSize; i++ ) {
+        /*printf("i = %d, evaluptodate = %d\n",i,(pop+i)->evaluptodate);*/
+        if ( (pop+i)->evaluptodate != PGA_TRUE )
+            PGAError( ctx, "PGAFitness: evaluptodate not PGA_TRUE for:",
+                      PGA_FATAL, PGA_INT, (void *) &i );
+    }
+
+    /* put raw fitness into fitness field */
+
+    for( i=0; i<ctx->ga.PopSize; i++ )
+        (pop+i)->fitness = (pop+i)->evalfunc;
+
+    /* translate to all positive sequence (if necessary) */
+
+    mineval = ctx->sys.PGAMaxDouble;
+    for( i=0; i<ctx->ga.PopSize; i++ )
+        if ( (pop+i)->fitness < mineval )
+            mineval =(pop+i)->fitness;
+    if ( mineval < 0.0 ) {
+        mineval = (-1.01) * mineval;
+        for( i=0; i<ctx->ga.PopSize; i++ )
+           (pop+i)->fitness  = (pop+i)->fitness + mineval;
+    }
+
+    /* translate to maximization problem  (if necessary) */
+
+    if ( ctx->ga.optdir == PGA_MINIMIZE ) {
+        switch (ctx->ga.FitnessMinType) {
+        case PGA_FITNESSMIN_RECIPROCAL:
+            PGAFitnessMinReciprocal( ctx, pop );
+            break;
+        case PGA_FITNESSMIN_CMAX:
+            PGAFitnessMinCmax      ( ctx, pop );
+            break;
+        default:
+            PGAError( ctx,
+                     "PGAFitness: Invalid FitnessMinType:",
+                      PGA_FATAL,
+                      PGA_INT,
+                      (void *) &(ctx->ga.FitnessMinType) );
+            break;
+        }
+    }
+
+    /* last step in fitness calculation */
+
+    switch (ctx->ga.FitnessType) {
+    case PGA_FITNESS_RAW:
+        break;
+    case PGA_FITNESS_NORMAL:
+        PGAFitnessLinearNormal    ( ctx, pop );
+        break;
+    case PGA_FITNESS_RANKING:
+        PGAFitnessLinearRank   ( ctx, pop );
+        break;
+    default:
+        PGAError( ctx,
+                 "PGAFitness: Invalid FitnessType:",
+                  PGA_FATAL,
+                  PGA_INT,
+                  (void *) &(ctx->ga.FitnessType) );
+        break;
+    }
+
+    PGADebugExited("PGAFitness");
+}
+
+
+/*U****************************************************************************
+  PGARank - returns the rank of a string in a population.  This is a value
+  between 1,...,N (the population size).  The most fit string has rank 1,
+  the least fit string has rank N.
+
+  Category: Fitness & Evaluation
+
+  Inputs:
+    ctx   - context variable
+    p     - the index of the string whose rank is desired
+    order - an array containing a unique rank for each string
+    n     - the size of the array order
+
+  Outputs:
+    The rank of string p
+
+  Example:
+    Determine the rank of string p.
+
+    PGAContext *ctx;
+    int i, popsize, rank, *order;
+    double *fitness;
+
+    popsize = PGAGetPopsize(ctx);
+    order   = (int *)   malloc(sizeof(int)    * popsize);
+    fitness = (double *)malloc(sizeof(double) * popsize);
+
+    for(i=0;i<popsize; i++) {
+        fitness[i] = PGAGetFitness(ctx, p, PGA_OLDPOP);
+        order[i]   = i;
+    }
+
+    PGADblHeapSort(ctx, fitness, order, popsize);
+    rank = PGARank(ctx, p, order, popsize)
+
+****************************************************************************U*/
+int PGARank( PGAContext *ctx, int p, int *order, int n )
+{
+    int i;
+
+    PGADebugEntered("PGARank");
+
+    /*  If the user gives us PGA_TEMP1 or PGA_TEMP2 (or, gasp, some random
+     *  number that is not in the population), fail.
+     */
+    if ((p<0) || (p > PGAGetPopSize(ctx)))
+        PGAError(ctx, "PGARank: Not a valid population member, p = ",
+                 PGA_FATAL, PGA_INT, (void *)&p);
+
+    /*  Search through all the orderings until we find the one that
+     *  matches the given string.  Return the index number.  If we do not
+     *  find one, something is _very_ bad; terminate with a fatal error.
+     */
+    for(i=0; i<n; i++)
+        if (order[i] == p) {
+	    PGADebugExited("PGARank");
+	    return(i+1);
+        }
+
+    /*  Ideally, we should print out the order array, but, well, ideally,
+     *  we should never get here anyway...Also, to make some compilers
+     *  shut up, return(0) is here, even though PGAError doesn't return.
+     */
+    PGAError( ctx, "PGARank: Bottom of loop in rank, p = ", PGA_FATAL,
+             PGA_INT, (void *) &p );
+    return(0);
+}
+
+/*U***************************************************************************
+   PGAGetFitness - returns the fitness value for a string
+
+   Category: Fitness & Evaluation
+
+   Inputs:
+      ctx - context variable
+      p   - string index
+      pop - symbolic constant of the population the string is in
+
+   Outputs:
+      The fitness value for string p in population pop
+
+   Example:
+      PGAContext *ctx;
+      int p;
+      double fit;
+      :
+      fit = PGAGetFitness(ctx, p, PGA_NEWPOP);
+
+***************************************************************************U*/
+double PGAGetFitness ( PGAContext *ctx, int p, int pop )
+{
+    PGAIndividual *ind;
+
+    PGADebugEntered("PGAGetFitness");
+    PGADebugPrint( ctx, PGA_DEBUG_PRINTVAR,"PGAGetFitness", "p = ",
+                   PGA_INT, (void *) &p );
+    PGADebugPrint( ctx, PGA_DEBUG_PRINTVAR,"PGAGetFitness", "pop = ",
+                   PGA_INT, (void *) &pop );
+
+    ind = PGAGetIndividual ( ctx, p, pop );
+
+    PGADebugExited("PGAGetFitness");
+
+    return(ind->evalfunc);
+}
+
+/*U***************************************************************************
+   PGAGetFitnessType - Returns the type of fitness transformation used.
+
+   Category: Fitness & Evaluation
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      Returns the integer corresponding to the symbolic constant
+      used to specify the type of fitness transformation used
+
+   Example:
+      PGAContext *ctx;
+      int fittype;
+      :
+      fittype = PGAGetFitnessType(ctx);
+      switch (fittype) {
+      case PGA_FITNESS_RAW:
+          printf("Fitness Type = PGA_FITNESS_RAW\n");
+          break;
+      case PGA_FITNESS_NORMAL:
+          printf("Fitness Type = PGA_FITNESS_NORMAL\n");
+          break;
+      case PGA_FITNESS_RANKING:
+          printf("Fitness Type = PGA_FITNESS_RANKING\n");
+          break;
+      }
+
+***************************************************************************U*/
+int PGAGetFitnessType (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetFitnessType");
+    PGAFailIfNotSetUp("PGAGetFitnessType");
+
+    PGADebugExited("PGAGetFitnessType");
+
+    return(ctx->ga.FitnessType);
+}
+
+/*U***************************************************************************
+   PGAGetFitnessMinType - Returns the type of fitness transformation used
+   for minimization problems.
+
+   Category: Fitness & Evaluation
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      Returns the integer corresponding to the symbolic constant
+      used to specify the type of fitness transformation used
+      for minimization problems
+
+   Example:
+      PGAContext *ctx;
+      int fitmintype;
+      :
+      fitmintype = PGAGetFitnessMinType(ctx);
+      switch (fitmintype) {
+      case PGA_FITNESSMIN_RECIPROCAL:
+          printf("Fitness Minimization Type = PGA_FITNESSMIN_RECIPROCAL\n");
+          break;
+      case PGA_FITNESSMIN_CMAX:
+          printf("Fitness Minimization Type = PGA_FITNESSMIN_CMAX\n");
+          break;
+      }
+
+***************************************************************************U*/
+int PGAGetFitnessMinType (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetFitnessMinType");
+    PGAFailIfNotSetUp("PGAGetFitnessType");
+
+    PGADebugExited("PGAGetFitnessMinType");
+
+    return(ctx->ga.FitnessMinType);
+}
+
+/*U***************************************************************************
+   PGAGetMaxFitnessRank - returns the maximum value used in rank-based
+   fitness.
+
+   Category: Fitness & Evaluation
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      The value of MAX used in rank-based fitness
+
+   Example:
+      PGAContext *ctx;
+      double max;
+      :
+      max = PGAGetMaxFitnessRank(ctx);
+
+***************************************************************************U*/
+double PGAGetMaxFitnessRank (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetMaxFitnessRank");
+    PGAFailIfNotSetUp("PGAGetFitnessType");
+
+    PGADebugExited("PGAGetMaxFitnessRank");
+
+    return(ctx->ga.FitnessRankMax);
+}
+
+/*U****************************************************************************
+   PGASetFitnessType - Set the type of fitness algorithm to use. Valid choices
+   are PGA_FITNESS_RAW, PGA_FITNESS_NORMAL, or PGA_FITNESS_RANKING for
+   raw fitness (the evaluation function value), linear normalization, or
+   linear ranking, respectively.  The default is PGA_FITNESS_RAW.
+
+   Category: Fitness & Evaluation
+
+   Inputs:
+      ctx          - context variable
+      fitness_type - symbolic constant to specify fitness type
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx;
+      :
+      PGASetFitnessType(ctx, PGA_FITNESS_RANKING);
+
+****************************************************************************U*/
+void PGASetFitnessType( PGAContext *ctx, int fitness_type)
+{
+
+    PGADebugEntered("PGASetFitnessType");
+
+    switch (fitness_type) {
+        case PGA_FITNESS_RAW:
+        case PGA_FITNESS_NORMAL:
+        case PGA_FITNESS_RANKING:
+            ctx->ga.FitnessType = fitness_type;
+            break;
+        default:
+            PGAError(ctx, "PGASetFitnessType: Invalid value of fitness_type:",
+                     PGA_FATAL, PGA_INT, (void *) &fitness_type);
+            break;
+    }
+
+    PGADebugExited("PGASetFitnessType");
+}
+
+/*U****************************************************************************
+   PGASetFitnessMinType - sets the type of algorithm used if a minimization
+   problem is specified to determine how values are remapped for maximization.
+   Valid choices are PGA_FITNESSMIN_RECIPROCAL and PGA_FITNESSMIN_CMAX to do
+   the mapping using the reciprocal of the evaluation function, or by
+   subtracting the worst evaluation function value from each evaluation
+   function value, respectively.  The default is PGA_FITNESSMIN_CMAX
+
+   Category: Fitness & Evaluation
+
+   Inputs:
+      ctx          - context variable
+      fitness_type - symbolic constant to specify fitness minimization type
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx;
+      :
+      PGASetFitnessMinType(ctx, PGA_FITNESSMIN_CMAX);
+
+****************************************************************************U*/
+void PGASetFitnessMinType( PGAContext *ctx, int fitness_type)
+{
+
+    PGADebugEntered("PGASetFitnessMinType");
+
+    switch (fitness_type) {
+        case PGA_FITNESSMIN_RECIPROCAL:
+        case PGA_FITNESSMIN_CMAX:
+            ctx->ga.FitnessMinType = fitness_type;
+            break;
+        default:
+            PGAError ( ctx,
+                      "PGASetFitnessMinType: Invalid value of fitness_type:",
+                       PGA_FATAL, PGA_INT, (void *) &fitness_type);
+        break;
+    }
+
+    PGADebugExited("PGASetFitnessMinType");
+}
+
+/*U****************************************************************************
+   PGASetMaxFitnessRank - The value of the parameter Max when using linear
+   ranking for fitness determination. The default value is 1.2.  The value
+   must be from the interval [1.0, 2.0].  The fitness type must have been set
+   to PGA_FITNESS_RANKING with PGASetFitnessType for this function call
+   to have any effect.
+
+   Category: Fitness & Evaluation
+
+   Inputs:
+      ctx - context variable
+      max - the value of the parameter Max when using linear ranking
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx;
+      :
+      PGASetMaxFitnessRank(ctx, 1.1);
+
+****************************************************************************U*/
+void PGASetMaxFitnessRank( PGAContext *ctx, double fitness_rank_max)
+{
+    PGADebugEntered("PGASetMaxFitnessRank");
+
+    if ((fitness_rank_max < 1.0) || (fitness_rank_max > 2.0))
+        PGAError ( ctx,
+                  "PGASetMaxFitnessRank: Invalid value of fitness_rank_max:",
+                   PGA_FATAL, PGA_DOUBLE, (void *) &fitness_rank_max);
+    else
+        ctx->ga.FitnessRankMax = fitness_rank_max;
+
+    PGADebugExited("PGASetMaxFitnessRank");
+}
+
+
+
+/*I****************************************************************************
+  PGAFitnessLinearNormal - Calculates fitness using a ranking method and
+  linear' ordering.  The fitness function is of the form
+  u(x) = K - ( rank * sigma ) with the constant K equal to the mean of the
+  evaluation functions, and the decrement sigma equal to the standard
+  deviation of the same.
+  Ref:    L. Davis, Handbook of Genetic Algorithms, pg. 33
+
+  Inputs:
+    ctx  - context variable
+    pop  - population pointer to calculate fitness for
+
+  Outputs:
+     Calculates the fitness for each string in the population via side effect
+
+  Example:
+
+****************************************************************************I*/
+void PGAFitnessLinearNormal ( PGAContext *ctx, PGAIndividual *pop )
+{
+
+    int i;
+    double K, sigma, mean;
+
+    PGADebugEntered("PGAFitnessLinearNormal");
+
+    /* fill arrays for sorting */
+
+    for(i=0;i<ctx->ga.PopSize;i++) {
+        ctx->scratch.dblscratch[i] = (pop+i)->fitness;
+        ctx->scratch.intscratch[i] =                i;
+    }
+
+    /* calculate parameters for linear normalization */
+
+    mean  = PGAMean   ( ctx, ctx->scratch.dblscratch, ctx->ga.PopSize  );
+    sigma = PGAStddev ( ctx, ctx->scratch.dblscratch, ctx->ga.PopSize, mean );
+    if (sigma == 0)
+         sigma = 1;
+    K = sigma * (double) ctx->ga.PopSize;
+    PGADblHeapSort ( ctx, ctx->scratch.dblscratch,
+                  ctx->scratch.intscratch,
+                  ctx->ga.PopSize);
+
+    for( i=0; i<ctx->ga.PopSize; i++ )
+        (pop+i)->fitness = K - ( sigma *
+            (double) PGARank(ctx,i,ctx->scratch.intscratch,ctx->ga.PopSize) );
+
+    PGADebugExited("PGAFitnessLinearNormal");
+}
+
+/*I****************************************************************************
+  PGAFitnessLinearRank - Calculates fitness using linear ranking. The fitness
+  function is of the form 1/N * ( max - (max-min) * ( (i-1)/(N-1) ) ) where
+  min = 2-max and 1 <= max <= 2.
+  Ref:    J. Baker: Adaptive selection methods for GAs
+  Ref:    J. Baker: Extended selection mechanism in GAs
+  Ref:    J. Grefenstte: A critical look at implicit parallelism
+  Ref:    D. Whitley's linear() function on pp. 121 of ICGA
+
+  Inputs:
+    ctx  - context variable
+    pop  - population pointer to calculate fitness for
+
+  Outputs:
+     Calculates the fitness for each string in the population via side effect
+
+  Example:
+
+****************************************************************************I*/
+void PGAFitnessLinearRank ( PGAContext *ctx, PGAIndividual *pop )
+{
+    double max, min, popsize, rpopsize;
+    int i;
+
+    PGADebugEntered("PGAFitnessLinearRank");
+
+    max      = ctx->ga.FitnessRankMax;
+    min      = 2. - max;
+    popsize  = (double) ctx->ga.PopSize;
+    rpopsize = 1.0/popsize;
+
+    for(i=0;i<ctx->ga.PopSize;i++) {
+        ctx->scratch.dblscratch[i] = (pop+i)->fitness;
+        ctx->scratch.intscratch[i] =                i;
+    }
+
+    PGADblHeapSort ( ctx, ctx->scratch.dblscratch,
+                  ctx->scratch.intscratch,
+                  ctx->ga.PopSize);
+
+    for(i=0;i<ctx->ga.PopSize;i++) {
+        (pop+i)->fitness = rpopsize * ( max -
+        ( (max - min) *
+        ( ( (double) PGARank(ctx,i,ctx->scratch.intscratch,ctx->ga.PopSize)
+             - 1. ) / ( popsize - 1. ) ) ) );
+
+    }
+
+    PGADebugExited("PGAFitnessLinearRank");
+}
+
+
+/*I****************************************************************************
+  PGAFitnessMinReciprocal - Calculates fitness in the case of a minimization
+  problem using the reciprocal of the evaluation function. This is a power law
+  u(x) = ( a f(x) + b )^k with a=1, b=0, k=-1
+
+  Inputs:
+    ctx  - context variable
+    pop  - population pointer to calculate fitness for
+
+  Outputs:
+     Calculates the fitness for each string in the population via side effect
+
+  Example:
+
+****************************************************************************I*/
+void PGAFitnessMinReciprocal ( PGAContext *ctx, PGAIndividual *pop )
+{
+    int i;
+
+    PGADebugEntered("PGAFitnessMinReciprocal");
+
+    for( i=0; i<ctx->ga.PopSize; i++ ) {
+        if ( (pop+i)->fitness != 0. )
+            (pop+i)->fitness = 1. / (pop+i)->fitness;
+        else
+            PGAError( ctx,
+                     "PGAFitnessReciprocal: Value 0.0 for fitness member:",
+                      PGA_FATAL,
+                      PGA_INT,
+                     (void *) &i );
+    }
+
+    PGADebugExited("PGAFitnessMinReciprocal");
+}
+
+
+/*I****************************************************************************
+  PGAFitnessMinCmax - Calculates fitness in the case of a minimization
+  problem by subtracting the worst evaluation function value from each
+  evaluation function.  This is a dynamic linear fitness function
+  u(x) = a f(x) + b(t) with a=-1, b(t) = 1.1 * max f(x)
+
+  Inputs:
+    ctx  - context variable
+    pop  - population pointer to calculate fitness for
+
+  Outputs:
+     Calculates the fitness for each string in the population via side effect
+
+  Example:
+
+****************************************************************************I*/
+void PGAFitnessMinCmax ( PGAContext *ctx, PGAIndividual *pop )
+{
+    int i;
+    double cmax;
+
+    PGADebugEntered("PGAFitnessMinCmax");
+
+    cmax = 0.;
+
+    for(i=0; i<ctx->ga.PopSize; i++)
+        if ( (pop+i)->evalfunc > cmax )
+            cmax = (pop+i)->evalfunc;
+
+    cmax *= ctx->ga.FitnessCmaxValue; /* so worst string has nonzero fitness */
+
+    for(i=0;i<ctx->ga.PopSize;i++)
+        (pop+i)->fitness = cmax - (pop+i)->evalfunc;
+
+    PGADebugExited("PGAFitnessMinCmax");
+}
+
+
+/*U****************************************************************************
+   PGASetFitnessCmaxValue - The value of the multiplier used by
+   PGAFitnessMinCmax so that the worst string has a nonzero fitness.
+   The default value is 1.01.
+
+   Category: Fitness & Evaluation
+
+   Inputs:
+      ctx - context variable
+      val - the value of the multiplier
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx;
+      :
+      PGASetFitnessCmaxValue(ctx, 1.2);
+
+****************************************************************************U*/
+void PGASetFitnessCmaxValue( PGAContext *ctx, double val)
+{
+    PGADebugEntered("PGASetFitnessCmaxValue");
+    ctx->ga.FitnessCmaxValue = val;
+    PGADebugExited("PGASetFitnessCmaxValue");
+}
+
+
+
+/*U***************************************************************************
+   PGAGetFitnessCmaxValue - returns the value of the multiplier used by
+   PGAFitnessMinCmax.
+
+   Category: Fitness & Evaluation
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      The value of Cmax used in
+
+   Example:
+      PGAContext *ctx;
+      double cmax;
+      :
+      cmax = PGAGetFitnessCmaxValue(ctx);
+
+***************************************************************************U*/
+double PGAGetFitnessCmaxValue (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetFitnessCmaxValue");
+    PGAFailIfNotSetUp("PGAGetFitnessType");
+    PGADebugExited("PGAGetFitnessCmaxValue");
+    return(ctx->ga.FitnessCmaxValue);
+}
+
Index: trunk/optimizer/src/pgapack/pgapack/source/hamming.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/hamming.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/hamming.c	(revision 816)
@@ -0,0 +1,170 @@
+/*
+ *  
+ *  ********************************************************************* 
+ *  (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+ *  *********************************************************************
+ *  
+ *  This software was authored by
+ *  
+ *  D. Levine
+ *  Mathematics and Computer Science Division Argonne National Laboratory
+ *  Argonne IL 60439
+ *  levine@mcs.anl.gov
+ *  (708) 252-6735
+ *  (708) 252-5986 (FAX)
+ *  
+ *  with programming assistance of participants in Argonne National 
+ *  Laboratory's SERS program.
+ *  
+ *  This program contains material protectable under copyright laws of the 
+ *  United States.  Permission is hereby granted to use it, reproduce it, 
+ *  to translate it into another language, and to redistribute it to 
+ *  others at no charge except a fee for transferring a copy, provided 
+ *  that you conspicuously and appropriately publish on each copy the 
+ *  University of Chicago's copyright notice, and the disclaimer of 
+ *  warranty and Government license included below.  Further, permission 
+ *  is hereby granted, subject to the same provisions, to modify a copy or 
+ *  copies or any portion of it, and to distribute to others at no charge 
+ *  materials containing or derived from the material.
+ *  
+ *  The developers of the software ask that you acknowledge its use in any 
+ *  document referencing work based on the  program, such as published 
+ *  research.  Also, they ask that you supply to Argonne National 
+ *  Laboratory a copy of any published research referencing work based on 
+ *  the software.
+ *  
+ *  Any entity desiring permission for further use must contact:
+ *  
+ *  J. Gleeson
+ *  Industrial Technology Development Center Argonne National Laboratory
+ *  Argonne IL 60439
+ *  gleesonj@smtplink.eid.anl.gov
+ *  (708) 252-6055
+ *  
+ *  ******************************************************************** 
+ *  DISCLAIMER
+ *  
+ *  THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+ *  OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+ *  THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+ *  WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+ *  RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+ *  INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+ *  INFRINGE PRIVATELY OWNED RIGHTS.
+ *  
+ *  ********************************************************************** 
+ *  GOVERNMENT LICENSE
+ *  
+ *  The Government is granted for itself and others acting on its behalf a 
+ *  paid-up, non-exclusive, irrevocable worldwide license in this computer 
+ *  software to reproduce, prepare derivative works, and perform publicly 
+ *  and display publicly.
+ */
+
+/*****************************************************************************
+*     FILE: hamming.c: This file contains the routines that have to do with
+*                      Hamming distances.
+*
+*     Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle
+*****************************************************************************/
+
+#include "pgapack.h"
+
+/*U****************************************************************************
+  PGAHammingDistance - Calculates the mean Hamming distance for a population
+  of binary strings.  For all other data types returns a value of 0.0 and
+  prints a warning message.
+
+  Category: Utility
+
+  Inputs:
+      ctx      - context variable
+      popindex - symbolic constant of the population for which the
+                 Hamming distance is to be calculated
+  Output:
+      The mean Hamming distance in the population
+
+  Example:
+      PGAContext *ctx;
+      double hd;
+      :
+      hd = PGAHammingDistance(ctx, PGA_NEWPOP);
+
+****************************************************************************U*/
+double PGAHammingDistance( PGAContext *ctx, int popindex)
+{
+    int i, j, hd, count=0;
+    double avg_hd = 0.;
+    PGAIndividual *pop;      /* pointer to appropriate population          */
+
+    PGADebugEntered("PGAHammingDistance");
+
+    switch (popindex) {
+    case PGA_OLDPOP:
+        pop = ctx->ga.oldpop;
+        break;
+    case PGA_NEWPOP:
+        pop = ctx->ga.newpop;
+        break;
+    default:
+        PGAError( ctx, "PGAHammingDistance: Invalid value of popindex:",
+                  PGA_FATAL, PGA_INT, (void *) &popindex );
+        break;
+    }
+
+    switch (ctx->ga.datatype) {
+    case PGA_DATATYPE_BINARY:
+        for(i=0; i<ctx->ga.PopSize-1; ++i)
+            for ( j = i+1; j<ctx->ga.PopSize; ++j ) {
+                count++;
+                hd = PGABinaryHammingDistance( ctx,
+                                            (pop+i)->chrom, (pop+j)->chrom );
+                avg_hd += (double) hd;
+            }
+        avg_hd /= (double) count;
+        break;
+    case PGA_DATATYPE_INTEGER:
+        avg_hd = 0.0;
+        PGAError( ctx,
+        "PGAHammingDistance: No Hamming Distance for PGA_DATATYPE_INTEGER ",
+                  PGA_WARNING,
+                  PGA_DOUBLE,
+                  (void *) &avg_hd );
+        break;
+    case PGA_DATATYPE_REAL:
+        avg_hd = 0;
+        PGAError( ctx,
+        "PGAHammingDistance: No Hamming Distance for PGA_DATATYPE_REAL ",
+                  PGA_WARNING,
+                  PGA_DOUBLE,
+                  (void *) &avg_hd );
+        break;
+    case PGA_DATATYPE_CHARACTER:
+        avg_hd = 0;
+        PGAError( ctx,
+        "PGAHammingDistance: No Hamming Distance for PGA_DATATYPE_CHARACTER ",
+                  PGA_WARNING,
+                  PGA_DOUBLE,
+                  (void *) &avg_hd );
+        break;
+    case PGA_DATATYPE_USER:
+        avg_hd = 0;
+        PGAError( ctx,
+        "PGAHammingDistance: No Hamming Distance for PGA_DATATYPE_USER ",
+                  PGA_WARNING,
+                  PGA_DOUBLE,
+                  (void *) &avg_hd );
+        break;
+    default:
+        PGAError( ctx,
+                 "PGAHammingDistance: Invalid value of datatype:",
+                  PGA_FATAL,
+                  PGA_INT,
+                  (void *) &(ctx->ga.datatype) );
+        break;
+    }
+
+    PGADebugExited("PGAHammingDistance");
+
+    return(avg_hd);
+}
Index: trunk/optimizer/src/pgapack/pgapack/source/heap.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/heap.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/heap.c	(revision 816)
@@ -0,0 +1,239 @@
+/*
+ *  
+ *  ********************************************************************* 
+ *  (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+ *  *********************************************************************
+ *  
+ *  This software was authored by
+ *  
+ *  D. Levine
+ *  Mathematics and Computer Science Division Argonne National Laboratory
+ *  Argonne IL 60439
+ *  levine@mcs.anl.gov
+ *  (708) 252-6735
+ *  (708) 252-5986 (FAX)
+ *  
+ *  with programming assistance of participants in Argonne National 
+ *  Laboratory's SERS program.
+ *  
+ *  This program contains material protectable under copyright laws of the 
+ *  United States.  Permission is hereby granted to use it, reproduce it, 
+ *  to translate it into another language, and to redistribute it to 
+ *  others at no charge except a fee for transferring a copy, provided 
+ *  that you conspicuously and appropriately publish on each copy the 
+ *  University of Chicago's copyright notice, and the disclaimer of 
+ *  warranty and Government license included below.  Further, permission 
+ *  is hereby granted, subject to the same provisions, to modify a copy or 
+ *  copies or any portion of it, and to distribute to others at no charge 
+ *  materials containing or derived from the material.
+ *  
+ *  The developers of the software ask that you acknowledge its use in any 
+ *  document referencing work based on the  program, such as published 
+ *  research.  Also, they ask that you supply to Argonne National 
+ *  Laboratory a copy of any published research referencing work based on 
+ *  the software.
+ *  
+ *  Any entity desiring permission for further use must contact:
+ *  
+ *  J. Gleeson
+ *  Industrial Technology Development Center Argonne National Laboratory
+ *  Argonne IL 60439
+ *  gleesonj@smtplink.eid.anl.gov
+ *  (708) 252-6055
+ *  
+ *  ******************************************************************** 
+ *  DISCLAIMER
+ *  
+ *  THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+ *  OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+ *  THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+ *  WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+ *  RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+ *  INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+ *  INFRINGE PRIVATELY OWNED RIGHTS.
+ *  
+ *  ********************************************************************** 
+ *  GOVERNMENT LICENSE
+ *  
+ *  The Government is granted for itself and others acting on its behalf a 
+ *  paid-up, non-exclusive, irrevocable worldwide license in this computer 
+ *  software to reproduce, prepare derivative works, and perform publicly 
+ *  and display publicly.
+ */
+
+/*****************************************************************************
+*      FILE: heap.c: This file contains routines for sorting individuals for
+*                     selection
+*
+*      Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle,
+*               Brian P. Walenz
+*****************************************************************************/
+
+#include <pgapack.h>
+
+/******************************************************************************
+   PGAAdjustHeap - Auxiliary routine called by PGA*HeapSort
+
+   Category: Sorting
+
+   Inputs:
+       ctx      - context variable
+       a        - array of values to be sorted
+       idx      - array of integer indices corresponding to the array
+                  a being sorted
+       i        - point of combination -- combine the node at a[i] with
+                  the two heaps at a[2i+1] and a[2i+2] to form a single
+                  heap.  0 <= i <= n-1.
+       n        - size of the arrays a and idx
+       j        - temporary variable, integer
+       item     - temporary variable, type must be same as a
+       item_idx - temporary variable, integer
+
+   Output:
+
+   Example:
+
+******************************************************************************/
+#define PGAAdjustHeap(ctx, a, idx, i, n, j, item, item_idx) {       \
+  item     = a[i];                                                  \
+  item_idx = idx[i];                                                \
+  j = 2*i+1;      /* let j be the left child */                     \
+  while (j < n) {                                                   \
+    if (j<n-1 && a[j] > a[j+1])                                     \
+       j = j + 1;       /* j is the larger child */                 \
+    if (item <= a[j])   /* a position for item has been found */    \
+       break;                                                       \
+    a[(j-1)/2]   = a[j];    /* move the larger child up a level */  \
+    idx[(j-1)/2] = idx[j];                                          \
+    j = j*2+1;                                                      \
+  }                                                                 \
+  a[(j-1)/2]   = item;                                              \
+  idx[(j-1)/2] = item_idx;                                          \
+}                                                                   \
+
+
+
+
+/*I****************************************************************************
+   PGADblHeapSort - Uses a heapsort algorithm to sort from largest to smallest
+   element.  An integer array, intialized with the original indices of the
+   elements of array a is sorted also so that the original locations are known
+
+   Category: Sorting
+
+   Inputs:
+       ctx      - context variable
+       a        - array of (double) values to be sorted
+       idx      - array of integer indices corresponding to the array
+                  a being sorted
+       n        - size of the arrays a and idx
+
+   Output:
+       The sorted arrays a and idx
+
+   Example:
+      The following code sorts the population by fitness
+
+      PGAContext *ctx;
+      int i,j,n,idx[LARGE]
+      double a[LARGE];
+      :
+      n = PGAGetPopsize(ctx);
+      for(i=0;i<n;i++) {
+        a[i]   = PGAGetFitness(ctx,p,PGA_OLDPOP);
+        idx[i] = i;
+      }
+      PGADblHeapSort ( ctx, a, idx, n);
+
+****************************************************************************I*/
+void PGADblHeapSort ( PGAContext *ctx, double *a, int *idx, int n )
+{
+  int i;
+  double temp_a;
+  int temp_idx;
+  int j, item_idx;
+  double item;
+
+    PGADebugEntered("PGADblHeapSort");
+
+  /*  Create a heap from our array  */
+  for (i=(n-2)/2; i>=0; i--)
+    PGAAdjustHeap(ctx, a, idx, i, n, j, item, item_idx);
+
+  for ( i=n-1; i>=1; i--)  /* interchange the new maximum with the   */
+  {                        /* element at the end of the tree         */
+    temp_a   = a[i];
+    temp_idx = idx[i];
+    a[i]     = a[0];
+    idx[i]   = idx[0];
+    a[0]     = temp_a;
+    idx[0]     = temp_idx;
+    PGAAdjustHeap(ctx, a, idx, 0, i, j, item, item_idx);
+  }
+
+    PGADebugExited("PGADblHeapSort");
+}
+
+
+
+
+/*I****************************************************************************
+   PGAIntHeapSort - Uses a heapsort algorithm to sort from largest to smallest
+   element.  An integer array, intialized with the original indices of the
+   elements of array a is sorted also so that the original locations are known
+
+   Category: Sorting
+
+   Inputs:
+       ctx      - context variable
+       a        - array of (int) values to be sorted
+       idx      - array of integer indices corresponding to the array
+                  a being sorted
+       n        - size of the arrays a and idx
+
+   Output:
+       The sorted arrays a and idx
+
+   Example:
+      The following code sorts the population by fitness
+
+      PGAContext *ctx;
+      int i,j,n,idx[LARGE],a[LARGE];
+      :
+      n = PGAGetPopsize(ctx);
+      for(i=0;i<n;i++) {
+        a[i]   = (int) PGAGetEvaluation(ctx,p,PGA_OLDPOP);
+        idx[i] = i;
+      }
+      PGAIntHeapSort ( ctx, a, idx, n);
+
+****************************************************************************I*/
+void PGAIntHeapSort ( PGAContext *ctx, int *a, int *idx, int n )
+{
+  int i;                   /* index of for loops                      */
+  int temp_a;
+  int temp_idx;
+  int j, item_idx;
+  double item;
+
+    PGADebugEntered("PGAIntHeapSort");
+
+  /*  Create a heap from our elements.  */
+  for (i=(n-2)/2; i>=0; i--)
+    PGAAdjustHeap(ctx, a, idx, i, n, j, item, item_idx);
+
+  for ( i=n-1; i>=1; i--)  /* interchange the new maximum with the   */
+  {                        /* element at the end of the tree         */
+    temp_a   = a[i];
+    temp_idx = idx[i];
+    a[i]     = a[0];
+    idx[i]   = idx[0];
+    a[0]     = temp_a;
+    idx[0]     = temp_idx;
+    PGAAdjustHeap(ctx, a, idx, 0, i, j, item, item_idx);
+  }
+
+    PGADebugExited("PGAIntHeapSort");
+}
+
+
Index: trunk/optimizer/src/pgapack/pgapack/source/integer.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/integer.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/integer.c	(revision 816)
@@ -0,0 +1,907 @@
+/*
+ *  
+ *  ********************************************************************* 
+ *  (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+ *  *********************************************************************
+ *  
+ *  This software was authored by
+ *  
+ *  D. Levine
+ *  Mathematics and Computer Science Division Argonne National Laboratory
+ *  Argonne IL 60439
+ *  levine@mcs.anl.gov
+ *  (708) 252-6735
+ *  (708) 252-5986 (FAX)
+ *  
+ *  with programming assistance of participants in Argonne National 
+ *  Laboratory's SERS program.
+ *  
+ *  This program contains material protectable under copyright laws of the 
+ *  United States.  Permission is hereby granted to use it, reproduce it, 
+ *  to translate it into another language, and to redistribute it to 
+ *  others at no charge except a fee for transferring a copy, provided 
+ *  that you conspicuously and appropriately publish on each copy the 
+ *  University of Chicago's copyright notice, and the disclaimer of 
+ *  warranty and Government license included below.  Further, permission 
+ *  is hereby granted, subject to the same provisions, to modify a copy or 
+ *  copies or any portion of it, and to distribute to others at no charge 
+ *  materials containing or derived from the material.
+ *  
+ *  The developers of the software ask that you acknowledge its use in any 
+ *  document referencing work based on the  program, such as published 
+ *  research.  Also, they ask that you supply to Argonne National 
+ *  Laboratory a copy of any published research referencing work based on 
+ *  the software.
+ *  
+ *  Any entity desiring permission for further use must contact:
+ *  
+ *  J. Gleeson
+ *  Industrial Technology Development Center Argonne National Laboratory
+ *  Argonne IL 60439
+ *  gleesonj@smtplink.eid.anl.gov
+ *  (708) 252-6055
+ *  
+ *  ******************************************************************** 
+ *  DISCLAIMER
+ *  
+ *  THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+ *  OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+ *  THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+ *  WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+ *  RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+ *  INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+ *  INFRINGE PRIVATELY OWNED RIGHTS.
+ *  
+ *  ********************************************************************** 
+ *  GOVERNMENT LICENSE
+ *  
+ *  The Government is granted for itself and others acting on its behalf a 
+ *  paid-up, non-exclusive, irrevocable worldwide license in this computer 
+ *  software to reproduce, prepare derivative works, and perform publicly 
+ *  and display publicly.
+ */
+
+/*****************************************************************************
+*     FILE: integer.c: This file contains the routines specific to the integer
+*                      data structure
+*
+*     Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle,
+*              Brian P. Walenz
+*****************************************************************************/
+
+#include "pgapack.h"
+
+/*U****************************************************************************
+   PGASetIntegerAllele - sets the value of a (integer) allele.
+
+   Category: Fitness & Evaluation
+
+   Inputs:
+      ctx - context variable
+      p   - string index
+      pop - symbolic constant of the population the string is in
+      i   - allele index
+      val - integer value to set the allele to
+
+   Outputs:
+
+   Example:
+      Set the value of the ith allele of string p in population PGA_NEWPOP
+      to 64.
+
+      PGAContext *ctx;
+      int p, i;
+      :
+      PGASetIntegerAllele (ctx, p, PGA_NEWPOP, i, 64)
+
+****************************************************************************U*/
+void PGASetIntegerAllele (PGAContext *ctx, int p, int pop, int i, int value)
+{
+    PGAIndividual *ind;
+    PGAInteger     *chrom;
+
+    PGADebugEntered("PGASetIntegerAllele");
+    PGACheckDataType("PGASetIntegerAllele", PGA_DATATYPE_INTEGER);
+
+    ind = PGAGetIndividual ( ctx, p, pop );
+    chrom = (PGAInteger *)ind->chrom;
+    chrom[i] = value;
+
+    PGADebugExited("PGASetIntegerAllele");
+}
+
+/*U****************************************************************************
+   PGAGetIntegerAllele - Returns the value of allele i of member p in
+   population pop.  Assumes the data type is PGA_DATATYPE_INTEGER.
+
+   Category: Fitness & Evaluation
+
+   Inputs:
+      ctx - context variable
+      p   - string index
+      pop - symbolic constant of the population the string is in
+      i   - allele index
+
+   Outputs:
+
+   Example:
+      Returns the value of the ith integer allele of string p
+      in population PGA_NEWPOP.
+
+      PGAContext *ctx;
+      int p, i, k;
+      :
+      k =  PGAGetIntegerAllele ( ctx, p, PGA_NEWPOP, i )
+
+****************************************************************************U*/
+int PGAGetIntegerAllele (PGAContext *ctx, int p, int pop, int i)
+{
+    PGAIndividual *ind;
+    PGAInteger     *chrom;
+
+    PGADebugEntered("PGAGetIntegerAllele");
+
+    PGACheckDataType("PGAGetIntegerAllele", PGA_DATATYPE_INTEGER);
+
+    ind = PGAGetIndividual ( ctx, p, pop );
+    chrom = (PGAInteger *)ind->chrom;
+
+    PGADebugExited("PGAGetIntegerAllele");
+
+    return( (int) chrom[i] );
+}
+
+/*U****************************************************************************
+  PGASetIntegerInitPermute - sets a flag to tell the initialization routines
+  to set each integer-valued gene to a random permutation of the values given
+  by an upper and lower bound.  The length of the interval must be the same
+  as the string length.  This is the default strategy for initializing
+  integer-valued strings. The default interval is [0,L-1] where L is the
+  string length.  No string initialization is done by this call.
+
+  Category: Initialization
+
+  Inputs:
+     ctx - context variable
+     min - the lower bound of numbers used in the permutation
+     max - the upper bound of numbers used in the permutation
+
+  Outputs:
+
+  Example:
+      Set the initialization routines to set each gene to a random and
+      unique value from the interval $[500,599]$.
+
+      PGAContext *ctx;
+      :
+      PGASetIntegerInitPermute(ctx, 500, 599)}
+
+****************************************************************************U*/
+void PGASetIntegerInitPermute ( PGAContext *ctx, int min, int max)
+{
+     int i, range;
+
+    PGADebugEntered("PGASetIntegerInitPermute");
+    PGAFailIfSetUp("PGASetIntegerInitPermute");
+    PGACheckDataType("PGASetIntegerInitPermute", PGA_DATATYPE_INTEGER);
+
+     range = max - min + 1;
+     if (max <= min)
+          PGAError(ctx, "PGASetIntegerInitPermute: max does not exceed min:",
+                   PGA_FATAL, PGA_INT, (void *) &max);
+     else if (range != ctx->ga.StringLen) {
+          PGAError(ctx, "PGASetIntegerInitPermute: range of:",
+                   PGA_FATAL, PGA_INT, (void *) &range);
+          PGAError(ctx, "PGASetIntegerInitPermute: does not equal "
+                   "string length:", PGA_FATAL, PGA_INT,
+                    (void *) &(ctx->ga.StringLen));
+     }
+     else
+     {
+          ctx->init.IntegerType = PGA_IINIT_PERMUTE;
+          for (i = 0; i < ctx->ga.StringLen; i++)
+          {
+               ctx->init.IntegerMin[i] = min;
+               ctx->init.IntegerMax[i] = max;
+          }
+     }
+
+    PGADebugExited("PGASetIntegerInitPermute");
+}
+
+/*U****************************************************************************
+  PGASetIntegerInitRange - sets a flag to tell the initialization routines to
+  set each integer-valued gene to a value chosen randomly from the interval
+  given by an upper and lower bound.  No string initialization is done by
+  this call.
+
+  Category: Initialization
+
+  Inputs:
+     ctx - context variable
+     min - array of lower bounds that define the interval the gene is
+           initialized from
+     max - array of upper bounds that define the interval the gene is
+           initialized from
+
+  Outputs:
+
+  Example:
+      Set the initialization routines to select a value for gene i
+      uniformly randomly from the interval [0,i].  Assumes all strings
+      are of the same length.
+
+      PGAContext *ctx;
+      int *low, *high, stringlen, i;
+      :
+      stringlen = PGAGetStringLength(ctx);
+      low  = (int *) malloc(stringlen*sizeof(int));
+      high = (int *) malloc(stringlen*sizeof(int));
+      for(i=0;i<stringlen;i++) {
+          low[i]  = 0;
+          high[i] = i
+      }
+      PGASetIntegerInitRange(ctx, low, high);
+
+****************************************************************************U*/
+void PGASetIntegerInitRange (PGAContext *ctx, int *min, int *max)
+{
+     int i;
+
+     PGADebugEntered("PGASetIntegerInitRange");
+     PGAFailIfSetUp("PGASetIntegerInitRange");
+     PGACheckDataType("PGASetIntegerInitRange", PGA_DATATYPE_INTEGER);
+
+     for (i = 0; i < ctx->ga.StringLen; i++)
+     {
+        if (max[i] < min[i])
+            PGAError(ctx, "PGASetIntegerInitRange: Lower bound exceeds upper "
+                    "bound for allele #", PGA_FATAL, PGA_INT, (void *) &i);
+        else {
+            ctx->init.IntegerMin[i] = min[i];
+            ctx->init.IntegerMax[i] = max[i];
+        }
+     }
+     ctx->init.IntegerType = PGA_IINIT_RANGE;
+
+     PGADebugExited("PGASetIntegerInitRange");
+}
+
+/*U***************************************************************************
+  PGAGetIntegerInitType - returns the type of scheme used to randomly
+  initialize strings of data type PGA_DATATYPE_INTEGER.
+
+   Category: Initialization
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      Returns the integer corresponding to the symbolic constant
+      used to specify the scheme used to initialize integer strings
+
+   Example:
+      PGAContext *ctx;
+      int inittype;
+      :
+      inittype = PGAGetIntegerInitType(ctx);
+      switch (inittype) {
+      case PGA_IINIT_PERMUTE:
+          printf("Data Type = PGA_IINIT_PERMUTE\n");
+          break;
+      case PGA_IINIT_RANGE:
+          printf("Data Type = PGA_IINIT_RANGE\n");
+          break;
+      }
+
+***************************************************************************U*/
+int PGAGetIntegerInitType (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetIntegerInitType");
+    PGAFailIfNotSetUp("PGAGetIntegerInitType");
+    PGACheckDataType("PGAGetIntegerInitType", PGA_DATATYPE_INTEGER);
+
+    PGADebugExited("PGAGetIntegerInitType");
+
+    return(ctx->init.IntegerType);
+}
+
+/*U***************************************************************************
+   PGAGetMinIntegerInitValue - returns the minimum of the range of integers
+   used to randomly initialize integer strings.
+
+   Category: Initialization
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      The minimum of the range of integers used to randomly initialize
+      integer strings
+
+   Example:
+      PGAContext *ctx;
+      int min;
+      :
+      min = PGAGetMinIntegerInitValue(ctx);
+
+***************************************************************************U*/
+int PGAGetMinIntegerInitValue (PGAContext *ctx, int i)
+{
+    PGADebugEntered("PGAGetMinIntegerInitValue");
+    PGAFailIfNotSetUp("PGAGetMinIntegerInitValue");
+    PGACheckDataType("PGASetIntegerAllele", PGA_DATATYPE_INTEGER);
+
+    if (i < 0 || i >= ctx->ga.StringLen)
+         PGAError(ctx, "PGAGetMinIntegerInitValue: Index out of range:",
+                  PGA_FATAL, PGA_INT, (int *) &i);
+
+    PGADebugExited("PGAGetMinIntegerInitValue");
+
+    return(ctx->init.IntegerMin[i]);
+}
+
+/*U***************************************************************************
+   PGAGetMaxIntegerInitValue - returns the maximum of the range of integers
+   used to randomly initialize integer strings.
+
+   Category: Initialization
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      The maximum of the range of integers used to randomly initialize
+      integer strings.
+
+   Example:
+      PGAContext *ctx;
+      int max;
+      :
+      max = PGAGetMaxIntegerInitValue(ctx);
+
+***************************************************************************U*/
+int PGAGetMaxIntegerInitValue (PGAContext *ctx, int i)
+{
+    PGADebugEntered("PGAGetMaxIntegerInitValue");
+    PGAFailIfNotSetUp("PGAGetMaxIntegerInitValue");
+    PGACheckDataType("PGAGetMaxIntegerInitValue", PGA_DATATYPE_INTEGER);
+
+    if (i < 0 || i >= ctx->ga.StringLen)
+         PGAError(ctx, "PGAGetMaxIntegerInitValue: Index out of range:",
+                  PGA_FATAL, PGA_INT, (int *) &i);
+
+    PGADebugExited("PGAGetMaxIntegerInitValue");
+
+    return(ctx->init.IntegerMax[i]);
+}
+
+
+/*I****************************************************************************
+   PGAIntegerCreateString - Allocate memory for a string of type PGAInteger,
+   and initializes or clears the string according to initflag.
+
+   Inputs:
+      ctx      - context variable
+      p        - string index
+      pop      - symbolic constant of the population string p is in
+      initflag - A true/false flag used in conjunction with ctx->ga.RandomInit
+                 to initialize the string either randomly or set to zero
+
+   Outputs:
+      new      - a pointer set to the address of the allocated memory
+
+   Example:
+      Allocates and clears memory and assigns the address of the allocated
+      memory to the string field (ind->chrom) of the individual.
+
+      PGAContext *ctx;
+      PGAIndividual *ind;
+      :
+      PGAIntegerCreateString( ctx, ind, PGA_FALSE );
+
+****************************************************************************I*/
+void PGAIntegerCreateString (PGAContext *ctx, int p, int pop, int InitFlag)
+{
+    int i, fp;
+    PGAInteger *c;
+    PGAIndividual *new = PGAGetIndividual(ctx, p, pop);
+
+    PGADebugEntered("PGAIntegerCreateString");
+
+    new->chrom = (void *)malloc(ctx->ga.StringLen * sizeof(PGAInteger));
+    if (new->chrom == NULL)
+	PGAError(ctx, "PGAIntegerCreateString: No room to allocate "
+		 "new->chrom", PGA_FATAL, PGA_VOID, NULL);
+    c = (PGAInteger *)new->chrom;
+    if (InitFlag)
+	if (ctx->fops.InitString) {
+	    fp = ((p == PGA_TEMP1) || (p == PGA_TEMP2)) ? p : p+1;
+	    (*ctx->fops.InitString)(&ctx, &fp, &pop);
+	} else {
+	    (*ctx->cops.InitString)(ctx, p, pop);
+	}
+    else
+	for (i=0; i<ctx->ga.StringLen; i++)
+	    c[i] = 0;
+    
+    PGADebugExited("PGAIntegerCreateString");
+}
+
+/*I****************************************************************************
+   PGAIntegerMutation - randomly mutates an integer-valued gene with a
+   specified probability. This routine is called from PGAMutation and must
+   cast the void string pointer it is passed as the second argument.
+
+   Inputs:
+      ctx      - context variable
+      p        - string index
+      pop      - symbolic constant of the population string p is in
+      mr       - probability of mutating an integer-valued gene
+
+   Outputs:
+      Returns the number of mutations
+
+   Example:
+
+****************************************************************************I*/
+int PGAIntegerMutation( PGAContext *ctx, int p, int pop, double mr )
+{
+     PGAInteger *c;
+     int i, j, temp;
+     int count = 0;
+
+     PGADebugEntered("PGAIntegerMutation");
+
+     c = (PGAInteger *)PGAGetIndividual(ctx, p, pop)->chrom;
+     for(i=0; i<ctx->ga.StringLen; i++) {
+
+         /* randomly choose an allele   */
+         if ( PGARandomFlip(ctx, mr) ) {
+
+             /* apply appropriate mutation operator */
+             switch (ctx->ga.MutationType) {
+             case PGA_MUTATION_CONSTANT:
+                 /* add or subtract from allele */             
+                 if ( PGARandomFlip(ctx, .5) )
+                      c[i] += ctx->ga.MutateIntegerValue;
+                 else
+                      c[i] -= ctx->ga.MutateIntegerValue;
+                 break;
+             case PGA_MUTATION_PERMUTE:
+                 /* could check for j == i if we were noble */
+                 j = PGARandomInterval(ctx, 0, ctx->ga.StringLen);
+                 temp = c[i];                 
+                 c[i] = c[j];
+                 c[j] = temp;                 
+                 break;
+             case PGA_MUTATION_RANGE:
+                 c[i] = PGARandomInterval(ctx, ctx->init.IntegerMin[i],
+                                               ctx->init.IntegerMax[i]);
+                 break;
+             default:
+                  PGAError(ctx, "PGAIntegerMutation: Invalid value of "
+                           "ga.MutationType:", PGA_FATAL, PGA_INT,
+                           (void *) &(ctx->ga.MutationType));
+                  break;
+             }
+
+             /* reset to min/max if bounded flag true and outside range */
+             if( ctx->ga.MutateBoundedFlag == PGA_TRUE ) {
+                 if( c[i] < ctx->init.IntegerMin[i])
+                     c[i] = ctx->init.IntegerMin[i];
+                 if( c[i] > ctx->init.IntegerMax[i])
+                     c[i] = ctx->init.IntegerMax[i];
+             }
+
+             count++;
+         }
+     }
+     PGADebugExited("PGAIntegerMutation");
+     return(count);
+}
+
+/*I****************************************************************************
+   PGAIntegerOneptCrossover - performs one-point crossover on two parent
+   strings producing two children via side-effect
+
+   Inputs:
+      ctx  - context variable
+      p1   - the first parent string
+      p2   - the second parent string
+      pop1 - symbolic constant of the population containing string p1 and p2
+      c1   - the first child string
+      c2   - the second child string
+      pop2 - symbolic constant of the population to contain string c1 and c2
+
+   Outputs:
+
+   Example:
+      Performs crossover on the two parent strings m and d, producing
+      children s and b.
+
+      PGAContext *ctx;
+      int m, d, s, b;
+      :
+      PGAIntegerOneptCrossover(ctx, m, d, PGA_OLDPOP, s, b, PGA_NEWPOP);
+
+****************************************************************************I*/
+void PGAIntegerOneptCrossover(PGAContext *ctx, int p1, int p2, int pop1,
+                              int c1, int c2, int pop2)
+{
+     PGAInteger *parent1 = (PGAInteger *)PGAGetIndividual(ctx, p1,
+                                                          pop1)->chrom;
+     PGAInteger *parent2 = (PGAInteger *)PGAGetIndividual(ctx, p2,
+                                                          pop1)->chrom;
+     PGAInteger *child1  = (PGAInteger *)PGAGetIndividual(ctx, c1,
+                                                          pop2)->chrom;
+     PGAInteger *child2  = (PGAInteger *)PGAGetIndividual(ctx, c2,
+                                                          pop2)->chrom;
+     int i, xsite;
+
+    PGADebugEntered("PGAIntegerOneptCrossover");
+
+    xsite = PGARandomInterval(ctx, 1,ctx->ga.StringLen-1);
+
+    for(i=0;i<xsite;i++) {
+        child1[i] = parent1[i];
+        child2[i] = parent2[i];
+    }
+
+    for(i=xsite;i<ctx->ga.StringLen;i++) {
+        child1[i] = parent2[i];
+        child2[i] = parent1[i];
+    }
+
+    PGADebugExited("PGAIntegerOneptCrossover");
+}
+
+
+/*I****************************************************************************
+   PGAIntegerTwoptCrossover - performs two-point crossover on two parent
+   strings producing two children via side-effect
+
+   Inputs:
+      ctx  - context variable
+      p1   - the first parent string
+      p2   - the second parent string
+      pop1 - symbolic constant of the population containing string p1 and p2
+      c1   - the first child string
+      c2   - the second child string
+      pop2 - symbolic constant of the population to contain string c1 and c2
+
+   Outputs:
+
+   Example:
+      Performs crossover on the two parent strings m and d, producing
+      children s and b.
+
+      PGAContext *ctx;
+      int m, d, s, b;
+      :
+      PGAIntegerTwoptCrossover(ctx, m, d, PGA_OLDPOP, s, b, PGA_NEWPOP);
+
+****************************************************************************I*/
+void PGAIntegerTwoptCrossover( PGAContext *ctx, int p1, int p2, int pop1,
+                              int c1, int c2, int pop2)
+{
+     PGAInteger *parent1 = (PGAInteger *)PGAGetIndividual(ctx, p1,
+                                                          pop1)->chrom;
+     PGAInteger *parent2 = (PGAInteger *)PGAGetIndividual(ctx, p2,
+                                                          pop1)->chrom;
+     PGAInteger *child1  = (PGAInteger *)PGAGetIndividual(ctx, c1,
+                                                          pop2)->chrom;
+     PGAInteger *child2  = (PGAInteger *)PGAGetIndividual(ctx, c2,
+                                                          pop2)->chrom;
+     int i, temp, xsite1, xsite2;
+
+    PGADebugEntered("PGAIntegerTwoptCrossover");
+
+    /* pick two cross sites such that xsite2 > xsite1 */
+    xsite1 = PGARandomInterval(ctx, 1,ctx->ga.StringLen-1);
+    xsite2 = xsite1;
+    while ( xsite2 == xsite1 )
+        xsite2 = PGARandomInterval(ctx, 1,ctx->ga.StringLen-1);
+    if ( xsite1 > xsite2 ) {
+        temp   = xsite1;
+        xsite1 = xsite2;
+        xsite2 = temp;
+    }
+
+    for(i=0;i<xsite1;i++) {
+        child1[i] = parent1[i];
+        child2[i] = parent2[i];
+    }
+
+    for(i=xsite1;i<xsite2;i++) {
+        child1[i] = parent2[i];
+        child2[i] = parent1[i];
+    }
+
+    for(i=xsite2;i<ctx->ga.StringLen;i++) {
+        child1[i] = parent1[i];
+        child2[i] = parent2[i];
+    }
+
+    PGADebugExited("PGAIntegerTwoptCrossover");
+}
+
+
+/*I****************************************************************************
+   PGAIntegerUniformCrossover - performs uniform crossover on two parent
+   strings producing two children via side-effect
+
+   Inputs:
+      ctx  - context variable
+      p1   - the first parent string
+      p2   - the second parent string
+      pop1 - symbolic constant of the population containing string p1 and p2
+      c1   - the first child string
+      c2   - the second child string
+      pop2 - symbolic constant of the population to contain string c1 and c2
+
+   Outputs:
+
+   Example:
+      Performs crossover on the two parent strings m and d, producing
+      children s and b.
+
+      PGAContext *ctx;
+      int m, d, s, b;
+      :
+      PGAIntegerUniformCrossover( ctx, m, d, PGA_OLDPOP, s, b, PGA_NEWPOP);
+
+****************************************************************************I*/
+void PGAIntegerUniformCrossover(PGAContext *ctx, int p1, int p2, int pop1,
+                                int c1, int c2, int pop2)
+{
+     PGAInteger *parent1 = (PGAInteger *)PGAGetIndividual(ctx, p1,
+                                                          pop1)->chrom;
+     PGAInteger *parent2 = (PGAInteger *)PGAGetIndividual(ctx, p2,
+                                                          pop1)->chrom;
+     PGAInteger *child1  = (PGAInteger *)PGAGetIndividual(ctx, c1,
+                                                          pop2)->chrom;
+     PGAInteger *child2  = (PGAInteger *)PGAGetIndividual(ctx, c2,
+                                                          pop2)->chrom;
+     int i;
+
+    PGADebugEntered("PGAIntegerUniformCrossover");
+
+    for(i=0;i<ctx->ga.StringLen;i++) {
+        if ( parent1[i] == parent2[i] ) {
+            child1[i] = parent1[i];
+            child2[i] = parent2[i];
+        }
+        else {
+            if(PGARandomFlip(ctx, ctx->ga.UniformCrossProb)) {
+                child1[i] = parent1[i];
+                child2[i] = parent2[i];
+            }
+            else {
+                child1[i] = parent2[i];
+                child2[i] = parent1[i];
+            }
+        }
+    }
+
+    PGADebugExited("PGAIntegerUniformCrossover");
+}
+
+/*I****************************************************************************
+   PGAIntegerPrintString - writes an integer-valued string to a file.
+
+   Inputs:
+      ctx - context variable
+      fp  - file pointer to file to write the string to
+      p   - index of the string to write out
+      pop - symbolic constant of the population string p is in
+
+   Outputs:
+
+   Example:
+      Write member p in population PGA_NEWPOP to stdout.
+
+      PGAContext *ctx;
+      int  p;
+      :
+      PGAIntegerPrintString(ctx, stdout, p, PGA_NEWPOP);
+
+****************************************************************************I*/
+void PGAIntegerPrintString ( PGAContext *ctx, FILE *fp, int p, int pop)
+{
+    PGAInteger *c = (PGAInteger *)PGAGetIndividual(ctx, p, pop)->chrom;
+    int i;
+
+    PGADebugEntered("PGAIntegerPrintString");
+
+    for(i = 0; i < ctx->ga.StringLen; i++)
+    {
+        switch ( i % 6 )
+        {
+        case 0:
+            fprintf ( fp, "#%5d: [%8ld]",i,c[i]);
+            break;
+        case 1:
+        case 2:
+        case 3:
+        case 4:
+            fprintf ( fp, ", [%8ld]",c[i]);
+            break;
+        case 5:
+            fprintf ( fp, ", [%8ld]",c[i]);
+            if (i+1 < ctx->ga.StringLen)
+                fprintf ( fp, "\n");
+            break;
+        }
+    }
+    fprintf ( fp, "\n" );
+
+    PGADebugExited("PGAIntegerPrintString");
+}
+
+/*I****************************************************************************
+   PGAIntegerCopyString - Copy one integer-valued string to another.
+
+   Inputs:
+      ctx - context variable
+      p1   - string to copy
+      pop1 - symbolic constant of population containing string p1
+      p2   - string to copy p1 to
+      pop2 - symbolic constant of population containing string p2
+
+   Outputs:
+
+   Example:
+
+****************************************************************************I*/
+void PGAIntegerCopyString (PGAContext *ctx, int p1, int pop1, int p2, int pop2)
+{
+    PGAInteger *source = (PGAInteger *)PGAGetIndividual(ctx, p1, pop1)->chrom;
+    PGAInteger *dest   = (PGAInteger *)PGAGetIndividual(ctx, p2, pop2)->chrom;
+    int i;
+
+    PGADebugEntered("PGAIntegerCopyString");
+
+    for (i = 0; i < ctx->ga.StringLen; i++)
+        dest[i] = source[i];
+
+    PGADebugExited("PGAIntegerCopyString");
+}
+
+/*I****************************************************************************
+   PGAIntegerDuplicate - Returns true if string a is a duplicate of
+   string b, else returns false.
+
+   Inputs:
+      ctx - context variable
+      p1   - string index of the first string to compare
+      pop1 - symbolic constant of the population string p1 is in
+      p2   - string index of the second string to compare
+      pop2 - symbolic constant of the population string p2 is in
+
+   Outputs:
+      Returns true/false if strings are duplicates
+
+   Example:
+
+****************************************************************************I*/
+int PGAIntegerDuplicate( PGAContext *ctx, int p1, int pop1, int p2, int pop2)
+{
+     PGAInteger *a = (PGAInteger *)PGAGetIndividual(ctx, p1, pop1)->chrom;
+     PGAInteger *b = (PGAInteger *)PGAGetIndividual(ctx, p2, pop2)->chrom;
+     int i;
+
+    PGADebugEntered("PGAIntegerDuplicate");
+
+     i = ctx->ga.StringLen-1;
+     if (a[0] == b[0])
+       for(; (i>0) && (a[i] == b[i]); i--);
+
+    PGADebugExited("PGAIntegerDuplicate");
+
+     return((i==0) ? PGA_TRUE : PGA_FALSE);
+}
+
+/*I****************************************************************************
+   PGAIntegerInitString - randomly initialize a string of type PGAInteger
+
+   Inputs:
+      ctx - context variable
+      p   - index of string to randomly initialize
+      pop - symbolic constant of the population string p is in
+
+   Outputs:
+
+   Example:
+
+****************************************************************************I*/
+void PGAIntegerInitString(PGAContext *ctx, int p, int pop)
+{
+     int *list;
+     int len, i, j;
+     PGAInteger *c = (PGAInteger *)PGAGetIndividual(ctx, p, pop)->chrom;
+
+     PGADebugEntered("PGAIntegerInitString");
+
+     len = ctx->ga.StringLen;
+
+     switch (ctx->init.IntegerType)
+     {
+     case PGA_IINIT_PERMUTE:
+          list = (int *)malloc(sizeof(int) * len);
+          if (list == NULL)
+               PGAError(ctx, "PGAIntegerInitString: No room to allocate list",
+                        PGA_FATAL, PGA_VOID, NULL);
+          j = ctx->init.IntegerMin[0];
+          for (i = 0; i < len; i++)
+               list[i] = j++;
+          for (i = 0; i < len; i++)
+          {
+               j = PGARandomInterval ( ctx, 0, len - i - 1 );
+               c[i] = list[j];
+               list[j] = list[len - i - 1];
+          }
+          free(list);
+          break;
+     case PGA_IINIT_RANGE:
+          for (i = 0; i < len; i++)
+               c[i] = PGARandomInterval(ctx, ctx->init.IntegerMin[i],
+                                        ctx->init.IntegerMax[i]);
+          break;
+     }
+
+     PGADebugExited("PGAIntegerInitString");
+}
+
+/*I****************************************************************************
+  PGAIntegerBuildDatatype - Build an MPI datatype for a string of type
+  PGA_DATATYPE_INTEGER.
+
+  Inputs:
+      ctx - context variable
+      p   - index of string to randomly initialize
+      pop - symbolic constant of the population string p is in
+
+  Outputs:
+
+  Example:
+
+****************************************************************************I*/
+MPI_Datatype PGAIntegerBuildDatatype(PGAContext *ctx, int p, int pop)
+{
+
+     int            counts[4];      /* Number of elements in each
+                                       block (array of integer) */
+     MPI_Aint       displs[4];      /* byte displacement of each
+                                       block (array of integer) */
+     MPI_Datatype   types[4];       /* type of elements in each block (array
+                                       of handles to datatype objects) */
+     MPI_Datatype   individualtype; /* new datatype (handle) */
+     PGAIndividual *traveller;      /* address of individual in question */
+
+    PGADebugEntered("PGAIntegerBuildDatatype");
+
+     traveller = PGAGetIndividual(ctx, p, pop);
+     MPI_Address(&traveller->evalfunc, &displs[0]);
+     counts[0] = 1;
+     types[0]  = MPI_DOUBLE;
+
+     MPI_Address(&traveller->fitness, &displs[1]);
+     counts[1] = 1;
+     types[1]  = MPI_DOUBLE;
+
+     MPI_Address(&traveller->evaluptodate, &displs[2]);
+     counts[2] = 1;
+     types[2]  = MPI_INT;
+
+     MPI_Address(traveller->chrom, &displs[3]);
+     counts[3] = ctx->ga.StringLen;
+     types[3]  = MPI_LONG;
+
+     MPI_Type_struct(4, counts, displs, types, &individualtype);
+     MPI_Type_commit(&individualtype);
+
+    PGADebugExited("PGAIntegerBuildDatatype");
+
+     return (individualtype);
+}
Index: trunk/optimizer/src/pgapack/pgapack/source/mpi_stub.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/mpi_stub.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/mpi_stub.c	(revision 816)
@@ -0,0 +1,325 @@
+/*
+ *  
+ *  ********************************************************************* 
+ *  (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+ *  *********************************************************************
+ *  
+ *  This software was authored by
+ *  
+ *  D. Levine
+ *  Mathematics and Computer Science Division Argonne National Laboratory
+ *  Argonne IL 60439
+ *  levine@mcs.anl.gov
+ *  (708) 252-6735
+ *  (708) 252-5986 (FAX)
+ *  
+ *  with programming assistance of participants in Argonne National 
+ *  Laboratory's SERS program.
+ *  
+ *  This program contains material protectable under copyright laws of the 
+ *  United States.  Permission is hereby granted to use it, reproduce it, 
+ *  to translate it into another language, and to redistribute it to 
+ *  others at no charge except a fee for transferring a copy, provided 
+ *  that you conspicuously and appropriately publish on each copy the 
+ *  University of Chicago's copyright notice, and the disclaimer of 
+ *  warranty and Government license included below.  Further, permission 
+ *  is hereby granted, subject to the same provisions, to modify a copy or 
+ *  copies or any portion of it, and to distribute to others at no charge 
+ *  materials containing or derived from the material.
+ *  
+ *  The developers of the software ask that you acknowledge its use in any 
+ *  document referencing work based on the  program, such as published 
+ *  research.  Also, they ask that you supply to Argonne National 
+ *  Laboratory a copy of any published research referencing work based on 
+ *  the software.
+ *  
+ *  Any entity desiring permission for further use must contact:
+ *  
+ *  J. Gleeson
+ *  Industrial Technology Development Center Argonne National Laboratory
+ *  Argonne IL 60439
+ *  gleesonj@smtplink.eid.anl.gov
+ *  (708) 252-6055
+ *  
+ *  ******************************************************************** 
+ *  DISCLAIMER
+ *  
+ *  THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+ *  OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+ *  THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+ *  WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+ *  RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+ *  INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+ *  INFRINGE PRIVATELY OWNED RIGHTS.
+ *  
+ *  ********************************************************************** 
+ *  GOVERNMENT LICENSE
+ *  
+ *  The Government is granted for itself and others acting on its behalf a 
+ *  paid-up, non-exclusive, irrevocable worldwide license in this computer 
+ *  software to reproduce, prepare derivative works, and perform publicly 
+ *  and display publicly.
+ */
+
+/******************************************************************************
+*     FILE: mpi_stub.c:  MPI stubs needed for PGAPack operation without
+*                        linking with a real MPI.
+*
+*     Authors: Brian P. Walenz
+******************************************************************************/
+
+#include "pgapack.h"
+
+
+#if defined(FORTRANCAP)
+#define mpi_address_      MPI_ADDRESS
+#define mpi_bcast_        MPI_BCAST
+#define mpi_comm_dup_     MPI_COMM_DUP
+#define mpi_comm_free_    MPI_COMM_FREE
+#define mpi_comm_rank_    MPI_COMM_RANK
+#define mpi_comm_size_    MPI_COMM_SIZE
+#define mpi_finalize_     MPI_FINALIZE
+#define mpi_init_         MPI_INIT
+#define mpi_initialized_  MPI_INITIALIZED
+#define mpi_probe_        MPI_PROBE
+#define mpi_send_         MPI_SEND
+#define mpi_recv_         MPI_RECV
+#define mpi_sendrecv_     MPI_SENDRECV
+#define mpi_type_commit_  MPI_TYPE_COMMIT
+#define mpi_type_free_    MPI_TYPE_FREE
+#define mpi_type_struct_  MPI_TYPE_STRUCT
+#elif !defined(FORTRANUNDERSCORE)
+#define mpi_address_      mpi_address
+#define mpi_bcast_        mpi_bcast
+#define mpi_comm_dup_     mpi_comm_dup
+#define mpi_comm_free_    mpi_comm_free
+#define mpi_comm_rank_    mpi_comm_rank
+#define mpi_comm_size_    mpi_comm_size
+#define mpi_finalize_     mpi_finalize
+#define mpi_init_         mpi_init
+#define mpi_initialized_  mpi_initialized
+#define mpi_probe_        mpi_probe
+#define mpi_send_         mpi_send
+#define mpi_recv_         mpi_recv
+#define mpi_sendrecv_     mpi_sendrecv
+#define mpi_type_commit_  mpi_type_commit
+#define mpi_type_free_    mpi_type_free
+#define mpi_type_struct_  mpi_type_struct
+#endif
+
+
+
+/*  Places the address of "location" into "address"
+ *  In FORTRAN, does not return anything.
+ */
+int MPI_Address(void *location, MPI_Aint *address) {
+    *address = (MPI_Aint)NULL;
+    return(0);
+}
+
+
+/*  Broadcast "buf" to all processes.
+ *  FORTRAN adds integer ierror to the end of the parameters.
+ */
+int MPI_Bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm) {
+    return(0);
+}
+
+
+/*  Duplicates communicator "comm" into "newcomm"
+ *  FORTRAN has a third parameter, integer ie, and does not return anything.
+ */
+int MPI_Comm_dup(MPI_Comm comm, MPI_Comm *newcomm) {
+    return(0);
+}
+
+
+/*  Frees a communicator.   */
+int MPI_Comm_free(MPI_Comm *comm) {
+    return(0);
+}
+
+
+/*  Returns the rank of the current process in rank.  We return
+ *  0 -- we are the master.
+ */
+int MPI_Comm_rank(MPI_Comm comm, int *rank) {
+    *rank = 0;
+    return(0);
+}
+
+
+/*  Returns the number of processors that are in communicator comm
+ *  in size.  Always 1.
+ */
+int MPI_Comm_size(MPI_Comm comm, int *size) {
+    *size = 1;
+    return(0);
+}
+
+/*  Finalizes MPI.  */
+int MPI_Finalize(void) {
+    return(0);
+}
+
+
+/*  Initializes MPI.
+ *  Ideally, we should parse the command-line and remove MPI arguments.
+ */
+int MPI_Init(int *argc, char ***argv) {
+    return(0);
+}
+
+
+/*  Returns 1 in flag if MPI is already running.  It is.  */
+int MPI_Initialized(int *flag) {
+    *flag = 1;
+    return(0);
+}
+
+
+/*  Waits for messages to us with tag "tag".  Sets status->MPI_SOURCE to the
+ *  source of the message, status->MPI_TAG to the tag, and status->MPI_ERROR
+ *  to 0.
+ */
+int MPI_Probe(int source, int tag, MPI_Comm comm, MPI_Status *status) {
+    status->MPI_SOURCE = source;
+    status->MPI_TAG    = tag;
+    status->MPI_ERROR  = 0;
+    return(0);
+}
+
+
+/*  Send a message to a process.  */
+int MPI_Send(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) {
+    return(0);
+}
+
+
+/*  Receive a message from a source. */
+int MPI_Recv(void* buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status) {
+    status->MPI_SOURCE = source;
+    status->MPI_TAG    = tag;
+    status->MPI_ERROR  = 0;
+    return(0);
+}
+
+
+int MPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
+                 int dest, int sendtag, void *recvbuf, int recvcount,
+                  MPI_Datatype recvtype, int source, int recvtag,
+                  MPI_Comm comm, MPI_Status *status) {
+    status->MPI_SOURCE = source;
+    status->MPI_TAG    = recvtag;
+    status->MPI_ERROR  = 0;
+    return(0);
+}
+
+
+int MPI_Type_commit(MPI_Datatype *datatype) {
+    return(0);
+}
+
+
+int MPI_Type_free(MPI_Datatype *datatype) {
+    return(0);
+}
+
+
+int MPI_Type_struct(int count, int *array_of_blocklengths,
+                    MPI_Aint *array_of_displacements,
+                    MPI_Datatype *array_of_types, MPI_Datatype *newtype) {
+    return(0);
+}
+
+
+/*  FORTRAN versions of some of the above functions.
+ *  Most of these operate the same as above, we just need to make sure that 
+ *  they are linked in properly, see f2c.c for details.
+ */
+void mpi_address_(void **location, MPI_Aint *address) {
+    *address = (MPI_Aint)NULL;
+}
+
+void mpi_bcast_(void **n, int *com, MPI_Datatype *dt, int *r, MPI_Comm *c, int *ie) {
+    *ie = 0;
+}
+
+void mpi_comm_dup_(MPI_Comm *comm, MPI_Comm **newcomm, int *ie) {
+    *ie = 0;
+}
+
+void mpi_comm_free_(MPI_Comm **comm, int *ie) {
+    *ie = 0;
+}
+
+void mpi_comm_rank_(MPI_Comm *comm, int *rank, int *ie) {
+    *rank = 0;
+    *ie = 0;
+}
+
+void mpi_comm_size_(MPI_Comm *comm, int *size, int *ie) {
+    *size = 1;
+    *ie = 0;
+}
+
+void mpi_finalize_(int *ie) {
+    *ie = 0;
+}
+
+void mpi_init_(int *ie) {
+    *ie = 0;
+}
+
+void mpi_initialized_(int *flag, int *ie) {
+    *flag = 1;
+    *ie = 0;
+}
+
+void mpi_probe_(int *source, int *tag, MPI_Comm *comm, MPI_Status *status,
+               int *ie) {
+    status->MPI_SOURCE = *source;
+    status->MPI_TAG    = *tag;
+    status->MPI_ERROR  = 0;
+    *ie = 0;
+}
+
+void mpi_send_(void *buf, int *count, MPI_Datatype *datatype, int *dest,
+              int *tag, MPI_Comm *comm, int *ie) {
+    *ie = 0;
+}
+
+
+void mpi_recv_(void *buf, int *count, MPI_Datatype *datatype, int *source,
+              int *tag, MPI_Comm *comm, MPI_Status *status, int *ie) {
+    status->MPI_SOURCE = *source;
+    status->MPI_TAG    = *tag;
+    status->MPI_ERROR  = 0;
+    *ie = 0;
+}
+
+
+void mpi_sendrecv_(void *sendbuf, int *sendcount, MPI_Datatype *sendtype,
+                  int *dest, int *sendtag, void *recvbuf, int *recvcount,
+                  MPI_Datatype *recvtype, int *source, int *recvtag,
+                  MPI_Comm *comm, MPI_Status *status, int *ie) {
+    status->MPI_SOURCE = *source;
+    status->MPI_TAG    = *recvtag;
+    status->MPI_ERROR  = 0;
+    *ie = 0;
+}
+
+void mpi_type_commit_(MPI_Datatype **datatype, int *ie) {
+    *ie = 0;
+}
+
+void mpi_type_free_(MPI_Datatype **datatype, int *ie) {
+    *ie = 0;
+}
+
+
+void mpi_type_struct_(int *count, int **array_of_blocklengths,
+                    MPI_Aint **array_of_displacements,
+                    MPI_Datatype **array_of_types, MPI_Datatype **newtype, int *ie) {
+    *ie = 0;
+}
Index: trunk/optimizer/src/pgapack/pgapack/source/mutation.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/mutation.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/mutation.c	(revision 816)
@@ -0,0 +1,481 @@
+/*
+ *  
+ *  ********************************************************************* 
+ *  (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+ *  *********************************************************************
+ *  
+ *  This software was authored by
+ *  
+ *  D. Levine
+ *  Mathematics and Computer Science Division Argonne National Laboratory
+ *  Argonne IL 60439
+ *  levine@mcs.anl.gov
+ *  (708) 252-6735
+ *  (708) 252-5986 (FAX)
+ *  
+ *  with programming assistance of participants in Argonne National 
+ *  Laboratory's SERS program.
+ *  
+ *  This program contains material protectable under copyright laws of the 
+ *  United States.  Permission is hereby granted to use it, reproduce it, 
+ *  to translate it into another language, and to redistribute it to 
+ *  others at no charge except a fee for transferring a copy, provided 
+ *  that you conspicuously and appropriately publish on each copy the 
+ *  University of Chicago's copyright notice, and the disclaimer of 
+ *  warranty and Government license included below.  Further, permission 
+ *  is hereby granted, subject to the same provisions, to modify a copy or 
+ *  copies or any portion of it, and to distribute to others at no charge 
+ *  materials containing or derived from the material.
+ *  
+ *  The developers of the software ask that you acknowledge its use in any 
+ *  document referencing work based on the  program, such as published 
+ *  research.  Also, they ask that you supply to Argonne National 
+ *  Laboratory a copy of any published research referencing work based on 
+ *  the software.
+ *  
+ *  Any entity desiring permission for further use must contact:
+ *  
+ *  J. Gleeson
+ *  Industrial Technology Development Center Argonne National Laboratory
+ *  Argonne IL 60439
+ *  gleesonj@smtplink.eid.anl.gov
+ *  (708) 252-6055
+ *  
+ *  ******************************************************************** 
+ *  DISCLAIMER
+ *  
+ *  THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+ *  OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+ *  THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+ *  WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+ *  RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+ *  INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+ *  INFRINGE PRIVATELY OWNED RIGHTS.
+ *  
+ *  ********************************************************************** 
+ *  GOVERNMENT LICENSE
+ *  
+ *  The Government is granted for itself and others acting on its behalf a 
+ *  paid-up, non-exclusive, irrevocable worldwide license in this computer 
+ *  software to reproduce, prepare derivative works, and perform publicly 
+ *  and display publicly.
+ */
+
+/*****************************************************************************
+*     File: mutation.c: This file contains the data structure neutral mutation
+*                       routines
+*
+*     Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle,
+*              Brian P. Walenz
+*****************************************************************************/
+
+#include "pgapack.h"
+
+/*U****************************************************************************
+  PGAMutate - This routine performs mutation on a string.  The type of mutation
+  depends on the data type.  Refer to the user guide for data-specific
+  examples.
+
+  Category: Operators
+
+  Inputs:
+      ctx  - context variable
+      p   - index of string to mutate
+      pop - symbolic constant of the population containing p
+
+  Output:
+      The number of mutations performed.  Member p in population pop is
+      mutated by side-effect.
+
+  Example:
+      Mutate the best string in the population, until 10 or more mutations
+      have occured.
+
+      PGAContext *ctx;
+      int p, count = 0;
+      :
+      p = PGAGetBestIndex(ctx, PGA_NEWPOP);
+      while (count < 10) {
+          count += PGAMutate(ctx, p, PGA_NEWPOP);
+      }
+
+****************************************************************************U*/
+int PGAMutate(PGAContext *ctx, int p, int pop)
+{
+    double mr;
+    int count;
+    int fp;
+    PGADebugEntered("PGAMutate");
+    
+    mr    = ctx->ga.MutationProb;
+    if (ctx->fops.Mutation) {
+	fp = ((p == PGA_TEMP1) || (p == PGA_TEMP2)) ? p : p+1;
+        count = (*ctx->fops.Mutation)(&ctx, &fp, &pop, &mr);
+    } else {
+	count = (*ctx->cops.Mutation)( ctx, p, pop, mr );
+    }
+    
+    if ( count > 0 )
+	PGASetEvaluationUpToDateFlag(ctx, p, pop, PGA_FALSE);
+    
+    PGADebugExited("PGAMutate");
+    
+    return(count);
+}
+
+/*U****************************************************************************
+   PGASetMutationType - set type of mutation to use. Only effects integer-
+   and real-valued strings.  Binary-valued strings are always complemented.
+   In character-valued strings, one alphabetic character is replaced with
+   another chosen uniformly randomly.  The alphabetic characters will be lower,
+   upper, or mixed case depending on how the strings were initialized.
+
+   Valid choices are PGA_MUTATION_CONSTANT (Real/Integer), PGA_MUTATION_RANGE
+   (Real/Integer), PGA_MUTATION_UNIFORM (Real), PGA_MUTATION_GAUSSIAN (Real),
+   and PGA_MUTATION_PERMUTE (Integer).  The default for integer-valued strings
+   conforms to how the strings were initialized.  The default for real-valued
+   strings is PGA_MUTATION_GAUSSIAN.  See the user guide for more details.
+
+   Category: Operators
+
+   Inputs:
+      ctx           - context variable
+      mutation_type - symbolic constant to specify the mutation type
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx;
+      :
+      PGASetMutationType(ctx, PGA_MUTATION_UNIFORM);
+
+****************************************************************************U*/
+void PGASetMutationType( PGAContext *ctx, int mutation_type)
+{
+    PGADebugEntered("PGASetMutationType");
+
+     switch (mutation_type)
+     {
+     case PGA_MUTATION_CONSTANT:
+     case PGA_MUTATION_RANGE:
+     case PGA_MUTATION_UNIFORM:
+     case PGA_MUTATION_GAUSSIAN:
+     case PGA_MUTATION_PERMUTE:
+          ctx->ga.MutationType = mutation_type;
+          break;
+     default:
+          PGAError ( ctx,
+                    "PGASetMutationType: Invalid value of mutation_type:",
+                    PGA_FATAL, PGA_INT, (void *) &mutation_type);
+          break;
+     }
+
+    PGADebugExited("PGASetMutationType");
+}
+
+/*U***************************************************************************
+   PGAGetMutationType - Returns the type of mutation used
+
+   Category: Operators
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      Returns the integer corresponding to the symbolic constant
+      used to specify the type of mutation specified
+
+   Example:
+      PGAContext *ctx;
+      int mutatetype;
+      :
+      mutatetype = PGAGetMutationType(ctx);
+      switch (mutatetype) {
+      case PGA_MUTATION_CONSTANT:
+          printf("Mutation Type = PGA_MUTATION_CONSTANT\n");
+          break;
+      case PGA_MUTATION_RANGE:
+          printf("Mutation Type = PGA_MUTATION_RANGE\n");
+          break;
+      case PGA_MUTATION_UNIFORM:
+          printf("Mutation Type = PGA_MUTATION_UNIFORM\n");
+          break;
+      case PGA_MUTATION_GAUSSIAN:
+          printf("Mutation Type = PGA_MUTATION_GAUSSIAN\n");
+          break;
+      case PGA_MUTATION_PERMUTE:
+          printf("Mutation Type = PGA_MUTATION_PERMUTE\n");
+          break;
+      }
+
+***************************************************************************U*/
+int PGAGetMutationType (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetMutationType");
+    PGAFailIfNotSetUp("PGAGetMutationType");
+    PGADebugExited("PGAGetMutationType");
+    return(ctx->ga.MutationType);
+}
+
+/*U****************************************************************************
+   PGASetMutationRealValue - Set multiplier to mutate PGA_DATATYPE_REAL
+   strings with.  The use of this value depends on the type of mutation
+   being used.  The default value is 0.1.  See the user guide for more details.
+
+   Category: Operators
+
+   Inputs:
+      ctx - context variable
+      val - the mutation value to use for Real mutation
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx;
+      :
+      PGASetMutationRealValue(ctx,50.0);
+
+****************************************************************************U*/
+void PGASetMutationRealValue( PGAContext *ctx, double val)
+{
+    PGADebugEntered("PGASetMutationRealValue");
+
+    if (val < 0.0)
+        PGAError ( ctx,
+                  "PGASetMutationRealValue: Invalid value of val:",
+                   PGA_FATAL, PGA_DOUBLE, (void *) &val);
+    else
+        ctx->ga.MutateRealValue = val;
+
+    PGADebugExited("PGASetMutationRealValue");
+}
+
+/*U***************************************************************************
+   PGAGetMutationRealValue - Returns the value of the multiplier used to
+   mutate PGA_DATATYPE_REAL strings with.
+
+   Category: Operators
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      The value of the multiplier used to mutate PGA_DATATYPE_REAL strings with
+
+   Example:
+      PGAContext *ctx;
+      double val;
+      :
+      val = PGAGetMutationRealValue(ctx);
+
+***************************************************************************U*/
+double PGAGetMutationRealValue (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetMutationRealValue");
+    PGAFailIfNotSetUp("PGAGetMutationRealValue");
+
+    PGADebugExited("PGAGetMutationRealValue");
+
+    return(ctx->ga.MutateRealValue);
+}
+
+/*U****************************************************************************
+   PGASetMutationIntegerValue - Set multiplier to mutate PGA_DATATYPE_INTEGER
+   strings with.  The use of this value depends on the type of mutation
+   being used.  The default value is 1.  See the user guide for more details.
+
+   Category: Operators
+
+   Inputs:
+      ctx - context variable
+      val - the mutation value to use for Integer mutation
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx;
+      :
+      PGASetMutationIntegerValue(ctx, 5);
+
+****************************************************************************U*/
+void PGASetMutationIntegerValue( PGAContext *ctx, int val)
+{
+    PGADebugEntered("PGASetMutationIntegerValue");
+
+    if (val < 0.0)
+        PGAError ( ctx,
+                  "PGASetMutationIntegerValue: Invalid value of val:",
+                   PGA_FATAL, PGA_DOUBLE, (void *) &val);
+    else
+        ctx->ga.MutateIntegerValue = val;
+
+    PGADebugExited("PGASetMutationIntegerValue");
+}
+
+
+/*U***************************************************************************
+  PGAGetMutationIntegerValue - Returns the value of the multiplier
+  used to mutate PGA_DATATYPE_INTEGER strings with.
+
+   Category: Operators
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      The value of the multiplier used to mutate PGA_DATATYPE_INTEGER
+      strings with
+
+   Example:
+      PGAContext *ctx;
+      int ival;
+      :
+      ival = PGAGetMutationIntegerValue(ctx);
+
+***************************************************************************U*/
+int PGAGetMutationIntegerValue (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetMutationIntegerValue");
+    PGAFailIfNotSetUp("PGAGetMutationIntegerValue");
+
+    PGADebugExited("PGAGetMutationIntegerValue");
+
+    return(ctx->ga.MutateIntegerValue);
+}
+
+/*U****************************************************************************
+   PGASetMutationBoundedFlag - If this flag is set to PGA_TRUE, then for
+   Integer and Real strings whenever a gene is mutated, if it underflows
+   (overflows) the lower (upper)bound it is reset to the lower (upper) bound.
+   In this way all allele values remain within the range the integer strings
+   were initialized on.  If this flag is PGA_FALSE (the default), the alleles
+   may take any values.
+
+   Category: Operators
+
+   Inputs:
+      ctx  - context variable
+      flag - either PGA_TRUE or PGA_FALSE
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx;
+      :
+      PGASetMutationBoundedFlag(ctx, PGA_TRUE);
+
+****************************************************************************U*/
+void PGASetMutationBoundedFlag(PGAContext *ctx, int val)
+{
+    PGADebugEntered("PGASetMutationBoundedFlag");
+
+    switch (val)
+    {
+    case PGA_TRUE:
+    case PGA_FALSE:
+         ctx->ga.MutateBoundedFlag = val;
+         break;
+    default:
+         PGAError(ctx, "PGASetMutationBoundedFlag: Invalid value:",
+                  PGA_FATAL, PGA_INT, (void *) &val);
+         break;
+    }
+
+    PGADebugExited("PGASetMutationBoundedFlag");
+}
+
+
+/*U****************************************************************************
+   PGAGetMutationBoundedFlag - returns PGA_TRUE or PGA_FALSE to indicate
+   whether mutated integer strings remain in the range specified when
+   initialized with PGASetIntegerInitRange.
+
+   Category: Operators
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      PGA_TRUE if restricted to the given range, otherwise PGA_FALSE.
+
+   Example:
+      PGAContext *ctx;
+      int val;
+      :
+      val = PGAGetMutationBoundedFlag(ctx);
+
+****************************************************************************U*/
+int PGAGetMutationBoundedFlag(PGAContext *ctx)
+{
+    PGADebugEntered  ("PGAGetMutationBoundedFlag");
+    PGAFailIfNotSetUp("PGAGetMutationBoundedFlag");
+    PGADebugExited   ("PGAGetMutationBoundedFlag");
+    return (ctx->ga.MutateBoundedFlag);
+}
+
+
+
+/*U****************************************************************************
+   PGASetMutationProb - Specifies the probability that a given allele will
+   be mutated.  If this is called without calling PGASetMutationType(), the
+   default mutation type is PGA_MUTATION_FIXED.  The default probability is
+   the reciprocal of the string length.
+
+   Category: Operators
+
+   Inputs:
+      ctx - context variable
+      p   - the mutation probability
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx;
+      :
+      PGASetMutationProb(ctx,0.001);
+
+****************************************************************************U*/
+void PGASetMutationProb(PGAContext *ctx, double mutation_prob)
+{
+    PGADebugEntered("PGASetMutationProb");
+
+    if ((mutation_prob < 0.0) || (mutation_prob > 1.0))
+        PGAError ( ctx,
+                  "PGASetMutationProb: Invalid value of mutation_prob:",
+                   PGA_FATAL, PGA_DOUBLE, (void *) &mutation_prob);
+    else
+        ctx->ga.MutationProb = mutation_prob;
+
+    PGADebugExited("PGASetMutationProb");
+}
+
+/*U***************************************************************************
+   PGAGetMutationProb - Returns the probability of mutation.
+
+   Category: Operators
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      The mutation probability
+
+   Example:
+      PGAContext *ctx;
+      double pm;
+      :
+      pm = PGAGetMutateProb(ctx);
+
+***************************************************************************U*/
+double PGAGetMutationProb (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetMutationProb");
+    PGAFailIfNotSetUp("PGAGetMutationProb");
+    PGADebugExited("PGAGetMutationProb");
+    return(ctx->ga.MutationProb);
+}
Index: trunk/optimizer/src/pgapack/pgapack/source/parallel.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/parallel.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/parallel.c	(revision 816)
@@ -0,0 +1,1022 @@
+/*
+ *  
+ *  ********************************************************************* 
+ *  (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+ *  *********************************************************************
+ *  
+ *  This software was authored by
+ *  
+ *  D. Levine
+ *  Mathematics and Computer Science Division Argonne National Laboratory
+ *  Argonne IL 60439
+ *  levine@mcs.anl.gov
+ *  (708) 252-6735
+ *  (708) 252-5986 (FAX)
+ *  
+ *  with programming assistance of participants in Argonne National 
+ *  Laboratory's SERS program.
+ *  
+ *  This program contains material protectable under copyright laws of the 
+ *  United States.  Permission is hereby granted to use it, reproduce it, 
+ *  to translate it into another language, and to redistribute it to 
+ *  others at no charge except a fee for transferring a copy, provided 
+ *  that you conspicuously and appropriately publish on each copy the 
+ *  University of Chicago's copyright notice, and the disclaimer of 
+ *  warranty and Government license included below.  Further, permission 
+ *  is hereby granted, subject to the same provisions, to modify a copy or 
+ *  copies or any portion of it, and to distribute to others at no charge 
+ *  materials containing or derived from the material.
+ *  
+ *  The developers of the software ask that you acknowledge its use in any 
+ *  document referencing work based on the  program, such as published 
+ *  research.  Also, they ask that you supply to Argonne National 
+ *  Laboratory a copy of any published research referencing work based on 
+ *  the software.
+ *  
+ *  Any entity desiring permission for further use must contact:
+ *  
+ *  J. Gleeson
+ *  Industrial Technology Development Center Argonne National Laboratory
+ *  Argonne IL 60439
+ *  gleesonj@smtplink.eid.anl.gov
+ *  (708) 252-6055
+ *  
+ *  ******************************************************************** 
+ *  DISCLAIMER
+ *  
+ *  THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+ *  OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+ *  THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+ *  WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+ *  RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+ *  INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+ *  INFRINGE PRIVATELY OWNED RIGHTS.
+ *  
+ *  ********************************************************************** 
+ *  GOVERNMENT LICENSE
+ *  
+ *  The Government is granted for itself and others acting on its behalf a 
+ *  paid-up, non-exclusive, irrevocable worldwide license in this computer 
+ *  software to reproduce, prepare derivative works, and perform publicly 
+ *  and display publicly.
+ */
+
+/******************************************************************************
+*     FILE: parallel.c: This file contains all the parallel functions
+*     Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle,
+*              Brian P. Walenz
+******************************************************************************/
+
+#include "pgapack.h"
+
+#define DEBUG_EVAL 0
+
+/*U****************************************************************************
+  PGARunGM - High-level routine to execute the genetic algorithm using the
+  global model.  It is called after PGACreate and PGASetup have been called.
+  If a NULL communicator is given, a sequential execution method is used,
+  otherwise, work is divided among the processors in the communicator.
+
+  Category: Generation
+
+  Inputs:
+    ctx      - context variable
+    evaluate - a pointer to the user's evaluation function, which must
+    have the calling sequence shown in the example.
+    comm     - an MPI communicator
+
+  Outputs:
+    none
+
+  Example:
+    PGAContext *ctx;
+    double f(PGAContext *ctx, int p, int pop);
+    :
+    PGARunGM(ctx, f, MPI_COMM_WORLD);
+
+****************************************************************************U*/
+void PGARunGM(PGAContext *ctx, double (*f)(PGAContext *, int, int),
+	      MPI_Comm comm)
+{
+    int       rank, Restarted, best_p;
+    void    (*CreateNewGeneration)(PGAContext *, int, int);
+
+    /*  Let this be warned:
+     *  The communicator is NOT duplicated.  There might be problems with
+     *  PGAPack and the user program using the same communicator.
+     */
+    PGADebugEntered("PGARunGM");
+
+    rank = PGAGetRank(ctx, comm);
+
+    PGAEvaluate(ctx, PGA_OLDPOP, f, comm);
+    if (rank == 0)
+	PGAFitness(ctx, PGA_OLDPOP);
+
+    if (PGAGetMutationOrCrossoverFlag(ctx)) 
+	CreateNewGeneration = PGARunMutationOrCrossover;
+    else
+	CreateNewGeneration = PGARunMutationAndCrossover;
+
+    while (!PGADone(ctx, comm)) {
+	if (rank == 0) {
+	    Restarted = PGA_FALSE;
+	    if ((ctx->ga.restart == PGA_TRUE) &&
+		(ctx->ga.ItersOfSame % ctx->ga.restartFreq == 0)) {
+		ctx->ga.ItersOfSame++;
+		Restarted = PGA_TRUE;
+		PGARestart(ctx, PGA_OLDPOP, PGA_NEWPOP);
+	    } else {
+		PGASelect(ctx, PGA_OLDPOP);
+		CreateNewGeneration(ctx, PGA_OLDPOP, PGA_NEWPOP);
+	    }
+	}
+	MPI_Bcast(&Restarted, 1, MPI_INT, 0, comm);
+
+	PGAEvaluate(ctx, PGA_NEWPOP, f, comm);
+	if (rank == 0)
+	    PGAFitness(ctx, PGA_NEWPOP);
+
+	/*  If the GA wasn't restarted, update the generation and print
+         *  stuff.  We do this because a restart is NOT counted as a 
+         *  complete generation.
+	 */
+	if (!Restarted) {
+	    PGAUpdateGeneration(ctx, comm);
+	    if (rank == 0)
+		PGAPrintReport(ctx, stdout, PGA_OLDPOP);
+	}
+    }
+
+    if (rank == 0) {
+	best_p = PGAGetBestIndex(ctx, PGA_OLDPOP);
+	printf("The Best Evaluation: %e.\n",
+	       PGAGetEvaluation(ctx, best_p, PGA_OLDPOP));
+	printf("The Best String:\n");
+	PGAPrintString(ctx, stdout, best_p, PGA_OLDPOP);
+	fflush(stdout);
+    }
+    PGADebugExited("PGARunGM");
+}
+
+
+/*I****************************************************************************
+   PGAEvaluateSeq - Internal evalution function.  Evaluates all strings
+   that need to be evaluated using one processor.
+
+   Category: Fitness & Evaluation
+
+   Inputs:
+      ctx  - context variable
+      pop  - symbolic constant of the population to be evaluated
+      f    - a pointer to a function to evaluate a string.
+
+   Outputs:
+
+   Example:
+
+****************************************************************************I*/
+void PGAEvaluateSeq(PGAContext *ctx, int pop,
+		    double (*f)(PGAContext *, int, int))
+{
+    int     p;
+    double  e;
+
+    PGADebugEntered("PGAEvaluateSeq");
+
+    /*  Standard sequential evaluation.  */
+    if (ctx->sys.UserFortran == PGA_TRUE) {
+	for (p=1; p<=ctx->ga.PopSize; p++)
+	    if (!PGAGetEvaluationUpToDateFlag(ctx, p-1, pop)) {
+		e = (*((double(*)(void *, void *, void *))f))(&ctx, &p, &pop);
+		PGASetEvaluation (ctx, p-1, pop, e);
+	    }
+    } else {
+	for (p=0; p<ctx->ga.PopSize; p++) 
+	    if (!PGAGetEvaluationUpToDateFlag(ctx, p, pop)) {
+		e = (*f)(ctx, p, pop);
+		PGASetEvaluation(ctx, p, pop, e);
+	    }
+    }
+    PGADebugExited("PGAEvaluateSeq");
+}
+
+
+/*I****************************************************************************
+   PGAEvaluateCoop - Internal evaluation function.  Evaluates all strings
+   that need to be evaluated using two processors cooperatively.  The first
+   is treated as a master, it will send a string to the second for evaluation.
+   While the second is evaluating, the master will _also_ evaluate a string.
+
+   Category: Fitness & Evaluation
+
+   Inputs:
+      ctx  - context variable
+      pop  - symbolic constant of the population to be evaluated
+      f    - a pointer to a function to evaluate a string.
+      comm - an MPI communicator
+
+   Outputs:
+
+   Example:
+
+****************************************************************************I*/
+void PGAEvaluateCoop(PGAContext *ctx, int pop,
+		     double (*f)(PGAContext *, int, int), MPI_Comm comm)
+{
+    MPI_Status      stat;
+    int             p, fp, q;
+    double          e;
+    PGAIndividual  *ind;
+
+    PGADebugEntered("PGAEvaluateCoop");
+
+    q = -1;
+
+    ind = PGAGetIndividual(ctx, 0, pop);
+    
+    for (p=0; p<ctx->ga.PopSize;) {
+	while ((p<ctx->ga.PopSize) && (ind+p)->evaluptodate)  p++;
+	if (p<ctx->ga.PopSize) {
+	    PGASendIndividual(ctx, p, pop, 1, PGA_COMM_STRINGTOEVAL, comm);
+	    q = p;
+	}
+	p++;
+	
+	while ((p<ctx->ga.PopSize) && (ind+p)->evaluptodate)  p++;
+	if (p<ctx->ga.PopSize) {
+	    if (ctx->sys.UserFortran == PGA_TRUE) {
+		fp = p+1;
+		e = (*((double(*)(void *, void *, void *))f))(&ctx, &fp, &pop);
+	    } else {
+		e = (*f)(ctx, p, pop);
+	    }
+	    PGASetEvaluation(ctx, p, pop, e);
+#if DEBUG_EVAL
+	    printf("%4d: %10.8e Local\n", p, e); fflush(stdout);
+#endif
+	}
+	
+	if (q >= 0) {
+	    MPI_Recv(&e, 1, MPI_DOUBLE, 1, PGA_COMM_EVALOFSTRING, comm, &stat);
+	    PGASetEvaluation(ctx, q, pop, e);
+#if DEBUG_EVAL
+	    printf("%4d: %10.8e Slave %d\n", p, e, 1); fflush(stdout);
+#endif
+	    q = -1;
+	}
+    }   
+    
+    /*  Release the slave  */
+    MPI_Send(&q, 1, MPI_INT, 1, PGA_COMM_DONEWITHEVALS, comm);
+
+    PGADebugExited("PGAEvaluateCoop");
+}
+
+
+
+/*I****************************************************************************
+   PGAEvaluateMS - Internal evaluation function.  Evaluates all strings
+   that need evaluating using three or more processors.  Operates in a 
+   standard master-slave execution method.
+
+   Category: Fitness & Evaluation
+
+   Inputs:
+      ctx  - context variable
+      pop  - symbolic constant of the population to be evaluated
+      f    - a pointer to a function to evaluate a string.
+      comm - an MPI communicator
+
+   Outputs:
+
+   Example:
+
+****************************************************************************I*/
+void PGAEvaluateMS(PGAContext *ctx, int pop,
+		   double (*f)(PGAContext *c, int p, int pop), MPI_Comm comm)
+{
+    int    *work;
+    int     i, k, s, p, size, sentout;
+    double  e;
+    MPI_Status stat;
+    PGAIndividual *ind;
+
+    PGADebugEntered("PGAEvaluateMS");
+
+    size = PGAGetNumProcs(ctx, comm);
+
+    work = (int *)malloc(size *sizeof(int));
+    if (work == NULL) {
+	PGAError(ctx, "PGAEvaluateMS:  Couldn't allocate work array",
+		 PGA_FATAL, PGA_VOID, NULL);
+    }
+    
+    sentout = 0;
+    s = 1;
+    ind = PGAGetIndividual(ctx, 0, pop);
+    
+    /*  Send strings to all processes, since they are all unused.  */
+    for (k=0; ((k<ctx->ga.PopSize) && (s<size)); k++) {
+	if ((ind+k)->evaluptodate == PGA_FALSE) {
+	    work[s] = k;
+	    PGASendIndividual(ctx, k, pop, s, PGA_COMM_STRINGTOEVAL, comm);
+#if DEBUG_EVAL
+	    printf("%4d: Sent to slave %d.\n", k, s); fflush(stdout);
+#endif
+	    sentout++;
+	    s++;
+	}
+    }
+    
+    /*  Move to the next string to be evaluated.  Notice that all we need
+     *  to do is skip any strings that are already evaluated, unlike 
+     *  below, where we need to _first_ go to the next string, then
+     *  skip any that are up to date.
+     */
+    while ((k<ctx->ga.PopSize) && (ind+k)->evaluptodate)  k++;
+    
+    /*  While there are still unevaluated individuals, receive whatever
+     *  is waiting, then immediately send a new string to it.  This 
+     *  implicitly will balance the load across the machines, as we
+     *  initially sent a string to _each_ process, so _each_ process
+     *  will return an evaluation and get a new one immediately.
+     */
+    while(k<ctx->ga.PopSize) {
+	/*  Receive the next evaluated string.  */
+	MPI_Recv(&e, 1, MPI_DOUBLE, MPI_ANY_SOURCE, PGA_COMM_EVALOFSTRING,
+		 comm, &stat);
+	p = work[stat.MPI_SOURCE];
+	PGASetEvaluation(ctx, p, pop, e);
+	
+#if DEBUG_EVAL
+	printf("%4d: %10.8e Slave %d  Sent %d\n", work[stat.MPI_SOURCE],
+	       e, stat.MPI_SOURCE, k); fflush(stdout);
+#endif
+	
+	/*  Immediately send another string to be evaluated.  */
+	work[stat.MPI_SOURCE] = k;
+	PGASendIndividual(ctx, k, pop, stat.MPI_SOURCE,
+			  PGA_COMM_STRINGTOEVAL, comm);
+	
+	/*  Find the next unevaluated individual  */
+	k++;
+	while ((k<ctx->ga.PopSize) && (ind+k)->evaluptodate)  k++;
+    }
+    
+    /*  All strings have been sent out.  Wait for them to be done.  */
+    while(sentout > 0) {
+	MPI_Recv(&e, 1, MPI_DOUBLE, MPI_ANY_SOURCE, PGA_COMM_EVALOFSTRING,
+		 comm, &stat);
+	p = work[stat.MPI_SOURCE];
+	PGASetEvaluation(ctx, p, pop, e);
+	sentout--;
+#if DEBUG_EVAL
+	printf("%4d: %10.8e Slave %d\n", 
+	       work[stat.MPI_SOURCE], e, stat.MPI_SOURCE); fflush(stdout);
+#endif
+    }
+    free(work);
+    
+    /*  Release the slaves.  */
+    for (i=1; i<size; i++)
+	MPI_Send(&i, 1, MPI_INT, i, PGA_COMM_DONEWITHEVALS, comm);
+
+    PGADebugExited("PGAEvaluateMS");
+}
+
+
+/*I****************************************************************************
+   PGAEvaluateSlave - Slave execution routine.  Sit around and wait for a
+   string to eval to show up, then evaluate it and return the evaluation.
+   Terminates when it receives PGA_COMM_DONEWITHEVALS.
+
+   Category: Fitness & Evaluation
+
+   Inputs:
+
+   Outputs:
+
+   Example:
+
+****************************************************************************I*/
+void PGAEvaluateSlave(PGAContext *ctx, int pop,
+		      double (*f)(PGAContext *, int, int), MPI_Comm comm)
+{
+    MPI_Status  stat;
+    int         k;
+    double      e;
+
+    PGADebugEntered("PGAEvaluateSlave");
+
+    k = PGA_TEMP1;
+    MPI_Probe(0, MPI_ANY_TAG, comm, &stat);
+    while (stat.MPI_TAG == PGA_COMM_STRINGTOEVAL) {
+	PGAReceiveIndividual(ctx, PGA_TEMP1, pop, 0, PGA_COMM_STRINGTOEVAL,
+			     comm, &stat);
+
+	if (ctx->sys.UserFortran == PGA_TRUE)
+	    e = (*((double(*)(void *, void *, void *))f))(&ctx, &k, &pop);
+	else 
+	    e = (*f)(ctx, PGA_TEMP1, pop);
+
+	MPI_Send(&e, 1, MPI_DOUBLE, 0, PGA_COMM_EVALOFSTRING, comm);
+	MPI_Probe(0, MPI_ANY_TAG, comm, &stat);
+    }
+    MPI_Recv(&k, 1, MPI_INT, 0, PGA_COMM_DONEWITHEVALS, comm, &stat);
+
+    PGADebugExited("PGAEvaluateSlave");
+}
+
+
+/*U****************************************************************************
+   PGAEvaluate - Calls a user-specified function to return an evaluation of
+   each string in the population. The user-specified function is only called
+   if the string has been changed (e.g., by crossover or mutation) or the user
+   has explicitly signaled the string's evaluation is out-of-date by a call
+   to PGASetEvaluationUpToDateFlag().
+
+   Category: Fitness & Evaluation
+
+   Inputs:
+      ctx  - context variable
+      pop  - symbolic constant of the population to be evaluated
+      f    - a pointer to a function to evaluate a string.  This function will
+             be called once for each string in population pop that requires
+             evaluation.  This function must return a double (the evaluation
+             function value) and must fit the prototype
+                 double f(PGAContext *c, int p, int pop);
+      comm - an MPI communicator
+
+   Outputs:
+      Evaluates the population via side effect
+
+   Example:
+      Evaluate all strings in population PGA_NEWPOP using the user-defined
+      evaluation function Energy.
+
+      double Energy(PGAContext *ctx, int p, int pop) {
+        :
+      };
+
+      PGAContext *ctx;
+      :
+      PGAEvaluate(ctx, PGA_NEWPOP, Energy, MPI_COMM_WORLD);
+
+****************************************************************************U*/
+void PGAEvaluate(PGAContext *ctx, int pop,
+		 double (*f)(PGAContext *, int, int), MPI_Comm comm)
+{
+    int  rank, size;
+
+    PGADebugEntered("PGAEvaluate");
+
+    rank = PGAGetRank(ctx, comm);
+    size = PGAGetNumProcs(ctx, comm);
+
+    if (rank == 0) {
+	if (size == 1)
+	    PGAEvaluateSeq(ctx, pop, f);
+	if (size == 2)
+	    PGAEvaluateCoop(ctx, pop, f, comm);
+	if (size > 2) 
+	    PGAEvaluateMS(ctx, pop, f, comm);
+    } else {
+	PGAEvaluateSlave(ctx, pop, f, comm);
+    }
+
+    PGADebugExited("PGAEvaluate");
+}
+
+
+/*U****************************************************************************
+  PGABuildDatatype - Build an MPI datatype for string p in population pop.
+
+  Category: Parallel
+
+  Inputs:
+    ctx     - context variable
+    p       - index of an individual
+    pop     - symbolic constant of the population
+
+  Outputs:
+    An MPI datatype for member p of population pop.
+
+  Example:
+    PGAContext *ctx;
+    int p;
+    MPI_Datatype dt;
+    :
+    dt = PGABuildDatatype(ctx, p, PGA_NEWPOP);
+
+****************************************************************************U*/
+MPI_Datatype PGABuildDatatype(PGAContext *ctx, int p, int pop)
+{
+    PGADebugEntered("PGABuildDatatype");
+    
+    PGADebugExited("PGABuildDatatype");
+
+    return((*ctx->cops.BuildDatatype)(ctx, p, pop));
+}
+
+
+/*U****************************************************************************
+  PGASendIndividual - transmit an individual to another process
+
+  Category: Parallel
+
+  Inputs:
+    ctx  - context variable
+    p    - index of an individual
+    pop  - symbolic constant of the population
+    dest - ID of the process where this is going
+    tag  - MPI tag to send with the individual
+    comm - MPI communicator
+
+  Outputs:
+
+  Example:
+    PGAContext *ctx;
+    int p, dest;
+    :
+    dest = SelectAFreeProcessor();
+    PGASendIndividual(ctx, p, PGA_NEWPOP, dest, PGA_SR_STRINGTOEVAL, comm);
+
+****************************************************************************U*/
+void PGASendIndividual(PGAContext *ctx, int p, int pop, int dest, int tag,
+                       MPI_Comm comm)
+{
+    MPI_Datatype individualtype;
+
+    PGADebugEntered("PGASendIndividual");
+
+    individualtype = PGABuildDatatype(ctx, p, pop);
+    MPI_Send(MPI_BOTTOM, 1, individualtype, dest, tag, comm);
+    MPI_Type_free(&individualtype);
+    
+    PGADebugExited("PGASendIndividual");
+}
+
+/*U****************************************************************************
+  PGAReceiveIndividual - receive an individual from another process
+
+  Category: Parallel
+
+  Inputs:
+    ctx    - contex variable
+    p      - index of an individual
+    pop    - symbolic constant of the population
+    source - ID of the process from which to receive
+    tag    - MPI tag to look for
+    status - pointer to an MPI status structure
+
+  Outputs:
+    status and string p in population pop are changed by side-effect.
+
+  Example:
+    Receive a string from the master process (rank == 0) with tag
+    PGA_SR_STRINGTOEVAL, and place it into the first temporary location
+    in PGA_NEWPOP.
+
+    PGAContext *ctx;
+    MPI_Comm    comm;
+    MPI_Status  status;
+    :
+    PGAReceiveIndividual(ctx, PGA_TEMP1, PGA_NEWPOP, 0, PGA_SR_STRINGTOEVAL,
+                         comm, &status);
+
+****************************************************************************U*/
+void PGAReceiveIndividual(PGAContext *ctx, int p, int pop, int source, int tag,
+                          MPI_Comm comm, MPI_Status *status)
+{
+     MPI_Datatype individualtype;
+
+    PGADebugEntered("PGAReceiveIndividual");
+
+     individualtype = PGABuildDatatype(ctx, p, pop);
+     MPI_Recv(MPI_BOTTOM, 1, individualtype, source, tag, comm, status);
+     MPI_Type_free(&individualtype);
+
+    PGADebugExited("PGAReceiveIndividual");
+}
+
+/*U****************************************************************************
+  PGASendReceiveIndividual - Send an individual to a process, while receiving
+  a different individual from a different process.
+
+  Category: Parallel
+
+  Inputs:
+    ctx       - context variable
+    send_p    - index of string to send
+    send_pop  - symbolic constant of population to send from
+    dest      - destination process
+    send_tag  - tag to send with
+    recv_p    - index of string to receive
+    recv_pop  - symbolic constant of population to receive from
+    source    - process to receive from
+    recv_tag  - tag to receive with
+    comm      - an MPI communicator
+    status    - pointer to the MPI status structure
+
+  Outputs:
+    status and string recv_p in population recv_pop are modified by
+    side-effect.
+
+  Example:
+    A dedicated process is being used to perform an optimization algorithm
+    on the strings.  Send a new string, s, to the process, while receiving an
+    optimized string, r, from it.
+
+    PGAContext *ctx;
+    MPI_Comm    comm;
+    MPI_Status  status;
+    int  s, r;
+    :
+    PGASendReceiveIndividual(ctx, s, PGA_NEWPOP, 1, PGA_SR_STRINGTOMODIFY,
+                                  r, PGA_NEWPOP, 1, PGA_SR_MODIFIEDSTRING,
+                                  comm, &status);
+
+****************************************************************************U*/
+void PGASendReceiveIndividual(PGAContext *ctx, int send_p, int send_pop,
+                              int dest, int send_tag, int recv_p, int recv_pop,
+                              int source, int recv_tag, MPI_Comm comm,
+                              MPI_Status *status)
+{
+     MPI_Datatype individualsendtype;
+     MPI_Datatype individualrecvtype;
+
+    PGADebugEntered("PGASendReceiveIndividual");
+
+     individualsendtype = PGABuildDatatype(ctx, send_p, send_pop);
+     individualrecvtype = PGABuildDatatype(ctx, recv_p, recv_pop);
+
+     MPI_Sendrecv(MPI_BOTTOM, 1, individualsendtype, dest,   send_tag,
+                  MPI_BOTTOM, 1, individualrecvtype, source, recv_tag,
+                  comm, status);
+
+     MPI_Type_free(&individualsendtype);
+     MPI_Type_free(&individualrecvtype);
+
+    PGADebugExited("PGASendReceiveIndividual");
+}
+
+
+/*I****************************************************************************
+  PGARunIM - Execute the island model genetic algorithm
+
+  Category: Parallel
+
+  Inputs:
+    ctx      - context variable
+    evaluate - a pointer to the user's evaluation function, which must
+               have the calling sequence shown in the example.
+    comm     - the MPI communicator to use
+
+  Outputs:
+    none
+
+  Example:
+    PGAContext *ctx,
+    double f(PGAContext *ctx, int p, int pop);
+    MPI_Comm comm;
+    :
+    PGARunIM(ctx, f, comm);
+
+****************************************************************************I*/
+void PGARunIM(PGAContext *ctx, double (*f)(PGAContext *c, int p, int pop),
+              MPI_Comm tcomm)
+{
+    /* Based on ctx->par.topology this routine will need to create the
+       appropriate communicator out of tcomm
+    */
+    
+     PGADebugEntered("PGARunIM");
+     PGAError (ctx, "PGARunIM: Island model not implemented",
+               PGA_FATAL, PGA_VOID, NULL);
+     PGADebugExited("PGARunIM");
+}
+
+
+/*I****************************************************************************
+  PGARunNM - Execute a neighborhood model genetic algorithm
+
+  Category: Parallel
+
+  Inputs:
+    ctx      - context variable
+    evaluate - a pointer to the user's evaluation function, which must
+               have the calling sequence shown in the example.
+    comm     - the MPI communicator to use
+
+  Outputs:
+    none
+
+  Example:
+    PGAContext *ctx,
+    MPI_Comm comm;
+    double f(PGAContext *ctx, int p, int pop);
+    :
+    PGARunNM(ctx, f, comm);
+
+****************************************************************************I*/
+void PGARunNM(PGAContext *ctx, double (*f)(PGAContext *c, int p, int pop),
+              MPI_Comm tcomm)
+{
+    /* Based on ctx->par.topology this routine will need to create the
+       appropriate communicator out of tcomm
+    */
+     PGADebugEntered("PGARunNM");
+     PGAError (ctx, "PGARunNM: Island model not implemented",
+               PGA_FATAL, PGA_VOID, NULL);
+     PGADebugExited("PGARunNM");
+}
+
+
+
+/*U****************************************************************************
+  PGAGetRank - Returns the rank of the processor in communicator comm.  If
+  comm is NULL or a sequential version of PGAPack is used, PGAGetRank()
+  returns 0.
+
+  Category: Parallel
+
+  Inputs:
+      ctx  - context variable structure pointer
+      comm - an MPI communicator
+
+  Outputs:
+      The rank of this processor
+
+  Example:
+      PGAContext  *ctx;
+      int          rank;
+      :
+      rank = PGAGetRank(ctx, MPI_COMM_WORLD);
+      if (rank == 0) {
+          LetTheMasterDoSomething();
+      }
+
+****************************************************************************U*/
+int PGAGetRank (PGAContext *ctx, MPI_Comm comm)
+{
+    int rank;
+    
+    PGADebugEntered("PGAGetRank");
+
+    if (comm == NULL)
+	rank = 0;
+    else
+	MPI_Comm_rank(comm, &rank);
+    
+    PGADebugExited("PGAGetRank");
+    
+    return(rank);
+}
+
+
+/*U****************************************************************************
+  PGAGetNumProcs - Returns the size of communicator comm in processes.  If
+  comm is NULL or a sequential version of PGAPack is used, PGAGetNumProcs()
+  returns 1.
+
+  Category: Parallel
+
+  Inputs:
+      ctx  - context variable structure pointer
+      comm - an MPI communicator
+
+  Outputs:
+      The numbers of processors in communicator comm.
+
+  Example:
+      PGAContext  *ctx;
+      :
+      if (PGAGetNumProcs(ctx, MPI_COMM_WORLD) < 4) {
+          printf("Too few processors for decent performance!\n");
+	  exit(-1);
+      }
+
+****************************************************************************U*/
+int PGAGetNumProcs (PGAContext *ctx, MPI_Comm comm)
+{
+    int size;
+
+    PGADebugEntered("PGAGetNumProcs");
+
+    if (comm == NULL)
+	size = 1;
+    else
+	MPI_Comm_size(comm, &size);
+
+    PGADebugExited("PGAGetNumProcs");
+
+    return(size);
+}
+
+
+/*I****************************************************************************
+   PGASetNumIslands - Set the number of islands to use in an island model
+   GA. The default is one.  Currently must be the same as the number of
+   processes in the default communicator.  
+
+   Category: Parallel
+
+   Inputs:
+      ctx - context variable
+      n   - number of islands
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx,
+      double f(PGAContext *ctx, int p, int pop);
+      :
+      ctx = PGACreate(&argc, argv, PGA_DATATYPE_BINARY, 100, PGA_MAXIMIZE);
+      PGASetNumIslands(ctx, 10);
+      PGASetUp(ctx);
+      PGARun(ctx, f);
+      PGADestroy(ctx);
+
+****************************************************************************I*/
+void PGASetNumIslands( PGAContext *ctx, int n)
+{
+
+    PGADebugEntered("PGASetNumIslands");
+
+    if ( n < 1 )
+        PGAError(ctx, "PGASetNumIslands: Invalid value of n:",
+                 PGA_FATAL, PGA_INT, (void *) &n);
+
+    ctx->par.NumIslands = n;
+
+    PGADebugExited("PGASetNumIslands");
+}
+
+
+/*I***************************************************************************
+   PGAGetNumIslands - Returns the number of islands to use in an island model
+
+   Category: Parallel
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+       the number of islands to use in an island model
+
+   Example:
+      PGAContext *ctx;
+      int npop;
+      :
+      npop = PGAGetNumIslands(ctx);
+
+***************************************************************************I*/
+int PGAGetNumIslands (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetNumIslands");
+    PGAFailIfNotSetUp("PGAGetNumIslands");
+
+    PGADebugExited("PGAGetNumIslands");
+
+    return(ctx->par.NumIslands);
+}
+
+/*I****************************************************************************
+   PGASetNumDemes - Set the number of demes to use in a neighborhood model
+   GA. Currently must be the same as the number of processes in the default
+   communicator.  The default is one.
+
+   Category: Parallel
+
+   Inputs:
+      ctx          - context variable
+      numdemes     - number of demes
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx,
+      double f(PGAContext *ctx, int p, int pop);
+      :
+      ctx = PGACreate(&argc, argv, PGA_DATATYPE_BINARY, 100, PGA_MAXIMIZE);
+      PGASetNumDemes(ctx, 4);
+      PGASetUp(ctx);
+      PGARun(ctx, f);
+      PGADestroy(ctx);
+
+****************************************************************************I*/
+void PGASetNumDemes( PGAContext *ctx, int numdemes)
+{
+    PGADebugEntered("PGASetNumDemes");
+
+    if ( numdemes < 1 )
+        PGAError(ctx, "PGASetNumDemes: Invalid value of numdemes:",
+                 PGA_FATAL, PGA_INT, (void *) &numdemes);
+
+    ctx->par.NumDemes = numdemes;
+
+    PGADebugExited("PGASetNumDemes");
+}
+
+
+/*I***************************************************************************
+   PGAGetNumDemes - Returns the number of demes to use in a neighborhood model
+
+   Category: Parallel
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+       the number of demes to use in a neighborhood model
+
+   Example:
+      PGAContext *ctx;
+      int npop;
+      :
+      npop = PGAGetNumDemes(ctx);
+
+***************************************************************************I*/
+int PGAGetNumDemes (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetNumDemes");
+    PGAFailIfNotSetUp("PGAGetNumDemes");
+
+    PGADebugExited("PGAGetNumDemes");
+
+    return(ctx->par.NumDemes);
+}
+
+
+/*U****************************************************************************
+   PGASetCommunicator - Set the default communicator to use when PGARun is
+   called.  Does not necessarily need to be the same as the number of
+   processes in MPI_COMM_WORLD (which is the default).
+
+   Category: Parallel
+
+   Inputs:
+      ctx    - context variable
+      comm   - communicator to use
+
+   Outputs:
+      None
+
+   Example:
+      MPI_Comm mycomm;
+      PGAContext *ctx,
+      double f(PGAContext *ctx, int p, int pop);
+      :
+      ctx = PGACreate(&argc, argv, PGA_DATATYPE_BINARY, 100, PGA_MAXIMIZE);
+      PGASetCommunicator(ctx, mycomm);
+      PGASetUp(ctx);
+      PGARun(ctx, f);
+      PGADestroy(ctx);
+
+****************************************************************************U*/
+void PGASetCommunicator( PGAContext *ctx, MPI_Comm comm)
+{
+
+    PGADebugEntered("PGASetCommunicator");
+
+    ctx->par.DefaultComm = comm;
+
+    PGADebugExited("PGASetCommunicator");
+}
+
+
+/*U****************************************************************************
+   PGAGetCommunicator - Returns the default communicator used when PGARun is
+   called.
+   
+   Category: Parallel
+
+   Inputs:
+      ctx    - context variable
+
+   Outputs:
+      The default communicator
+
+   Example:
+      MPI_Comm comm;
+      PGAContext *ctx,
+      double f(PGAContext *ctx, int p, int pop);
+      :
+      ctx = PGACreate(&argc, argv, PGA_DATATYPE_BINARY, 100, PGA_MAXIMIZE);
+      PGASetUp(ctx);
+      comm = PGAGetCommunicator(ctx);
+
+
+****************************************************************************U*/
+MPI_Comm PGAGetCommunicator( PGAContext *ctx)
+{
+
+    PGADebugEntered("PGAGetCommunicator");
+
+    PGADebugExited("PGAGetCommunicator");
+
+    return(ctx->par.DefaultComm);
+}
Index: trunk/optimizer/src/pgapack/pgapack/source/pga.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/pga.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/pga.c	(revision 816)
@@ -0,0 +1,741 @@
+/*
+ *  
+ *  ********************************************************************* 
+ *  (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+ *  *********************************************************************
+ *  
+ *  This software was authored by
+ *  
+ *  D. Levine
+ *  Mathematics and Computer Science Division Argonne National Laboratory
+ *  Argonne IL 60439
+ *  levine@mcs.anl.gov
+ *  (708) 252-6735
+ *  (708) 252-5986 (FAX)
+ *  
+ *  with programming assistance of participants in Argonne National 
+ *  Laboratory's SERS program.
+ *  
+ *  This program contains material protectable under copyright laws of the 
+ *  United States.  Permission is hereby granted to use it, reproduce it, 
+ *  to translate it into another language, and to redistribute it to 
+ *  others at no charge except a fee for transferring a copy, provided 
+ *  that you conspicuously and appropriately publish on each copy the 
+ *  University of Chicago's copyright notice, and the disclaimer of 
+ *  warranty and Government license included below.  Further, permission 
+ *  is hereby granted, subject to the same provisions, to modify a copy or 
+ *  copies or any portion of it, and to distribute to others at no charge 
+ *  materials containing or derived from the material.
+ *  
+ *  The developers of the software ask that you acknowledge its use in any 
+ *  document referencing work based on the  program, such as published 
+ *  research.  Also, they ask that you supply to Argonne National 
+ *  Laboratory a copy of any published research referencing work based on 
+ *  the software.
+ *  
+ *  Any entity desiring permission for further use must contact:
+ *  
+ *  J. Gleeson
+ *  Industrial Technology Development Center Argonne National Laboratory
+ *  Argonne IL 60439
+ *  gleesonj@smtplink.eid.anl.gov
+ *  (708) 252-6055
+ *  
+ *  ******************************************************************** 
+ *  DISCLAIMER
+ *  
+ *  THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+ *  OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+ *  THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+ *  WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+ *  RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+ *  INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+ *  INFRINGE PRIVATELY OWNED RIGHTS.
+ *  
+ *  ********************************************************************** 
+ *  GOVERNMENT LICENSE
+ *  
+ *  The Government is granted for itself and others acting on its behalf a 
+ *  paid-up, non-exclusive, irrevocable worldwide license in this computer 
+ *  software to reproduce, prepare derivative works, and perform publicly 
+ *  and display publicly.
+ */
+
+/*****************************************************************************
+*     FILE: pga.c: This file contains all the routines that are data structure
+*                  neutral
+*
+*     Authors: David M. Levine, Philip L. Hallstrom, and David M. Noelle,
+*              Brian P. Walenz
+*****************************************************************************/
+
+#include "pgapack.h"
+
+/*U****************************************************************************
+  PGARun - Highest level routine to execute the genetic algorithm.  It
+  is called after PGACreate and PGASetup have been called.
+
+  Category: Generation
+
+  Inputs:
+    ctx      - context variable
+    evaluate - a pointer to the user's evaluation function, which must
+               have the calling sequence shown in the example.
+
+  Outputs:
+    none
+
+  Example:
+    PGAContext *ctx,
+    double f(PGAContext *ctx, int p, int pop);
+    :
+    ctx = PGACreate(&argc, argv, PGA_DATATYPE_BINARY, 100, PGA_MAXIMIZE);
+    PGASetUp(ctx);
+    PGARun(ctx, f);
+    PGADestroy(ctx);
+
+****************************************************************************U*/
+void PGARun(PGAContext *ctx, double (*evaluate)(PGAContext *c, int p, int pop))
+{
+     MPI_Comm comm;                  /* value of default communicator */
+     int nprocs;                     /* number of processes in above  */
+     int npops;                      /* number of populations         */
+     int ndemes;                     /* number of demes               */
+     
+
+     PGADebugEntered("PGARun");
+     PGAFailIfNotSetUp("PGARun");
+
+     comm   = PGAGetCommunicator(ctx);
+     nprocs = PGAGetNumProcs    (ctx, comm);
+     npops  = PGAGetNumIslands  (ctx);
+     ndemes = PGAGetNumDemes    (ctx);
+
+     /**********************************************************************/
+     /*              Global model, one island, one deme                    */
+     /**********************************************************************/
+     if     ( (npops == 1) && (ndemes == 1) ) {
+
+	 PGARunGM(ctx, evaluate, comm);
+     }
+     
+     /**********************************************************************/
+     /*              Island model, > one island, one deme                  */
+     /**********************************************************************/
+     else if( (npops > 1) && (ndemes == 1) ) {
+         if ( nprocs == 1 )
+             PGAError (ctx, "PGARun: island model with one process",
+                       PGA_FATAL, PGA_VOID, (void *) &nprocs);
+         if ( nprocs != npops) {
+             PGAError (ctx, "PGARun: island model no. processes != no. pops",
+                       PGA_FATAL, PGA_VOID, (void *) &nprocs);
+         }
+         PGARunIM(ctx,evaluate,comm);
+     }
+             
+     /**********************************************************************/
+     /*              Neighborhood model, one island, > one deme            */
+     /**********************************************************************/
+     else if( (npops == 1) && (ndemes > 1) ) {
+         if ( nprocs == 1 )
+             PGAError (ctx, "PGARun: neighborhood model with one process",
+                       PGA_FATAL, PGA_VOID, (void *) &nprocs);
+         if ( nprocs != ndemes)
+             PGAError (ctx, "PGARun: neighborhood model no. processes "
+                       "!= no. demes", PGA_FATAL, PGA_VOID, (void *) &nprocs);
+         PGARunNM(ctx,evaluate,comm);
+     }
+             
+     /**********************************************************************/
+     /*              Mixed model, > one island, > one deme                 */
+     /**********************************************************************/
+     else if( (npops > 1) && (ndemes > 1) ) {
+         PGAError (ctx, "PGARun: Cannot execute mixed models",
+                   PGA_FATAL, PGA_VOID, (void *) &nprocs);
+     }
+
+     /**********************************************************************/
+     /*                        E R R O R                                   */
+     /**********************************************************************/
+     else {
+         PGAError (ctx, "PGARun: Invalid combination of numislands,"
+                   "ndemes, and nprocs.",
+                   PGA_FATAL, PGA_VOID, (void *) &nprocs);
+     }
+
+     /**********************************************************************/
+     /*                         E X I T                                    */
+     /**********************************************************************/
+     PGADebugExited("PGARun");
+     return;
+ }
+
+
+/*U****************************************************************************
+  PGARunMutationAndCrossover - Performs crossover and mutation from one
+  population to create the next.  Assumes PGASelect has been called.
+
+  Category: Generation
+
+  Inputs:
+    ctx - context variable
+    oldpop - symbolic constant of old population
+    newpop - symbolic constant of new population
+
+  Outputs:
+    newpop is modified by side-effect.
+
+  Example:
+     PGAContext *ctx,
+    :
+    PGARunMutationAndCrossover(ctx, PGA_OLDPOP, PGA_NEWPOP);
+
+****************************************************************************U*/
+void PGARunMutationAndCrossover (PGAContext *ctx, int oldpop, int newpop)
+{
+    int i, j, n, m1, m2;
+    int popsize, numreplace;
+    double pc;
+
+    PGADebugEntered("PGARunMutationAndCrossover");
+
+    popsize = PGAGetPopSize(ctx);
+    numreplace = PGAGetNumReplaceValue(ctx);
+    /*** first, copy n best strings (sorted by fitness) to new pop ***/
+    PGASortPop( ctx, oldpop );
+    n = popsize - numreplace;
+    for ( i=0; i < n; i++ ) {
+        j = PGAGetSortedPopIndex( ctx, i );
+        PGACopyIndividual ( ctx, j, oldpop, i, newpop );
+    }
+    pc = PGAGetCrossoverProb(ctx);
+    /*** reproduce to create the rest of the new population ***/
+    while ( n < popsize) {
+        m1 = PGASelectNextIndex( ctx );
+        m2 = PGASelectNextIndex( ctx );
+        if ( PGARandomFlip(ctx, pc) ) {
+             PGACrossover ( ctx, m1, m2, oldpop, PGA_TEMP1,
+                            PGA_TEMP2, newpop);
+
+              /*** mutate and copy first string to new population ***/
+              PGAMutate ( ctx, PGA_TEMP1, newpop);
+              while (PGADuplicate( ctx, PGA_TEMP1, newpop, newpop, n))
+                   PGAChange ( ctx, PGA_TEMP1, newpop );
+              PGACopyIndividual ( ctx, PGA_TEMP1, newpop, n, newpop);
+              n++;
+
+              if ( n < popsize ) {
+              /*** mutate and copy second string to new population ***/
+              PGAMutate ( ctx, PGA_TEMP2, newpop);
+              while ( PGADuplicate( ctx, PGA_TEMP2, newpop, newpop, n))
+                   PGAChange ( ctx, PGA_TEMP2, newpop );
+              PGACopyIndividual ( ctx, PGA_TEMP2, newpop, n, newpop);
+              n++;
+              }
+         }
+         else {
+            PGACopyIndividual ( ctx, m1, oldpop, n, newpop );
+            n++;
+            if ( n < ctx->ga.PopSize ) {
+                PGACopyIndividual ( ctx, m2, oldpop, n, newpop );
+                n++;
+            }
+       }
+    }
+
+    PGADebugExited("PGARunMutationAndCrossover");
+}
+
+
+/*U****************************************************************************
+  PGARunMutationOrCrossover - Performs crossover or mutation (but not both)
+  from one populationto create the next.  Assumes PGASelect has been called.
+
+  Category: Generation
+
+  Inputs:
+    ctx - context variable
+    oldpop - symbolic constant of old population
+    newpop - symbolic constant of new population
+
+  Outputs:
+    newpop is modified by side-effect.
+
+  Example:
+    PGAContext *ctx,
+    :
+    PGARunMutationOrCrossover(ctx, PGA_OLDPOP, PGA_NEWPOP);
+
+****************************************************************************U*/
+void PGARunMutationOrCrossover ( PGAContext *ctx, int oldpop, int newpop )
+{
+    int i, j, n, m1, m2;
+    int popsize, numreplace;
+    double pc;
+
+    PGADebugEntered("PGARunMutationOrCrossover");
+
+    popsize = PGAGetPopSize(ctx);
+    numreplace = PGAGetNumReplaceValue(ctx);
+    /*** first, copy n best strings (sorted by fitness) to new pop ***/
+    PGASortPop( ctx, oldpop );
+    n = popsize - numreplace;
+    for ( i=0; i < n; i++ ) {
+        j = PGAGetSortedPopIndex( ctx, i );
+        PGACopyIndividual ( ctx, j, oldpop, i, newpop );
+    }
+    pc = PGAGetCrossoverProb(ctx);
+    /*** reproduce to create the rest of the new population ***/
+    while ( n < popsize ) {
+        m1 = PGASelectNextIndex( ctx );
+        m2 = PGASelectNextIndex( ctx );
+        if ( PGARandomFlip(ctx, pc) ) {
+            PGACrossover ( ctx, m1, m2, oldpop, PGA_TEMP1,
+                                        PGA_TEMP2, newpop);
+
+            /*** copy first string to new population ***/
+            while (PGADuplicate(ctx, PGA_TEMP1, newpop,  newpop, n))
+                PGAChange ( ctx, PGA_TEMP1, newpop );
+            PGACopyIndividual ( ctx, PGA_TEMP1, newpop, n, newpop);
+            n++;
+
+            if ( n < popsize )
+            {
+                 /*** copy second string to new population ***/
+                 while (PGADuplicate(ctx, PGA_TEMP2, newpop,  newpop, n))
+                      PGAChange ( ctx, PGA_TEMP2, newpop );
+                 PGACopyIndividual ( ctx, PGA_TEMP2, newpop, n, newpop);
+                 n++;
+            }
+        }
+        else
+        {
+             PGACopyIndividual(ctx, m1, oldpop, PGA_TEMP1, newpop);
+             PGAMutate ( ctx, PGA_TEMP1, newpop );
+             while (PGADuplicate(ctx, PGA_TEMP1, newpop, newpop, n ))
+                  PGAChange ( ctx, PGA_TEMP1, newpop );
+             PGACopyIndividual ( ctx, PGA_TEMP1, newpop, n, newpop);
+             n++;
+
+             if ( n < popsize ) {
+                  PGACopyIndividual(ctx, m2, oldpop, PGA_TEMP2, newpop);
+                  PGAMutate ( ctx, PGA_TEMP2, newpop );
+                  while (PGADuplicate(ctx, PGA_TEMP2, newpop, newpop, n ))
+                       PGAChange ( ctx, PGA_TEMP2, newpop );
+                  PGACopyIndividual ( ctx, PGA_TEMP2, newpop, n, newpop);
+                  n++;
+             }
+        }
+    }
+
+    PGADebugExited("PGARunMutationOrCrossover");
+}
+
+
+/*U****************************************************************************
+  PGAUpdateGeneration - updates internal data structures for the next
+  genetic algorithm iteration, and checks if the termination conditions, both
+  user and PGAPack, have been met.  This routine must be called by both
+  master and slave processes at the end of each GA generation.
+
+  Category: Generation
+
+  Inputs:
+     ctx  - context variable
+     comm - an MPI communicator
+
+  Outputs:
+     PGA_TRUE if the genetic algorithm has terminated, otherwise PGA_FALSE.
+
+  Example:
+    PGAContext *ctx;
+    :
+    PGAUpdateGeneration(ctx, MPI_COMM_WORLD);
+
+****************************************************************************U*/
+void PGAUpdateGeneration(PGAContext *ctx, MPI_Comm comm)
+{
+    PGAIndividual *temp;
+    int i, rank;
+
+    PGADebugEntered("PGAUpdateGeneration");
+    PGADebugPrint( ctx, PGA_DEBUG_PRINTVAR,"PGAUpdateGeneration",
+                  "ga.iter = ", PGA_INT, (void *) &(ctx->ga.iter) );
+
+    rank = PGAGetRank(ctx, comm);
+
+    ctx->ga.iter++;
+
+    if (rank == 0) {
+	if (ctx->rep.PrintOptions & PGA_REPORT_AVERAGE)
+	    PGAUpdateAverage(ctx, PGA_NEWPOP);
+
+	if (ctx->rep.PrintOptions & PGA_REPORT_ONLINE)
+	    PGAUpdateOnline(ctx, PGA_NEWPOP);
+
+	if (ctx->rep.PrintOptions & PGA_REPORT_OFFLINE)
+	    PGAUpdateOffline(ctx, PGA_NEWPOP);
+
+	if ((ctx->ga.StoppingRule & PGA_STOP_NOCHANGE) || ctx->ga.restart) {
+	    i = PGAGetBestIndex(ctx, PGA_NEWPOP);
+	    if (ctx->rep.Best == PGAGetEvaluation(ctx, i, PGA_NEWPOP))
+		ctx->ga.ItersOfSame++;
+	    else {
+		ctx->rep.Best = PGAGetEvaluation(ctx, i, PGA_NEWPOP);
+		ctx->ga.ItersOfSame = 1;
+	    }
+	}
+
+	if (ctx->ga.StoppingRule & PGA_STOP_TOOSIMILAR)
+	    ctx->ga.PercentSame = PGAComputeSimilarity(ctx, ctx->ga.newpop);
+
+	/*  Clear this twice in case the user EOG calls PGASelect.  */
+	ctx->ga.SelectIndex = 0;
+
+	if (ctx->fops.EndOfGen)
+	    (*ctx->fops.EndOfGen)(&ctx);
+	if (ctx->cops.EndOfGen)
+	    (*ctx->cops.EndOfGen)(ctx);
+
+	ctx->ga.SelectIndex = 0;
+	temp           = ctx->ga.oldpop;
+	ctx->ga.oldpop = ctx->ga.newpop;
+	ctx->ga.newpop = temp;
+    }
+
+    PGADebugExited("PGAUpdateGeneration");
+}
+
+
+/*U***************************************************************************
+   PGAGetDataType - Returns the data type used by the given context.
+
+   Category: Generation
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      Returns the integer corresponding to the symbolic constant
+      used to specify the data type.
+
+   Example:
+      PGAContext *ctx;
+      int datatype;
+      :
+      datatype = PGAGetDataType(ctx);
+      switch (datatype) {
+      case PGA_DATATYPE_BINARY:
+          printf("Data Type = PGA_DATATYPE_BINARY\n");
+          break;
+      case PGA_DATATYPE_CHARACTER:
+          printf("Data Type = PGA_DATATYPE_CHARACTER\n");
+          break;
+      case PGA_DATATYPE_INTEGER:
+          printf("Data Type = PGA_DATATYPE_INTEGER\n");
+          break;
+      case PGA_DATATYPE_REAL:
+          printf("Data Type = PGA_DATATYPE_REAL\n");
+          break;
+      case PGA_DATATYPE_USER:
+          printf("Data Type = PGA_DATATYPE_USER\n");
+          break;
+      }
+
+***************************************************************************U*/
+int PGAGetDataType (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetDataType");
+
+    PGADebugExited("PGAGetDataType");
+
+    return(ctx->ga.datatype);
+}
+
+/*U***************************************************************************
+   PGAGetOptDirFlag - Returns a symbolic constant that represents the
+   direction of optimization
+
+   Category: Generation
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      Returns the integer corresponding to the symbolic constant
+      used to specify the  direction of optimization
+
+   Example:
+      PGAContext *ctx;
+      int optdir;
+      :
+      optdir = PGAGetOptDirFlag(ctx);
+      switch (optdir) {
+      case PGA_MAXIMIZE:
+          printf("Optimization direction = PGA_MAXIMIZE\n");
+          break;
+      case PGA_MINIMIZE:
+          printf("Optimization direction = PGA_MINIMIZE\n");
+          break;
+      }
+
+***************************************************************************U*/
+int PGAGetOptDirFlag (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetOptDirFlag");
+
+    PGADebugExited("PGAGetOptDirFlag");
+
+    return(ctx->ga.optdir);
+}
+
+/*U***************************************************************************
+   PGAGetStringLength - Returns the string length
+
+   Category: Generation
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      The string length
+
+   Example:
+      PGAContext *ctx;
+      int stringlen;
+      :
+      stringlen = PGAGetStringLength(ctx);
+
+***************************************************************************U*/
+int PGAGetStringLength (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetStringLength");
+
+    PGADebugExited("PGAGetStringLength");
+
+    return(ctx->ga.StringLen);
+}
+
+/*I***************************************************************************
+   PGAGetVariableStringLength - Returns the length of a variable length
+   string.
+
+   Category: Generation
+
+   Inputs:
+      ctx - context variable
+      p   - index into the population
+      pop - symbolic constant for the population
+
+   Outputs:
+      The string length
+
+   Example:
+      PGAContext *ctx;
+      int stringlen;
+      :
+      stringlen = PGAGetVariableStringLength(ctx, 0, PGA_NEWPOP);
+
+***************************************************************************I*/
+int PGAGetVariableStringLength (PGAContext *ctx, int p, int pop)
+{
+    PGADebugEntered("PGAGetVariableStringLength");
+
+    PGADebugExited("PGAGetVariableStringLength");
+
+    PGAError(ctx, "PGAGetVariableStringLength:  Variable length strings not "
+	     "currently supported.", PGA_FATAL, PGA_VOID, NULL);
+#if 0
+    ind = PGAGetIndividual(ctx, p, pop);
+    return(ind->StringLength);
+#endif
+    /*  Make the compilers be quiet.  */
+    return(0);
+}
+
+/*U***************************************************************************
+  PGAGetGAIterValue - returns the number of the current genetic
+  algorithm generation
+
+   Category: Generation
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      The genetic algorithm generation number
+
+   Example:
+      PGAContext *ctx;
+      int g;
+      :
+      g = PGAGetGAIterValue(ctx);
+
+***************************************************************************U*/
+int PGAGetGAIterValue (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetGAIterValue");
+    PGAFailIfNotSetUp("PGAGetGAIterValue");
+
+    PGADebugExited("PGAGetGAIterValue");
+
+    return(ctx->ga.iter);
+}
+
+/*U****************************************************************************
+  PGASetMutationOrCrossoverFlag - A boolean flag to indicate if recombination
+  uses exactly one of crossover or mutation on selected strings.
+
+   Category: Generation
+
+   Inputs:
+      ctx  - context variable
+      flag - PGA_TRUE (default) or PGA_FALSE
+
+   Outputs:
+      None
+
+   Example:
+      Set the genetic algorithm to use mutation only when crossover is
+      not used.
+
+      PGAContext *ctx;
+      :
+      PGASetMutationOrCrossoverFlag(ctx,PGA_FALSE);
+
+****************************************************************************U*/
+void PGASetMutationOrCrossoverFlag( PGAContext *ctx, int flag)
+{
+    PGADebugEntered("PGASetMutationOrCrossoverFlag");
+
+     switch (flag)
+     {
+     case PGA_TRUE:
+     case PGA_FALSE:
+          ctx->ga.MutateOnlyNoCross = flag;
+          break;
+     default:
+          PGAError (ctx, "PGASetMutationOrCrossoverFlag: Invalid value of "
+                    "flag:", PGA_FATAL, PGA_INT, (void *) &flag);
+          break;
+     }
+
+    PGADebugExited("PGASetMutationOrCrossoverFlag");
+}
+
+/*U****************************************************************************
+  PGASetMutationAndCrossoverFlag - A boolean flag to indicate if
+  recombination uses both crossover and mutation on selected strings
+
+   Category: Generation
+
+   Inputs:
+      ctx  - context variable
+      flag - PGA_TRUE (default) or PGA_FALSE
+
+   Outputs:
+      None
+
+   Example:
+      Set the genetic algorithm to use both crossover and mutation when
+      reproducing strings.
+
+      PGAContext *ctx;
+      :
+      PGASetMutationAndCrossoverFlag(ctx,PGA_FALSE);
+
+****************************************************************************U*/
+void PGASetMutationAndCrossoverFlag( PGAContext *ctx, int flag)
+{
+    PGADebugEntered("PGASetMutationAndCrossoverFlag");
+
+     switch (flag)
+     {
+     case PGA_TRUE:
+     case PGA_FALSE:
+          ctx->ga.MutateOnlyNoCross = !flag;
+          break;
+     default:
+          PGAError (ctx, "PGASetMutationAndCrossoverFlag: Invalid value of "
+                    "flag:", PGA_FATAL, PGA_INT, (void *) &flag);
+          break;
+     }
+
+    PGADebugExited("PGASetMutationAndCrossoverFlag");
+}
+/*U***************************************************************************
+   PGAGetMutationOrCrossoverFlag - Returns true if mutation only occurs when
+   crossover does not.
+
+   Category: Generation
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      Returns PGA_TRUE if mutation only occurs when crossover does not,
+      otherwise, returns PGA_FALSE.
+
+   Example:
+      PGAContext *ctx;
+      int mutatetype;
+      :
+      mutatetype = PGAGetMutationOrCrossoverFlag(ctx);
+      switch (mutatetype) {
+      case PGA_TRUE:
+          printf("Only mutating strings not undergoing crossover\n");
+          break;
+      case PGA_FALSE:
+          printf("Mutating strings only after crossover\n");
+          break;
+      }
+
+***************************************************************************U*/
+int PGAGetMutationOrCrossoverFlag (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetMutationOrCrossoverFlag");
+    PGAFailIfNotSetUp("PGAGetMutationOrCrossoverFlag");
+
+    PGADebugExited("PGAGetMutationOrCrossoverFlag");
+
+    return(ctx->ga.MutateOnlyNoCross);
+}
+
+/*U***************************************************************************
+   PGAGetMutationAndCrossoverFlag - Returns true if mutation occurs only
+   when crossover does.
+
+   Category: Generation
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      Returns PGA_TRUE if mutation is applied to crossed-over strings.
+      Otherwise, returns PGA_FALSE
+
+   Example:
+      PGAContext *ctx;
+      int mutatetype;
+      :
+      mutatetype = PGAGetMutationAndCrossoverFlag(ctx);
+      switch (mutatetype) {
+      case PGA_TRUE:
+          printf("Mutating strings only after crossover\n");
+          break;
+      case PGA_FALSE:
+          printf("Only mutating strings not undergoing crossover\n");
+          break;
+      }
+
+***************************************************************************U*/
+int PGAGetMutationAndCrossoverFlag (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetMutationAndCrossoverFlag");
+    PGAFailIfNotSetUp("PGAGetMutationAndCrossoverFlag");
+
+    PGADebugExited("PGAGetMutationAndCrossoverFlag");
+
+    return(!ctx->ga.MutateOnlyNoCross);
+}
+
Index: trunk/optimizer/src/pgapack/pgapack/source/pop.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/pop.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/pop.c	(revision 816)
@@ -0,0 +1,438 @@
+/*
+ *  
+ *  ********************************************************************* 
+ *  (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+ *  *********************************************************************
+ *  
+ *  This software was authored by
+ *  
+ *  D. Levine
+ *  Mathematics and Computer Science Division Argonne National Laboratory
+ *  Argonne IL 60439
+ *  levine@mcs.anl.gov
+ *  (708) 252-6735
+ *  (708) 252-5986 (FAX)
+ *  
+ *  with programming assistance of participants in Argonne National 
+ *  Laboratory's SERS program.
+ *  
+ *  This program contains material protectable under copyright laws of the 
+ *  United States.  Permission is hereby granted to use it, reproduce it, 
+ *  to translate it into another language, and to redistribute it to 
+ *  others at no charge except a fee for transferring a copy, provided 
+ *  that you conspicuously and appropriately publish on each copy the 
+ *  University of Chicago's copyright notice, and the disclaimer of 
+ *  warranty and Government license included below.  Further, permission 
+ *  is hereby granted, subject to the same provisions, to modify a copy or 
+ *  copies or any portion of it, and to distribute to others at no charge 
+ *  materials containing or derived from the material.
+ *  
+ *  The developers of the software ask that you acknowledge its use in any 
+ *  document referencing work based on the  program, such as published 
+ *  research.  Also, they ask that you supply to Argonne National 
+ *  Laboratory a copy of any published research referencing work based on 
+ *  the software.
+ *  
+ *  Any entity desiring permission for further use must contact:
+ *  
+ *  J. Gleeson
+ *  Industrial Technology Development Center Argonne National Laboratory
+ *  Argonne IL 60439
+ *  gleesonj@smtplink.eid.anl.gov
+ *  (708) 252-6055
+ *  
+ *  ******************************************************************** 
+ *  DISCLAIMER
+ *  
+ *  THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+ *  OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+ *  THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+ *  WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+ *  RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+ *  INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+ *  INFRINGE PRIVATELY OWNED RIGHTS.
+ *  
+ *  ********************************************************************** 
+ *  GOVERNMENT LICENSE
+ *  
+ *  The Government is granted for itself and others acting on its behalf a 
+ *  paid-up, non-exclusive, irrevocable worldwide license in this computer 
+ *  software to reproduce, prepare derivative works, and perform publicly 
+ *  and display publicly.
+ */
+
+/*****************************************************************************
+*     FILE: pop.c: This file contains systme routines that act on entire
+*                  populations.
+*
+*     Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle,
+*              Brian P. Walenz
+*****************************************************************************/
+
+#include "pgapack.h"
+
+/*U****************************************************************************
+   PGASortPop - Creates an (internal) array of indices according to one of
+   three criteria.  If PGA_POPREPL_BEST is used (the default) the array is
+   sorted from most fit to least fit.  If PGA_POPREPL_RANDOM_REP is
+   used the indices in the array are selected randomly with replacement.
+   If PGA_POPREPL_RANDOM_NOREP is used the indices in the array are selected
+   randomly without replacement.  The function PGASetPopReplaceType() is used
+   to specify which strategy is used.  The indices of the sorted population
+   members may then be accessed from the internal array via
+   PGAGetSortedPopIndex().  This routine is typically used during population
+   replacement.
+
+   Category: Generation
+
+   Inputs:
+       ctx      - context variable
+       popindex - symbolic constant of the population from which to create
+                  the srted array.
+
+   Output:
+      An inteneral array of indices sorted according to one of three
+      criteria is created.
+
+   Example:
+      Copy the five best strings from the old population into the new
+      population.  The rest of the new population will be created by
+      recombination, and is not shown.
+
+      PGAContext *ctx;
+      int i,j;
+      :
+      PGASetPopReplaceType(ctx,PGA_POPREPL_BEST)
+      :
+      PGASortPop(ctx, PGA_OLDPOP);
+      for ( i=0; i < 5; i++) {
+          j = PGAGetSortedPopIndex(ctx, i);
+      PGACopyIndividual (ctx, j, PGA_OLDPOP, i, PGA_NEWPOP);
+      :
+
+****************************************************************************U*/
+void PGASortPop ( PGAContext *ctx, int pop )
+{
+    int i,j;
+    PGADebugEntered("PGASortPop");
+    switch (ctx->ga.PopReplace) {
+    case PGA_POPREPL_BEST:
+            switch ( pop ) {
+            case PGA_OLDPOP:
+                for (i = 0 ; i < ctx->ga.PopSize ; i++ ) {
+                    ctx->ga.sorted[i] = i;
+                    ctx->scratch.dblscratch[i] = ctx->ga.oldpop[i].fitness;
+                };
+                break;
+            case PGA_NEWPOP:
+                for (i = 0 ; i < ctx->ga.PopSize ; i++ ) {
+                    ctx->ga.sorted[i] = i;
+                    ctx->scratch.dblscratch[i] = ctx->ga.newpop[i].fitness;
+                };
+                break;
+            default:
+                PGAError( ctx,
+                         "PGASort: Invalid value of pop:",
+                         PGA_FATAL,
+                         PGA_INT,
+                         (void *) &pop );
+                break;
+            };
+            PGADblHeapSort ( ctx, ctx->scratch.dblscratch, ctx->ga.sorted,
+                            ctx->ga.PopSize );
+            break;
+    case PGA_POPREPL_RANDOM_REP:
+        if ((pop != PGA_OLDPOP) && (pop != PGA_NEWPOP))
+            PGAError( ctx,
+                     "PGASort: Invalid value of pop:",
+                      PGA_FATAL,
+                      PGA_INT,
+                      (void *) &pop );
+        for (i = 0; i < ctx->ga.PopSize; i++) {
+            ctx->scratch.intscratch[i] = i;
+        };
+        for (i = 0; i < ctx->ga.PopSize; i++) {
+            j = PGARandomInterval ( ctx, 0, ctx->ga.PopSize-1 );
+            ctx->ga.sorted[i] = ctx->scratch.intscratch[j];
+        };
+        break;
+    case PGA_POPREPL_RANDOM_NOREP:
+        if ((pop != PGA_OLDPOP) && (pop != PGA_NEWPOP))
+            PGAError( ctx,
+                     "PGASort: Invalid value of pop:",
+                      PGA_FATAL,
+                      PGA_INT,
+                      (void *) &pop );
+        for (i = 0; i < ctx->ga.PopSize; i++) {
+            ctx->scratch.intscratch[i] = i;
+        };
+        for (i = 0; i < ctx->ga.PopSize; i++) {
+            j = PGARandomInterval ( ctx, 0, ctx->ga.PopSize-i-1 );
+            ctx->ga.sorted[i] = ctx->scratch.intscratch[j];
+            ctx->scratch.intscratch[j] =
+                ctx->scratch.intscratch[ctx->ga.PopSize-i-1];
+        };
+        break;
+    }
+    PGADebugExited("PGASortPop");
+}
+
+
+/*U***************************************************************************
+   PGAGetPopSize - Returns the population size
+
+   Category: Generation
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      The population size
+
+   Example:
+      PGAContext *ctx;
+      int popsize;
+      :
+      popsize = PGAGetPopSize(ctx);
+
+***************************************************************************U*/
+int PGAGetPopSize (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetPopSize");
+    PGAFailIfNotSetUp("PGAGetPopSize");
+
+    PGADebugExited("PGAGetPopSize");
+
+    return(ctx->ga.PopSize);
+}
+
+/*U***************************************************************************
+   PGAGetNumReplaceValue - Returns the maximum number of strings to replace
+   each generation.
+
+   Category: Generation
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      The maximum number number of strings to replace each generation
+
+   Example:
+      PGAContext *ctx;
+      int numreplace;
+      :
+      numreplace = PGAGetNumReplaceValue(ctx);
+
+***************************************************************************U*/
+int PGAGetNumReplaceValue (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetNumReplaceValue");
+    PGAFailIfNotSetUp("PGAGetNumReplaceValue");
+
+    PGADebugExited("PGAGetNumReplaceValue");
+
+    return(ctx->ga.NumReplace);
+}
+
+/*U***************************************************************************
+   PGAGetPopReplaceType - returns the symbolic constant used to determine
+   which strings to copy from the old population to the new population.
+
+   Category: Generation
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      The symbolic constant of the replacement strategy.
+
+   Example:
+      PGAContext *ctx;
+      int popreplace;
+      :
+      popreplace = PGAGetPopReplaceType(ctx);
+      switch (popreplace) {
+      case PGA_POPREPL_BEST:
+          printf("Replacement Strategy = PGA_POPREPL_BEST\n");
+          break;
+      case PGA_POPREPL_RANDOM_REP:
+          printf("Replacement Strategy = PGA_POPREPL_RANDOM_REP\n");
+          break;
+      case PGA_POPREPL_RANDOM_NOREP:
+          printf("Replacement Strategy = PGA_POPREPL_RANDOM_NOREP\n");
+          break;
+      }
+
+****************************************************************************U*/
+int PGAGetPopReplaceType (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetPopReplaceType");
+    PGAFailIfNotSetUp("PGAGetPopRelaceType");
+
+    PGADebugExited("PGAGetPopReplaceType");
+
+    return(ctx->ga.PopReplace);
+}
+
+
+/*U****************************************************************************
+   PGAGetSortedPopIndex - returns a population string index from the array
+   created by PGASortPop().
+
+   Category: Generation
+
+   Inputs:
+       ctx      - context variable
+       n        - specified which index element is to be returned.
+
+   Output:
+       A population string index from the array created by PGASortPop
+
+   Example:
+      Copy the five best strings from the old population into the new
+      population.  The rest of the new population will be created by
+      recombination, and is not shown.
+
+      PGAContext *ctx;
+      int i,j;
+      :
+      PGASetPopReplaceType(ctx,PGA_POPREPL_BEST)
+      PGASortPop(ctx, PGA_OLDPOP);
+      for ( i=0; i < 5; i++) {
+          j = PGAGetSortedPopIndex(ctx, i);
+      PGACopyIndividual (ctx, j, PGA_OLDPOP, i, PGA_NEWPOP);
+      :
+
+****************************************************************************U*/
+int PGAGetSortedPopIndex ( PGAContext *ctx, int n )
+{
+     int temp;
+
+    PGADebugEntered("PGAGetSortedPopIndex");
+     if (n >= 0 && n < ctx->ga.PopSize )
+          temp = ctx->ga.sorted[n];
+     else
+          PGAError( ctx, "PGAGetSorted: Invalid value of n:",
+                   PGA_FATAL, PGA_INT, (void *) &n );
+
+    PGADebugExited("PGAGetSortedPopIndex");
+
+     return (temp);
+}
+
+/*U****************************************************************************
+   PGASetPopSize - Specifies the size of the genetic algorithm population.
+   The default population size is 100.
+
+   Category: Generation
+
+   Inputs:
+      ctx     - context variable
+      popsize - the genetic algorithm population size to use
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx;
+      :
+      PGASetPopSize(ctx, 200);
+
+****************************************************************************U*/
+void PGASetPopSize (PGAContext *ctx, int popsize)
+{
+
+    PGADebugEntered("PGASetPopSize");
+    PGAFailIfSetUp("PGASetPopSize");
+
+    if (popsize < 1 || popsize % 2)
+        PGAError( ctx, "PGASetPopSize: Invalid value of popsize:",
+                  PGA_FATAL, PGA_INT, (void *) &popsize );
+    else
+        ctx->ga.PopSize = popsize;
+
+    PGADebugExited("PGASetPopSize");
+}
+
+
+
+/*U****************************************************************************
+   PGASetNumReplaceValue - specifies the number of new strings to create each
+   generation.  The default is ten percent of the population size
+
+   Category: Generation
+
+   Inputs:
+      ctx         - context variable
+      pop_replace - the genetic algorithm population size to use
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx;
+      :
+      PGASetNumReplaceValue(ctx, 35);
+
+****************************************************************************U*/
+void PGASetNumReplaceValue( PGAContext *ctx, int pop_replace)
+{
+    PGADebugEntered("PGASetNumReplaceValue");
+
+    if (pop_replace < 0)
+      PGAError( ctx,
+               "PGASetNumReplaceValue: Invalid value of pop_replace:",
+                PGA_FATAL, PGA_INT, (void *) &pop_replace );
+    else
+        ctx->ga.NumReplace = pop_replace;
+
+    PGADebugExited("PGASetNumReplaceValue");
+}
+
+
+
+
+/*U****************************************************************************
+   PGASetPopReplaceType - Choose method of sorting strings to copy from old
+   population to new population.  Valid choices are PGA_POPREPL_BEST,
+   PGA_POPREPL_RANDOM_NOREP, or PGA_POPREPL_RANDOM_REP for copying the best
+   strings, or  random string, with or without replacement, respectively,
+   from the old population into the new population. The default is
+   PGA_POPREPL_BEST.
+
+   Category: Generation
+
+   Inputs:
+      ctx         - context variable
+      pop_replace - symbolic constant to specify the population replacement
+                    strategy
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx;
+      :
+      PGASetPopReplaceType(ctx, PGA_POPREPL_RANDOM_NOREP);
+
+****************************************************************************U*/
+void PGASetPopReplaceType( PGAContext *ctx, int pop_replace)
+{
+    PGADebugEntered("PGASetPopReplaceType");
+
+    switch (pop_replace) {
+    case PGA_POPREPL_BEST:
+    case PGA_POPREPL_RANDOM_NOREP:
+    case PGA_POPREPL_RANDOM_REP:
+        ctx->ga.PopReplace = pop_replace;
+        break;
+    default:
+        PGAError ( ctx,
+                  "PGASetPopReplaceType: Invalid value of pop_replace:",
+                   PGA_FATAL, PGA_INT, (void *) &pop_replace);
+        break;
+    }
+
+    PGADebugExited("PGASetPopReplaceType");
+}
Index: trunk/optimizer/src/pgapack/pgapack/source/random.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/random.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/random.c	(revision 816)
@@ -0,0 +1,404 @@
+/*
+ *  
+ *  ********************************************************************* 
+ *  (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+ *  *********************************************************************
+ *  
+ *  This software was authored by
+ *  
+ *  D. Levine
+ *  Mathematics and Computer Science Division Argonne National Laboratory
+ *  Argonne IL 60439
+ *  levine@mcs.anl.gov
+ *  (708) 252-6735
+ *  (708) 252-5986 (FAX)
+ *  
+ *  with programming assistance of participants in Argonne National 
+ *  Laboratory's SERS program.
+ *  
+ *  This program contains material protectable under copyright laws of the 
+ *  United States.  Permission is hereby granted to use it, reproduce it, 
+ *  to translate it into another language, and to redistribute it to 
+ *  others at no charge except a fee for transferring a copy, provided 
+ *  that you conspicuously and appropriately publish on each copy the 
+ *  University of Chicago's copyright notice, and the disclaimer of 
+ *  warranty and Government license included below.  Further, permission 
+ *  is hereby granted, subject to the same provisions, to modify a copy or 
+ *  copies or any portion of it, and to distribute to others at no charge 
+ *  materials containing or derived from the material.
+ *  
+ *  The developers of the software ask that you acknowledge its use in any 
+ *  document referencing work based on the  program, such as published 
+ *  research.  Also, they ask that you supply to Argonne National 
+ *  Laboratory a copy of any published research referencing work based on 
+ *  the software.
+ *  
+ *  Any entity desiring permission for further use must contact:
+ *  
+ *  J. Gleeson
+ *  Industrial Technology Development Center Argonne National Laboratory
+ *  Argonne IL 60439
+ *  gleesonj@smtplink.eid.anl.gov
+ *  (708) 252-6055
+ *  
+ *  ******************************************************************** 
+ *  DISCLAIMER
+ *  
+ *  THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+ *  OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+ *  THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+ *  WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+ *  RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+ *  INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+ *  INFRINGE PRIVATELY OWNED RIGHTS.
+ *  
+ *  ********************************************************************** 
+ *  GOVERNMENT LICENSE
+ *  
+ *  The Government is granted for itself and others acting on its behalf a 
+ *  paid-up, non-exclusive, irrevocable worldwide license in this computer 
+ *  software to reproduce, prepare derivative works, and perform publicly 
+ *  and display publicly.
+ */
+
+/*****************************************************************************
+*     FILE: random.c: This file contains routines to generate randomness.
+*
+*     Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle,
+*              Brian P. Walenz
+*****************************************************************************/
+
+#include "pgapack.h"
+
+/*U****************************************************************************
+   PGARandomFlip - flip a biased coin and return PGA_TRUE if the coin is
+   a "winner."  Otherwise, return PGA_FALSE.
+
+   Category: Utility
+
+   Inputs:
+      ctx - context variable
+      p   - biased probability (.5 is a fair coin)
+
+   Outputs:
+      PGA_TRUE or PGA_FALSE
+
+   Example:
+      To return PGA_TRUE approximately seventy percent of the time, use
+
+      PGAContext *ctx;
+      int p;
+      :
+      PGARandomFlip(ctx, 0.7)
+
+****************************************************************************U*/
+int PGARandomFlip ( PGAContext *ctx, double p )
+{
+    PGADebugEntered("PGARandomFlip");
+
+    PGADebugExited("PGARandomFlip");
+
+    return( (PGARandom01(ctx, 0) < p) ? PGA_TRUE : PGA_FALSE);
+}
+
+
+/*U****************************************************************************
+   PGARandomInterval - returns a uniform random number on the specified
+   interval
+
+   Category: Utility
+
+   Inputs:
+      ctx - context variable
+      start - starting (integer) value of the interval
+      end   - ending   (integer) value of the interval
+
+   Outputs:
+      A uniformly distributed random number in the interval [start, end].
+
+   Example:
+      Generate a value uniformly random from the interval [0,99]
+
+      PGAContext *ctx;
+      :
+      PGARandomInterval(ctx, 0, 99);
+
+****************************************************************************U*/
+int PGARandomInterval( PGAContext *ctx, int start, int end)
+{
+    PGADebugEntered("PGARandomInterval");
+    
+    PGADebugExited("PGARandomInterval");
+
+    return( (int)floor(PGARandom01(ctx, 0) * (double)(end-start+1) ) + start );
+    
+/*
+   The original call...
+
+   return(ceil( (double)(end-start+1) * PGARandom01(ctx, 0) )+start-1);
+*/
+}
+
+
+/*****************************************************************************
+*  This is a C language implementation of the universal random number        *
+*  generator proposed by G. Marsaglia and A. Zaman and translated from       *
+*  F. James' version.                                                        *
+*                                                                            *
+*  F. James                                                                  *
+*  A review of pseudorandom number generators                                *
+*  Computer Physics Communication                                            *
+*  60 (1990) 329-344                                                         *
+*                                                                            *
+*  G. Marsaglia, A. Zaman, W. Tseng                                          *
+*  Stat Prob. Letter                                                         *
+*  9 (1990) 35.                                                              *
+*                                                                            *
+*  G. Marsaglia, A. Zaman                                                    *
+*  FSU-SCRI-87-50                                                            *
+*                                                                            *
+*  This algorithm is a combination of a lagged Fibonacci and arithmetic      *
+*  sequence (F. James) generator with period of 2^144.  It provides 32-bit   *
+*  floating point numbers in the range from zero to one.  It is claimed to   *
+*  be portable and provides bit-identical results on all machines with at    *
+*  least 24-bit mantissas.                                                   *
+*                                                                            *
+*  PGARandom01 should be initialized with a 32-bit integer seed such that    *
+*  0 <= seed <= 900,000,000.  Each of these 900,000,000 values gives rise    *
+*  to an independent sequence of ~ 10^30.                                    *
+*                                                                            *
+*  warning on use of static storage class on thread shared memory machines   *
+*****************************************************************************/
+/*U****************************************************************************
+   PGARandom01 - generates a uniform random number on the interval [0,1)
+   If the second argument is 0 it returns the next random number in the
+   sequence.  Otherwise, the second argument is used as a new seed for the
+   population
+
+   Category: Utility
+
+   Inputs:
+      ctx     - context variable
+      newseed - either 0 to get the next random number, or nonzero
+                to reseed
+   Outputs:
+      A random number on the interval [0,1)
+
+   Example:
+      To get the next random number use
+
+      PGAContext *ctx;
+      double r;
+      :
+      r = PGARandom01(ctx,0);
+
+****************************************************************************U*/
+double PGARandom01( PGAContext *ctx, int newseed )
+{
+
+    /* initialization variables */
+    int ij, kl, i, j, k, l, m, ii, jj;
+    float s, t;
+
+    /* random number variables */
+    static int seed=1;      /* default seed if none specified */
+    static int i96, j96;
+    static float u[97], uni, c, cd, cm;
+
+
+    PGADebugEntered("PGARandom01");
+
+    /* initialization */
+/*     printf("i96 = %d\tj96 = %d\n", i96, j96); */
+
+    if ( newseed != 0 ) {
+
+        seed = newseed % 900000000;
+        ij   = seed / 30082;
+        kl   = seed - 30082 * ij;
+        i    = ( (ij/177) % 177 ) + 2;
+        j    = (  ij      % 177 ) + 2;
+        k    = ( (kl/169) % 178 ) + 1;
+        l    = (  kl      % 169 );
+
+        for ( ii=0; ii<97; ii++ ) {
+
+            s = 0.0;
+            t = 0.5;
+
+            for ( jj=0; jj<24; jj++ ) {
+
+                m = ( ((i*j) % 179) * k ) % 179;
+                i = j;
+                j = k;
+                k = m;
+                l = ( (53*l) + 1 ) % 169;
+                if ( ( (l*m) % 64 ) >= 32 )
+                    s += t;
+                t *= .5;
+            }
+
+            u[ii] = s;
+        }
+
+        c   = 362436.  /16777216.;
+        cd  = 7654321. /16777216.;
+        cm  = 16777213./16777216.;
+        i96 = 96;
+        j96 = 32;
+    }
+
+    /* random number generation */
+    uni = u[i96] - u[j96];
+    if ( uni < 0. ) uni += 1.0;
+    u[i96] = uni;
+    i96--;
+    if ( i96 < 0  ) i96 = 96;
+    j96--;
+    if ( j96 < 0  ) j96 = 96;
+    c   -= cd;
+    if ( c   < 0. ) c += cm;
+    uni -= c;
+    if ( uni < 0. ) uni += 1.0;
+
+    PGADebugExited("PGARandom01");
+    return( (double) uni);
+}
+
+/*U****************************************************************************
+   PGARandomUniform - returns a uniform random number on the interval
+   [start,end]
+
+   Category: Utility
+
+   Inputs:
+      ctx - context variable
+      start - starting (double) value of the interval
+      end   - ending   (double) value of the interval
+
+   Outputs:
+      A random number on the interval [start,end]
+
+   Example:
+      Generate a uniform random number on the interval [-0.5, 1.5]
+
+      PGAContext *ctx;
+      double r;
+      :
+      r = PGARandomUniform(ctx, -0.5, 1.5);
+
+****************************************************************************U*/
+double PGARandomUniform( PGAContext *ctx, double start, double end)
+{
+    double val, r;
+
+    PGADebugEntered("PGARandomUniform");
+
+    r = PGARandom01(ctx, 0);
+    val = (end-start) * r + start;
+
+    PGADebugExited("PGARandomUniform");
+
+    return(val);
+}
+
+
+/*U****************************************************************************
+   PGARandomGaussian - returns an approximation to a Gaussian random number
+
+   Category: Utility
+
+   Inputs:
+       mean  - the mean of the Gaussian distribution
+       sigma - the standard deviation of the Gaussian distribution
+
+   Outputs:
+      A random number selected from a Gaussian distribution with given
+      mean and standard deviation
+
+   Example:
+      To generate a Gaussian random number with mean 0.0 and standard
+      deviation 1.0 use
+
+      PGAContext *ctx;
+      :
+      r = PGARandomGaussian(ctx, 0.0, 1.0);
+
+****************************************************************************U*/
+double PGARandomGaussian( PGAContext *ctx, double mean, double sigma)
+{
+    int i;
+    double sum = 0.;
+
+    PGADebugEntered("PGARandomGaussian");
+
+    for (i=11;i>=0; i--)
+        sum += PGARandom01(ctx, 0);
+
+    PGADebugExited("PGARandomGaussian");
+
+    return ( (sum-6.0) * sigma + mean );
+}
+
+/*U***************************************************************************
+   PGAGetRandomSeed - returns the integer to seed random numbers with
+
+   Category: Utility
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      The seed for the random number generator
+
+   Example:
+      PGAContext *ctx;
+      int seed;
+      :
+      seed = PGAGetRandomSeed(ctx);
+
+***************************************************************************U*/
+int PGAGetRandomSeed(PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetRandomSeed");
+
+    PGADebugExited("PGAGetRandomSeed");
+
+    return(ctx->init.RandomSeed);
+}
+
+/*U****************************************************************************
+   PGASetRandomSeed - set a seed for the random number generator.  The
+   default is to use a random seed.  Specifying a seed exlicitly allows
+   for reproducibility of runs.
+
+   Category: Utility
+
+   Inputs:
+      ctx  - context variable
+      seed - seed  for the random number generator
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx;
+      :
+      PGASetRandomSeed(ctx,1);
+
+****************************************************************************U*/
+void PGASetRandomSeed(PGAContext *ctx, int seed)
+{
+#define MAX_PROCESSORS 2048
+
+    PGADebugEntered("PGASetRandomSeed");
+    PGAFailIfSetUp("PGASetRandomSeed");
+
+    if ((seed < 1) || (seed + MAX_PROCESSORS > 900000000))
+	PGAError ( ctx, "PGASetRandomSeed: Invalid value of seed:",
+		  PGA_FATAL, PGA_INT, (void *) &seed);
+    else
+	ctx->init.RandomSeed = seed;
+    
+    PGADebugExited("PGASetRandomSeed");
+}
Index: trunk/optimizer/src/pgapack/pgapack/source/real.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/real.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/real.c	(revision 816)
@@ -0,0 +1,944 @@
+/*
+ *  
+ *  ********************************************************************* 
+ *  (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+ *  *********************************************************************
+ *  
+ *  This software was authored by
+ *  
+ *  D. Levine
+ *  Mathematics and Computer Science Division Argonne National Laboratory
+ *  Argonne IL 60439
+ *  levine@mcs.anl.gov
+ *  (708) 252-6735
+ *  (708) 252-5986 (FAX)
+ *  
+ *  with programming assistance of participants in Argonne National 
+ *  Laboratory's SERS program.
+ *  
+ *  This program contains material protectable under copyright laws of the 
+ *  United States.  Permission is hereby granted to use it, reproduce it, 
+ *  to translate it into another language, and to redistribute it to 
+ *  others at no charge except a fee for transferring a copy, provided 
+ *  that you conspicuously and appropriately publish on each copy the 
+ *  University of Chicago's copyright notice, and the disclaimer of 
+ *  warranty and Government license included below.  Further, permission 
+ *  is hereby granted, subject to the same provisions, to modify a copy or 
+ *  copies or any portion of it, and to distribute to others at no charge 
+ *  materials containing or derived from the material.
+ *  
+ *  The developers of the software ask that you acknowledge its use in any 
+ *  document referencing work based on the  program, such as published 
+ *  research.  Also, they ask that you supply to Argonne National 
+ *  Laboratory a copy of any published research referencing work based on 
+ *  the software.
+ *  
+ *  Any entity desiring permission for further use must contact:
+ *  
+ *  J. Gleeson
+ *  Industrial Technology Development Center Argonne National Laboratory
+ *  Argonne IL 60439
+ *  gleesonj@smtplink.eid.anl.gov
+ *  (708) 252-6055
+ *  
+ *  ******************************************************************** 
+ *  DISCLAIMER
+ *  
+ *  THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+ *  OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+ *  THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+ *  WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+ *  RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+ *  INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+ *  INFRINGE PRIVATELY OWNED RIGHTS.
+ *  
+ *  ********************************************************************** 
+ *  GOVERNMENT LICENSE
+ *  
+ *  The Government is granted for itself and others acting on its behalf a 
+ *  paid-up, non-exclusive, irrevocable worldwide license in this computer 
+ *  software to reproduce, prepare derivative works, and perform publicly 
+ *  and display publicly.
+ */
+
+/*****************************************************************************
+*     FILE: real.c: This file contains the routines specific to the floating
+*                   point data structure
+*
+*     Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle,
+*              Brian P. Walenz
+*****************************************************************************/
+
+#include <pgapack.h>
+
+/*U****************************************************************************
+   PGASetRealAllele - sets the value of real-valued allele i in string p
+   in population pop
+
+   Category: Fitness & Evaluation
+
+   Inputs:
+      ctx - context variable
+      p   - string index
+      pop - symbolic constant of the population the string is in
+      i   - allele index
+      val - real value to set the allele to
+
+   Outputs:
+      The specified allele in p is modified by side-effect.
+
+   Example:
+      Sets the value of the ith allele of string p in population PGA_NEWPOP
+      to 1.57
+
+      PGAContext *ctx;
+      int i, p;
+      :
+      PGASetRealAllele ( ctx, p, PGA_NEWPOP, i, 1.57)
+
+****************************************************************************U*/
+void PGASetRealAllele (PGAContext *ctx, int p, int pop, int i, double value)
+{
+    PGAIndividual *ind;
+    PGAReal      *chrom;
+
+    PGADebugEntered("PGASetRealAllele");
+    PGACheckDataType("PGASetRealAllele", PGA_DATATYPE_REAL);
+
+    ind = PGAGetIndividual ( ctx, p, pop );
+    chrom = (PGAReal *)ind->chrom;
+    chrom[i] = value;
+
+    PGADebugExited("PGASetRealAllele");
+}
+
+/*U****************************************************************************
+   PGAGetRealAllele - returns the value of real-valued allele i in string p
+   in population pop
+
+   Category: Fitness & Evaluation
+
+   Inputs:
+      ctx - context variable
+      p   - string index
+      pop - symbolic constant of the population the string is in
+      i   - allele index
+
+   Outputs:
+      The value of allele i
+
+   Example:
+      Returns the value of the ith real-valued allele of string p
+      in population PGA_NEWPOP
+
+      PGAContext *ctx;
+      int p, i, r;
+      r =  PGAGetRealAllele (ctx, p, PGA_NEWPOP, i)
+
+****************************************************************************U*/
+double PGAGetRealAllele (PGAContext *ctx, int p, int pop, int i)
+{
+    PGAIndividual *ind;
+    PGAReal      *chrom;
+
+    PGADebugEntered("PGAGetRealAllele");
+    PGACheckDataType("PGAGetRealAllele", PGA_DATATYPE_REAL);
+
+    ind = PGAGetIndividual ( ctx, p, pop );
+    chrom = (PGAReal *)ind->chrom;
+
+    PGADebugExited("PGAGetRealAllele");
+
+    return( (double) chrom[i] );
+}
+
+/*U****************************************************************************
+  PGASetRealInitPercent - sets the upper and lower bounds for randomly
+  initializing real-valued genes.  For each gene these bounds define an
+  interval from which the initial allele value is selected uniformly randomly.
+  With this routine the user specifies a median value and a percent offset
+  for each allele.
+
+  Category: Initialization
+
+  Inputs:
+     ctx     - context variable
+     median  - an array containing the mean value of the interval
+     percent - an array containing the percent offset to add and subtract to
+               the median to define the interval
+
+  Outputs:
+
+  Example:
+     Set the initialization routines to select a value for each real-valued
+     gene i uniformly randomly from the interval [i-v,i+v], where $v = i/2$.
+     Assumes all strings are the same length.
+
+     PGAContext *ctx;
+     double *median, *percent;
+     int i, stringlen;
+     :
+     stringlen = PGAGetStringLength(ctx);
+     median  = (double *) malloc(stringlen*sizeof(double));
+     percent = (double *) malloc(stringlen*sizeof(double));
+     for(i=0;i<stringlen;i++) {
+        median[i]  = (double) i;
+        percent[i] = 0.5;
+     }
+     PGASetRealInitPercent(ctx, median, percent);
+
+****************************************************************************U*/
+void PGASetRealInitPercent ( PGAContext *ctx, double *median, double *percent)
+{
+     int i;
+     int stringlen;
+     double offset;
+
+    PGADebugEntered("PGASetRealInitPercent");
+    PGAFailIfSetUp("PGASetRealInitPercent");
+    PGACheckDataType("PGASetRealInitPercent", PGA_DATATYPE_REAL);
+
+    stringlen = PGAGetStringLength(ctx);
+    for (i=0; i<stringlen; i++) {
+    }
+    for (i=0; i<stringlen; i++) {
+         offset = fabs(median[i] * percent[i]);
+         ctx->init.RealMin[i] = median[i] - offset;
+         ctx->init.RealMax[i] = median[i] + offset;
+         
+    }
+    ctx->init.RealType = PGA_RINIT_PERCENT;
+
+    PGADebugExited("PGASetRealInitPercent");
+}
+
+/*U****************************************************************************
+  PGASetRealInitRange - sets the upper and lower bounds for randomly
+  initializing real-valued genes.  For each gene these bounds define an
+  interval from which the initial allele value is selected uniformly randomly.
+  The user specifies two arrays containing lower and bound for each gene to
+  define the interval.  This is the default strategy for initializing
+  real-valued strings.  The default interval is $[0,1.0]$ for each gene.
+
+  Category: Initialization
+
+  Inputs:
+     ctx - context variable
+     min - array containing the lower bound of the interval for each gene
+     mac - array containing the upper bound of the interval for each gene
+
+  Outputs:
+
+  Example:
+     Set the initialization routines to select a value for each real-valued
+     gene i uniformly randomly from the interval [-10.,i]
+     Assumes all strings are of the same length.
+
+     PGAContext *ctx;
+     double *low, *high;
+     int i, stringlen;
+     :
+     stringlen = PGAGetStringLength(ctx);
+     low  = (double *) malloc(stringlen*sizeof(double));
+     high = (double *) malloc(stringlen*sizeof(double));
+     for(i=0;i<stringlen;i++) {
+        low[i]  = -10.0;
+        high[i] = i;
+     }
+     PGASetRealInitRange(ctx, low, high);
+
+****************************************************************************U*/
+void PGASetRealInitRange (PGAContext *ctx, double *min, double *max)
+{
+     int i;
+    PGADebugEntered("PGASetRealInitRange");
+    PGAFailIfSetUp("PGASetRealInitRange");
+    PGACheckDataType("PGASetRealInitRange", PGA_DATATYPE_REAL);
+
+    for (i=ctx->ga.StringLen-1; i>=0; i--) {
+         if (max[i] < min[i])
+              PGAError(ctx, "PGASetRealInitRange: Lower bound exceeds upper "
+                       "bound for allele #", PGA_FATAL, PGA_INT, (void *) &i);
+         else
+         {
+              ctx->init.RealMin[i] = min[i];
+              ctx->init.RealMax[i] = max[i];
+         }
+    }
+    ctx->init.RealType = PGA_RINIT_RANGE;
+
+    PGADebugExited("PGASetRealInitRange");
+}
+
+
+/*U***************************************************************************
+  PGAGetMinRealInitValue - returns the minimum value used to randomly
+  initialize allele i in a real string
+
+   Category: Initialization
+
+   Inputs:
+      ctx - context variable
+      i   - an allele position
+
+   Outputs:
+      The minimum value used to randomly initialize allele i
+
+   Example:
+      PGAContext *ctx;
+      int min;
+      :
+      min = PGAGetMinRealInitValue(ctx, 0);
+
+***************************************************************************U*/
+double PGAGetMinRealInitValue (PGAContext *ctx, int i)
+{
+    PGADebugEntered("PGAGetMinRealInitValue");
+    PGAFailIfNotSetUp("PGAGetMinRealInitValue");
+    PGACheckDataType("PGAGetMinRealInitValue", PGA_DATATYPE_REAL);
+
+    if (i < 0 || i >= ctx->ga.StringLen)
+         PGAError(ctx, "PGAGetMinRealInitValue: Index out of range:",
+                  PGA_FATAL, PGA_INT, (int *) &i);
+
+    PGADebugExited("PGAGetMinRealInitValue");
+
+    return(ctx->init.RealMin[i]);
+}
+
+/*U***************************************************************************
+  PGAGetMaxRealInitValue - returns the maximum value used to randomly
+  initialize allele i in a real string
+
+   Category: Initialization
+
+   Inputs:
+      ctx - context variable
+      i   - an allele position
+
+   Outputs:
+      The maximum value used to randomly initialize allele i
+
+   Example:
+      PGAContext *ctx;
+      int max;
+      :
+      max = PGAGetMaxRealInitValue(ctx, 0);
+
+***************************************************************************U*/
+double PGAGetMaxRealInitValue (PGAContext *ctx, int i)
+{
+    PGADebugEntered("PGAGetMaxRealInitValue");
+    PGAFailIfNotSetUp("PGAGetMaxRealInitValue");
+    PGACheckDataType("PGAGetMaxRealInitValue", PGA_DATATYPE_REAL);
+
+    if (i < 0 || i >= ctx->ga.StringLen)
+         PGAError(ctx, "PGAGetMaxRealInitValue: Index out of range:",
+                  PGA_FATAL, PGA_INT, (int *) &i);
+
+    PGADebugExited("PGAGetMaxRealInitValue");
+
+    return(ctx->init.RealMax[i]);
+}
+
+
+/*U***************************************************************************
+  PGAGetRealInitType - returns the type of scheme used to randomly
+  initialize strings of data type PGA_DATATYPE_REAL.
+
+   Category: Initialization
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      Returns the integer corresponding to the symbolic constant
+      used to specify the scheme used to initialize real strings
+
+   Example:
+      PGAContext *ctx;
+      int inittype;
+      :
+      inittype = PGAGetRealInitType(ctx);
+      switch (inittype) {
+      case PGA_RINIT_PERCENT:
+          printf("Data Type = PGA_RINIT_PERCENT\n");
+          break;
+      case PGA_RINIT_RANGE:
+          printf("Data Type = PGA_RINIT_RANGE\n");
+          break;
+      }
+
+***************************************************************************U*/
+int PGAGetRealInitType (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetRealInitType");
+    PGAFailIfNotSetUp("PGAGetRealInitType");
+    PGACheckDataType("PGAGetRealInitType", PGA_DATATYPE_REAL);
+
+    PGADebugExited("PGAGetRealInitType");
+
+    return(ctx->init.RealType);
+}
+
+
+/*I****************************************************************************
+   PGARealCreateString - Allocate memory for a string of type PGAReal
+
+   Inputs:
+      ctx      - context variable
+      p        - string index
+      pop      - symbolic constant of the population string p is in
+      initflag - A true/false flag used in conjunction with ctx->ga.RandomInit
+                 to initialize the string either randomly or set to zero
+
+   Outputs:
+
+   Example:
+      Allocates memory and assigns the address of the allocated memory to
+      the real string field (ind->chrom) of the individual.  Also, clears
+      the string.
+
+      PGAContext *ctx;
+      int p;
+      :
+      PGARealCreateString( ctx, p, PGA_NEWPOP, PGA_FALSE );
+
+****************************************************************************I*/
+void PGARealCreateString (PGAContext *ctx, int p, int pop, int initflag)
+{
+    PGAIndividual *new = PGAGetIndividual(ctx, p, pop);
+    int i, fp;
+    PGAReal *c;
+    
+    PGADebugEntered("PGARealCreateString");
+    
+    new->chrom = (void *) malloc (ctx->ga.StringLen * sizeof(PGAReal));
+    if (new->chrom == NULL)
+	PGAError(ctx, "PGARealCreateString: No room to allocate new->chrom",
+		 PGA_FATAL, PGA_VOID, NULL);
+    c = (PGAReal *)new->chrom;
+    if (initflag)
+	if (ctx->fops.InitString) {
+	    fp = ((p == PGA_TEMP1) || (p == PGA_TEMP2)) ? p : p+1;
+	    (*ctx->fops.InitString)(&ctx, &fp, &pop);
+	} else {
+	    (*ctx->cops.InitString)(ctx, p, pop);
+	}
+    else
+	for (i=ctx->ga.StringLen-1; i>=0; i--)
+	    c[i] = 0.0;
+    
+    PGADebugExited("PGARealCreateString");
+}
+
+/*I****************************************************************************
+   PGARealMutation - randomly mutates a floating point string with probability
+   mr.  Three of the four mutation operators are of the form v = v +- p*v.
+   That is, the new value of v (allele i) is the old value + or - a percentage,
+   p, of the old value. There are three possibilities for choosing p: (1)
+   constant value (0.01 by default), (2) selected uniformly on (0,UB) (UB is
+   .1 by default), and (3) selected from a Gaussian distribution (with mean 0
+   and standard deviation .1 be default).  The change to an allele, p*v, is
+   added or subtracted to the old value with a probability of .5. The fourth
+   option is to replace v with a value selected uniformly random from the
+   initialization range of that gene. Alleles to mutate are randomly selected.
+   The value set by the routine PGASetMutationRealValue is used as p, UB, and
+   sigma in cases 1,2, and 3, respectively.
+
+   Inputs:
+      ctx - context variable
+      p        - string index
+      pop      - symbolic constant of the population string p is in
+      mr  - probability of mutating a real-valued gene
+
+   Outputs: The number of mutations performed.
+
+   Example:
+      Sets the value of the ith gene of string p
+      in population PGA_NEWPOP to one
+
+      PGAContext *ctx;
+      int NumMutations, p;
+      :
+      NumMutations = PGARealMutation( ctx, p, PGA_NEWPOP, .001 );
+
+****************************************************************************I*/
+int PGARealMutation( PGAContext *ctx, int p, int pop, double mr )
+{
+     PGAReal *c;
+     int i;
+     int count = 0;
+     double val;
+
+     PGADebugEntered("PGARealMutation");
+
+     c = (PGAReal *)PGAGetIndividual(ctx, p, pop)->chrom;
+     for(i=0; i<ctx->ga.StringLen; i++) {
+
+         /* randomly choose an allele   */
+         if ( PGARandomFlip(ctx, mr) ) {
+
+             /* generate on range, or calculate multplier */
+             switch (ctx->ga.MutationType) {
+             case PGA_MUTATION_RANGE:
+                 c[i] = PGARandomUniform(ctx, ctx->init.RealMin[i],
+                                              ctx->init.RealMax[i]);
+                 break;
+             case PGA_MUTATION_CONSTANT:
+                 val = ctx->ga.MutateRealValue;
+                 break;
+             case PGA_MUTATION_UNIFORM:
+                 val = PGARandomUniform (ctx, 0.0, ctx->ga.MutateRealValue);
+                 break;
+             case PGA_MUTATION_GAUSSIAN:
+                 val = PGARandomGaussian(ctx, 0.0, ctx->ga.MutateRealValue);
+                 break;
+             default:
+                  PGAError(ctx, "PGARealMutation: Invalid value of "
+                           "ga.MutationType:", PGA_FATAL, PGA_INT,
+                           (void *) &(ctx->ga.MutationType));
+                  break;
+             }
+
+             /* apply multiplier calculated in switch above */
+             if ( (ctx->ga.MutationType == PGA_MUTATION_CONSTANT) ||
+                  (ctx->ga.MutationType == PGA_MUTATION_UNIFORM)  ||
+                  (ctx->ga.MutationType == PGA_MUTATION_GAUSSIAN)
+                ) {
+                 /* add/subtract from allele */
+                 if ( PGARandomFlip(ctx, .5) )
+                     c[i] += val*c[i];
+                 else
+                     c[i] -= val*c[i];
+             }
+
+             /* reset to min/max if bounded flag true and outside range */
+             if( ctx->ga.MutateBoundedFlag == PGA_TRUE ) {
+                if( c[i] < ctx->init.RealMin[i])
+                    c[i] = ctx->init.RealMin[i];
+                if( c[i] > ctx->init.RealMax[i])
+                    c[i] = ctx->init.RealMax[i];
+             }
+
+             /* increment mutation count */
+             count++;
+         }
+     }
+
+     PGADebugExited("PGARealMutation");
+
+     return(count);
+}
+
+/*I****************************************************************************
+   PGARealOneptCrossover - this routine performs one point crossover on two
+   parent strings, producing (via side effect) the crossed children child1 and
+   child2
+
+   Inputs:
+      ctx  - context variable
+      p1   - the first parent string
+      p2   - the second parent string
+      pop1 - symbolic constant of the population containing string p1 and p2
+      c1   - the first child string
+      c2   - the second child string
+      pop2 - symbolic constant of the population to contain string c1 and c2
+
+   Outputs:
+      c1 and c2 in population pop2 are modified by side-effect.
+
+   Example:
+      Performs crossover on the two parent strings m and d, producing
+      children s and b.
+
+      PGAContext *ctx;
+      int m, d, s, b;
+      :
+      PGARealOneptCrossover( ctx, m, d, PGA_OLDPOP, s, b, PGA_NEWPOP );
+
+****************************************************************************I*/
+void PGARealOneptCrossover( PGAContext *ctx, int p1, int p2, int pop1,
+                           int c1, int c2, int pop2)
+{
+     PGAReal *parent1 = (PGAReal *)PGAGetIndividual(ctx, p1,
+                                                    pop1)->chrom;
+     PGAReal *parent2 = (PGAReal *)PGAGetIndividual(ctx, p2,
+                                                    pop1)->chrom;
+     PGAReal *child1  = (PGAReal *)PGAGetIndividual(ctx, c1,
+                                                    pop2)->chrom;
+     PGAReal *child2  = (PGAReal *)PGAGetIndividual(ctx, c2,
+                                                    pop2)->chrom;
+     int i, xsite;
+
+    PGADebugEntered("PGARealOneptCrossover");
+
+    xsite = PGARandomInterval(ctx, 1,ctx->ga.StringLen-1);
+
+    for(i=0;i<xsite;i++) {
+        child1[i] = parent1[i];
+        child2[i] = parent2[i];
+    }
+
+    for(i=xsite;i<ctx->ga.StringLen;i++) {
+        child1[i] = parent2[i];
+        child2[i] = parent1[i];
+    }
+
+    PGADebugExited("PGARealOneptCrossover");
+}
+
+
+/*I****************************************************************************
+   PGARealTwoptCrossover - performs two-point crossover on two parent strings
+   producing two children via side-effect
+
+   Inputs:
+      ctx  - context variable
+      p1   - the first parent string
+      p2   - the second parent string
+      pop1 - symbolic constant of the population containing string p1 and p2
+      c1   - the first child string
+      c2   - the second child string
+      pop2 - symbolic constant of the population to contain string c1 and c2
+
+   Outputs:
+      c1 and c2 in population pop2 are modified by side-effect.
+
+   Example:
+      Performs crossover on the two parent strings m and d, producing
+      children s and b.
+
+      PGAContext *ctx;
+      int m, d, s, b;
+      :
+      PGARealTwoptCrossover( ctx, m, d, PGA_OLDPOP, s, b, PGA_NEWPOP );
+
+****************************************************************************I*/
+void PGARealTwoptCrossover( PGAContext *ctx, int p1, int p2, int pop1,
+                           int c1, int c2, int pop2)
+{
+     PGAReal *parent1 = (PGAReal *)PGAGetIndividual(ctx, p1,
+                                                    pop1)->chrom;
+     PGAReal *parent2 = (PGAReal *)PGAGetIndividual(ctx, p2,
+                                                    pop1)->chrom;
+     PGAReal *child1  = (PGAReal *)PGAGetIndividual(ctx, c1,
+                                                    pop2)->chrom;
+     PGAReal *child2  = (PGAReal *)PGAGetIndividual(ctx, c2,
+                                                    pop2)->chrom;
+     int i, temp, xsite1, xsite2;
+
+    PGADebugEntered("PGARealTwoptCrossover");
+
+    /* pick two cross sites such that xsite2 > xsite1 */
+    xsite1 = PGARandomInterval(ctx, 1,ctx->ga.StringLen-1);
+    xsite2 = xsite1;
+    while ( xsite2 == xsite1 )
+        xsite2 = PGARandomInterval(ctx, 1,ctx->ga.StringLen-1);
+    if ( xsite1 > xsite2 ) {
+        temp   = xsite1;
+        xsite1 = xsite2;
+        xsite2 = temp;
+    }
+
+    for(i=0;i<xsite1;i++) {
+        child1[i] = parent1[i];
+        child2[i] = parent2[i];
+    }
+
+    for(i=xsite1;i<xsite2;i++) {
+        child1[i] = parent2[i];
+        child2[i] = parent1[i];
+    }
+
+    for(i=xsite2;i<ctx->ga.StringLen;i++) {
+        child1[i] = parent1[i];
+        child2[i] = parent2[i];
+    }
+
+    PGADebugExited("PGARealTwoptCrossover");
+}
+
+
+/*I****************************************************************************
+   PGARealUniformCrossover - performs uniform crossover on two parent strings
+   producing two children via side-effect
+
+   Inputs:
+      ctx  - context variable
+      p1   - the first parent string
+      p2   - the second parent string
+      pop1 - symbolic constant of the population containing string p1 and p2
+      c1   - the first child string
+      c2   - the second child string
+      pop2 - symbolic constant of the population to contain string c1 and c2
+
+   Outputs:
+      c1 and c2 in population pop2 are modified by side-effect.
+
+   Example:
+      Performs crossover on the two parent strings m and d, producing
+      children s and b.
+
+      PGAContext *ctx;
+      int m, d, s, b;
+      :
+      PGARealUniformCrossover( ctx, m, d, PGA_OLDPOP, s, b, PGA_NEWPOP );
+
+****************************************************************************I*/
+void PGARealUniformCrossover( PGAContext *ctx, int p1, int p2, int pop1,
+                             int c1, int c2, int pop2)
+{
+     PGAReal *parent1 = (PGAReal *)PGAGetIndividual(ctx, p1,
+                                                    pop1)->chrom;
+     PGAReal *parent2 = (PGAReal *)PGAGetIndividual(ctx, p2,
+                                                    pop1)->chrom;
+     PGAReal *child1  = (PGAReal *)PGAGetIndividual(ctx, c1,
+                                                    pop2)->chrom;
+     PGAReal *child2  = (PGAReal *)PGAGetIndividual(ctx, c2,
+                                                    pop2)->chrom;
+     int i;
+
+    PGADebugEntered("PGARealUniformCrossover");
+
+    for(i=0;i<ctx->ga.StringLen;i++) {
+        if ( parent1[i] == parent2[i] ) {
+            child1[i] = parent1[i];
+            child2[i] = parent2[i];
+        }
+        else {
+            if(PGARandomFlip(ctx, ctx->ga.UniformCrossProb)) {
+                child1[i] = parent1[i];
+                child2[i] = parent2[i];
+            }
+            else {
+                child1[i] = parent2[i];
+                child2[i] = parent1[i];
+            }
+        }
+    }
+
+    PGADebugExited("PGARealUniformCrossover");
+}
+
+/*I****************************************************************************
+   PGARealPrintString - writes a real-valued string to a file.  This routine
+   casts the void string pointer it is passed as the second argument.
+
+   Inputs:
+      ctx - context variable
+      fp  - file pointer to file to write the string to
+      p   - index of the string to write out
+      pop - symbolic constant of the population string p is in
+
+   Outputs:
+
+   Example:
+      Write string s to stdout.
+
+      PGAContext *ctx;
+      int s;
+      :
+      PGARealPrintString( ctx, stdout, s, PGA_NEWPOP );
+
+****************************************************************************I*/
+void PGARealPrintString (PGAContext *ctx, FILE *fp, int p, int pop)
+{
+    PGAReal *c = (PGAReal *)PGAGetIndividual(ctx, p, pop)->chrom;
+    int i;
+
+    PGADebugEntered("PGARealPrintString");
+
+    for(i = 0; i < ctx->ga.StringLen; i++)
+    {
+        switch ( i % 5 )
+        {
+        case 0:
+            fprintf ( fp, "#%4d: [%11.7g]",i,c[i]);
+            break;
+        case 1:
+        case 2:
+        case 3:
+            fprintf ( fp, ", [%11.7g]",c[i]);
+            break;
+        case 4:
+            fprintf ( fp, ", [%11.7g]",c[i]);
+            if (i+1 < ctx->ga.StringLen)
+                fprintf ( fp, "\n");
+            break;
+        }
+    }
+    fprintf ( fp, "\n" );
+
+    PGADebugExited("PGARealPrintString");
+}
+
+
+/*I****************************************************************************
+   PGARealCopyString - Copy one real-valued string string to another
+
+   Inputs:
+      ctx - context variable
+      p1   - string to copy
+      pop1 - symbolic constant of population containing string p1
+      p2   - string to copy p1 to
+      pop2 - symbolic constant of population containing string p2
+
+   Outputs:
+      String p2 in population pop2 is modified to be a copy of string
+      p1 in population pop1.
+
+   Example:
+      Copy string x to y.
+
+      PGAContext *ctx;
+      int x, y;
+      :
+      PGARealCopyString (ctx, x, PGA_OLDPOP, y, PGA_NEWPOP);
+
+****************************************************************************I*/
+void PGARealCopyString ( PGAContext *ctx, int p1, int pop1, int p2, int pop2)
+{
+    PGAReal *source = (PGAReal *)PGAGetIndividual(ctx, p1, pop1)->chrom;
+    PGAReal *dest   = (PGAReal *)PGAGetIndividual(ctx, p2, pop2)->chrom;
+    int i;
+
+    PGADebugEntered("PGARealCopyString");
+
+    for (i=ctx->ga.StringLen-1; i>=0; i--)
+        *(dest++) = *(source++);
+
+    PGADebugExited("PGARealCopyString");
+}
+
+
+/*I****************************************************************************
+   PGARealDuplicate - Returns true if real-valued string a is a duplicate of
+   real-valued string b, else returns false.
+
+   Inputs:
+      ctx - context variable
+      p1   - string index of the first string to compare
+      pop1 - symbolic constant of the population string p1 is in
+      p2   - string index of the second string to compare
+      pop2 - symbolic constant of the population string p2 is in
+
+   Outputs:
+      Returns true/false if strings are duplicates
+
+   Example:
+      Compare strings x with y to see if they are duplicates
+
+      PGAContext *ctx;
+      int x, y;
+      :
+      if ( PGARealDuplicate( ctx, x, PGA_OLDPOP, y, PGA_OLDPOP ) )
+          printf("strings are duplicates\n");
+
+****************************************************************************I*/
+int PGARealDuplicate( PGAContext *ctx, int p1, int pop1, int p2, int pop2)
+{
+     PGAReal *a = (PGAReal *)PGAGetIndividual(ctx, p1, pop1)->chrom;
+     PGAReal *b = (PGAReal *)PGAGetIndividual(ctx, p2, pop2)->chrom;
+     int i;
+
+    PGADebugEntered("PGARealDuplicate");
+
+     i = ctx->ga.StringLen-1;
+     if (a[0] == b[0])
+       for(; (i>0) && (a[i] == b[i]); i--);
+
+    PGADebugExited("PGARealDuplicate");
+
+     return((i==0) ? PGA_TRUE : PGA_FALSE);
+}
+
+/*I****************************************************************************
+   PGARealInitString - randomly initialize a string of type PGAReal
+
+   Inputs:
+      ctx - context variable
+      p   - index of string to randomly initialize
+      pop - symbolic constant of the population string p is in
+
+   Outputs:
+      String p in population pop is randomly initialized by side-effect.
+
+   Example:
+      PGAContext *ctx;
+      int p;
+      :
+      PGARealInitString (ctx, p, PGA_NEWPOP);
+
+****************************************************************************I*/
+void PGARealInitString ( PGAContext *ctx, int p, int pop)
+{
+     int i;
+     PGAReal *c = (PGAReal *)PGAGetIndividual(ctx, p, pop)->chrom;
+
+     PGADebugEntered("PGARealInitString");
+
+     for (i = 0; i < ctx->ga.StringLen; i++)
+          c[i] = PGARandomUniform(ctx, ctx->init.RealMin[i],
+                                  ctx->init.RealMax[i]);
+
+     PGADebugExited("PGARealInitString");
+}
+
+/*I****************************************************************************
+  PGARealBuildDatatype - Build an MPI datatype for a string.
+
+  Inputs:
+     ctx   - context variable
+     p     - index of string
+     pop   - symbolic constant of population string p is in
+
+  Outputs:
+     An MPI_Datatype.
+
+  Example:
+     PGAContext   *ctx;
+     int           p;
+     MPI_Datatype  dt;
+     :
+     dt = PGARealBuildDatatype(ctx, p, pop);
+
+****************************************************************************I*/
+MPI_Datatype PGARealBuildDatatype(PGAContext *ctx, int p, int pop)
+{
+
+     int            counts[4];      /* Number of elements in each
+                                       block (array of integer) */
+     MPI_Aint       displs[4];      /* byte displacement of each
+                                       block (array of integer) */
+     MPI_Datatype   types[4];       /* type of elements in each block (array
+                                       of handles to datatype objects) */
+     MPI_Datatype   individualtype; /* new datatype (handle) */
+     PGAIndividual *traveller;      /* address of individual in question */
+
+    PGADebugEntered("PGARealBuildDatatype");
+
+     traveller = PGAGetIndividual(ctx, p, pop);
+     MPI_Address(&traveller->evalfunc, &displs[0]);
+     counts[0] = 1;
+     types[0]  = MPI_DOUBLE;
+
+     MPI_Address(&traveller->fitness, &displs[1]);
+     counts[1] = 1;
+     types[1]  = MPI_DOUBLE;
+
+     MPI_Address(&traveller->evaluptodate, &displs[2]);
+     counts[2] = 1;
+     types[2]  = MPI_INT;
+
+     MPI_Address(traveller->chrom, &displs[3]);
+     counts[3] = ctx->ga.StringLen;
+     types[3]  = MPI_DOUBLE;
+
+     MPI_Type_struct(4, counts, displs, types, &individualtype);
+     MPI_Type_commit(&individualtype);
+
+    PGADebugExited("PGARealBuildDatatype");
+
+     return (individualtype);
+}
Index: trunk/optimizer/src/pgapack/pgapack/source/report.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/report.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/report.c	(revision 816)
@@ -0,0 +1,1347 @@
+/*
+ *  
+ *  ********************************************************************* 
+ *  (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+ *  *********************************************************************
+ *  
+ *  This software was authored by
+ *  
+ *  D. Levine
+ *  Mathematics and Computer Science Division Argonne National Laboratory
+ *  Argonne IL 60439
+ *  levine@mcs.anl.gov
+ *  (708) 252-6735
+ *  (708) 252-5986 (FAX)
+ *  
+ *  with programming assistance of participants in Argonne National 
+ *  Laboratory's SERS program.
+ *  
+ *  This program contains material protectable under copyright laws of the 
+ *  United States.  Permission is hereby granted to use it, reproduce it, 
+ *  to translate it into another language, and to redistribute it to 
+ *  others at no charge except a fee for transferring a copy, provided 
+ *  that you conspicuously and appropriately publish on each copy the 
+ *  University of Chicago's copyright notice, and the disclaimer of 
+ *  warranty and Government license included below.  Further, permission 
+ *  is hereby granted, subject to the same provisions, to modify a copy or 
+ *  copies or any portion of it, and to distribute to others at no charge 
+ *  materials containing or derived from the material.
+ *  
+ *  The developers of the software ask that you acknowledge its use in any 
+ *  document referencing work based on the  program, such as published 
+ *  research.  Also, they ask that you supply to Argonne National 
+ *  Laboratory a copy of any published research referencing work based on 
+ *  the software.
+ *  
+ *  Any entity desiring permission for further use must contact:
+ *  
+ *  J. Gleeson
+ *  Industrial Technology Development Center Argonne National Laboratory
+ *  Argonne IL 60439
+ *  gleesonj@smtplink.eid.anl.gov
+ *  (708) 252-6055
+ *  
+ *  ******************************************************************** 
+ *  DISCLAIMER
+ *  
+ *  THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+ *  OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+ *  THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+ *  WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+ *  RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+ *  INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+ *  INFRINGE PRIVATELY OWNED RIGHTS.
+ *  
+ *  ********************************************************************** 
+ *  GOVERNMENT LICENSE
+ *  
+ *  The Government is granted for itself and others acting on its behalf a 
+ *  paid-up, non-exclusive, irrevocable worldwide license in this computer 
+ *  software to reproduce, prepare derivative works, and perform publicly 
+ *  and display publicly.
+ */
+
+/******************************************************************************
+ *     FILE: report.c: This file contains functions for reporting on GA
+ *                     parameters, and execution.
+ *
+ *     Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle
+ *              Brian P. Walenz
+ ******************************************************************************/
+
+#include "pgapack.h"
+
+/*U****************************************************************************
+   PGAPrintReport - prints genetic algorithm statistics.  The statistics
+   that are printed are determined by PGASetPrintOptions().
+
+   Category: Reporting
+
+   Inputs:
+      ctx - context variable
+      fp  - file pointer to print the output to
+      pop - symbolic constant of the population whose statistics are printed
+
+   Outputs:
+      genetic algorithm statistics are printed to fp
+
+   Example:
+      PGAContext *ctx;
+      int p;
+      :
+      PGAPrintReport(ctx, stdout, PGA_NEWPOP);
+
+****************************************************************************U*/
+void PGAPrintReport(PGAContext *ctx, FILE *fp, int pop)
+{
+     int p, best_p;
+     double e, best_e;
+
+    PGADebugEntered("PGAPrintReport");
+
+     if (ctx->ga.iter == 1)
+/*       fprintf (fp, "Iter #     Field      Value           Time\n");  */
+         fprintf (fp, "Iter #     Field      Value\n");
+
+     best_p = PGAGetBestIndex(ctx, pop);
+     best_e = PGAGetEvaluation(ctx, best_p, pop);
+     if (!(ctx->ga.iter % ctx->rep.PrintFreq) || ctx->ga.iter == 1)
+     {
+          fprintf(fp, "%-11dBest       %e\n", PGAGetGAIterValue(ctx), best_e);
+/*        fprintf(fp, "      %ld\n", time(NULL) - ctx->rep.starttime);  */
+          if ((ctx->rep.PrintOptions & PGA_REPORT_WORST) == PGA_REPORT_WORST)
+          {
+               p = PGAGetWorstIndex(ctx, pop);
+               e = PGAGetEvaluation(ctx, p, pop);
+               fprintf(fp, "           Worst      %e\n", e);
+          }
+
+          if ((ctx->rep.PrintOptions & PGA_REPORT_AVERAGE) == PGA_REPORT_AVERAGE)
+               fprintf(fp, "           Average    %e\n", ctx->rep.Average);
+
+          if ((ctx->rep.PrintOptions & PGA_REPORT_OFFLINE)
+               == PGA_REPORT_OFFLINE)
+               fprintf(fp, "           Offline    %e\n", ctx->rep.Offline);
+
+          if ((ctx->rep.PrintOptions & PGA_REPORT_ONLINE) == PGA_REPORT_ONLINE)
+               fprintf(fp, "           Online     %e\n", ctx->rep.Online);
+
+          if((ctx->rep.PrintOptions & PGA_REPORT_HAMMING)
+             == PGA_REPORT_HAMMING)
+               fprintf(fp, "           Hamming    %e\n",
+                       PGAHammingDistance(ctx, pop));
+          if ((ctx->rep.PrintOptions & PGA_REPORT_STRING) == PGA_REPORT_STRING)
+               PGAPrintString(ctx, fp, best_p, pop);
+     }
+     fflush(fp);
+
+    PGADebugExited("PGAPrintReport");
+}
+
+/*U****************************************************************************
+   PGASetPrintOptions - set flags to indicate what GA statistics should be
+   printed whenever output is printed.  May be called more than once to
+   specify different report options.  Valid choices are PGA_REPORT_AVERAGE,
+   PGA_REPORT_OFFLINE, PGA_REPORT_ONLINE, PGA_REPORT_WORST, PGA_REPORT_HAMMING,
+   and PGA_REPORT_STRING to specify offline analysis, online analysis, the
+   worst string in the population, the Hamming distance of the population, and
+   the actual allele values of the best string.  The best string is always
+   printed. 
+
+   Category: Reporting
+
+   Inputs:
+      ctx    - context variable
+      option - symbolic constant to specify a print option
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx;
+      :
+      PGASetPrintOptions(ctx, PGA_REPORT_WORST);
+
+****************************************************************************U*/
+void PGASetPrintOptions (PGAContext *ctx, int option)
+{
+    PGADebugEntered("PGASetPrintOptions");
+
+  switch (option) {
+    case PGA_REPORT_AVERAGE:
+    case PGA_REPORT_OFFLINE:
+    case PGA_REPORT_ONLINE:
+    case PGA_REPORT_WORST:
+    case PGA_REPORT_HAMMING:
+    case PGA_REPORT_STRING:
+      ctx->rep.PrintOptions |= option;
+      break;
+    default:
+      PGAError (ctx, "PGASetPrintOption: Invalid value of option:",
+                PGA_FATAL, PGA_INT, (void *) &option);
+      break;
+  }
+
+    PGADebugExited("PGASetPrintOptions");
+}
+
+/*U****************************************************************************
+   PGASetPrintFrequencyValue - Specifies the frequency with which genetic
+   algorithm statistics are reported.  The default is every 10 GA iterations.
+   Used only if PGARun() is used to run the GA.
+
+   Category: Reporting
+
+   Inputs:
+      ctx        - context variable
+      print_freq - the genetic algorithm population size to use
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx;
+      :
+      PGASetPrintFrequencyValue(ctx,1);
+
+****************************************************************************U*/
+void PGASetPrintFrequencyValue( PGAContext *ctx, int print_freq)
+{
+    PGADebugEntered("PGASetPrintFrequencyValue");
+
+    if (print_freq < 0)
+        PGAError ( ctx,
+                  "PGASetPrintFrequencyValue: Invalid value of print_freq:",
+                   PGA_FATAL,
+                   PGA_INT,
+                  (void *) &print_freq);
+    else
+        ctx->rep.PrintFreq = print_freq;
+
+    PGADebugExited("PGASetPrintFrequencyValue");
+}
+
+/*U***************************************************************************
+   PGAGetPrintFrequencyValue - returns how often to print statistics reports
+
+   Category: Reporting
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      The frequency of printing output
+
+   Example:
+      PGAContext *ctx;
+      int freq;
+      :
+      freq = PGAGetPrintFrequencyValue(ctx);
+
+***************************************************************************U*/
+int PGAGetPrintFrequencyValue (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetPrintFrequencyValue");
+    PGAFailIfNotSetUp("PGAGetPrintFrequencyValue");
+
+    PGADebugExited("PGAGetPrintFrequencyValue");
+
+    return(ctx->rep.PrintFreq);
+}
+
+/*U****************************************************************************
+   PGAPrintPopulation - Calls PGAPrintIndividual to print each member of a
+   population
+
+   Category: Reporting
+
+   Inputs:
+      ctx - context variable
+      fp  - file pointer to print the output to
+      pop - symbolic constant of the population to be printed
+
+   Outputs:
+      The strings and associated fields that make up a population member are
+      printed to fp.
+
+   Example:
+      PGAContext *ctx;
+      :
+      PGAPrintPopulation(ctx, stdout, PGA_NEWPOP);
+
+****************************************************************************U*/
+void PGAPrintPopulation ( PGAContext *ctx, FILE *fp, int pop )
+{
+    int i;
+
+
+    PGADebugEntered("PGAPrintPopulation");
+
+    for ( i=0; i < ctx->ga.PopSize; i++ )
+         PGAPrintIndividual ( ctx, fp,  i, pop );
+    fprintf(fp,"\n");
+
+    PGADebugExited("PGAPrintPopulation");
+}
+
+/*U****************************************************************************
+   PGAPrintIndividual - prints the allele values of a string and associated
+   fields (evaluation, fitness, etc.) of a string
+
+   Category: Reporting
+
+   Inputs:
+      ctx - context variable
+      fp  - file pointer to print the output to
+      p   - string index
+      pop - symbolic constant of the population string p is in
+
+   Outputs:
+      The allele values of string p and associated fields are printed to fp
+
+   Example:
+      PGAContext *ctx;
+      int p;
+      :
+      PGAPrintIndividual(ctx, stdout, p, PGA_NEWPOP);
+
+****************************************************************************U*/
+void PGAPrintIndividual ( PGAContext *ctx, FILE *fp, int p, int pop )
+{
+    PGAIndividual *ind;
+
+    PGADebugEntered("PGAPrintIndividual");
+
+    ind = PGAGetIndividual ( ctx, p, pop );
+
+    fprintf( fp,"%d  %e %e ", p, ind->evalfunc, ind->fitness);
+    if ( ind->evaluptodate )
+        fprintf( fp, "T\n" );
+    else
+        fprintf( fp, "F\n" );
+    PGAPrintString ( ctx, fp, p, pop );
+
+    PGADebugExited("PGAPrintIndividual");
+}
+
+/*U****************************************************************************
+   PGAPrintString - write the allele values in a string to a file
+
+   Category: Reporting
+
+   Inputs:
+      ctx - context variable
+      fp  - pointer to file to write the string to
+      p   - index of the string to write out
+      pop - symbolic constant of the population string p is in
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx;
+      int p;
+      :
+      PGAPrintString(ctx, stdout, p, PGA_OLDPOP);
+
+****************************************************************************U*/
+void PGAPrintString ( PGAContext *ctx, FILE *file, int p, int pop )
+{
+    int fp;
+
+    PGADebugEntered("PGAPrintString");
+    PGADebugPrint( ctx, PGA_DEBUG_PRINTVAR,"PGAPrintString",
+                  "p   = ", PGA_INT, (void *) &p );
+    PGADebugPrint( ctx, PGA_DEBUG_PRINTVAR,"PGAPrintString",
+                  "pop = ", PGA_INT, (void *) &pop );
+    
+    if (ctx->fops.PrintString) {
+        fp = ((p == PGA_TEMP1) || (p == PGA_TEMP2)) ? p : p+1;
+        (*ctx->fops.PrintString)(&ctx, NULL, &fp, &pop);
+    } else {
+        (*ctx->cops.PrintString)(ctx, file, p, pop);
+    }
+    fprintf(file,"\n");
+
+    PGADebugExited("PGAPrintString");
+}
+
+/*U****************************************************************************
+   PGAPrintContextVariable - prints the value of all the fields in the context
+   variable.
+
+   Category: Reporting
+
+   Inputs:
+      ctx - context variable
+      fp  - file pointer to print the output to
+
+   Outputs:
+      The value of all the fields in the context variable are printed to fp.
+
+   Example:
+      PGAContext *ctx;
+      :
+      PGAPrintContextVariable(ctx, stdout);
+
+****************************************************************************U*/
+void PGAPrintContextVariable ( PGAContext *ctx, FILE *fp )
+{
+    PGADebugEntered("PGAPrintContextVariable");
+
+     fprintf( fp,"Algorithm Parameters (Static)\n");
+
+     fprintf( fp,"    Data type                      : ");
+     switch(ctx->ga.datatype)
+     {
+     case PGA_DATATYPE_BINARY:
+          fprintf( fp,"Binary\n");
+          /*fprintf( fp,"    Bit Type Total Words           : ");
+          switch(ctx->ga.tw)
+          {
+          case PGA_UNINITIALIZED_INT:
+               fprintf( fp,"*UNINITIALIZED*\n");
+               break;
+          default:
+               fprintf( fp,"%d\n",ctx->ga.tw);
+               break;
+          };
+          fprintf( fp,"    Bit Type Full Words            : ");
+          switch(ctx->ga.fw)
+          {
+          case PGA_UNINITIALIZED_INT:
+               fprintf( fp,"*UNINITIALIZED*\n");
+               break;
+          default:
+               fprintf( fp,"%d\n",ctx->ga.fw);
+               break;
+          };
+          fprintf( fp,"    Bit Type Extra Bits            : ");
+          switch(ctx->ga.eb)
+          {
+          case PGA_UNINITIALIZED_INT:
+               fprintf( fp,"*UNINITIALIZED*\n");
+               break;
+          default:
+               fprintf( fp,"%d\n",ctx->ga.eb);
+               break;
+          };*/
+          break;
+     case PGA_DATATYPE_INTEGER:
+          fprintf( fp,"Integer\n");
+          break;
+     case PGA_DATATYPE_REAL:
+          fprintf( fp,"Real\n");
+          break;
+     case PGA_DATATYPE_CHARACTER:
+          fprintf( fp,"Character\n");
+          break;
+     case PGA_DATATYPE_USER:
+          fprintf( fp,"User Defined\n");
+          break;
+     case PGA_UNINITIALIZED_INT:
+          fprintf( fp,"*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf( fp,"!ERROR!  =(%d)?\n", ctx->ga.datatype);
+          break;
+     };
+
+     fprintf( fp,"    Optimization Direction         : ");
+     switch(ctx->ga.optdir)
+     {
+     case PGA_MAXIMIZE:
+          fprintf( fp,"Maximize\n");
+          break;
+     case PGA_MINIMIZE:
+          fprintf( fp,"Minimize\n");
+          break;
+     case PGA_UNINITIALIZED_INT:
+          fprintf( fp,"*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf( fp,"!ERROR!  =(%d)?\n", ctx->ga.optdir);
+          break;
+     };
+
+     fprintf( fp,"    Population Size                : ");
+     switch(ctx->ga.PopSize)
+     {
+     case PGA_UNINITIALIZED_INT:
+          fprintf( fp,"*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf( fp,"%d\n",ctx->ga.PopSize);
+          break;
+     };
+
+     fprintf( fp,"    String Length                  : ");
+     switch(ctx->ga.StringLen)
+     {
+     case PGA_UNINITIALIZED_INT:
+          fprintf( fp,"*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf( fp,"%d\n",ctx->ga.StringLen);
+          break;
+     };
+     
+
+     fprintf( fp,"    Copy to Next Population        : ");
+     switch(ctx->ga.PopReplace)
+     {
+     case PGA_POPREPL_BEST:
+          fprintf( fp,"Best\n");
+          break;
+     case PGA_POPREPL_RANDOM_NOREP:
+          fprintf( fp,"Random without replacement\n");
+          break;
+     case PGA_POPREPL_RANDOM_REP:
+          fprintf( fp,"Random with replacement\n");
+          break;
+     case PGA_UNINITIALIZED_INT:
+          fprintf( fp,"*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf( fp,"!ERROR!  =(%d)?\n", ctx->ga.PopReplace);
+          break;
+     };
+
+     
+     /*fprintf( fp,"    Stopping Rule (s)              :\n");
+     if ((ctx->ga.StoppingRule & PGA_STOP_MAXITER) == PGA_STOP_MAXITER)
+          fprintf(fp, "%50s", "Maximum iterations\n");
+     if ((ctx->ga.StoppingRule & PGA_STOP_NOCHANGE) == PGA_STOP_NOCHANGE)
+          fprintf(fp, "%49s", "No change in best\n");
+     if ((ctx->ga.StoppingRule & PGA_STOP_TOOSIMILAR) == PGA_STOP_TOOSIMILAR)
+          fprintf(fp, "%54s", "Population Homogeneity\n");
+     if (ctx->ga.StoppingRule == PGA_UNINITIALIZED_INT)
+          fprintf(fp, "%47s", "*UNINITIALIZED*\n");*/
+
+     fprintf( fp,"    Stop: Maximum Iterations       : ");
+     if ((ctx->ga.StoppingRule & PGA_STOP_MAXITER) == PGA_STOP_MAXITER)
+         fprintf( fp,"On\n");
+     else
+         fprintf( fp,"Off\n");
+
+
+     fprintf( fp,"        Maximum Iterations         : ");
+     switch(ctx->ga.MaxIter)
+     {
+     case PGA_UNINITIALIZED_INT:
+          fprintf( fp,"*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf( fp,"%d\n",ctx->ga.MaxIter);
+          break;
+     };
+
+
+     fprintf( fp,"    Stop: No Change                : ");
+     if ((ctx->ga.StoppingRule & PGA_STOP_NOCHANGE) == PGA_STOP_NOCHANGE)
+         fprintf( fp,"On\n");
+     else
+         fprintf( fp,"Off\n");
+
+     
+     fprintf(fp, "        Max No Change Iterations   : ");
+     switch(ctx->ga.MaxNoChange)
+     {
+     case PGA_UNINITIALIZED_INT:
+          fprintf(fp, "*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf(fp, "%d\n", ctx->ga.MaxNoChange);
+          break;
+     }
+
+     fprintf( fp,"    Stop: Too Similar              : ");
+     if ((ctx->ga.StoppingRule & PGA_STOP_TOOSIMILAR) == PGA_STOP_TOOSIMILAR)
+         fprintf( fp,"On\n");
+     else
+         fprintf( fp,"Off\n");
+
+
+     fprintf(fp, "        Percent Similarity         : ");
+     switch(ctx->ga.MaxSimilarity)
+     {
+     case PGA_UNINITIALIZED_INT:
+          fprintf(fp, "*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf(fp, "%d\n", ctx->ga.MaxSimilarity);
+          break;
+     }
+
+     fprintf( fp,"    No. Strings Replaced per Iter  : ");
+     switch(ctx->ga.NumReplace)
+     {
+     case PGA_UNINITIALIZED_INT:
+          fprintf( fp,"*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf( fp,"%d\n",ctx->ga.NumReplace);
+          break;
+     };
+
+
+     fprintf( fp,"    Mutate [And,Or] Crossover      : ");
+     switch(ctx->ga.MutateOnlyNoCross)
+     {
+     case PGA_TRUE:
+          fprintf( fp,"Or\n");
+          break;
+     case PGA_FALSE:
+          fprintf( fp,"And\n");
+          break;
+     case PGA_UNINITIALIZED_INT:
+          fprintf( fp,"*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf( fp,"!ERROR!  =(%d)?\n", ctx->ga.MutateOnlyNoCross);
+          break;
+     };
+
+     
+     fprintf( fp,"    Crossover Type                 : ");
+     switch(ctx->ga.CrossoverType)
+     {
+     case PGA_CROSSOVER_ONEPT:
+          fprintf( fp,"One Point\n");
+          break;
+     case PGA_CROSSOVER_TWOPT:
+          fprintf( fp,"Two Point\n");
+          break;
+     case PGA_CROSSOVER_UNIFORM:
+          fprintf( fp,"Uniform\n");
+          break;
+     case PGA_UNINITIALIZED_INT:
+          fprintf( fp,"*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf( fp,"!ERROR!  =(%d)?\n", ctx->ga.CrossoverType);
+          break;
+     };
+
+     
+     fprintf( fp,"    Crossover Probability          : ");
+     if (ctx->ga.CrossoverProb == PGA_UNINITIALIZED_DOUBLE)
+          fprintf( fp,"*UNINITIALIZED*\n");
+     else
+          fprintf( fp,"%f\n",ctx->ga.CrossoverProb);
+
+    
+     fprintf( fp,"    Uniform Crossover Prob.        : ");
+     if (ctx->ga.UniformCrossProb == PGA_UNINITIALIZED_DOUBLE)
+          fprintf( fp,"*UNINITIALIZED*\n");
+     else
+          fprintf( fp,"%f\n",ctx->ga.UniformCrossProb);
+
+     
+     fprintf( fp,"    Mutation Type                  : ");
+     switch(ctx->ga.datatype)
+     {
+     case PGA_DATATYPE_BINARY:
+          fprintf( fp,"Binary\n");
+          break;
+     case PGA_DATATYPE_CHARACTER:
+          fprintf( fp,"Character\n");
+          break;
+     case PGA_DATATYPE_REAL:
+     case PGA_DATATYPE_INTEGER:
+         switch(ctx->ga.MutationType)
+         {
+         case PGA_MUTATION_CONSTANT:
+              fprintf( fp,"Constant\n");
+              break;
+         case PGA_MUTATION_RANGE:
+              fprintf( fp,"Range\n");
+              break;
+         case PGA_MUTATION_UNIFORM:
+              fprintf( fp,"Uniform\n");
+              break;
+         case PGA_MUTATION_GAUSSIAN:
+              fprintf( fp,"Gaussian\n");
+              break;
+         case PGA_MUTATION_PERMUTE:
+              fprintf( fp,"Permutation\n");
+              break;
+         case PGA_UNINITIALIZED_INT:
+              fprintf( fp,"*UNINITIALIZED*\n");
+              break;
+         default:
+              fprintf( fp,"!ERROR!  =(%d)?\n", ctx->ga.MutationType);
+              break;
+         };
+     default:
+         break;
+     };
+
+     
+     fprintf( fp,"    Mutation Probability           : ");
+     if (ctx->ga.MutationProb == PGA_UNINITIALIZED_DOUBLE)
+          fprintf( fp,"*UNINITIALIZED*\n");
+     else
+          fprintf( fp,"%f\n",ctx->ga.MutationProb);
+
+     
+     fprintf( fp,"    Real Mutation Constant         : ");
+     if (ctx->ga.MutationProb == PGA_UNINITIALIZED_DOUBLE)
+          fprintf( fp,"*UNINITIALIZED*\n");
+     else
+          fprintf( fp,"%f\n",ctx->ga.MutateRealValue);
+
+
+     fprintf(fp, "    Integer Mutation Constant      : ");
+     switch(ctx->ga.MutateIntegerValue)
+     {
+     case PGA_UNINITIALIZED_INT:
+          fprintf(fp, "*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf(fp, "%d\n", ctx->ga.MutateIntegerValue);
+          break;
+     }
+
+     
+     fprintf( fp,"    Mutation Range Bounded         : ");
+     switch(ctx->ga.MutateBoundedFlag)
+     {
+     case PGA_TRUE:
+          fprintf( fp,"On\n");
+          break;
+     case PGA_FALSE:
+          fprintf( fp,"Off\n");
+          break;
+     case PGA_UNINITIALIZED_INT:
+          fprintf( fp,"*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf( fp,"!ERROR!  =(%d)?\n", ctx->ga.MutateBoundedFlag);
+          break;
+     };
+
+     
+     fprintf( fp,"    Selection Type                 : ");
+     switch(ctx->ga.SelectType)
+     {
+     case PGA_SELECT_PROPORTIONAL:
+          fprintf( fp,"Proportional\n");
+          break;
+     case PGA_SELECT_SUS:
+          fprintf( fp,"Stochastic Universal\n");
+          break;
+     case PGA_SELECT_TOURNAMENT:
+          fprintf( fp,"Binary Tournament\n");
+          break;
+     case PGA_SELECT_PTOURNAMENT:
+          fprintf( fp,"Probabilistic Binary Tournament\n");
+          break;
+     case PGA_UNINITIALIZED_INT:
+          fprintf( fp,"*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf( fp,"!ERROR!  =(%d)?\n", ctx->ga.SelectType);
+          break;
+     };
+
+     
+     fprintf( fp,"    Tournament Selection Param     : ");
+     if (ctx->ga.PTournamentProb == PGA_UNINITIALIZED_DOUBLE)
+          fprintf( fp,"*UNINITIALIZED*\n");
+     else
+          fprintf( fp,"%f\n",ctx->ga.PTournamentProb);
+    
+     
+
+     fprintf( fp,"    Restart Operator               : ");
+     switch(ctx->ga.restart)
+     {
+     case PGA_TRUE:
+          fprintf( fp,"On\n");
+          break;
+     case PGA_FALSE:
+          fprintf( fp,"Off\n");
+          break;
+     case PGA_UNINITIALIZED_INT:
+          fprintf( fp,"*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf( fp,"!ERROR!  =(%d)?\n", ctx->ga.restart);
+          break;
+     };
+
+     fprintf( fp,"    Restart Frequency              : ");
+     switch(ctx->ga.restartFreq)
+     {
+     case PGA_UNINITIALIZED_INT:
+          fprintf( fp,"*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf( fp,"%d\n",ctx->ga.restartFreq);
+          break;
+     };
+
+     fprintf( fp,"    Restart Allele Change Prob     : ");
+     if (ctx->ga.restartAlleleProb == PGA_UNINITIALIZED_DOUBLE)
+          fprintf( fp,"*UNINITIALIZED*\n");
+     else
+          fprintf( fp,"%f\n",ctx->ga.restartAlleleProb);
+
+     
+     fprintf( fp,"    Allow Duplicates               : ");
+     switch(ctx->ga.NoDuplicates)
+     {
+     case PGA_TRUE:
+          fprintf( fp,"No\n");
+          break;
+     case PGA_FALSE:
+          fprintf( fp,"Yes\n");
+          break;
+     case PGA_UNINITIALIZED_INT:
+          fprintf( fp,"*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf( fp,"!ERROR!  =(%d)?\n", ctx->ga.NoDuplicates);
+          break;
+     };
+
+
+     fprintf( fp,"    Fitness Type                   : ");
+     switch(ctx->ga.FitnessType)
+     {
+     case PGA_FITNESS_RAW:
+          fprintf( fp,"Raw\n");
+          break;
+     case PGA_FITNESS_NORMAL:
+          fprintf( fp,"Linear Normalization\n");
+          break;
+     case PGA_FITNESS_RANKING:
+          fprintf( fp,"Linear Ranking\n");
+          break;
+     case PGA_UNINITIALIZED_INT:
+          fprintf( fp,"*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf( fp,"!ERROR!  =(%d)?\n", ctx->ga.FitnessType);
+          break;
+     };
+
+     
+     if ( ctx->ga.optdir == PGA_MINIMIZE )
+     {
+          fprintf( fp,"    Fitness Type(Minimization)     : ");
+          switch(ctx->ga.FitnessMinType) {
+          case PGA_FITNESSMIN_RECIPROCAL:
+               fprintf( fp,"Reciprocal\n");
+               break;
+          case PGA_FITNESSMIN_CMAX:
+               fprintf( fp,"CMax\n");
+               break;
+          case PGA_UNINITIALIZED_INT:
+               fprintf( fp,"*UNINITIALIZED*\n");
+               break;
+          default:
+               fprintf( fp,"!ERROR!  =(%d)?\n", ctx->ga.FitnessMinType);
+               break;
+          };
+     }
+
+     
+     fprintf( fp,"    Fitness Ranking Parameter      : ");
+     if (ctx->ga.FitnessRankMax == PGA_UNINITIALIZED_DOUBLE)
+          fprintf( fp,"*UNINITIALIZED*\n");
+     else
+          fprintf( fp,"%f\n",ctx->ga.FitnessRankMax);
+     
+
+     fprintf( fp,"    Fitness CMAX Parameter         : ");
+     if (ctx->ga.FitnessCmaxValue == PGA_UNINITIALIZED_DOUBLE)
+          fprintf( fp,"*UNINITIALIZED*\n");
+     else
+          fprintf( fp,"%f\n",ctx->ga.FitnessCmaxValue);
+
+     
+     fprintf( fp,"Algorithm Parameters (Dynamic)\n");
+
+     
+     fprintf( fp,"    Current Generation             : ");
+     switch(ctx->ga.iter)
+     {
+     case PGA_UNINITIALIZED_INT:
+          fprintf( fp,"*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf( fp,"%d\n",ctx->ga.iter);
+          break;
+     };
+
+     fprintf(fp, "    Num Iters With No Change       : ");
+     switch(ctx->ga.ItersOfSame)
+     {
+     case PGA_UNINITIALIZED_INT:
+          fprintf(fp, "*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf(fp, "%d\n", ctx->ga.ItersOfSame);
+          break;
+     }
+
+     fprintf(fp, "    Percent Similarity In Pop      : ");
+     switch(ctx->ga.PercentSame)
+     {
+     case PGA_UNINITIALIZED_INT:
+          fprintf(fp, "?UNINITIALZED?\n");
+          break;
+     default:
+          fprintf(fp, "%d\n", ctx->ga.PercentSame);
+          break;
+     }
+
+     fprintf( fp,"    Selection Index                : ");
+     switch(ctx->ga.SelectIndex)
+     {
+     case PGA_UNINITIALIZED_INT:
+          fprintf( fp,"*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf( fp,"%d\n",ctx->ga.SelectIndex);
+          break;
+     };
+
+     
+/* initialization */
+     fprintf( fp,"Initialization\n");
+
+     fprintf( fp,"    Random Initialization          : ");
+     switch(ctx->init.RandomInit)
+     {
+     case PGA_TRUE:
+          fprintf( fp,"On\n");
+          break;
+     case PGA_FALSE:
+          fprintf( fp,"Off\n");
+          break;
+     case PGA_UNINITIALIZED_INT:
+          fprintf( fp,"*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf( fp,"!ERROR!  =(%d)?\n", ctx->init.RandomInit);
+          break;
+     };
+
+     fprintf( fp,"    Initialization Binary Prob     : ");
+     if (ctx->init.BinaryProbability == PGA_UNINITIALIZED_DOUBLE)
+          fprintf( fp,"*UNINITIALIZED*\n");
+     else
+          fprintf( fp,"%f\n",ctx->init.BinaryProbability);
+
+
+     fprintf( fp,"    Initialization Real            : ");
+     switch(ctx->init.RealType)
+     {
+     case PGA_RINIT_RANGE:
+          fprintf( fp,"Range\n");
+          break;
+     case PGA_RINIT_PERCENT:
+          fprintf( fp,"Percent Offset\n");
+          break;
+     case PGA_UNINITIALIZED_INT:
+          fprintf( fp,"*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf( fp,"!ERROR!  =(%d)?\n", ctx->init.RealType);
+          break;
+     };
+
+     fprintf( fp,"    Initialization Integer         : ");
+     switch(ctx->init.IntegerType)
+     {
+     case PGA_IINIT_RANGE:
+          fprintf( fp,"Range\n");
+          break;
+     case PGA_IINIT_PERMUTE:
+          fprintf( fp,"Permutation\n");
+          break;
+     case PGA_UNINITIALIZED_INT:
+          fprintf( fp,"*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf( fp,"!ERROR!  =(%d)?\n", ctx->init.IntegerType);
+          break;
+     };
+
+     fprintf( fp,"    Initialization Character       : ");
+     switch(ctx->init.CharacterType)
+     {
+     case PGA_CINIT_LOWER:
+          fprintf( fp,"Lower Case\n");
+          break;
+     case PGA_CINIT_UPPER:
+          fprintf( fp,"Upper Case\n");
+          break;
+     case PGA_CINIT_MIXED:
+          fprintf( fp,"Mixed Case\n");
+          break;
+     case PGA_UNINITIALIZED_INT:
+          fprintf( fp,"*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf( fp,"!ERROR!  =(%d)?\n", ctx->init.CharacterType);
+          break;
+     };
+     
+     fprintf( fp,"    Random Number Seed             : ");
+     switch(ctx->init.RandomSeed)
+     {
+     case PGA_UNINITIALIZED_INT:
+          fprintf( fp,"*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf( fp,"%d\n", ctx->init.RandomSeed);
+          break;
+     };
+
+     PGADebugExited("PGAPrintContextVariable");
+
+
+/* par */
+    fprintf( fp,"Parallel\n");
+
+    fprintf( fp,"    MPI Library Used               : ");
+     switch(ctx->par.MPIStubLibrary)
+     {
+     case PGA_TRUE:
+          fprintf( fp,"Sequential\n");
+          break;
+     case PGA_FALSE:
+          fprintf( fp,"Parallel\n");
+          break;
+     default:
+          fprintf( fp,"!ERROR!  =(%d)?\n", ctx->par.MPIStubLibrary);
+          break;
+     };
+
+
+     fprintf( fp,"    MPI Initialized by PGAPack     : ");
+     switch(ctx->par.MPIAlreadyInit)
+     {
+     case PGA_TRUE:
+          fprintf( fp,"Yes\n");
+          break;
+     case PGA_FALSE:
+          fprintf( fp,"No\n");
+          break;
+     case PGA_UNINITIALIZED_INT:
+          fprintf( fp,"*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf( fp,"!ERROR!  =(%d)?\n", ctx->par.MPIAlreadyInit);
+          break;
+     };
+
+     /*fprintf(fp, "    Number Islands                 : ");
+     switch(ctx->par.NumIslands)
+     {
+     case PGA_UNINITIALIZED_INT:
+          fprintf(fp, "*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf(fp, "%d\n", ctx->par.NumIslands);
+          break;
+     }
+
+     fprintf(fp, "    Number Demes                   : ");
+     switch(ctx->par.NumDemes)
+     {
+     case PGA_UNINITIALIZED_INT:
+          fprintf(fp, "*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf(fp, "%d\n", ctx->par.NumDemes);
+          break;
+     }*/
+
+     fprintf(fp, "    Default Communicator           : ");
+     if (ctx->par.DefaultComm == NULL) 
+	 fprintf(fp, "NULL\n");
+     else if (ctx->par.DefaultComm == MPI_COMM_WORLD)
+         fprintf(fp, "MPI_COMM_WORLD\n");
+     else
+	 fprintf(fp, "User Defined\n");
+ 
+
+
+/* report */
+     fprintf( fp,"Report\n");
+
+     fprintf( fp,"    Print Frequency                : ");
+     switch(ctx->rep.PrintFreq)
+     {
+     case PGA_UNINITIALIZED_INT:
+          fprintf( fp,"*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf( fp,"%d\n",ctx->rep.PrintFreq);
+          break;
+     };
+
+     fprintf( fp,"    Print Worst Evaluation         : ");
+     if ((ctx->rep.PrintOptions & PGA_REPORT_WORST) == PGA_REPORT_WORST)
+         fprintf( fp,"On\n");
+     else
+         fprintf( fp,"Off\n");
+
+     fprintf( fp,"    Print Average Evaluation       : ");
+     if ((ctx->rep.PrintOptions & PGA_REPORT_AVERAGE) == PGA_REPORT_AVERAGE)
+         fprintf( fp,"On\n");
+     else
+         fprintf( fp,"Off\n");
+
+     fprintf( fp,"    Print Offline Statistics       : ");
+     if ((ctx->rep.PrintOptions & PGA_REPORT_OFFLINE) == PGA_REPORT_OFFLINE)
+         fprintf( fp,"On\n");
+     else
+         fprintf( fp,"Off\n");
+
+     fprintf( fp,"    Print Online Statistics        : ");
+     if ((ctx->rep.PrintOptions & PGA_REPORT_ONLINE) == PGA_REPORT_ONLINE)
+         fprintf( fp,"On\n");
+     else
+         fprintf( fp,"Off\n");
+
+     fprintf( fp,"    Print Hamming Distance         : ");
+     if ((ctx->rep.PrintOptions & PGA_REPORT_HAMMING) == PGA_REPORT_HAMMING)
+         fprintf( fp,"On\n");
+     else
+         fprintf( fp,"Off\n");
+
+/* system */
+     fprintf( fp,"System\n");
+
+     fprintf( fp,"    Maximum Integer                : ");
+     switch(ctx->sys.PGAMaxInt)
+     {
+     case PGA_UNINITIALIZED_INT:
+          fprintf( fp,"*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf( fp,"%d\n",ctx->sys.PGAMaxInt);
+          break;
+     };
+
+     fprintf( fp,"    Minimum Integer                : ");
+     switch(ctx->sys.PGAMinInt)
+     {
+     case PGA_UNINITIALIZED_INT:
+          fprintf( fp,"*UNINITIALIZED*\n");
+          break;
+     default:
+          fprintf( fp,"%d\n",ctx->sys.PGAMinInt);
+          break;
+     };
+
+     fprintf( fp,"    Maximum Double                 : ");
+     if (ctx->sys.PGAMaxDouble == PGA_UNINITIALIZED_DOUBLE)
+          fprintf( fp,"*UNINITIALIZED*\n");
+     else
+          fprintf( fp,"%e\n",ctx->sys.PGAMaxDouble);
+
+     fprintf( fp,"    Minimum Double                 : ");
+     if (ctx->sys.PGAMinDouble == PGA_UNINITIALIZED_DOUBLE)
+          fprintf( fp,"*UNINITIALIZED*\n");
+     else
+          fprintf( fp,"%e\n",ctx->sys.PGAMinDouble);
+
+
+
+/* ops */
+    fprintf( fp,"Operations\n");
+
+    fprintf( fp,"    CreateString  function         : ");
+    if (ctx->cops.CreateString == NULL)
+	fprintf( fp,"NULL\n");
+    else if (ctx->cops.CreateString == PGABinaryCreateString)
+	fprintf( fp,"PGABinaryCreateString\n");
+    else if (ctx->cops.CreateString == PGAIntegerCreateString)
+	fprintf( fp,"PGAIntegerCreateString\n");
+    else if (ctx->cops.CreateString == PGARealCreateString)
+	fprintf( fp,"PGARealCreateString\n");
+    else if (ctx->cops.CreateString == PGACharacterCreateString)
+	fprintf( fp,"PGACharacterCreateString\n");
+    else
+	fprintf( fp,"C User Defined: %p\n",ctx->cops.CreateString);
+
+    
+    fprintf( fp,"    InitString    function         : ");
+    if (ctx->cops.InitString) {
+        if (ctx->cops.InitString == PGABinaryInitString)
+	    fprintf( fp,"PGABinaryInitString\n");
+        else if (ctx->cops.InitString == PGAIntegerInitString)
+            fprintf( fp,"PGAIntegerInitString\n");
+        else if (ctx->cops.InitString == PGARealInitString)
+    	    fprintf( fp,"PGARealInitString\n");
+        else if (ctx->cops.InitString == PGACharacterInitString)
+    	    fprintf( fp,"PGACharacterInitString\n");
+        else
+	    fprintf( fp,"C User Defined: %p\n",ctx->cops.InitString);
+    } else {
+	if (ctx->fops.InitString) 
+	    fprintf( fp,"Fortran User Defined: %p\n",ctx->fops.InitString);
+	else
+	    fprintf( fp,"NULL\n");
+    }
+    
+
+    fprintf( fp,"    BuildDatatype function         : ");
+    if (ctx->cops.BuildDatatype == NULL)
+	fprintf( fp,"NULL\n");
+    else if (ctx->cops.BuildDatatype == PGABinaryBuildDatatype)
+	fprintf( fp,"PGABinaryBuildDatatype\n");
+    else if (ctx->cops.BuildDatatype == PGAIntegerBuildDatatype)
+	fprintf( fp,"PGAIntegerBuildDatatype\n");
+    else if (ctx->cops.BuildDatatype == PGARealBuildDatatype)
+	fprintf( fp,"PGARealBuildDatatype\n");
+    else if (ctx->cops.BuildDatatype == PGACharacterBuildDatatype)
+	fprintf( fp,"PGACharacterBuildDatatype\n");
+    else
+	fprintf( fp,"C User Defined: %p\n",ctx->cops.BuildDatatype);
+
+    
+    fprintf( fp,"    Mutation      function         : ");
+    if (ctx->cops.Mutation) {
+	if (ctx->cops.Mutation == PGABinaryMutation)
+	    fprintf( fp,"PGABinaryMutation\n");
+	else if (ctx->cops.Mutation == PGAIntegerMutation)
+	    fprintf( fp,"PGAIntegerMutation\n");
+	else if (ctx->cops.Mutation == PGARealMutation)
+	    fprintf( fp,"PGARealMutation\n");
+	else if (ctx->cops.Mutation == PGACharacterMutation)
+	    fprintf( fp,"PGACharacterMutation\n");
+	else
+	    fprintf( fp,"C User Defined: %p\n",ctx->cops.Mutation);
+    } else {
+	if (ctx->fops.Mutation) 
+	    fprintf( fp,"Fortran User Defined: %p\n",ctx->fops.Mutation);
+	else
+	    fprintf( fp,"NULL\n");
+    }
+
+    
+    fprintf( fp,"    Crossover     function         : ");
+    if (ctx->cops.Crossover) {
+	if (ctx->cops.Crossover == PGABinaryOneptCrossover)
+	    fprintf( fp,"PGABinaryOneptCrossover\n");
+	else if (ctx->cops.Crossover == PGAIntegerOneptCrossover)
+	    fprintf( fp,"PGAIntegerOneptCrossover\n");
+	else if (ctx->cops.Crossover == PGARealOneptCrossover)
+	    fprintf( fp,"PGARealOneptCrossover\n");
+	else if (ctx->cops.Crossover == PGACharacterOneptCrossover)
+	    fprintf( fp,"PGACharacterOneptCrossover\n");
+	else if (ctx->cops.Crossover == PGABinaryTwoptCrossover)
+	    fprintf( fp,"PGABinaryTwoptCrossover\n");
+	else if (ctx->cops.Crossover == PGAIntegerTwoptCrossover)
+	    fprintf( fp,"PGAIntegerTwoptCrossover\n");
+	else if (ctx->cops.Crossover == PGARealTwoptCrossover)
+	    fprintf( fp,"PGARealTwoptCrossover\n");
+	else if (ctx->cops.Crossover == PGACharacterTwoptCrossover)
+	    fprintf( fp,"PGACharacterTwoptCrossover\n");
+	else if (ctx->cops.Crossover == PGABinaryUniformCrossover)
+	    fprintf( fp,"PGABinarytUniformCrossover\n");
+	else if (ctx->cops.Crossover == PGAIntegerUniformCrossover)
+	    fprintf( fp,"PGAIntegerUniformCrossover\n");
+	else if (ctx->cops.Crossover == PGARealUniformCrossover)
+	    fprintf( fp,"PGARealUniformCrossover\n");
+	else if (ctx->cops.Crossover == PGACharacterUniformCrossover)
+	    fprintf( fp,"PGACharacterUniformCrossover\n");
+	else
+	    fprintf( fp,"C User Defined: %p\n",ctx->cops.Crossover);
+    } else {
+	if (ctx->fops.Crossover) 
+	    fprintf( fp,"Fortran User Defined: %p\n",ctx->fops.Crossover);
+	else
+	    fprintf( fp,"NULL\n");
+    }
+
+    
+    fprintf( fp,"    PrintString   function         : ");
+    if (ctx->cops.PrintString) {
+	if (ctx->cops.PrintString == PGABinaryPrintString)
+	    fprintf( fp,"PGABinaryPrintString\n");
+	else if (ctx->cops.PrintString == PGAIntegerPrintString)
+	    fprintf( fp,"PGAIntegerPrintString\n");
+	else if (ctx->cops.PrintString == PGARealPrintString)
+	    fprintf( fp,"PGARealPrintString\n");
+	else if (ctx->cops.PrintString == PGACharacterPrintString)
+	    fprintf( fp,"PGACharacterPrintString\n");
+	else
+	    fprintf( fp,"C User Defined: %p\n",ctx->cops.PrintString);
+    } else {
+	if (ctx->fops.PrintString)
+	    fprintf( fp,"Fortran User Defined: %p\n",ctx->fops.PrintString);
+	else
+	    fprintf( fp,"NULL\n");
+    }
+    
+
+    fprintf( fp,"    CopyString    function         : ");
+    if (ctx->cops.CopyString) {
+	if (ctx->cops.CopyString == PGABinaryCopyString)
+	    fprintf( fp,"PGABinaryCopyString\n");
+	else if (ctx->cops.CopyString == PGAIntegerCopyString)
+	    fprintf( fp,"PGAIntegerCopyString\n");
+	else if (ctx->cops.CopyString == PGARealCopyString)
+	    fprintf( fp,"PGARealCopyString\n");
+	else if (ctx->cops.CopyString == PGACharacterCopyString)
+	    fprintf( fp,"PGACharacterCopyString\n");
+	else
+	    fprintf( fp,"C User Defined: %p\n",ctx->cops.CopyString);
+    } else {
+	if (ctx->cops.CopyString)
+	    fprintf( fp,"Fortran User Defined: %p\n",ctx->fops.CopyString);
+	else
+	    fprintf( fp,"NULL\n");
+    }
+
+    
+    fprintf( fp,"    Duplicate     function         : ");
+    if (ctx->cops.Duplicate) {
+	if (ctx->cops.Duplicate == PGABinaryDuplicate)
+	    fprintf( fp,"PGABinaryDuplicate\n");
+	else if (ctx->cops.Duplicate == PGAIntegerDuplicate)
+	    fprintf( fp,"PGAIntegerDuplicate\n");
+	else if (ctx->cops.Duplicate == PGARealDuplicate)
+	    fprintf( fp,"PGARealDuplicate\n"); 
+	else if (ctx->cops.Duplicate == PGACharacterDuplicate)
+	    fprintf( fp,"PGACharacterDuplicate\n"); 
+	else
+	    fprintf( fp,"C User Defined: %p\n",ctx->cops.Duplicate);
+    } else {
+	if (ctx->fops.Duplicate)
+	    fprintf( fp,"Fortran User Defined: %p\n",ctx->fops.Duplicate);
+	else
+	    fprintf( fp,"NULL\n");
+    }
+
+
+    fprintf( fp,"    Stopping      function         : ");
+    if (ctx->cops.StopCond)
+	fprintf( fp,"C User Defined: %p\n",ctx->cops.StopCond);
+    else
+	if (ctx->fops.StopCond)
+	    fprintf( fp,"Fortran User Defined: %p\n",ctx->fops.StopCond);
+	else
+	    fprintf( fp,"PGACheckStoppingConditions\n");
+
+
+    fprintf( fp,"    End of Generation function     : ");
+    if (ctx->cops.EndOfGen)
+	fprintf( fp,"C User Defined: %p\n",ctx->cops.EndOfGen);
+    else
+	if (ctx->cops.EndOfGen)
+	    fprintf( fp,"Fortran User Defined: %p\n",ctx->fops.EndOfGen);
+	else
+	    fprintf( fp,"NULL\n");
+    
+
+}
Index: trunk/optimizer/src/pgapack/pgapack/source/restart.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/restart.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/restart.c	(revision 816)
@@ -0,0 +1,330 @@
+/*
+ *  
+ *  ********************************************************************* 
+ *  (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+ *  *********************************************************************
+ *  
+ *  This software was authored by
+ *  
+ *  D. Levine
+ *  Mathematics and Computer Science Division Argonne National Laboratory
+ *  Argonne IL 60439
+ *  levine@mcs.anl.gov
+ *  (708) 252-6735
+ *  (708) 252-5986 (FAX)
+ *  
+ *  with programming assistance of participants in Argonne National 
+ *  Laboratory's SERS program.
+ *  
+ *  This program contains material protectable under copyright laws of the 
+ *  United States.  Permission is hereby granted to use it, reproduce it, 
+ *  to translate it into another language, and to redistribute it to 
+ *  others at no charge except a fee for transferring a copy, provided 
+ *  that you conspicuously and appropriately publish on each copy the 
+ *  University of Chicago's copyright notice, and the disclaimer of 
+ *  warranty and Government license included below.  Further, permission 
+ *  is hereby granted, subject to the same provisions, to modify a copy or 
+ *  copies or any portion of it, and to distribute to others at no charge 
+ *  materials containing or derived from the material.
+ *  
+ *  The developers of the software ask that you acknowledge its use in any 
+ *  document referencing work based on the  program, such as published 
+ *  research.  Also, they ask that you supply to Argonne National 
+ *  Laboratory a copy of any published research referencing work based on 
+ *  the software.
+ *  
+ *  Any entity desiring permission for further use must contact:
+ *  
+ *  J. Gleeson
+ *  Industrial Technology Development Center Argonne National Laboratory
+ *  Argonne IL 60439
+ *  gleesonj@smtplink.eid.anl.gov
+ *  (708) 252-6055
+ *  
+ *  ******************************************************************** 
+ *  DISCLAIMER
+ *  
+ *  THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+ *  OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+ *  THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+ *  WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+ *  RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+ *  INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+ *  INFRINGE PRIVATELY OWNED RIGHTS.
+ *  
+ *  ********************************************************************** 
+ *  GOVERNMENT LICENSE
+ *  
+ *  The Government is granted for itself and others acting on its behalf a 
+ *  paid-up, non-exclusive, irrevocable worldwide license in this computer 
+ *  software to reproduce, prepare derivative works, and perform publicly 
+ *  and display publicly.
+ */
+
+/*****************************************************************************
+*     FILE: restart.c: This file contains the routines needed to handle
+*                      the restart operator, and restarting the GA.
+*
+*     Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle,
+*              Brian P. Walenz
+*****************************************************************************/
+
+#include "pgapack.h"
+
+/*U****************************************************************************
+   PGARestart - reseeds a population from the best string
+
+   Category: Operators
+
+   Inputs:
+      val         - the probability of changing an allele when copying the
+                    best string to the new population
+      source_pop  - the source population
+      dest_pop    - symbolic constant of the destination population
+
+   Outputs:
+      dest_pop is modified by side-effect.
+
+   Example:
+      Perform an unspecified test to determine if the current evolution is
+      not evolving fast enough, and if so, restart the evolution.
+
+      PGAContext *ctx;	    PGAEvaluateMS(ctx, PGA_OLDPOP, f, comm);
+	    PGAFitness   (ctx, PGA_OLDPOP);
+	    }
+
+      :
+      if (StagnantEvolution()) {
+          PGARestart(ctx, PGA_OLDPOP, PGA_NEWPOP);
+          PGAEvaluate(ctx, PGA_NEWPOP, EvalFunc);
+          PGAUpdateGeneration(ctx);
+      }
+
+****************************************************************************U*/
+void PGARestart(PGAContext *ctx, int source_pop, int dest_pop)
+{
+    /* For integers and reals, the amount by which to change is set with
+       PGASetMutationIntegerValue and PGASetMutationRealValue, respectively.
+       For binary strings, the bits are complemented. */
+
+    int dest_p, old_mut_type, source_p;
+    double val;
+    
+    PGADebugEntered("PGARestart");
+    
+    printf("Restarting the algorithm . . . \n");
+    fflush(stdout);
+    source_p = PGAGetBestIndex(ctx, source_pop);
+    if (source_p != 0 || source_pop != dest_pop)
+	PGACopyIndividual(ctx, source_p, source_pop, 0, dest_pop);
+    PGASetEvaluationUpToDateFlag(ctx, 0, dest_pop, PGA_FALSE);
+    old_mut_type = PGAGetMutationType(ctx);
+    ctx->ga.MutationType = PGA_MUTATION_UNIFORM;
+    val = ctx->ga.restartAlleleProb;
+    
+    if (ctx->fops.Mutation) {
+	for (dest_p = 2; dest_p <= ctx->ga.PopSize; dest_p++) {
+	    PGACopyIndividual(ctx, 0, dest_pop, dest_p-1, dest_pop);
+	    (*ctx->fops.Mutation)(&ctx, &dest_p, &dest_pop, &val);
+	    PGASetEvaluationUpToDateFlag(ctx, dest_p-1, dest_pop, PGA_FALSE);
+	}
+    } else {
+	for (dest_p = 1; dest_p < ctx->ga.PopSize; dest_p++) {
+	    PGACopyIndividual(ctx, 0, dest_pop, dest_p, dest_pop);
+	    (*ctx->cops.Mutation)(ctx, dest_p, dest_pop, val);
+	    PGASetEvaluationUpToDateFlag(ctx, dest_p, dest_pop, PGA_FALSE);
+	}
+    }
+    ctx->ga.MutationType = old_mut_type;
+    
+    PGADebugExited("PGARestart");
+}
+
+/*U****************************************************************************
+  PGASetRestartFlag - specifies whether the algorithm should employ
+  the restart operator
+
+   Category: Operators
+
+   Inputs:
+      ctx - context variable
+      val - boolean variable
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx;
+      :
+      PGASetRestartFlag(ctx, PGA_TRUE);
+
+****************************************************************************U*/
+void PGASetRestartFlag(PGAContext *ctx, int val)
+{
+    PGADebugEntered("PGASetRestartFlag");
+
+    switch (val)
+    {
+    case PGA_TRUE:
+    case PGA_FALSE:
+         ctx->ga.restart = val;
+         break;
+    default:
+         PGAError(ctx, "PGASetRestartFlag: Invalid value for restart:",
+                  PGA_FATAL, PGA_INT, (void *) &val);
+         break;
+    }
+
+    PGADebugExited("PGASetRestartFlag");
+}
+
+/*U****************************************************************************
+   PGAGetRestartFlag - returns whether the algorithm should employ the
+   restart operator
+
+   Category: Operators
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      PGA_TRUE if restarting is enabled, otherwise PGA_FALSE.
+
+   Example:
+      PGAContext *ctx;
+      int val;
+      :
+      val = PGAGetRestartFlag(ctx);
+
+****************************************************************************U*/
+int PGAGetRestartFlag(PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetRestartFlag");
+    PGAFailIfNotSetUp("PGAGetRestartFlag");
+
+    PGADebugExited("PGAGetRestartFlag");
+
+    return (ctx->ga.restart);
+}
+
+/*U****************************************************************************
+  PGASetRestartFrequencyValue - specifies the number of iterations of no
+  change in the best string after which the algorithm should restart
+
+  Category: Operators
+
+  Inputs:
+      ctx - context variable
+      numiter - number of changeless iterations
+
+  Outputs:
+      None
+
+  Example:
+      PGAContext *ctx;
+      :
+      PGASetRestartFrequencyValue(ctx, 100);
+
+****************************************************************************U*/
+void PGASetRestartFrequencyValue(PGAContext *ctx, int numiter)
+{
+    PGADebugEntered("PGASetRestartFrequencyValue");
+
+    if (numiter > 0)
+         ctx->ga.restartFreq = numiter;
+    else
+         PGAError(ctx, "PGASetRestartFrequencyValue: Invalid value for "
+                  "restart freqency:", PGA_FATAL, PGA_INT, (void *) &numiter);
+
+    PGADebugExited("PGASetRestartFrequencyValue");
+}
+
+/*U****************************************************************************
+  PGAGetRestartFrequencyValue - returns the number of iterations of no
+  change in the best string after which the algorithm should restart
+
+  Category: Operators
+
+  Inputs:
+      ctx     - context variable
+      numiter - number of changeless iterations
+
+  Outputs:
+      The number of iteration of no change required for a restart.
+
+  Example:
+      PGAContext *ctx;
+      :
+      numiter = PGAGetRestartFrequencyValue(ctx);
+
+****************************************************************************U*/
+int PGAGetRestartFrequencyValue(PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetRestartFrequencyValue");
+    PGAFailIfNotSetUp("PGAGetRestartFrequencyValue");
+
+    PGADebugExited("PGAGetRestartFrequencyValue");
+
+    return (ctx->ga.restartFreq);
+}
+
+/*U****************************************************************************
+  PGASetRestartAlleleChangeProb - specifies the probability with which
+  an allele will be mutated during a restart
+
+  Category: Operators
+
+  Inputs:
+      ctx - context variable
+      prob - probability of mutation
+
+  Outputs:
+      None
+
+  Example:
+      PGAContext *ctx;
+      :
+      PGASetRestartAlleleChangeProb(ctx, 0.5);
+
+****************************************************************************U*/
+void PGASetRestartAlleleChangeProb(PGAContext *ctx, double prob)
+{
+    PGADebugEntered("PGASetRestartAlleleChangeProb");
+
+    if (prob >= 0.0 && prob <= 1.0)
+         ctx->ga.restartAlleleProb = prob;
+    else
+         PGAError(ctx, "PGASetRestartAlleleChangeProb: Invalid probability:",
+                  PGA_FATAL, PGA_DOUBLE, (void *) &prob);
+
+    PGADebugExited("PGASetRestartAlleleChangeProb");
+}
+
+/*U****************************************************************************
+  PGAGetRestartAlleleChangeProb - returns the probability with which
+  an allele will be mutated during a restart
+
+  Category: Operators
+
+  Inputs:
+      ctx - context variable
+
+  Outputs:
+      The probability of mutating an allele during a restart.
+
+  Example:
+      PGAContext *ctx;
+      :
+      prob = PGASetRestartAlleleChangeProb(ctx);
+
+****************************************************************************U*/
+double PGAGetRestartAlleleChangeProb(PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetRestartAlleleChangeProb");
+    PGAFailIfNotSetUp("PGAGetRestartAlleleChangeProb");
+
+    PGADebugExited("PGAGetRestartAlleleChangeProb");
+
+    return (ctx->ga.restartAlleleProb);
+}
+
Index: trunk/optimizer/src/pgapack/pgapack/source/select.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/select.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/select.c	(revision 816)
@@ -0,0 +1,502 @@
+/*
+ *  
+ *  ********************************************************************* 
+ *  (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+ *  *********************************************************************
+ *  
+ *  This software was authored by
+ *  
+ *  D. Levine
+ *  Mathematics and Computer Science Division Argonne National Laboratory
+ *  Argonne IL 60439
+ *  levine@mcs.anl.gov
+ *  (708) 252-6735
+ *  (708) 252-5986 (FAX)
+ *  
+ *  with programming assistance of participants in Argonne National 
+ *  Laboratory's SERS program.
+ *  
+ *  This program contains material protectable under copyright laws of the 
+ *  United States.  Permission is hereby granted to use it, reproduce it, 
+ *  to translate it into another language, and to redistribute it to 
+ *  others at no charge except a fee for transferring a copy, provided 
+ *  that you conspicuously and appropriately publish on each copy the 
+ *  University of Chicago's copyright notice, and the disclaimer of 
+ *  warranty and Government license included below.  Further, permission 
+ *  is hereby granted, subject to the same provisions, to modify a copy or 
+ *  copies or any portion of it, and to distribute to others at no charge 
+ *  materials containing or derived from the material.
+ *  
+ *  The developers of the software ask that you acknowledge its use in any 
+ *  document referencing work based on the  program, such as published 
+ *  research.  Also, they ask that you supply to Argonne National 
+ *  Laboratory a copy of any published research referencing work based on 
+ *  the software.
+ *  
+ *  Any entity desiring permission for further use must contact:
+ *  
+ *  J. Gleeson
+ *  Industrial Technology Development Center Argonne National Laboratory
+ *  Argonne IL 60439
+ *  gleesonj@smtplink.eid.anl.gov
+ *  (708) 252-6055
+ *  
+ *  ******************************************************************** 
+ *  DISCLAIMER
+ *  
+ *  THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+ *  OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+ *  THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+ *  WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+ *  RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+ *  INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+ *  INFRINGE PRIVATELY OWNED RIGHTS.
+ *  
+ *  ********************************************************************** 
+ *  GOVERNMENT LICENSE
+ *  
+ *  The Government is granted for itself and others acting on its behalf a 
+ *  paid-up, non-exclusive, irrevocable worldwide license in this computer 
+ *  software to reproduce, prepare derivative works, and perform publicly 
+ *  and display publicly.
+ */
+
+/*****************************************************************************
+*     FILE: select.c: This file contains the routines that have to do with
+*                     selection
+*
+*     Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle,
+*              Brian P. Walenz
+*****************************************************************************/
+
+#include "pgapack.h"
+
+/*U****************************************************************************
+  PGASelect - performs genetic algorithm selection using either the default
+  selection scheme or that specified with PGASetSelectType().  Valid selection
+  methods are proportional, stochastic universal, tournament, or probabilistic
+  tournament selection, PGA_SELECT_PROPORTIONAL, PGA_SELECT_SUS, 
+  PGA_SELECT_TOURNAMENT, and PGA_SELECT_PTOURNAMENT, respectively.  This 
+  function updates an internal array with the indices of members of popix 
+  selected for recombination.  These indices may be accessed with 
+  PGASelectNextIndex()
+
+  Category: Operators
+
+  Inputs:
+    ctx   - context variable
+    popix - symbolic constant of population to select from
+
+  Outputs:
+    An array used by PGASelectNextIndex() is created which contains the
+    population indices of the selected individuals.
+
+  Example:
+    PGAContext *ctx,
+    :
+    PGASelect(ctx, PGA_OLDPOP);
+
+****************************************************************************U*/
+void PGASelect( PGAContext *ctx, int popix )
+{
+    int i;                   /* not to intefere with dummy argument        */
+    int j;                   /* random number                              */
+    int temp;                /* for shuffling selected indices US          */
+    PGAIndividual *pop;      /* pointer to appropriate population          */
+
+    PGADebugEntered("PGASelect");
+
+    pop = PGAGetIndividual(ctx, 0, popix);
+
+    switch (ctx->ga.SelectType) {
+
+    case PGA_SELECT_PROPORTIONAL:  /* proportional selection             */
+        for (i=0; i<ctx->ga.PopSize; i++)
+            ctx->ga.selected[i] = PGASelectProportional( ctx, pop );
+        break;
+    case PGA_SELECT_SUS:           /* stochastic universal selection     */
+        PGASelectSUS( ctx, pop );
+        break;
+    case PGA_SELECT_TOURNAMENT:    /* tournament selection               */
+        for (i=0; i<ctx->ga.PopSize; i++)
+            ctx->ga.selected[i] = PGASelectTournament( ctx, pop );
+        break;
+    case PGA_SELECT_PTOURNAMENT:   /* probabilistic tournament selection */
+        for (i=0; i<ctx->ga.PopSize; i++)
+            ctx->ga.selected[i] = PGASelectPTournament( ctx, pop );
+        break;
+    default:
+        PGAError( ctx,
+                 "PGASelect: Invalid value of SelectType:",
+                  PGA_FATAL,
+                  PGA_INT,
+                  (void *) &(ctx->ga.SelectType) );
+        break;
+    }
+
+    /* randomize selected string locations */
+    for (i=0; i<ctx->ga.PopSize; i++) {
+        j          = PGARandomInterval(ctx, 0,ctx->ga.PopSize-1);
+        temp       = ctx->ga.selected[j];
+        ctx->ga.selected[j] = ctx->ga.selected[i];
+        ctx->ga.selected[i] = temp;
+    }
+
+    PGADebugExited("PGASelect");
+}
+
+/*U****************************************************************************
+  PGASelectNextIndex - returns the index of next individual in
+  internal array that contains the indices determined by PGASelect
+
+  Category: Operators
+
+  Inputs:
+    ctx   - context variable
+
+  Outputs:
+    A population index for the next selected creature.
+
+  Example:
+    PGAContext *ctx;
+    int l;
+    :
+    l = PGASelectNextIndex(ctx, PGA_OLDPOP);
+
+****************************************************************************U*/
+int PGASelectNextIndex ( PGAContext *ctx )
+{
+    PGADebugEntered("PGASelectNextIndex");
+
+    if (ctx->ga.SelectIndex < ctx->ga.PopSize) {
+	PGADebugExited("PGASelectNextIndex");
+        return(ctx->ga.selected[ctx->ga.SelectIndex++]);
+    }
+
+    /*  Oops.  We never found the index.  Fatal error.  (return is here
+     *  so that compilers will be quiet.)
+     */
+    PGAError( ctx, "PGASelectNextIndex: SelectIndex >= ctx->ga.PopSize",
+             PGA_FATAL, PGA_INT, (void *) &ctx->ga.SelectIndex );
+    return(0);
+}
+
+/*U****************************************************************************
+   PGASetSelectType - specify the type of selection to use. Valid choices
+   are PGA_SELECT_PROPORTIONAL, PGA_SELECT_SUS, PGA_SELECT_TOURNAMENT, and
+   PGA_SELECT_PTOURNAMENT for proportional, stochastic universal selection,
+   tournament, and probabilistic tournament selection, respectively.  The
+   default is PGA_SELECT_TOURNAMENT.
+
+   Category: Operators
+
+   Inputs:
+      ctx         - context variable
+      select_type - symbolic constant to specify selection type
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx;
+      :
+      PGASetSelectType(ctx, PGA_SELECT_SUS);
+
+****************************************************************************U*/
+void PGASetSelectType( PGAContext *ctx, int select_type)
+{
+
+    PGADebugEntered("PGASetSelectType");
+
+    switch (select_type) {
+        case PGA_SELECT_PROPORTIONAL:
+        case PGA_SELECT_SUS:
+        case PGA_SELECT_TOURNAMENT:
+        case PGA_SELECT_PTOURNAMENT:
+            ctx->ga.SelectType = select_type;
+            break;
+        default:
+            PGAError ( ctx, "PGASetSelectType: Invalid value of select_type:",
+                      PGA_FATAL, PGA_INT, (void *) &select_type);
+        break;
+    }
+
+    PGADebugExited("PGASetSelectType");
+}
+
+/*U***************************************************************************
+   PGAGetSelectType - Returns the type of selection selected
+
+   Category: Operators
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      Returns the integer corresponding to the symbolic constant
+      used to specify the type of selection specified
+
+   Example:
+      PGAContext *ctx;
+      int selecttype;
+      :
+      selecttype = PGAGetSelectType(ctx);
+      switch (selecttype) {
+      case PGA_SELECT_PROPORTIONAL:
+          printf("Selection Type = PGA_SELECT_PROPORTIONAL\n");
+          break;
+      case PGA_SELECT_SUS:
+          printf("Selection Type = PGA_SELECT_SUS\n");
+          break;
+      case PGA_SELECT_TOURNAMENT:
+          printf("Selection Type = PGA_SELECT_TOURNAMENT\n");
+          break;
+      case PGA_SELECT_PTOURNAMENT:
+          printf("Selection Type = PGA_SELECT_PTOURNAMENT\n");
+          break;
+      }
+
+***************************************************************************U*/
+int PGAGetSelectType (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetSelectType");
+    PGAFailIfNotSetUp("PGAGetSelectType");
+
+    PGADebugExited("PGAGetSelectType");
+
+    return(ctx->ga.SelectType);
+}
+
+
+/*U****************************************************************************
+   PGASetPTournamentProb - Specifies the probability that the string that wins
+   a binary tournament will be selected.  This function will have no effect
+   unless PGA_SELECT_PTOURNAMENT was specified as the type of selection to
+   use with PGASetSelectType.  The default value is 0.6.
+
+   Category: Operators
+
+   Inputs:
+      ctx - context variable
+      p   - the probability of selecting the better string
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx;
+      :
+      PGASetPTournamentProb(ctx,0.8);
+
+****************************************************************************U*/
+void PGASetPTournamentProb(PGAContext *ctx, double ptournament_prob)
+{
+    PGADebugEntered("PGASetPTournamentProb");
+
+    ctx->ga.PTournamentProb = ptournament_prob;
+
+    PGADebugExited("PGASetPTournamentProb");
+}
+
+/*U***************************************************************************
+   PGAGetPTournamentProb - returns the probability of selecting the best
+   string in a probabilistic binary tournament
+
+   Category: Operators
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      The probabilistic binary tournament selection probability
+
+   Example:
+      PGAContext *ctx;
+      double pt;
+      :
+      pt = PGAGetPTournamentProb(ctx);
+
+***************************************************************************U*/
+double PGAGetPTournamentProb(PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetPTournamentProb");
+    PGAFailIfNotSetUp("PGAGetPTournamentProb");
+
+    PGADebugExited("PGAGetPTournamentProb");
+
+     return ctx->ga.PTournamentProb;
+}
+
+
+/*I****************************************************************************
+  PGASelectProportional - selects a parent for the next generation using a
+  linear search through a (fitness) weighted ``roulette wheel''.  The
+  probability of selection is given by p_i = f_i/sum(i)f_i
+  Ref: D. Goldberg, Genetic Algorithms, pg.
+
+  Inputs:
+    ctx   - context variable
+    popix - symbolic constant of population to select from
+
+  Outputs:
+    index of the selected string
+
+  Example:
+    PGAContext *ctx,
+    int l;
+    :
+    l = PGASelectProportional(ctx, PGA_OLDPOP);
+
+****************************************************************************I*/
+int PGASelectProportional(PGAContext *ctx, PGAIndividual *pop)
+{
+    double sum, sumfitness, r;
+    int i;
+
+    PGADebugEntered("PGASelectProportional");
+
+    sumfitness = 0.0;
+    for (i=0; i<ctx->ga.PopSize; i++)
+        sumfitness += (pop+i)->fitness;
+
+    i = 0;
+    sum = (pop+i)->fitness;
+
+    r = sumfitness * PGARandom01(ctx, 0);
+    while(r > sum || i==ctx->ga.PopSize) {
+        i++;
+        sum += (pop+i)->fitness;
+    }
+
+    PGADebugExited("PGASelectProportional");
+
+    return(i);
+}
+
+/*I****************************************************************************
+  PGASelectSUS - A select routine using stochastic universal sampling
+  Ref:    J. Baker, Reducing Bias and Inefficiency in the Selection Algorithm.
+  Second GA conference, pp 14-21 (page 16)
+
+  Inputs:
+    ctx   - context variable
+    popix - symbolic constant of population to select from
+
+  Outputs:
+    the array ga.selected[] created via side effect.  I.e., this routine
+    creates the entire selected population with one call
+
+  Example:
+    PGAContext *ctx,
+    :
+    PGASelectSUS(ctx, PGA_OLDPOP);
+
+****************************************************************************I*/
+void PGASelectSUS( PGAContext *ctx, PGAIndividual *pop )
+{
+    int i;
+    int k;                          /* index to fill samples array    */
+    double davg;                    /* population average fitness     */
+    double sum;                     /* running sum of expected values */
+    double r;                       /* random number                  */
+
+    PGADebugEntered("PGASelectSUS");
+
+    /* fill the expected value array */
+    davg = 0.0;
+    for(i=0;i<ctx->ga.PopSize;i++)
+        davg += (pop+i)->fitness;
+    davg /=  (double) ctx->ga.PopSize;
+    for(i=0;i<ctx->ga.PopSize;i++)
+        ctx->scratch.dblscratch[i] = (pop+i)->fitness / davg;
+
+    /* select ctx->ga.PopSize as follows */
+    sum = 0;
+    k   = 0;
+    r   = PGARandom01(ctx, 0);
+    for(i=0;i<ctx->ga.PopSize;i++)
+        for( sum+=ctx->scratch.dblscratch[i]; sum>r; r++ )
+            ctx->ga.selected[k++] = i;
+
+    PGADebugExited("PGASelectSUS");
+}
+
+
+/*I****************************************************************************
+  PGASelectTournament - chooses two strings randomly and returns the one with
+  higher fitness
+  Ref:    D. Goldberg, Genetic Algorithms, pg. 121
+
+  Inputs:
+    ctx   - context variable
+    popix - symbolic constant of population to select from
+
+  Outputs:
+    index of the selected string
+
+  Example:
+    PGAContext *ctx,
+    int l;
+    :
+    l = PGASelectTournament(ctx, PGA_OLDPOP);
+
+****************************************************************************I*/
+int PGASelectTournament( PGAContext *ctx, PGAIndividual *pop )
+{
+    int m1, m2;
+
+    PGADebugEntered("PGASelectTournament");
+
+    m1 = PGARandomInterval(ctx, 0, ctx->ga.PopSize-1);
+    m2 = PGARandomInterval(ctx, 0, ctx->ga.PopSize-1);
+
+    PGADebugExited("PGASelectTournament");
+
+    return( ((pop+m1)->fitness > (pop+m2)->fitness) ? m1 : m2);
+}
+
+/*I****************************************************************************
+  PGASelectPTournament - chooses two strings randomly and returns the one with
+  higher fitness with a specified probability
+  Ref:    D. Goldberg, Genetic Algorithms, pg. 121
+
+  Inputs:
+    ctx   - context variable
+    popix - symbolic constant of population to select from
+
+  Outputs:
+    index of the selected string
+
+  Example:
+    PGAContext *ctx,
+    int l;
+    :
+    l = PGASelectPTournament(ctx, PGA_OLDPOP);
+
+****************************************************************************I*/
+int PGASelectPTournament( PGAContext *ctx, PGAIndividual *pop )
+{
+    int m1, m2;
+    int RetVal;
+
+    PGADebugEntered("PGASelectPTournament");
+
+    m1 = PGARandomInterval(ctx, 0, ctx->ga.PopSize-1);
+    m2 = PGARandomInterval(ctx, 0, ctx->ga.PopSize-1);
+
+    if ( (pop+m1)->fitness > (pop+m2)->fitness )
+        if ( (double) PGARandom01(ctx, 0) < ctx->ga.PTournamentProb )
+            RetVal = m1;
+        else
+            RetVal = m2;
+    else
+        if ( (double) PGARandom01(ctx, 0) < ctx->ga.PTournamentProb )
+            RetVal = m2;
+        else
+            RetVal = m1;
+
+    PGADebugExited("PGASelectPTournament");
+    return(RetVal);
+}
+
+
Index: trunk/optimizer/src/pgapack/pgapack/source/stop.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/stop.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/stop.c	(revision 816)
@@ -0,0 +1,378 @@
+/*
+ *  
+ *  ********************************************************************* 
+ *  (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+ *  *********************************************************************
+ *  
+ *  This software was authored by
+ *  
+ *  D. Levine
+ *  Mathematics and Computer Science Division Argonne National Laboratory
+ *  Argonne IL 60439
+ *  levine@mcs.anl.gov
+ *  (708) 252-6735
+ *  (708) 252-5986 (FAX)
+ *  
+ *  with programming assistance of participants in Argonne National 
+ *  Laboratory's SERS program.
+ *  
+ *  This program contains material protectable under copyright laws of the 
+ *  United States.  Permission is hereby granted to use it, reproduce it, 
+ *  to translate it into another language, and to redistribute it to 
+ *  others at no charge except a fee for transferring a copy, provided 
+ *  that you conspicuously and appropriately publish on each copy the 
+ *  University of Chicago's copyright notice, and the disclaimer of 
+ *  warranty and Government license included below.  Further, permission 
+ *  is hereby granted, subject to the same provisions, to modify a copy or 
+ *  copies or any portion of it, and to distribute to others at no charge 
+ *  materials containing or derived from the material.
+ *  
+ *  The developers of the software ask that you acknowledge its use in any 
+ *  document referencing work based on the  program, such as published 
+ *  research.  Also, they ask that you supply to Argonne National 
+ *  Laboratory a copy of any published research referencing work based on 
+ *  the software.
+ *  
+ *  Any entity desiring permission for further use must contact:
+ *  
+ *  J. Gleeson
+ *  Industrial Technology Development Center Argonne National Laboratory
+ *  Argonne IL 60439
+ *  gleesonj@smtplink.eid.anl.gov
+ *  (708) 252-6055
+ *  
+ *  ******************************************************************** 
+ *  DISCLAIMER
+ *  
+ *  THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+ *  OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+ *  THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+ *  WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+ *  RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+ *  INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+ *  INFRINGE PRIVATELY OWNED RIGHTS.
+ *  
+ *  ********************************************************************** 
+ *  GOVERNMENT LICENSE
+ *  
+ *  The Government is granted for itself and others acting on its behalf a 
+ *  paid-up, non-exclusive, irrevocable worldwide license in this computer 
+ *  software to reproduce, prepare derivative works, and perform publicly 
+ *  and display publicly.
+ */
+
+/*****************************************************************************
+*     FILE: stop.c: This file contains routines related to the stopping
+*                   conditions for the GA.
+*
+*     Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle,
+*              Brian P. Walenz
+*****************************************************************************/
+
+#include "pgapack.h"
+
+/*U****************************************************************************
+  PGADone - Returns PGA_TRUE if the stopping conditions have been met,
+  otherwise returns false.  Calls exactly one of the user defined C or
+  fortran or system (PGACheckStoppingConditions) stopping condition functions.
+
+  Category: Generation
+
+  Inputs:
+     ctx  - context variable
+     comm - an MPI communicator
+
+  Outputs:
+     returns PGA_TRUE if at least one of the termination conditions has been
+     met.  Otherwise, returns PGA_FALSE
+
+  Example:
+    PGAContext *ctx;
+    :
+    PGADone(ctx, comm);
+
+****************************************************************************U*/
+int PGADone(PGAContext *ctx, MPI_Comm comm)
+{
+    int rank, size, done;
+
+    PGADebugEntered("PGADone");
+
+    rank = PGAGetRank(ctx, comm);
+    size = PGAGetNumProcs(ctx, comm);
+
+    if (rank == 0) {
+	if (ctx->fops.StopCond)
+	    done = (*ctx->fops.StopCond)(&ctx);
+	else if (ctx->cops.StopCond)
+	    done = (*ctx->cops.StopCond)(ctx);
+	else
+	    done = PGACheckStoppingConditions(ctx);
+    }
+
+    if (size > 1)
+	MPI_Bcast(&done, 1, MPI_INT, 0, comm);
+
+    PGADebugExited("PGADone");
+
+    return(done);
+}
+
+/*U****************************************************************************
+  PGACheckStoppingConditions - returns boolean to indicate if the PGAPack
+  termination conditions -- PGA_STOP_MAXITER, PGA_STOP_TOOSIMILAR, 
+  PGA_STOP_NOCHANGE -- have been met.
+
+  Category: Generation
+
+  Inputs:
+     ctx  - context variable
+
+  Outputs:
+     returns PGA_TRUE if at least one of the termination conditions has been
+     met.  Otherwise, returns PGA_FALSE
+
+  Example:
+    PGAContext *ctx;
+    :
+    PGACheckStoppingConditions(ctx);
+
+****************************************************************************U*/
+int PGACheckStoppingConditions( PGAContext *ctx)
+{
+    int done = PGA_FALSE;
+
+    PGADebugEntered("PGACheckStoppingConditions");
+
+    if (((ctx->ga.StoppingRule & PGA_STOP_MAXITER) == PGA_STOP_MAXITER) &&
+	(ctx->ga.iter > ctx->ga.MaxIter))
+	done |= PGA_TRUE;
+    
+    if (((ctx->ga.StoppingRule & PGA_STOP_NOCHANGE) == PGA_STOP_NOCHANGE) &&
+	(ctx->ga.ItersOfSame >= ctx->ga.MaxNoChange))
+	done |= PGA_TRUE;
+	
+    if (((ctx->ga.StoppingRule & PGA_STOP_TOOSIMILAR) == PGA_STOP_TOOSIMILAR) &&
+	(ctx->ga.PercentSame >= ctx->ga.MaxSimilarity))
+	done |= PGA_TRUE;
+
+    PGADebugExited("PGACheckStoppingConditions");
+    return(done);
+}
+
+/*U****************************************************************************
+   PGASetStoppingRuleType - specify a stopping criterion.  If called more than
+   once the different stopping criterion are ORed together.  Valid choices
+   are PGA_STOP_MAXITER, PGA_STOP_TOOSIMILAR, or PGA_STOP_NOCHANGE to
+   specify iteration limit reached, population too similar, or no change in
+   the best solution found in a given number of iterations, respectively.
+   The default is to stop when a maximum iteration limit is reached (by
+   default, 1000 iterations).
+
+   Category: Generation
+
+   Inputs:
+      ctx      - context variable
+      stoprule - symbolic constant to specify stopping rule
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx;
+      :
+      PGASetStoppingRuleType(ctx, PGA_STOP_TOOSIMILAR);
+
+****************************************************************************U*/
+void PGASetStoppingRuleType (PGAContext *ctx, int stoprule)
+{
+
+    PGADebugEntered("PGASetStoppingRuleType");
+    PGAFailIfSetUp("PGASetStoppingRuleType");
+
+    switch (stoprule) {
+	case PGA_STOP_MAXITER  :
+        case PGA_STOP_NOCHANGE :
+	case PGA_STOP_TOOSIMILAR :
+	    ctx->ga.StoppingRule |= stoprule;
+	    break;
+	default:
+	    PGAError( ctx,
+		     "PGASetStoppingRuleType: Invalid value of stoprule:",
+		     PGA_FATAL, PGA_INT, (void *) &stoprule );
+    }
+
+    PGADebugExited("PGASetStoppingRuleType");
+}
+
+/*U***************************************************************************
+   PGAGetStoppingRuleType - Returns a symbolic constant that defines the
+   termination criteria.
+
+   Category: Generation
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      Returns an integer which is an ORed mask of the symbolic constants
+      used to specify the stopping rule(s).
+
+   Example:
+      PGAContext *ctx;
+      int stop;
+      :
+      stop = PGAGetStoppingRuleType(ctx);
+      if (stop & PGA_STOP_MAXITER)
+          printf("Stopping Rule = PGA_STOP_MAXITER\n");
+      if (stop & PGA_STOP_NOCHANGE)
+          printf("Stopping Rule = PGA_STOP_NOCHANGE\n");
+      if (stop & PGA_STOP_TOOSIMILAR)
+          printf("Stopping Rule = PGA_STOP_TOOSIMILAR\n");
+
+***************************************************************************U*/
+int PGAGetStoppingRuleType (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetStoppingRuleType");
+    PGAFailIfNotSetUp("PGAGetStoppingRuleType");
+
+    PGADebugExited("PGAGetStoppingRuleType");
+
+    return(ctx->ga.StoppingRule);
+}
+
+/*U****************************************************************************
+   PGASetMaxGAIterValue - specify the maximum number of iterations for the
+   stopping rule PGA_STOP_MAXITER (which, by itself, is the default stopping
+   rule and is always in effect).  The default value is 1000 iterations.
+
+   Category: Generation
+
+   Inputs:
+      ctx     - context variable
+      maxiter - the maximum number of GA iterations to run before stopping
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx;
+      :
+      PGASetMaxGAIterValue(ctx,5000);
+
+****************************************************************************U*/
+void PGASetMaxGAIterValue(PGAContext *ctx, int maxiter)
+{
+
+    PGADebugEntered("PGASetMaxGAIterValue");
+    PGAFailIfSetUp("PGASetMaxGAIterValue");
+
+    if (maxiter < 1)
+	PGAError( ctx, "PGASetMaxGAIterValue: Invalid value of maxiter:",
+		 PGA_FATAL, PGA_INT, (void *) &maxiter );
+    else
+	ctx->ga.MaxIter = maxiter;
+    
+    PGADebugExited("PGASetMaxGAIterValue");
+}
+
+/*U***************************************************************************
+   PGAGetMaxGAIterValue - Returns the maximum number of iterations to run
+
+   Category: Generation
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      The maximum number of iterations to run
+
+   Example:
+      PGAContext *ctx;
+      int maxiter;
+      :
+      maxiter = PGAGetMaxGAIterValue(ctx);
+
+***************************************************************************U*/
+int PGAGetMaxGAIterValue (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetMaxGAIterValue");
+    PGAFailIfNotSetUp("PGAGetMaxGAIterValue");
+
+    PGADebugExited("PGAGetMaxGAIterValue");
+
+    return(ctx->ga.MaxIter);
+}
+
+/*U****************************************************************************
+   PGASetMaxNoChangeValue - specifiy maximum number of iterations of no change
+   in the evaluation function value of the best string before stopping.  The
+   default value is 50.  The stopping rule PGA_STOP_NOCHANGE must have been
+   set by PGASetStoppingRuleType for this function call to have any effect.
+
+   Category: Generation
+
+   Inputs:
+      ctx     - context variable
+      maxiter - the maximum number of GA iterations allowed with no change
+                in the best evaluation function value.
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx;
+      :
+      PGASetMaxGAIterValue(ctx,5000);
+
+****************************************************************************U*/
+void PGASetMaxNoChangeValue(PGAContext *ctx, int max_no_change)
+{
+    PGADebugEntered("PGASetMaxNoChangeValue");
+    PGAFailIfSetUp("PGASetMaxNoChangeValue");
+
+    if (max_no_change <= 0)
+	PGAError(ctx, "PGASetMaxNoChangeValue: max_no_change invalid",
+		 PGA_FATAL, PGA_INT, (void *)&max_no_change);
+    
+    ctx->ga.MaxNoChange = max_no_change;
+    
+    PGADebugExited("PGASetMaxNoChangeValue");
+}
+
+/*U****************************************************************************
+   PGASetMaxSimilarityValue - Specifiy the maximum percent of homogeneity of
+   the population before stopping.  The similarity measure is the same
+   evaluation function value.  The default value is 95 percent.  The stopping
+   rule PGA_STOP_TOOSIMILAR must have been set by PGASetStoppingRuleType for
+   this function call to have any effect.
+
+   Category: Generation
+
+   Inputs:
+      ctx            - context variable
+      max_similarity - the maximum percent of the population that can share
+                       the same evaluation function value
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx;
+      :
+      PGASetMaxSimilarityValue(ctx,99);
+
+****************************************************************************U*/
+void PGASetMaxSimilarityValue(PGAContext *ctx, int max_similarity)
+{
+    PGADebugEntered("PGASetMaxSimilarityValue");
+    PGAFailIfSetUp("PGASetMaxSimilarityValue");
+
+    if ((max_similarity <= 0) || (max_similarity > 100))
+        PGAError(ctx, "PGASetMaxSimilarityValue: max_similarity invalid",
+                 PGA_FATAL, PGA_INT, (void *) &max_similarity);
+    
+    ctx->ga.MaxSimilarity = max_similarity;
+
+    PGADebugExited("PGASetMaxSimilarityValue");
+}
Index: trunk/optimizer/src/pgapack/pgapack/source/system.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/system.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/system.c	(revision 816)
@@ -0,0 +1,376 @@
+/*
+ *  
+ *  ********************************************************************* 
+ *  (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+ *  *********************************************************************
+ *  
+ *  This software was authored by
+ *  
+ *  D. Levine
+ *  Mathematics and Computer Science Division Argonne National Laboratory
+ *  Argonne IL 60439
+ *  levine@mcs.anl.gov
+ *  (708) 252-6735
+ *  (708) 252-5986 (FAX)
+ *  
+ *  with programming assistance of participants in Argonne National 
+ *  Laboratory's SERS program.
+ *  
+ *  This program contains material protectable under copyright laws of the 
+ *  United States.  Permission is hereby granted to use it, reproduce it, 
+ *  to translate it into another language, and to redistribute it to 
+ *  others at no charge except a fee for transferring a copy, provided 
+ *  that you conspicuously and appropriately publish on each copy the 
+ *  University of Chicago's copyright notice, and the disclaimer of 
+ *  warranty and Government license included below.  Further, permission 
+ *  is hereby granted, subject to the same provisions, to modify a copy or 
+ *  copies or any portion of it, and to distribute to others at no charge 
+ *  materials containing or derived from the material.
+ *  
+ *  The developers of the software ask that you acknowledge its use in any 
+ *  document referencing work based on the  program, such as published 
+ *  research.  Also, they ask that you supply to Argonne National 
+ *  Laboratory a copy of any published research referencing work based on 
+ *  the software.
+ *  
+ *  Any entity desiring permission for further use must contact:
+ *  
+ *  J. Gleeson
+ *  Industrial Technology Development Center Argonne National Laboratory
+ *  Argonne IL 60439
+ *  gleesonj@smtplink.eid.anl.gov
+ *  (708) 252-6055
+ *  
+ *  ******************************************************************** 
+ *  DISCLAIMER
+ *  
+ *  THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+ *  OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+ *  THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+ *  WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+ *  RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+ *  INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+ *  INFRINGE PRIVATELY OWNED RIGHTS.
+ *  
+ *  ********************************************************************** 
+ *  GOVERNMENT LICENSE
+ *  
+ *  The Government is granted for itself and others acting on its behalf a 
+ *  paid-up, non-exclusive, irrevocable worldwide license in this computer 
+ *  software to reproduce, prepare derivative works, and perform publicly 
+ *  and display publicly.
+ */
+
+/*****************************************************************************
+*     FILE: system.c: This file contains systme routines such as errors and
+*                     exits
+*
+*     Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle,
+*              Brian P. Walenz
+*****************************************************************************/
+
+#include "pgapack.h"
+
+char PGAProgram[100];    /* Holds argv[0] for PGAUsage() call */
+
+/*U****************************************************************************
+   PGAError - reports error messages.  Prints out the message supplied, and
+   the value of a piece of data.  Terminates if PGA_FATAL.
+
+   Category: System
+
+   Inputs:
+      ctx      - context variable
+      msg      - the error message to print
+      level    - PGA_WARNING or PGA_FATAL to indicate the error's severity
+      datatype - the data type of the following argument
+      data     - the address of the data to be written out, cast as a void
+                 pointer
+
+   Outputs:
+      None
+
+   Example:
+      PGAContext *ctx;
+      int         val;
+      :
+      PGAError(ctx, "Some Non Fatal Error: val = ", PGA_WARNING, PGA_INT,
+               (void *) &val);
+      :
+      PGAError(ctx, "A Fatal Error!", PGA_FATAL, PGA_VOID, NULL);
+
+****************************************************************************U*/
+void PGAError( PGAContext *ctx, char *msg,
+               int level, int datatype, void *data )
+{
+
+    PGADebugEntered("PGAError");
+
+    switch (datatype) {
+      case PGA_INT:
+	fprintf(stderr, "%s %d\n", msg, *(int *)    data);
+	break;
+      case PGA_DOUBLE:
+	fprintf(stderr, "%s %f\n", msg, *(double *) data);
+	break;
+      case PGA_CHAR:
+	fprintf(stderr, "%s %s\n", msg,  (char *)   data);
+	break;
+      case PGA_VOID:
+	fprintf(stderr, "%s\n", msg);
+	break;
+    }
+    if ( level == PGA_FATAL ) {
+	fprintf(stderr, "PGAError: Fatal\n");
+	PGADestroy(ctx);
+	exit(-1);
+    }
+    PGADebugExited("PGAError");
+}
+
+/*U****************************************************************************
+  PGADestroy - deallocate memory for this instance of PGAPack, if this context
+  initialized MPI, finalize MPI as well.
+
+  Category: Generation
+
+  Inputs:
+     ctx   - context variable
+
+  Outputs:
+     None
+
+  Example:
+    PGAContext *ctx;
+    :
+    PGADestroy(ctx);
+
+****************************************************************************U*/
+void PGADestroy (PGAContext *ctx)
+{
+    int i;
+
+    PGADebugEntered("PGADestroy");
+
+    /*  These are allocated by PGASetUp.  Free then only if PGASetUp
+     *  was called.
+     */
+    if (ctx->sys.SetUpCalled == PGA_TRUE) {
+      /*  Free the population...fly little birdies!  You're FREE!!!  */
+      for ( i = 0; i < ctx->ga.PopSize + 2; i++ ) {
+        free ( ctx->ga.oldpop[i].chrom );
+        free ( ctx->ga.newpop[i].chrom );
+      }
+      free ( ctx->ga.oldpop );
+      free ( ctx->ga.newpop );
+
+      /*  Free the scratch space.  */
+      free ( ctx->scratch.intscratch );
+      free ( ctx->scratch.dblscratch );
+      free ( ctx->ga.selected );
+      free ( ctx->ga.sorted );
+    }
+
+    /*  These are allocated by PGACreate  */
+    if (ctx->ga.datatype == PGA_DATATYPE_REAL)
+      {
+        free ( ctx->init.RealMax );
+        free ( ctx->init.RealMin );
+      }
+    else if (ctx->ga.datatype == PGA_DATATYPE_INTEGER)
+      {
+        free ( ctx->init.IntegerMax );
+        free ( ctx->init.IntegerMin );
+      }
+
+    /*  We want to finalize MPI only if it was not started for us (as
+     *  fortran would do) AND it is actually running.  It would not be
+     *  running if, for example, -pgahelp is specified on the command
+     *  line.
+     */
+    MPI_Initialized(&i);
+    if ((ctx->par.MPIAlreadyInit == PGA_FALSE) && i)
+      MPI_Finalize();
+
+    /*  We really should perform a PGADebugPrint here, but we can't;
+     *  we've already deallocated most of the stuff we need!!
+     */
+    free ( ctx );
+}
+
+/*U***************************************************************************
+   PGAGetMaxMachineIntValue - returns the largest integer of the current
+   machine
+
+   Category: System
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      The largest integer of the given machine
+
+   Example:
+      PGAContext *ctx;
+      int intmax;
+      :
+      intmax = PGAGetMaxMachineIntValue(ctx);
+
+***************************************************************************U*/
+int PGAGetMaxMachineIntValue (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetMaxMachineIntValue");
+
+    PGADebugExited("PGAGetMaxMachineIntValue");
+
+    return(ctx->sys.PGAMaxInt);
+}
+
+/*U***************************************************************************
+   PGAGetMaxMachineIntValue - returns the smallest integer of the current
+   machine
+
+   Category: System
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      The smallest integer of the given machine
+
+   Example:
+      PGAContext *ctx;
+      int intmin;
+      :
+      intmin = PGAGetMinMachineIntValue(ctx);
+
+***************************************************************************U*/
+int PGAGetMinMachineIntValue (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetMinMachineIntValue");
+
+    PGADebugExited("PGAGetMinMachineIntValue");
+
+    return(ctx->sys.PGAMinInt);
+}
+
+/*U***************************************************************************
+   PGAGetMaxMachineDoubleValue - returns the largest double of the current
+   machine
+
+   Category: System
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      The largest double of the given machine
+
+   Example:
+      PGAContext *ctx;
+      double big;
+      :
+      big = PGAGetMaxMachineDoubleValue(ctx);
+
+***************************************************************************U*/
+double PGAGetMaxMachineDoubleValue (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetMaxMachineDoubleValue");
+
+    PGADebugExited("PGAGetMaxMachineDoubleValue");
+
+    return(ctx->sys.PGAMaxDouble);
+}
+
+/*U***************************************************************************
+   PGAGetMaxMachineDoubleValue - returns the smallest double of the current
+   machine
+
+   Category: System
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      The smallest double of the given machine
+
+   Example:
+      PGAContext *ctx;
+      double small;
+      :
+      small = PGAGetMinMachineDoubleValue(ctx);
+
+***************************************************************************U*/
+double PGAGetMinMachineDoubleValue (PGAContext *ctx)
+{
+    PGADebugEntered("PGAGetMinMachineDoubleValue");
+
+    PGADebugExited("PGAGetMinMachineDoubleValue");
+
+    return(ctx->sys.PGAMinDouble);
+}
+
+
+/*U****************************************************************************
+   PGAUsage - print list of available parameters and quit
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+     list of available parametersNone
+
+   Example:
+      PGAContext ctx;
+      :
+      PGAUsage(ctx);
+
+****************************************************************************U*/
+void PGAUsage( PGAContext *ctx )
+{
+    /*  Print the usage info out if MPI isn't running (thus, only one process
+     *  is probably running), or if we actually are the master.
+     */
+    if (!ctx->par.MPIAlreadyInit || (PGAGetRank(ctx, MPI_COMM_WORLD) == 0)) {
+	PGAPrintVersionNumber( ctx );
+	printf("PGAPack usage: %s [pga options]\n", PGAProgram);
+	printf("Valid PGAPack options:\n");
+	printf("\t-pgahelp          \tget this message\n");
+	printf("\t-pgahelp debug    \tlist of debug options\n");
+	printf("\t-pgadbg <option>  \tset debug option\n");
+	printf("\t-pgadebug <option>\tset debug option\n");
+	printf("\t-pgaversion       \tprint current PGAPack version number\n");
+	printf("\n");
+    }
+    PGADestroy(ctx);
+    exit(-1);
+}
+
+/*U****************************************************************************
+   PGAPrintVersionNumber - print PGAPack version number
+
+   Inputs:
+      ctx - context variable
+
+   Outputs:
+      PGAPack version number
+
+   Example:
+      PGAContext ctx;
+      :
+      PGAPrintVersionNumber(ctx);
+
+****************************************************************************U*/
+void PGAPrintVersionNumber( PGAContext *ctx )
+{
+    if (!ctx->par.MPIAlreadyInit || (PGAGetRank(ctx, MPI_COMM_WORLD) == 0)) {
+        printf("\nPGAPack version 1.0: (%s, %s)\n\n",
+	       (OPTIMIZE)                ? "Optimized"  : "Debug",
+#ifdef FAKE_MPI
+               "Sequential");
+#else
+               "Parallel");
+#endif               
+    }
+}
+
Index: trunk/optimizer/src/pgapack/pgapack/source/user.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/user.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/user.c	(revision 816)
@@ -0,0 +1,194 @@
+/*
+ *  
+ *  ********************************************************************* 
+ *  (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+ *  *********************************************************************
+ *  
+ *  This software was authored by
+ *  
+ *  D. Levine
+ *  Mathematics and Computer Science Division Argonne National Laboratory
+ *  Argonne IL 60439
+ *  levine@mcs.anl.gov
+ *  (708) 252-6735
+ *  (708) 252-5986 (FAX)
+ *  
+ *  with programming assistance of participants in Argonne National 
+ *  Laboratory's SERS program.
+ *  
+ *  This program contains material protectable under copyright laws of the 
+ *  United States.  Permission is hereby granted to use it, reproduce it, 
+ *  to translate it into another language, and to redistribute it to 
+ *  others at no charge except a fee for transferring a copy, provided 
+ *  that you conspicuously and appropriately publish on each copy the 
+ *  University of Chicago's copyright notice, and the disclaimer of 
+ *  warranty and Government license included below.  Further, permission 
+ *  is hereby granted, subject to the same provisions, to modify a copy or 
+ *  copies or any portion of it, and to distribute to others at no charge 
+ *  materials containing or derived from the material.
+ *  
+ *  The developers of the software ask that you acknowledge its use in any 
+ *  document referencing work based on the  program, such as published 
+ *  research.  Also, they ask that you supply to Argonne National 
+ *  Laboratory a copy of any published research referencing work based on 
+ *  the software.
+ *  
+ *  Any entity desiring permission for further use must contact:
+ *  
+ *  J. Gleeson
+ *  Industrial Technology Development Center Argonne National Laboratory
+ *  Argonne IL 60439
+ *  gleesonj@smtplink.eid.anl.gov
+ *  (708) 252-6055
+ *  
+ *  ******************************************************************** 
+ *  DISCLAIMER
+ *  
+ *  THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+ *  OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+ *  THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+ *  WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+ *  RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+ *  INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+ *  INFRINGE PRIVATELY OWNED RIGHTS.
+ *  
+ *  ********************************************************************** 
+ *  GOVERNMENT LICENSE
+ *  
+ *  The Government is granted for itself and others acting on its behalf a 
+ *  paid-up, non-exclusive, irrevocable worldwide license in this computer 
+ *  software to reproduce, prepare derivative works, and perform publicly 
+ *  and display publicly.
+ */
+
+/*****************************************************************************
+*     FILE: user.c: This file contains a function to set user functions.
+*
+*     Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle,
+*              Brian P. Walenz
+*****************************************************************************/
+
+#include "pgapack.h"
+
+/*U****************************************************************************
+   PGASetUserFunction - specifies the name of a user-written function
+   call to provide a specific GA capability (e.g., crossover,
+   mutation, etc.).  This function MUST be used when using a non-native
+   datatype and must be called once for each of:
+       PGA_USERFUNCTION_CREATESTRING     -- String creation
+       PGA_USERFUNCTION_MUTATION         -- Mutation
+       PGA_USERFUNCTION_CROSSOVER        -- Crossover
+       PGA_USERFUNCTION_PRINTSTRING      -- String Output
+       PGA_USERFUNCTION_COPYSTRING       -- Duplication
+       PGA_USERFUNCTION_DUPLICATE        -- Duplicate Checking
+       PGA_USERFUNCTION_INITSTRING       -- Initialization
+       PGA_USERFUNCTION_BUILDDATATYPE    -- MPI Datatype creation
+       PGA_USERFUNCTION_STOPCOND         -- Stopping conditions
+       PGA_USERFUNCTION_ENDOFGEN         -- Auxiliary functions at the end
+                                            of each generation
+   It MAY be called when using a native datatype to replace the built-in
+   functions PGAPack has for that datatype (For example, if the Integer data
+   type is used for a traveling salesperson problem, the user may want to
+   provide their own custom crossover operator).  See the user guide and the
+   examples in the examples directory for more details.
+
+   Category: Generation
+
+   Inputs:
+      ctx      - context variable
+      constant - symbolic constant of the user function to set
+      f        - name of the function to use
+
+   Outputs:
+      None
+
+   Example:
+      void MyStringInit(PGAContext *, void *);
+      PGAContext *ctx;
+      :
+      PGASetUserFunction(ctx, PGA_USERFUNCTION_INITSTRING, MyStringInit);
+
+****************************************************************************U*/
+void PGASetUserFunction(PGAContext *ctx, int constant, void *f)
+{
+    PGADebugEntered("PGASetUserFunction");
+
+    if (f == NULL)
+	PGAError ( ctx, "PGASetUserFunction: Invalid function",
+		  PGA_FATAL, PGA_VOID, NULL);
+
+    switch (constant) {
+      case PGA_USERFUNCTION_CREATESTRING:
+	if (ctx->sys.UserFortran) 
+	    PGAError(ctx, "PGASetUserFunction: Cannot call "
+		     "PGA_USERFUNCTION_CREATESTRING from Fortran.",
+		     PGA_FATAL, PGA_VOID, NULL);
+	else
+	    ctx->cops.CreateString = (void(*)(PGAContext *, int, int, int))f;
+	break;
+      case PGA_USERFUNCTION_MUTATION:
+	if (ctx->sys.UserFortran) 
+	    ctx->fops.Mutation = (int(*)(void *, void *, void *, void *))f;
+	else
+	    ctx->cops.Mutation = (int(*)(PGAContext *, int, int, double))f;
+	break;
+      case PGA_USERFUNCTION_CROSSOVER:
+	if (ctx->sys.UserFortran) 
+	    ctx->fops.Crossover = (void(*)(void *, void *, void *, void *, void *, void *, void *))f;
+	else
+	    ctx->cops.Crossover =  (void(*)(PGAContext *, int, int, int, int, int, int))f;
+	break;
+      case PGA_USERFUNCTION_PRINTSTRING:
+	if (ctx->sys.UserFortran) 
+	    ctx->fops.PrintString = (void(*)(void *, void *, void *, void *))f;
+	else
+	    ctx->cops.PrintString =  (void(*)(PGAContext *, FILE *, int, int))f;
+	break;
+      case PGA_USERFUNCTION_COPYSTRING:
+	if (ctx->sys.UserFortran) 
+	    PGAError(ctx, "PGASetUserFunction: Cannot call "
+		     "PGA_USERFUNCTION_COPYSTRING from Fortran.",
+		     PGA_FATAL, PGA_VOID, NULL);
+	else
+	    ctx->cops.CopyString = (void(*)(PGAContext *, int, int, int, int))f;
+	break;
+      case PGA_USERFUNCTION_DUPLICATE:
+	if (ctx->sys.UserFortran) 
+	    ctx->fops.Duplicate = (int(*)(void *, void *, void *, void *, void *))f;
+	else
+	    ctx->cops.Duplicate = (int(*)(PGAContext *, int, int, int, int))f;
+	break;
+      case PGA_USERFUNCTION_INITSTRING:
+	if (ctx->sys.UserFortran) 
+	    ctx->fops.InitString = (void(*)(void *, void *, void *))f;
+	else
+	    ctx->cops.InitString = (void(*)(PGAContext *, int, int))f;
+	break;
+      case PGA_USERFUNCTION_BUILDDATATYPE:
+	if (ctx->sys.UserFortran) 
+	    PGAError(ctx, "PGASetUserFunction: Cannot call "
+		     "PGA_USERFUNCTION_BUILDDATATYPE from Fortran.",
+		     PGA_FATAL, PGA_VOID, NULL);
+	else
+	    ctx->cops.BuildDatatype = (MPI_Datatype(*)(PGAContext *, int, int))f;
+	break;
+      case PGA_USERFUNCTION_STOPCOND:
+	if (ctx->sys.UserFortran) 
+	    ctx->fops.StopCond = (int(*)(void *))f;
+	else
+	    ctx->cops.StopCond = (int(*)(PGAContext *))f;
+	break;
+      case PGA_USERFUNCTION_ENDOFGEN:
+	if (ctx->sys.UserFortran) 
+	    ctx->fops.EndOfGen = (void(*)(void *))f;
+	else
+	    ctx->cops.EndOfGen = (void(*)(PGAContext *))f;
+	break;
+      default:
+	PGAError(ctx, "PGASetUserFunction: Invalid constant:",
+		 PGA_FATAL, PGA_INT, (void *) &constant);
+	break;
+    }
+
+    PGADebugExited("PGASetUserFunction");
+}
Index: trunk/optimizer/src/pgapack/pgapack/source/utility.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/source/utility.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/source/utility.c	(revision 816)
@@ -0,0 +1,640 @@
+/*
+ *  
+ *  ********************************************************************* 
+ *  (C) COPYRIGHT 1995 UNIVERSITY OF CHICAGO 
+ *  *********************************************************************
+ *  
+ *  This software was authored by
+ *  
+ *  D. Levine
+ *  Mathematics and Computer Science Division Argonne National Laboratory
+ *  Argonne IL 60439
+ *  levine@mcs.anl.gov
+ *  (708) 252-6735
+ *  (708) 252-5986 (FAX)
+ *  
+ *  with programming assistance of participants in Argonne National 
+ *  Laboratory's SERS program.
+ *  
+ *  This program contains material protectable under copyright laws of the 
+ *  United States.  Permission is hereby granted to use it, reproduce it, 
+ *  to translate it into another language, and to redistribute it to 
+ *  others at no charge except a fee for transferring a copy, provided 
+ *  that you conspicuously and appropriately publish on each copy the 
+ *  University of Chicago's copyright notice, and the disclaimer of 
+ *  warranty and Government license included below.  Further, permission 
+ *  is hereby granted, subject to the same provisions, to modify a copy or 
+ *  copies or any portion of it, and to distribute to others at no charge 
+ *  materials containing or derived from the material.
+ *  
+ *  The developers of the software ask that you acknowledge its use in any 
+ *  document referencing work based on the  program, such as published 
+ *  research.  Also, they ask that you supply to Argonne National 
+ *  Laboratory a copy of any published research referencing work based on 
+ *  the software.
+ *  
+ *  Any entity desiring permission for further use must contact:
+ *  
+ *  J. Gleeson
+ *  Industrial Technology Development Center Argonne National Laboratory
+ *  Argonne IL 60439
+ *  gleesonj@smtplink.eid.anl.gov
+ *  (708) 252-6055
+ *  
+ *  ******************************************************************** 
+ *  DISCLAIMER
+ *  
+ *  THIS PROGRAM WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY 
+ *  OF THE UNITED STATES GOVERNMENT.  NEITHER THE UNIVERSITY OF CHICAGO, 
+ *  THE UNITED STATES GOVERNMENT NOR ANY OF THEIR EMPLOYEES MAKE ANY 
+ *  WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR 
+ *  RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY 
+ *  INFORMATION OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT 
+ *  INFRINGE PRIVATELY OWNED RIGHTS.
+ *  
+ *  ********************************************************************** 
+ *  GOVERNMENT LICENSE
+ *  
+ *  The Government is granted for itself and others acting on its behalf a 
+ *  paid-up, non-exclusive, irrevocable worldwide license in this computer 
+ *  software to reproduce, prepare derivative works, and perform publicly 
+ *  and display publicly.
+ */
+
+/*****************************************************************************
+*     FILE: utility.c: This file contains routines that perform utility
+*                      functions.
+*
+*     Authors: David M. Levine, Philip L. Hallstrom, David M. Noelle,
+*              Brian P. Walenz
+*****************************************************************************/
+
+#include <pgapack.h>
+
+/*U****************************************************************************
+  PGAMean - calculates the mean value of an array of elements
+
+  Category: Utility
+
+  Inputs:
+    ctx  - context variable
+    a    - array to take the mean of
+    n    - number of elements in array a
+
+  Outputs:
+    The mean of the n elements in array a
+
+  Example:
+    PGAContext *ctx;
+    double a[100], mean;
+    :
+    mean = PGAMean(ctx, a, 100);
+
+****************************************************************************U*/
+double PGAMean ( PGAContext *ctx, double *a, int n)
+{
+    int i;
+    double result;
+
+    PGADebugEntered("PGAMean");
+
+    result = 0.;
+    for( i=n-1; i>=0; i-- )
+        result += a[i];
+
+    PGADebugExited("PGAMean");
+
+    return (result / (double) n );
+}
+
+
+/*U****************************************************************************
+  PGAStddev - calculates the standard deviation of an array of elements
+
+  Category: Utility
+
+  Inputs:
+    ctx  - context variable
+    a    - array to take the standard deviation of
+    n    - number of elements in array a
+    mean - the mean of the elements in array a
+
+  Outputs:
+    The standard deviation of the n elements in array a
+
+  Example:
+    PGAContext *ctx;
+    double a[100], mean, sigma;
+    :
+    mean  = PGAMean(ctx, a, 100);
+    sigma = PGAStddev(ctx, a, 100, mean);
+
+****************************************************************************U*/
+double PGAStddev ( PGAContext *ctx, double *a, int n, double mean)
+{
+    int i;
+    double result;
+
+    PGADebugEntered("PGAStddev");
+
+    result = 0;
+    for(i=n-1; i>=0; i--)
+        result += (a[i] - mean) * (a[i] - mean);
+    result  = sqrt(result/n);
+
+    PGADebugExited("PGAStddev");
+    return (result);
+}
+
+/*U****************************************************************************
+  PGARound - Mathematically round a double to an integer, using 0.5 as the
+  cutoff value.
+
+  Category: Utility
+
+  Inputs:
+     ctx - context variable
+     x - the number to be rounded
+
+  Outputs:
+     The rounded number.
+
+  Example:
+     PGAContext *ctx;
+     int y;
+     y = PGARound(ctx, -78.6);
+
+****************************************************************************U*/
+int PGARound(PGAContext *ctx, double x)
+{
+    double ipart, frac;
+
+    PGADebugEntered("PGARound");
+
+    frac = modf(x, &ipart);
+    if (frac <= -0.5)
+      ipart--;
+    else if (frac >= 0.5)
+      ipart++;
+
+    PGADebugExited("PGARound");
+
+    return ((int)ipart);
+}
+
+/*U****************************************************************************
+  PGACopyIndividual - copies string p1 in population pop1 to position p2 in
+  population pop2
+
+  Category: Generation
+
+  Inputs:
+     ctx  - context variable
+     p1   - string to copy
+     pop1 - symbolic constant of population containing string p1
+     p2   - string to copy p1 to
+     pop2 - symbolic constant of population containing string p2
+
+  Outputs:
+     String p2 is an exact copy of string p1.
+
+  Example:
+    PGAContext *ctx;
+    int i,j;
+    :
+    PGACopyIndividual(ctx, i, PGA_OLDPOP, j, PGA_NEWPOP);
+
+****************************************************************************U*/
+void PGACopyIndividual( PGAContext *ctx, int p1, int pop1, int p2, int pop2)
+{
+    PGAIndividual *source, *dest;
+
+    PGADebugEntered("PGACopyIndividual");
+
+    source = PGAGetIndividual ( ctx, p1, pop1 );
+    dest   = PGAGetIndividual ( ctx, p2, pop2 );
+
+    dest->evalfunc     = source->evalfunc;
+    dest->fitness      = source->fitness;
+    dest->evaluptodate = source->evaluptodate;
+
+    (*ctx->cops.CopyString)(ctx, p1, pop1, p2, pop2);
+
+    PGADebugExited("PGACopyIndividual");
+}
+
+/*U****************************************************************************
+  PGACheckSum - maps a string to a number to be used a verification check
+  PGA_DATATYPE_USER is not supported.
+
+  Category: Utility
+
+  Inputs:
+     ctx    - context variable
+     p      - string index
+     pop    - symbolic constant for the population
+
+  Outputs:
+     An integer representing the "value" of the string.
+
+  Example:
+     PGAContext *ctx;
+     int p, sum;
+     :
+     sum = PGACheckSum(ctx, p, PGA_NEWPOP);
+
+****************************************************************************U*/
+int PGACheckSum(PGAContext *ctx, int p, int pop)
+{
+    long stringlen, totalchars, charbits, i, j, checksum, totalbytes, out_bit;
+    unsigned char *message, specimen;
+
+    PGADebugEntered("PGACheckSum");
+
+    stringlen = PGAGetStringLength(ctx);
+    switch (ctx->ga.datatype) {
+      case PGA_DATATYPE_BINARY:
+        totalbytes = ctx->ga.tw * sizeof(PGABinary);
+        break;
+      case PGA_DATATYPE_INTEGER:
+        totalbytes = stringlen * sizeof(PGAInteger);
+        break;
+      case PGA_DATATYPE_REAL:
+        totalbytes = stringlen * sizeof(PGAReal);
+        break;
+      case PGA_DATATYPE_CHARACTER:
+        totalbytes = stringlen * sizeof(PGACharacter);
+        break;
+      default:
+        totalbytes = 0;
+        PGAError(ctx, "PGACheckSum: User datatype checksum may be invalid.",
+                 PGA_WARNING, PGA_VOID, NULL);
+        break;
+      }
+
+    message = (unsigned char *)PGAGetIndividual(ctx, p, pop)->chrom;
+    totalchars = totalbytes / sizeof(unsigned char);
+    charbits = sizeof(unsigned char) * 8;
+    checksum = 0;
+    for (i = 0; i < totalchars; i++) {
+      specimen = *(message + i);
+      for (j = 0; j < charbits; j++) {
+        out_bit = (checksum & 0x80000000) == 1;
+        checksum = (checksum << 1) + ((specimen & 0x80) == 0x80);
+        if (out_bit)
+          checksum ^= 0x04c11db7;
+        specimen <<= 1;
+      }
+    }
+
+    PGADebugExited("PGACheckSum");
+
+    return (checksum);
+}
+
+/*U***************************************************************************
+  PGAGetWorstIndex - returns the index of the string with the worst
+  evaluation function value in population pop
+
+  Category: Utility
+
+  Inputs:
+     ctx - context variable
+     pop - symbolic constant of the population to find the worst string in
+
+  Outputs:
+     Index of the string with the worst evaluation function value
+
+  Example:
+     PGAContext *ctx;
+     int worst;
+     :
+     worst = PGAGetWorstIndex(ctx,PGA_OLDPOP);
+
+***************************************************************************U*/
+int PGAGetWorstIndex(PGAContext *ctx, int pop)
+{
+    int     p, worst_indx = 0;
+    double  eval, worst_eval;
+
+    PGADebugEntered("PGAGetWorstIndex");
+
+    for (p = 0; p < ctx->ga.PopSize; p++)
+	if (!PGAGetEvaluationUpToDateFlag(ctx, p, pop))
+	    PGAError(ctx, "PGAGetWorstIndex: Evaluate function not up to "
+		     "date:", PGA_FATAL, PGA_INT, (void *) &p);
+
+    worst_eval = PGAGetEvaluation(ctx, 0, pop);
+    switch (PGAGetOptDirFlag(ctx)) {
+    case PGA_MAXIMIZE:
+	for (p = 1; p < ctx->ga.PopSize; p++) {
+	    eval = PGAGetEvaluation(ctx, p, pop);
+	    if (eval < worst_eval) {
+		worst_indx = p;
+		worst_eval = eval;
+	    }
+	}
+	break;
+
+    case PGA_MINIMIZE:
+	for (p = 1; p < ctx->ga.PopSize; p++) {
+	    eval = PGAGetEvaluation(ctx, p, pop);
+	    if (eval > worst_eval) {
+		worst_indx = p;
+		worst_eval = eval;
+	    }
+	}
+	break;    
+    }
+
+    PGADebugExited("PGAGetWorstIndex");
+
+    return (worst_indx);
+}
+
+/*U***************************************************************************
+  PGAGetBestIndex - returns the index of the string with the best evaluation
+  function value in population pop
+
+  Category: Utility
+
+  Inputs:
+     ctx - context variable
+     pop - symbolic constant of the population to find the best string in
+
+  Outputs:
+     Index of the string with the best evaluation function value
+
+  Example:
+     PGAContext *ctx;
+     int best;
+     :
+     best = PGAGetBestIndex(ctx,PGA_OLDPOP);
+
+***************************************************************************U*/
+int PGAGetBestIndex(PGAContext *ctx, int pop)
+{
+     int     p, Best_indx = 0;
+     double  eval, Best_eval;
+
+    PGADebugEntered("PGAGetBestIndex");
+     
+     for (p = 0; p < ctx->ga.PopSize; p++)
+	 if (!PGAGetEvaluationUpToDateFlag(ctx, p, pop))
+	     PGAError(ctx, "PGAGetBestIndex: Evaluate function not up to "
+		      "date:", PGA_FATAL, PGA_INT, (void *) &p);
+     
+     Best_eval = PGAGetEvaluation(ctx, 0, pop);
+
+     switch (PGAGetOptDirFlag(ctx)) {
+     case PGA_MAXIMIZE :
+	 for (p = 1; p < ctx->ga.PopSize; p++) {
+	     eval = PGAGetEvaluation(ctx, p, pop);
+	     if (eval > Best_eval) {
+		 Best_indx = p;
+		 Best_eval = eval;
+	     }
+	 }
+	 break;
+     case PGA_MINIMIZE :
+	 for (p = 1; p < ctx->ga.PopSize; p++) {
+	     eval = PGAGetEvaluation(ctx, p, pop);
+	     if (eval < Best_eval) {
+		 Best_indx = p;
+		 Best_eval = eval;
+	     }
+	 }
+	 break;
+     }
+     
+    PGADebugExited("PGAGetBestIndex");
+
+     return (Best_indx);
+}
+
+
+/*I****************************************************************************
+  PGAGetIndividual - translate string index and population symbolic constant
+  into pointer to an individual
+
+  Inputs:
+     ctx - context variable
+     p   - string index
+     pop - symbolic constant of the population the string is in
+
+  Outputs:
+     Address of the PGAIndividual structure for string p in population pop
+
+  Example:
+    PGAIndividual *source;
+    PGAContext *ctx;
+    int p;
+    :
+    source = PGAGetIndividual ( ctx, p, PGA_NEWPOP );
+
+****************************************************************************I*/
+PGAIndividual *PGAGetIndividual ( PGAContext *ctx, int p, int pop)
+{
+    PGAIndividual *ind;
+
+    PGADebugEntered("PGAGetIndividual");
+
+#ifdef OPTIMIZE
+    ind = (pop == PGA_OLDPOP) ? ctx->ga.oldpop : ctx->ga.newpop;
+
+    if (p>=0)
+      ind += p;
+    else
+      ind += (p == PGA_TEMP1) ? ctx->ga.PopSize : ctx->ga.PopSize+1;
+#else
+    if (pop == PGA_OLDPOP)
+      ind = ctx->ga.oldpop;
+    else
+      if (pop == PGA_NEWPOP)
+	ind = ctx->ga.newpop;
+      else
+        PGAError(ctx, "PGAGetIndividual: Invalid value of pop:",
+		 PGA_FATAL, PGA_INT, (void *) &pop );
+
+    if (p>0 && p<ctx->ga.PopSize)
+      ind += p;
+    else
+      if (p == PGA_TEMP1)
+	ind += ctx->ga.PopSize;
+      else
+	if (p == PGA_TEMP2)
+	  ind += ctx->ga.PopSize + 1;
+	else
+	  PGAError(ctx, "PGAGetIndividual: Invalid value of p:",
+		   PGA_FATAL, PGA_INT, (void *) &p );
+#endif
+
+    PGADebugExited("PGAGetIndividual");
+
+    return(ind);
+}
+
+
+/*I****************************************************************************
+   PGAUpdateAverage - Updates the average fitness statistic for reporting.
+
+   Inputs:
+       ctx - context variable
+       pop - symbolic constant of the population
+
+   Outputs:
+
+   Example:
+
+**************************************************************************I*/
+void PGAUpdateAverage(PGAContext *ctx, int pop)
+{
+    double ThisGensTotal = 0;
+    int p;
+
+    PGADebugEntered("PGAUpdateAverage");
+    
+    for (p = 0; p < ctx->ga.PopSize; p++)
+	if (!PGAGetEvaluationUpToDateFlag(ctx, p, pop))
+	    PGAError(ctx, "PGAUpdateOnline: Evaluate function not up to "
+		     "date:", PGA_FATAL, PGA_INT, (void *) &p);
+
+    for (p = 0; p < ctx->ga.PopSize; p++)
+	ThisGensTotal += PGAGetEvaluation(ctx, p, pop);
+    
+    ctx->rep.Average = ThisGensTotal / (double)ctx->ga.PopSize;
+    
+    PGADebugExited("PGAUpdateAverage");
+}
+
+
+/*I****************************************************************************
+  PGAUpdateOnline - Updates the online value based on the results in
+  the new generation
+
+  Inputs:
+     ctx - context variable
+     pop - symbolic constant of the population whose statistics to use
+
+  Outputs:
+     Updates an internal field in the context variable
+
+  Example:
+     PGAContext *ctx;
+     :
+     PGAUpdateOnline(ctx,PGA_NEWPOP);
+
+**************************************************************************I*/
+void PGAUpdateOnline(PGAContext *ctx, int pop)
+{
+     double ThisGensTotal = 0;
+     int p;
+
+    PGADebugEntered("PGAUpdateOnline");
+
+     for (p = 0; p < ctx->ga.PopSize; p++)
+          if (!PGAGetEvaluationUpToDateFlag(ctx, p, pop))
+               PGAError(ctx, "PGAUpdateOnline: Evaluate function not up to "
+                        "date:", PGA_FATAL, PGA_INT, (void *) &p);
+
+     for (p = 0; p < ctx->ga.PopSize; p++)
+          ThisGensTotal += PGAGetEvaluation(ctx, p, pop);
+
+     PGADebugPrint(ctx, PGA_DEBUG_PRINTVAR, "PGAUpdateOnline",
+                   "ThisGensTotal = ", PGA_DOUBLE, (void *) &ThisGensTotal);
+
+     ctx->rep.Online = (ctx->rep.Online * ctx->ga.PopSize * (ctx->ga.iter - 1)
+                        + ThisGensTotal) / ctx->ga.iter / ctx->ga.PopSize;
+
+    PGADebugExited("PGAUpdateOnline");
+
+}
+
+/*I****************************************************************************
+  PGAUpdateOffline - Updates the offline value based on the results in
+  the new generation
+
+  Inputs:
+     ctx - context variable
+     pop - symbolic constant of the population whose statistics to use
+
+  Outputs:
+     Updates an internal field in the context variable
+
+  Example:
+     PGAContext *ctx;
+     :
+     PGAUpdateOffline(ctx,PGA_NEWPOP);
+
+**************************************************************************I*/
+void PGAUpdateOffline(PGAContext *ctx, int pop)
+{
+     int p;
+
+    PGADebugEntered("PGAUpdateOffline");
+
+     for (p = 0; p < ctx->ga.PopSize; p++)
+          if (!PGAGetEvaluationUpToDateFlag(ctx, p, pop))
+               PGAError(ctx, "PGAUpdateOffline: Evaluate function not up to "
+                        "date:", PGA_FATAL, PGA_INT, (void *) &p);
+
+     p = PGAGetBestIndex(ctx, pop);
+
+     ctx->rep.Offline = ((ctx->ga.iter - 1) * ctx->rep.Offline +
+                         PGAGetEvaluation(ctx, p, pop)) / ctx->ga.iter;
+
+    PGADebugExited("PGAUpdateOffline");
+}
+
+/*I****************************************************************************
+  PGAComputeSimilarity - computes the percentage of the population that have
+  the same evaluation function
+
+  Inputs:
+     ctx - context variable
+     pop - symbolic constant of the population whose statistics to use
+
+  Outputs:
+     returns a count of the number of  population members that have the same
+     evaluation function value
+
+  Example:
+     PGAContext *ctx;
+     :
+     PGAComputeSimilarity(ctx,PGA_NEWPOP);
+
+**************************************************************************I*/
+int PGAComputeSimilarity(PGAContext *ctx, PGAIndividual *pop)
+{
+     int max = 0, curr = 1, i;
+     double prev;
+
+    PGADebugEntered("PGAComputeSimilarity");
+
+     for(i=0; i < ctx->ga.PopSize; i++)
+     {
+          ctx->scratch.dblscratch[i] = (pop + i)->evalfunc;
+          ctx->scratch.intscratch[i] = i;
+     }
+
+     PGADblHeapSort(ctx, ctx->scratch.dblscratch, ctx->scratch.intscratch,
+                    ctx->ga.PopSize);
+
+     prev = ctx->scratch.dblscratch[0];
+
+     for(i = 1; i < ctx->ga.PopSize; i++)
+     {
+          if (ctx->scratch.dblscratch[i] == prev)
+               curr++;
+          else
+          {
+               if (curr > max)
+                    max = curr;
+               curr = 1;
+          }
+     }
+
+    PGADebugExited("PGAComputeSimilarity");
+
+     return(100 * max / ctx->ga.PopSize);
+}
Index: trunk/optimizer/src/pgapack/pgapack/test/Makefile
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/test/Makefile	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/test/Makefile	(revision 816)
@@ -0,0 +1,28 @@
+# Generated automatically from Makefile.in by configure.
+CC          = cc
+FC          = f77
+PRECFLAGS   = -O 
+PREFFLAGS   = -w
+CPPFLAGS    = -I/Volumes/Data_mo/GENES/Software/pgapack/include -I/Volumes/Data_mo/GENES/Software/mpich-1.2.7p1/include/ -Dlinux -DWL=32 -DFORTRANUNDERSCORE -DOPTIMIZE 
+RM          = /bin/rm -f
+LDFLAGS     = -s  -L/Volumes/Data_mo/GENES/Software/pgapack/lib/linux  -lpgaO  /Volumes/Data_mo/GENES/Software/mpich-1.2.7p1/lib/libmpich.a -lm
+SHELL       = /bin/sh
+
+#    "$@" expands to the target; "$?" expands to the dependency list
+CFLAGS      = -o $@ $? $(PRECFLAGS)
+FFLAGS      = -o $@ $? $(PREFFLAGS)
+
+LINK.c      = @echo "  Compiling $@" ; $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
+LINK.f      = @if test -n "$(FC)"; \
+                  then echo "  Compiling $@" ; $(FC) $(FFLAGS) $(LDFLAGS); \
+              else \
+                  echo "$@: Fortran compiler unavailable"; fi
+
+default:
+	@make instverf 
+
+instverf: instverf.c
+	$(LINK.c)
+
+clean: 
+	@$(RM) instverf instverf.o
Index: trunk/optimizer/src/pgapack/pgapack/test/Makefile.in
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/test/Makefile.in	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/test/Makefile.in	(revision 816)
@@ -0,0 +1,27 @@
+CC          = @CC@
+FC          = @FC@
+PRECFLAGS   = @CFLAGS@
+PREFFLAGS   = @FFLAGS@
+CPPFLAGS    = @CPPFLAGS@
+RM          = @RM@
+LDFLAGS     = @LDFLAGS@
+SHELL       = @SHELL@
+
+#    "$@" expands to the target; "$?" expands to the dependency list
+CFLAGS      = -o $@ $? $(PRECFLAGS)
+FFLAGS      = -o $@ $? $(PREFFLAGS)
+
+LINK.c      = @echo "  Compiling $@" ; $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
+LINK.f      = @if test -n "$(FC)"; \
+                  then echo "  Compiling $@" ; $(FC) $(FFLAGS) $(LDFLAGS); \
+              else \
+                  echo "$@: Fortran compiler unavailable"; fi
+
+default:
+	@make instverf 
+
+instverf: instverf.c
+	$(LINK.c)
+
+clean: 
+	@$(RM) instverf instverf.o
Index: trunk/optimizer/src/pgapack/pgapack/test/README
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/test/README	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/test/README	(revision 816)
@@ -0,0 +1,45 @@
+This is the test directory README.
+
+instverf:
+--------
+
+A simple program to test the accuracy of an installation.  It runs five
+distinct genetic algorithms, and stores the results from each.  After all
+five are run, it will compare the computed results to those known to be
+correct, stored on disk as "instverf.data".  If any errors are found, the
+problem number is reported.
+
+The problems tested are
+	0:	Binary datatype
+	1:	Integer datatype
+	2:	Character datatype
+	3:	Real datatype
+	4:	Binary datatype using PGAGetRealFrom*
+
+
+SanityChecks:
+------------
+
+Contains several programs designed to test the sanity of PGAPack.  Under
+normal circumstances, they should not be needed.  ST_* will call most
+every PGAPack function.  PT_* will test the parallel code -- it must
+be run with at least three processors!
+This directory contains several programs that exist only to test the
+sanity of PGAPack.  They are very useful for testing the fortran to C
+interface, and that sending and receiving strings work.
+
+ST_c.c and ST_f.f simply call (most) every function in PGAPack.  They
+also run several GA's which do nothing other than use every type of
+crossover and mutation for each native datatype.
+
+PT_c.c and PT_f.f test high-level stuff.  It tests (not in this order) if
+sending/receiving of strings works, PGARun, PGARunGM, PGARunIM and PGARunNM
+(the last two aren't implemented yet, though), and a user defined
+run routine.  A real version of MPI _MUST_ be used for PT_c and PT_f.
+
+instverf.c will run several GA's, one for each native datatype, and check
+the output computed versus that stored on disk.  If any differences are
+found, it will give a warning.
+
+These programs are the development testing suite.
+
Index: trunk/optimizer/src/pgapack/pgapack/test/instverf.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/test/instverf.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/test/instverf.c	(revision 816)
@@ -0,0 +1,461 @@
+/*  Example program that shows how to run more than one GA in one
+ *  executable, _AND_ verifies the accuracy of installation.
+ *
+ *  We will run five distinct GA's, each using a different datatype, and,
+ *  thus, a different evaluation function.  The correct output of these GA's
+ *  is in instverf.data, which we read and compare after all GA's are done.
+ *
+ *  The correct solution for #4 and #5 is somewhere around 4.49339389176 for
+ *  the genes, and an evaluation value of around -6.951476096.
+ *
+ *  Author:  Brian P. Walenz
+ */
+#include <pgapack.h>
+
+
+double maxbit(PGAContext *, int, int);
+double ordering(PGAContext *, int, int);
+double name(PGAContext *, int, int);
+double function(PGAContext *, int, int);
+double functionb(PGAContext *, int, int);
+
+/*  The user defined functions.
+ *
+ *  O_* --> for the Ordering problem (integer), problem 2
+ *  N_* --> for the Name problem (character), problem 3
+ *  R_* --> for the real problem, problem 4
+ *  Rb_* -> for the real problem using the binary datatype, problem 5
+ */
+void EOG(PGAContext *);
+int  O_Mutate(PGAContext *, int, int, double);
+void O_Crossover(PGAContext *, int, int, int, int, int, int);
+int  N_Mutate(PGAContext *, int, int, double);
+int  N_StopCond(PGAContext *);
+void R_Init(PGAContext *, int, int);
+void Rb_Init(PGAContext *, int, int);
+void Rb_PrintString(PGAContext *, FILE *, int, int);
+
+char      String[65] = 
+          "THEQUICKBROWNFOXJUMPESOVERTHELAZYDOGWHILETHEOLDGOOSELOOKSPUZZLED";
+double    Results[5][1001];
+int       ResultsIndex;
+
+/*  How often to print, and the size (in bits) of each number in a binary
+ *  string (used by problem 5)
+ */
+#define   PRINTFREQ  100
+#define   RBS        24
+
+void main(int argc, char **argv) {
+    PGAContext     *ctx;
+    int             i, rank;
+    FILE           *ResultsFile;
+    double          R[5];
+    int             E[5];
+
+
+    /*  Even though we aren't doing I/O, we MUST initialize MPI ourselves.
+     *  If we don't, the first call to PGADestroy will finalize MPI, and
+     *  the MPI standard does not allow any MPI calls after that (even
+     *  if it is MPI_Init())!
+     */
+    MPI_Init(&argc, &argv);
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    
+    /*  All examples use a common custom end of generation function to 
+     *  stuff the best of generation evaluation into an array.
+     */
+
+
+    /*  Our first example is the ever-popular maxbit.  As usual, it is
+     *  very simple, not even setting PGAPack options!  Plus, we use a
+     *  very odd string length, 999, which is not divisible by 16, 32 or
+     *  64!  What an excellent test!
+     */
+    ResultsIndex = 0;
+    ctx = PGACreate(&argc, argv, PGA_DATATYPE_BINARY, 999, PGA_MAXIMIZE);
+    PGASetRandomSeed(ctx, 42);
+    PGASetPrintFrequencyValue(ctx, PRINTFREQ);
+    PGASetUserFunction(ctx, PGA_USERFUNCTION_ENDOFGEN,  (void *)EOG);
+    PGASetUp(ctx);
+    PGARun(ctx, maxbit);
+    PGADestroy(ctx);
+
+    /*  Second on the menu is a delicious integer ordering function.
+     *  This uses custom mutation and crossover, but permutation
+     *  initialization.  The objective is to order all alleles in the
+     *  integer datatype in an increasing fashion.
+     */
+    ResultsIndex = 1;
+    ctx = PGACreate(&argc, argv, PGA_DATATYPE_INTEGER, 64, PGA_MAXIMIZE);
+    PGASetRandomSeed(ctx, 42);
+    PGASetPrintFrequencyValue(ctx, PRINTFREQ);
+    PGASetUserFunction(ctx, PGA_USERFUNCTION_MUTATION,  (void *)O_Mutate);
+    PGASetUserFunction(ctx, PGA_USERFUNCTION_CROSSOVER, (void *)O_Crossover);
+    PGASetUserFunction(ctx, PGA_USERFUNCTION_ENDOFGEN,  (void *)EOG);
+    PGASetIntegerInitPermute(ctx, 0, 63);
+    PGASetUp(ctx);
+    PGARun(ctx, ordering);
+    PGADestroy(ctx);
+
+
+    /*  Third, and least interesting, is the character maximizer.
+     *  Much like name, it uses custom mutation and stopping conditions.
+     */
+    ResultsIndex = 2;
+    ctx = PGACreate(&argc, argv, PGA_DATATYPE_CHARACTER, 64, PGA_MAXIMIZE);
+    PGASetRandomSeed(ctx, 42); 
+    PGASetPrintFrequencyValue(ctx, PRINTFREQ);
+    PGASetUserFunction(ctx, PGA_USERFUNCTION_MUTATION,  (void *)N_Mutate);
+    PGASetUserFunction(ctx, PGA_USERFUNCTION_STOPCOND,  (void *)N_StopCond);
+    PGASetUserFunction(ctx, PGA_USERFUNCTION_ENDOFGEN,  (void *)EOG);
+    PGASetCharacterInitType(ctx, PGA_CINIT_UPPER);
+    PGASetUp(ctx);
+    PGARun(ctx, name);
+    PGADestroy(ctx);
+
+
+    /*  And, finally, the last of the day.  A simple real-valued function
+     *  optimizer.  Uses custom init string.
+     */
+    ResultsIndex = 3;
+    ctx = PGACreate(&argc, argv, PGA_DATATYPE_REAL, 32, PGA_MINIMIZE);
+    PGASetRandomSeed(ctx, 42); 
+    PGASetMutationType(ctx, PGA_MUTATION_CONSTANT);
+    PGASetMutationRealValue(ctx, .1); 
+    PGASetPrintFrequencyValue(ctx, PRINTFREQ);
+    PGASetMutationProb(ctx, 0.1);
+    PGASetUserFunction(ctx, PGA_USERFUNCTION_INITSTRING,  (void *)R_Init);
+    PGASetUserFunction(ctx, PGA_USERFUNCTION_ENDOFGEN,    (void *)EOG);
+    PGASetUp(ctx);
+    PGARun(ctx, function);
+    PGADestroy(ctx);
+
+
+    /*  Encore, encore!  Fine.  We will now perform the last number
+     *  using the binary datatype and PGAGetRealFromBinary alternating
+     *  with PGAGetRealFromGrayCode.
+     */
+    ResultsIndex = 4;
+    ctx = PGACreate(&argc, argv, PGA_DATATYPE_BINARY, 32*RBS, PGA_MINIMIZE);
+    PGASetRandomSeed(ctx, 42); 
+    PGASetPrintFrequencyValue(ctx, PRINTFREQ);
+    PGASetUserFunction(ctx, PGA_USERFUNCTION_INITSTRING,  (void *)Rb_Init);
+    PGASetUserFunction(ctx, PGA_USERFUNCTION_PRINTSTRING, (void *)Rb_PrintString);
+    PGASetUserFunction(ctx, PGA_USERFUNCTION_ENDOFGEN,    (void *)EOG);
+    PGASetUp(ctx);
+    PGARun(ctx, functionb);
+    PGADestroy(ctx);
+
+
+    /*  Compare the Results with the correct values
+     *  stored in "./test/data/Results.data"
+     */
+    if (rank == 0) {
+	ResultsFile = fopen("instverf.data", "r");
+	if (ResultsFile) {
+	    E[0] = E[1] = E[2] = E[3] = E[4] = 0;
+	    
+	    for (i=1; i<1001; i++) {
+#if 0
+		/*  This is used to generate the results file... */
+		printf("%12.6f %12.6f %12.6f %12.6f %12.6f\n",
+		       Results[0][i], Results[1][i], Results[2][i],
+		       Results[3][i], Results[4][i]);
+#endif
+		fscanf(ResultsFile, "%lf %lf %lf %lf %lf",
+		       R, R+1, R+2, R+3, R+4);
+		if (fabs(R[0] - Results[0][i]) > 0.001)   E[0]++;
+		if (fabs(R[1] - Results[1][i]) > 0.001)   E[1]++;
+		if (fabs(R[2] - Results[2][i]) > 0.001)   E[2]++;
+		if (fabs(R[3] - Results[3][i]) > 0.001)   E[3]++;
+		if (fabs(R[4] - Results[4][i]) > 0.001)   E[4]++;
+	    }
+	    fclose(ResultsFile);
+	    for (i=0; i<5; i++) {
+		if (E[i])
+		    printf("Test %d had %d errors.\n", i, E[i]);
+		else
+		    printf("Test %d was successful.\n", i);
+	    }
+	} else {
+	    fprintf(stderr, "Couldn't open \"instverf.data\".\n");
+	}
+    }
+
+    MPI_Finalize();
+}
+
+
+/******************************************************************************
+ *
+ *  The fitness functions
+ *
+ *****************************************************************************/
+double maxbit(PGAContext *ctx, int p, int pop) {
+    int i, result;
+
+    result = 0;
+    for (i=PGAGetStringLength(ctx)-1; i>=0; i--) 
+	if (PGAGetBinaryAllele(ctx, p, pop, i) == 1)
+	    result = result + 1;
+
+    return((double)result);
+}
+
+
+/*  Award points if two alleles are increasing (i.e., gene = .., 1, 2, ..)
+ *  and if any allele is in the correct spot (i.e., gene = 1, 2, 3, 4, ...)
+ */
+double ordering(PGAContext *ctx, int p, int pop) {
+    int i, n, o, len, result;
+
+    len = PGAGetStringLength(ctx);
+
+    result = 0;
+    o = PGAGetIntegerAllele(ctx, p, pop, 0);
+    if (o == 0)
+	result = 2;
+    for (i=1; i<len; i++) {
+	n = PGAGetIntegerAllele(ctx, p, pop, i);
+	if (o == n-1)
+	    result = result + 1;
+	if (n = i)
+	    result = result + 2;
+	o = n;
+    }
+
+    return((double)result);
+}
+
+double name(PGAContext *ctx, int p, int pop) {
+    int  i, result;
+
+    result = 0;
+    for (i=PGAGetStringLength(ctx)-1; i>=0; i--)
+	if (PGAGetCharacterAllele(ctx, p, pop, i) == String[i])
+	    result = result + 1;
+
+    return((double)result);
+}
+
+
+double function(PGAContext *ctx, int p, int pop) {
+    int    i;
+    double x, result;
+
+    result = 0;
+    for (i=PGAGetStringLength(ctx)-1; i>=0; i--) {
+	x = PGAGetRealAllele(ctx, p, pop, i);
+	result = result + sin(x) / x;
+    }
+
+    return(result);
+}
+
+
+double functionb(PGAContext *ctx, int p, int pop) {
+    int    i;
+    double x, result;
+
+    result = 0;
+    i = PGAGetStringLength(ctx)/RBS - 1;
+
+    for ( ; i>=0; i--) {
+	if (i % 2) {
+	    x = PGAGetRealFromBinary
+		(ctx, p, pop, i*RBS, (i+1)*RBS-1, 0.0, 6.28318530718);
+	} else {
+	    x = PGAGetRealFromGrayCode
+		(ctx, p, pop, i*RBS, (i+1)*RBS-1, 0.0, 6.28318530718);
+	}
+	result = result + sin(x) / x;
+    }
+    return(result);
+}
+
+
+
+/**********************************************************************/
+void EOG(PGAContext *ctx) {
+    int     best, iter;
+    double  besteval;
+
+    iter = PGAGetGAIterValue(ctx);
+    best = PGAGetBestIndex(ctx, PGA_NEWPOP);
+    besteval = PGAGetEvaluation(ctx, best, PGA_NEWPOP);
+
+    Results[ResultsIndex][iter] = besteval;
+}
+
+
+
+/**********************************************************************/
+int O_Mutate(PGAContext *ctx, int p, int pop, double mr) {
+    int i, a, b, len;
+ 
+    len = PGAGetStringLength(ctx);
+    
+    a = PGARandomInterval(ctx, 0, len-1);
+    b = PGARandomInterval(ctx, 0, len-1);
+
+    i = PGAGetIntegerAllele(ctx, p, pop, a);
+    PGASetIntegerAllele(ctx, p, pop, a,
+			PGAGetIntegerAllele(ctx, p, pop, b));
+    PGASetIntegerAllele(ctx, p, pop, b, i);
+    return(1);
+}
+
+/*  Crossover:  Ripped from tsp.c  */
+void O_Crossover(PGAContext *ctx, int A, int B, int ppop,
+		 int C, int D, int cpop) {
+    int     co1, co2, i, len, a, b;
+    int     inA[64], inB[64];
+
+    len = PGAGetStringLength(ctx);
+
+    /*  Select random crossover points from [1, len-1].  */
+    co1 = PGARandomInterval(ctx, 1, len-1);
+    while (co1 == (co2 = PGARandomInterval(ctx, 1, len-1))) ;
+    if (co1 > co2) {
+        i = co1;
+        co1 = co2;
+        co2 = i;
+    }
+
+    /*  Copy a->c and b->d up to the first crossover point. */
+    for (i=0; i<co1; i++) {
+        a = PGAGetIntegerAllele(ctx, A, ppop, i);
+        b = PGAGetIntegerAllele(ctx, B, ppop, i);
+        PGASetIntegerAllele(ctx, C, cpop, i, a);
+        PGASetIntegerAllele(ctx, D, cpop, i, b);
+    }
+    
+    /*  Copy a->c and b->d from the second co point to the end of the
+     *  string.  (Yes, we're ignoring the middle for now.)
+     */
+    for (i=co2; i<len; i++) {
+        a = PGAGetIntegerAllele(ctx, A, ppop, i);
+        b = PGAGetIntegerAllele(ctx, B, ppop, i);
+        PGASetIntegerAllele(ctx, C, cpop, i, a);
+        PGASetIntegerAllele(ctx, D, cpop, i, b);
+    }
+    
+    /*  Now, copy a->d and b->c in the middle (co1 <--> co2).  We must
+     *  be careful to not use any cities twice, thus, we must check
+     *  the rest of the string to see if the allele is used.  If it is,
+     *  change the allele to that of the corresponding one in the other
+     *  string, and check again.  For efficiency, we build a couple of
+     *  tables, AtoB and BtoA.
+     */
+    for (i=0; i<len; i++) {
+        a = PGAGetIntegerAllele(ctx, A, ppop, i);
+        b = PGAGetIntegerAllele(ctx, B, ppop, i);
+        inA[a] = i;
+        inB[b] = i;
+    }
+    
+    for (i=co1; i<co2; i++) {
+        /*  While what we picked is outside the crossover region
+         *  in the other string, keep cross-referencing.
+         */
+	b = PGAGetIntegerAllele(ctx, B, ppop, i);
+        while ((inA[b]<co1) || (inA[b]>=co2)) 
+	    b = PGAGetIntegerAllele(ctx, B, ppop, inA[b]);
+
+        a = PGAGetIntegerAllele(ctx, A, ppop, i);
+        while ((inB[a]<co1) || (inB[a]>=co2)) 
+	    a = PGAGetIntegerAllele(ctx, A, ppop, inB[a]);
+
+        PGASetIntegerAllele(ctx, C, cpop, i, b);
+        PGASetIntegerAllele(ctx, D, cpop, i, a);
+    }
+}
+
+
+
+/**********************************************************************/
+int N_Mutate(PGAContext *ctx, int p, int pop, double mr) {
+    int i, count;
+
+    count = 0;
+    for (i=PGAGetStringLength(ctx)-1; i>=0; i--) {
+	if ((PGAGetCharacterAllele(ctx, p, pop, i) != String[i]) &&
+	    (PGARandomFlip(ctx, mr) == PGA_TRUE)) {
+	    PGASetCharacterAllele(ctx, p, pop, i, String[i]);
+	    count += 1;
+	}
+    }
+    return(count);
+}
+
+int N_StopCond(PGAContext *ctx) {
+    int     done, len;
+    double  e;
+
+    done = 0;
+    len  = PGAGetStringLength(ctx);
+    e    = PGAGetEvaluation(ctx, PGAGetBestIndex(ctx, PGA_OLDPOP), PGA_OLDPOP);
+
+    if (PGACheckStoppingConditions(ctx) || (len == e))
+	done = 1;
+
+    return(done);
+}
+
+
+/**********************************************************************/
+void R_Init(PGAContext *ctx, int p, int pop) {
+    int     i;
+    double  r;
+    
+    for (i=PGAGetStringLength(ctx)-1; i>=0; i--) {
+	r = 6.28318530718 * PGARandom01(ctx, 0) - 3.14159265354;
+      	r = 6.28318530718 * exp(r) / (exp(r) + exp(-r));
+
+	PGASetRealAllele(ctx, p, pop, i, r);
+    }
+}
+
+void Rb_Init(PGAContext *ctx, int p, int pop) {
+    int     i;
+    double  r;
+    
+    i = PGAGetStringLength(ctx) / RBS - 1;
+
+    for ( ; i>=0; i--) {
+	r = 6.28318530718 * PGARandom01(ctx, 0) - 3.14159265354;
+      	r = 6.28318530718 * exp(r) / (exp(r) + exp(-r));
+
+	if (i % 2) {
+	    PGAEncodeRealAsBinary
+		(ctx, p, pop, i*RBS, (i+1)*RBS-1, 0.0, 6.28318530718, r);
+	} else {
+	    PGAEncodeRealAsGrayCode
+		(ctx, p, pop, i*RBS, (i+1)*RBS-1, 0.0, 6.28318530718, r);
+	}
+    }
+}
+
+void Rb_PrintString(PGAContext *ctx, FILE *file, int p, int pop) {
+    int     i, j, len;
+    double  r;
+
+    len = PGAGetStringLength(ctx) / RBS - 1;
+
+    for(i=j=0; i<len; i++, j++) {
+	if (i % 2) {
+	    r = PGAGetRealFromBinary
+		(ctx, p, pop, i*RBS, (i+1)*RBS-1, 0.0, 6.28318530718);
+	} else {
+	    r = PGAGetRealFromGrayCode
+		(ctx, p, pop, i*RBS, (i+1)*RBS-1, 0.0, 6.28318530718);
+	}
+	fprintf(file, "  %10.6f", r);
+	if (j==5) {
+	    fprintf(file, "\n");
+	    j = -1;
+	}
+    }
+}
+
Index: trunk/optimizer/src/pgapack/pgapack/test/instverf.data
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/test/instverf.data	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/test/instverf.data	(revision 816)
@@ -0,0 +1,1000 @@
+  545.000000   131.000000     7.000000     5.830600     5.830600
+  545.000000   131.000000     7.000000     5.830600     5.830600
+  545.000000   131.000000     7.000000     5.830600     3.095786
+  545.000000   131.000000     9.000000     5.830600     3.095786
+  545.000000   131.000000     9.000000     5.824771     3.095786
+  547.000000   131.000000     9.000000     5.824771     3.095786
+  551.000000   131.000000     9.000000     5.169932     3.095786
+  551.000000   131.000000     9.000000     5.169932     3.095786
+  551.000000   132.000000     9.000000     5.169932     3.095786
+  560.000000   132.000000     9.000000     5.169932     3.095786
+  560.000000   132.000000    11.000000     4.910874     3.095786
+  560.000000   132.000000    11.000000     4.726827     2.112962
+  560.000000   132.000000    11.000000     4.726827     2.112962
+  560.000000   132.000000    11.000000     4.234707     2.112962
+  560.000000   132.000000    11.000000     2.552202     2.112962
+  560.000000   132.000000    12.000000     2.552202     2.112962
+  560.000000   132.000000    12.000000     2.552202     1.241418
+  560.000000   132.000000    12.000000     2.502030     1.241418
+  560.000000   132.000000    12.000000     2.502030     1.241418
+  560.000000   132.000000    12.000000     2.502030     1.241418
+  560.000000   132.000000    12.000000     2.502030     1.241089
+  561.000000   133.000000    12.000000     2.265484     0.618203
+  563.000000   133.000000    13.000000     2.265484     0.618203
+  577.000000   133.000000    13.000000     2.265484     0.618203
+  577.000000   133.000000    13.000000     2.265484     0.618203
+  577.000000   133.000000    13.000000     2.265484     0.618203
+  577.000000   133.000000    13.000000     2.265484    -0.359117
+  577.000000   134.000000    13.000000     2.265484    -0.359117
+  577.000000   134.000000    13.000000    -1.347096    -0.460710
+  577.000000   134.000000    13.000000    -1.347096    -0.460710
+  577.000000   134.000000    14.000000    -1.347096    -0.460710
+  577.000000   134.000000    16.000000    -1.347096    -0.460710
+  577.000000   134.000000    16.000000    -1.347096    -0.460710
+  577.000000   134.000000    16.000000    -1.347096    -0.460710
+  577.000000   134.000000    16.000000    -1.347096    -0.460710
+  578.000000   134.000000    16.000000    -1.347096    -0.460710
+  578.000000   134.000000    16.000000    -1.347096    -0.460710
+  583.000000   134.000000    16.000000    -1.347096    -0.460710
+  583.000000   134.000000    16.000000    -1.347096    -0.460710
+  583.000000   134.000000    16.000000    -1.347096    -0.622914
+  583.000000   134.000000    19.000000    -1.347096    -0.663375
+  583.000000   134.000000    19.000000    -1.347096    -0.663375
+  583.000000   134.000000    19.000000    -1.347096    -0.663375
+  583.000000   134.000000    19.000000    -1.347096    -0.663375
+  583.000000   135.000000    19.000000    -1.347096    -0.663377
+  583.000000   135.000000    19.000000    -1.347096    -0.663377
+  583.000000   135.000000    19.000000    -1.347096    -0.663377
+  583.000000   135.000000    20.000000    -1.347096    -0.663377
+  587.000000   135.000000    20.000000    -1.347096    -0.663377
+  588.000000   135.000000    20.000000    -1.347096    -0.663377
+  588.000000   135.000000    20.000000    -1.347096    -0.666536
+  588.000000   135.000000    20.000000    -1.347096    -0.666536
+  588.000000   135.000000    20.000000    -1.402374    -0.666536
+  588.000000   135.000000    20.000000    -1.405540    -0.701919
+  588.000000   135.000000    20.000000    -1.516927    -0.701919
+  588.000000   135.000000    20.000000    -1.516927    -0.701919
+  588.000000   136.000000    20.000000    -1.516927    -0.701919
+  588.000000   136.000000    20.000000    -1.516927    -0.811475
+  588.000000   136.000000    21.000000    -1.516927    -0.811475
+  588.000000   136.000000    21.000000    -1.516927    -0.811475
+  588.000000   136.000000    21.000000    -1.518980    -0.811475
+  588.000000   136.000000    21.000000    -1.644250    -0.811475
+  591.000000   136.000000    21.000000    -1.644250    -0.811475
+  591.000000   136.000000    21.000000    -1.710707    -0.811475
+  591.000000   136.000000    21.000000    -1.717394    -0.811753
+  591.000000   136.000000    23.000000    -1.717394    -0.811753
+  591.000000   136.000000    23.000000    -1.725584    -0.811753
+  591.000000   136.000000    23.000000    -1.725584    -0.811753
+  591.000000   137.000000    23.000000    -1.749264    -0.823944
+  591.000000   137.000000    23.000000    -1.749264    -0.823944
+  591.000000   137.000000    24.000000    -1.749264    -0.823944
+  594.000000   137.000000    24.000000    -1.766108    -0.888304
+  595.000000   137.000000    24.000000    -1.766108    -0.888304
+  596.000000   137.000000    24.000000    -1.825106    -0.888304
+  596.000000   137.000000    24.000000    -1.825106    -0.888458
+  596.000000   138.000000    24.000000    -1.825106    -0.888458
+  596.000000   138.000000    24.000000    -1.991414    -0.891112
+  596.000000   138.000000    25.000000    -1.991414    -0.995596
+  596.000000   138.000000    25.000000    -1.991414    -0.995596
+  596.000000   138.000000    25.000000    -1.991414    -0.995596
+  598.000000   138.000000    25.000000    -1.991414    -0.995596
+  598.000000   138.000000    25.000000    -1.991414    -0.995596
+  598.000000   138.000000    26.000000    -1.991414    -0.995596
+  599.000000   138.000000    26.000000    -1.996462    -0.995596
+  599.000000   138.000000    26.000000    -2.038102    -0.995596
+  599.000000   138.000000    26.000000    -2.038102    -0.995596
+  599.000000   139.000000    26.000000    -2.038102    -0.995596
+  599.000000   139.000000    26.000000    -2.232807    -0.995596
+  599.000000   139.000000    26.000000    -2.232807    -0.995596
+  599.000000   139.000000    26.000000    -2.232807    -1.147490
+  599.000000   139.000000    26.000000    -2.232807    -1.147490
+  599.000000   139.000000    26.000000    -2.232807    -1.147490
+  599.000000   140.000000    27.000000    -2.615528    -1.147490
+  601.000000   140.000000    28.000000    -2.615528    -1.147490
+  601.000000   140.000000    28.000000    -2.615528    -1.147490
+  601.000000   140.000000    28.000000    -2.615528    -1.147490
+  601.000000   140.000000    28.000000    -2.615528    -1.147490
+  601.000000   140.000000    30.000000    -2.615528    -1.147490
+  601.000000   140.000000    30.000000    -2.615528    -1.177010
+  601.000000   140.000000    30.000000    -2.615528    -1.266449
+  601.000000   140.000000    30.000000    -2.615528    -1.266449
+  601.000000   140.000000    30.000000    -2.615528    -1.266449
+  601.000000   140.000000    30.000000    -2.615528    -1.266449
+  601.000000   140.000000    32.000000    -2.615528    -1.266449
+  601.000000   141.000000    32.000000    -2.615528    -1.266449
+  601.000000   141.000000    32.000000    -2.615528    -1.266449
+  603.000000   141.000000    32.000000    -2.615528    -2.087184
+  603.000000   141.000000    32.000000    -2.615528    -2.087184
+  603.000000   141.000000    32.000000    -2.615528    -2.087184
+  605.000000   141.000000    32.000000    -2.615528    -2.087184
+  605.000000   141.000000    32.000000    -2.615528    -2.087184
+  605.000000   141.000000    32.000000    -2.615528    -2.087184
+  605.000000   141.000000    32.000000    -2.615528    -2.087184
+  605.000000   141.000000    32.000000    -2.615528    -2.087184
+  605.000000   141.000000    32.000000    -2.615528    -2.087184
+  606.000000   141.000000    33.000000    -2.615528    -2.087184
+  606.000000   141.000000    33.000000    -2.615528    -2.087184
+  606.000000   142.000000    34.000000    -2.653765    -2.087184
+  606.000000   142.000000    34.000000    -2.809304    -2.087184
+  608.000000   142.000000    34.000000    -3.005066    -2.087184
+  608.000000   142.000000    34.000000    -3.005066    -2.087184
+  608.000000   142.000000    34.000000    -3.005066    -2.134288
+  608.000000   142.000000    34.000000    -3.005066    -2.134288
+  608.000000   142.000000    34.000000    -3.005066    -2.215644
+  608.000000   142.000000    35.000000    -3.005066    -2.215644
+  609.000000   142.000000    35.000000    -3.005066    -2.231666
+  609.000000   143.000000    35.000000    -3.005066    -2.231666
+  609.000000   143.000000    36.000000    -3.005066    -2.231666
+  609.000000   143.000000    36.000000    -3.005066    -2.231666
+  609.000000   143.000000    36.000000    -3.005066    -2.258783
+  609.000000   143.000000    36.000000    -3.005066    -2.360126
+  609.000000   143.000000    36.000000    -3.031497    -2.360126
+  609.000000   143.000000    36.000000    -3.031497    -2.360126
+  610.000000   143.000000    36.000000    -3.031497    -2.403671
+  610.000000   143.000000    36.000000    -3.144883    -2.403671
+  610.000000   143.000000    36.000000    -3.144883    -2.489972
+  611.000000   143.000000    36.000000    -3.144883    -2.489972
+  611.000000   143.000000    36.000000    -3.144883    -2.489972
+  611.000000   143.000000    37.000000    -3.144883    -2.489972
+  612.000000   144.000000    37.000000    -3.144883    -2.490465
+  612.000000   144.000000    37.000000    -3.144883    -2.645446
+  612.000000   144.000000    37.000000    -3.144883    -2.645446
+  612.000000   144.000000    37.000000    -3.319494    -2.645446
+  612.000000   145.000000    37.000000    -3.319494    -2.645446
+  612.000000   145.000000    38.000000    -3.319494    -2.645446
+  613.000000   145.000000    38.000000    -3.319494    -2.645446
+  613.000000   145.000000    38.000000    -3.319494    -2.645450
+  613.000000   145.000000    38.000000    -3.319494    -2.645450
+  613.000000   145.000000    38.000000    -3.319494    -2.645450
+  613.000000   145.000000    38.000000    -3.319494    -2.773906
+  613.000000   145.000000    38.000000    -3.319494    -2.773906
+  613.000000   145.000000    39.000000    -3.319494    -2.776500
+  614.000000   145.000000    39.000000    -3.319494    -2.776907
+  614.000000   145.000000    39.000000    -3.441136    -2.776907
+  614.000000   145.000000    39.000000    -3.441136    -2.776907
+  614.000000   145.000000    39.000000    -3.490688    -2.776907
+  615.000000   145.000000    41.000000    -3.490688    -2.777277
+  615.000000   145.000000    41.000000    -3.490688    -2.780465
+  615.000000   145.000000    41.000000    -3.495495    -2.780465
+  615.000000   145.000000    41.000000    -3.495495    -2.787853
+  615.000000   146.000000    41.000000    -3.495495    -2.787853
+  615.000000   146.000000    41.000000    -3.615383    -2.787853
+  615.000000   146.000000    41.000000    -3.615383    -2.787853
+  615.000000   146.000000    41.000000    -3.615383    -2.787853
+  615.000000   146.000000    41.000000    -3.615383    -2.787853
+  615.000000   146.000000    41.000000    -3.615383    -2.787853
+  615.000000   146.000000    41.000000    -3.615383    -2.787853
+  615.000000   146.000000    41.000000    -3.615383    -2.787853
+  615.000000   146.000000    41.000000    -3.615383    -2.787853
+  615.000000   146.000000    41.000000    -3.615383    -2.787853
+  616.000000   146.000000    41.000000    -3.615383    -2.787853
+  616.000000   146.000000    41.000000    -3.615383    -2.787853
+  616.000000   146.000000    41.000000    -3.615383    -2.787853
+  616.000000   146.000000    41.000000    -3.615383    -2.787853
+  616.000000   146.000000    42.000000    -3.615383    -2.787853
+  616.000000   147.000000    43.000000    -3.615383    -2.787867
+  616.000000   147.000000    43.000000    -3.615383    -2.787867
+  616.000000   147.000000    43.000000    -3.753140    -2.796747
+  617.000000   147.000000    43.000000    -3.753140    -2.796747
+  617.000000   147.000000    43.000000    -3.753140    -2.796747
+  617.000000   147.000000    43.000000    -3.753140    -2.796747
+  617.000000   147.000000    43.000000    -3.753140    -2.842833
+  617.000000   147.000000    43.000000    -3.753140    -2.919868
+  617.000000   147.000000    43.000000    -3.819071    -2.919868
+  617.000000   147.000000    43.000000    -3.819071    -2.919868
+  617.000000   147.000000    44.000000    -3.819071    -2.919868
+  619.000000   147.000000    44.000000    -3.819071    -2.919868
+  619.000000   148.000000    44.000000    -3.819071    -2.919868
+  619.000000   148.000000    44.000000    -3.834996    -2.919868
+  619.000000   148.000000    44.000000    -3.834996    -2.919868
+  619.000000   148.000000    44.000000    -3.834996    -2.919868
+  619.000000   148.000000    45.000000    -3.851305    -2.919868
+  619.000000   148.000000    45.000000    -3.851305    -2.919868
+  619.000000   148.000000    45.000000    -3.905956    -2.919868
+  619.000000   148.000000    45.000000    -3.905956    -2.920624
+  619.000000   148.000000    45.000000    -3.905956    -2.920624
+  619.000000   148.000000    45.000000    -3.905956    -2.920624
+  620.000000   148.000000    45.000000    -3.908264    -2.931201
+  620.000000   148.000000    45.000000    -3.975791    -2.931201
+  620.000000   148.000000    45.000000    -3.975791    -2.931201
+  620.000000   148.000000    45.000000    -4.192530    -2.931201
+  620.000000   148.000000    45.000000    -4.376775    -2.985771
+  620.000000   148.000000    45.000000    -4.376775    -2.985771
+  620.000000   148.000000    45.000000    -4.376775    -2.985800
+  621.000000   148.000000    45.000000    -4.376775    -2.985800
+  621.000000   149.000000    45.000000    -4.376775    -2.985800
+  623.000000   149.000000    45.000000    -4.376775    -2.985800
+  623.000000   149.000000    46.000000    -4.376775    -2.985800
+  623.000000   149.000000    46.000000    -4.430660    -2.985800
+  623.000000   149.000000    46.000000    -4.430660    -2.985800
+  623.000000   149.000000    46.000000    -4.430660    -2.995691
+  623.000000   149.000000    46.000000    -4.430660    -2.995691
+  623.000000   149.000000    46.000000    -4.430660    -2.995691
+  623.000000   149.000000    46.000000    -4.430660    -2.995691
+  623.000000   149.000000    47.000000    -4.430660    -2.995691
+  623.000000   149.000000    47.000000    -4.430660    -2.995691
+  623.000000   150.000000    47.000000    -4.430660    -3.058951
+  623.000000   150.000000    47.000000    -4.430660    -3.113522
+  623.000000   150.000000    47.000000    -4.430660    -3.124098
+  623.000000   150.000000    47.000000    -4.430660    -3.124098
+  623.000000   150.000000    47.000000    -4.454581    -3.124098
+  623.000000   150.000000    47.000000    -4.454581    -3.124098
+  623.000000   150.000000    48.000000    -4.454581    -3.124098
+  623.000000   150.000000    48.000000    -4.454581    -3.124098
+  623.000000   150.000000    48.000000    -4.454581    -3.124098
+  623.000000   150.000000    48.000000    -4.460662    -3.124098
+  623.000000   150.000000    48.000000    -4.460662    -3.124098
+  624.000000   150.000000    48.000000    -4.460662    -3.124098
+  624.000000   150.000000    48.000000    -4.473634    -3.124098
+  625.000000   150.000000    48.000000    -4.473634    -3.124098
+  625.000000   150.000000    48.000000    -4.473634    -3.130948
+  625.000000   150.000000    48.000000    -4.473634    -3.130948
+  625.000000   150.000000    49.000000    -4.473634    -3.130948
+  625.000000   150.000000    49.000000    -4.473634    -3.130948
+  625.000000   150.000000    49.000000    -4.540714    -3.130948
+  625.000000   150.000000    49.000000    -4.540714    -3.130967
+  625.000000   150.000000    49.000000    -4.540714    -3.130967
+  626.000000   150.000000    49.000000    -4.540714    -3.130967
+  627.000000   151.000000    49.000000    -4.540714    -3.130967
+  627.000000   151.000000    49.000000    -4.540714    -3.130967
+  627.000000   151.000000    49.000000    -4.540714    -3.138881
+  627.000000   151.000000    50.000000    -4.540714    -3.138881
+  627.000000   151.000000    50.000000    -4.540714    -3.138881
+  627.000000   151.000000    50.000000    -4.544082    -3.138881
+  627.000000   151.000000    50.000000    -4.571606    -3.138881
+  627.000000   151.000000    50.000000    -4.571606    -3.138881
+  627.000000   151.000000    50.000000    -4.584436    -3.138881
+  627.000000   151.000000    50.000000    -4.584436    -3.138881
+  627.000000   151.000000    50.000000    -4.584436    -3.149418
+  627.000000   151.000000    50.000000    -4.608382    -3.169051
+  628.000000   151.000000    50.000000    -4.608382    -3.169051
+  628.000000   151.000000    50.000000    -4.608382    -3.169051
+  629.000000   151.000000    51.000000    -4.608382    -3.169051
+  629.000000   151.000000    51.000000    -4.608382    -3.169051
+  629.000000   151.000000    51.000000    -4.608382    -3.169051
+  629.000000   151.000000    51.000000    -4.608382    -3.169051
+  629.000000   151.000000    51.000000    -4.608382    -3.169051
+  629.000000   151.000000    51.000000    -4.659364    -3.169051
+  629.000000   151.000000    51.000000    -4.659364    -3.779496
+  629.000000   152.000000    51.000000    -4.659364    -3.779496
+  629.000000   152.000000    51.000000    -4.659364    -3.779496
+  629.000000   152.000000    51.000000    -4.659364    -3.779496
+  629.000000   152.000000    51.000000    -4.681538    -3.779496
+  629.000000   152.000000    51.000000    -4.681538    -3.779496
+  630.000000   152.000000    52.000000    -4.681538    -3.779496
+  630.000000   152.000000    52.000000    -4.681538    -3.797945
+  630.000000   152.000000    52.000000    -4.721278    -3.798079
+  630.000000   152.000000    52.000000    -4.721278    -3.798079
+  630.000000   152.000000    52.000000    -4.721278    -3.798079
+  630.000000   152.000000    52.000000    -4.721278    -3.798079
+  631.000000   152.000000    52.000000    -4.729479    -3.805809
+  632.000000   152.000000    52.000000    -4.729479    -3.805809
+  632.000000   152.000000    53.000000    -4.729479    -3.805809
+  632.000000   152.000000    53.000000    -4.729479    -3.805809
+  632.000000   152.000000    53.000000    -4.749840    -3.824973
+  632.000000   152.000000    53.000000    -4.749840    -3.984939
+  632.000000   152.000000    53.000000    -4.749840    -3.984939
+  632.000000   152.000000    54.000000    -4.749840    -3.984939
+  632.000000   152.000000    54.000000    -4.749840    -3.984939
+  632.000000   152.000000    54.000000    -4.749840    -3.984939
+  632.000000   152.000000    54.000000    -4.763839    -3.984939
+  632.000000   152.000000    54.000000    -4.826880    -4.017910
+  632.000000   152.000000    54.000000    -4.826880    -4.017910
+  632.000000   152.000000    54.000000    -4.826880    -4.017910
+  633.000000   152.000000    54.000000    -4.826880    -4.017910
+  633.000000   152.000000    54.000000    -4.863338    -4.017910
+  633.000000   152.000000    54.000000    -4.863338    -4.017910
+  633.000000   152.000000    54.000000    -4.863338    -4.094107
+  633.000000   153.000000    55.000000    -4.863338    -4.094107
+  633.000000   153.000000    55.000000    -4.863338    -4.094107
+  633.000000   153.000000    55.000000    -4.863338    -4.094107
+  634.000000   153.000000    55.000000    -4.863338    -4.094107
+  634.000000   153.000000    55.000000    -4.870731    -4.094107
+  634.000000   153.000000    55.000000    -4.958954    -4.094107
+  634.000000   153.000000    55.000000    -4.958954    -4.191519
+  634.000000   153.000000    55.000000    -4.958954    -4.191519
+  634.000000   153.000000    56.000000    -4.981919    -4.191519
+  634.000000   153.000000    56.000000    -4.981919    -4.191519
+  636.000000   153.000000    56.000000    -4.981919    -4.191519
+  636.000000   153.000000    56.000000    -4.981919    -4.191549
+  636.000000   153.000000    56.000000    -4.981919    -4.191549
+  636.000000   153.000000    56.000000    -4.981919    -4.191549
+  636.000000   153.000000    56.000000    -4.981919    -4.191549
+  636.000000   153.000000    56.000000    -4.981919    -4.197134
+  636.000000   153.000000    56.000000    -4.981919    -4.197134
+  637.000000   153.000000    56.000000    -4.998592    -4.197134
+  637.000000   153.000000    56.000000    -4.998592    -4.199412
+  637.000000   154.000000    57.000000    -4.998592    -4.199412
+  637.000000   154.000000    57.000000    -5.046132    -4.199412
+  638.000000   154.000000    57.000000    -5.046132    -4.199412
+  638.000000   154.000000    57.000000    -5.046132    -4.199412
+  638.000000   154.000000    57.000000    -5.046132    -4.199412
+  638.000000   154.000000    57.000000    -5.046132    -4.209967
+  638.000000   154.000000    57.000000    -5.046132    -4.209967
+  638.000000   154.000000    57.000000    -5.046132    -4.209967
+  638.000000   154.000000    57.000000    -5.046132    -4.209989
+  638.000000   154.000000    58.000000    -5.046132    -4.210011
+  638.000000   154.000000    58.000000    -5.087775    -4.210011
+  638.000000   154.000000    58.000000    -5.087775    -4.210011
+  638.000000   154.000000    58.000000    -5.087775    -4.210011
+  638.000000   154.000000    59.000000    -5.087775    -4.210011
+  638.000000   154.000000    59.000000    -5.128770    -4.210011
+  638.000000   154.000000    59.000000    -5.128770    -4.210011
+  638.000000   154.000000    59.000000    -5.128770    -4.210011
+  639.000000   154.000000    59.000000    -5.128770    -4.210011
+  639.000000   154.000000    59.000000    -5.128770    -4.210011
+  639.000000   154.000000    59.000000    -5.128770    -4.215582
+  639.000000   154.000000    59.000000    -5.128770    -4.215604
+  639.000000   154.000000    59.000000    -5.128770    -4.215634
+  639.000000   154.000000    59.000000    -5.130395    -4.215634
+  639.000000   154.000000    59.000000    -5.213173    -4.217937
+  639.000000   154.000000    59.000000    -5.213173    -4.217937
+  639.000000   154.000000    59.000000    -5.213173    -4.217937
+  641.000000   154.000000    59.000000    -5.213173    -4.217937
+  641.000000   154.000000    59.000000    -5.213173    -4.217937
+  641.000000   154.000000    59.000000    -5.213173    -4.217937
+  641.000000   154.000000    59.000000    -5.213173    -4.228198
+  642.000000   154.000000    60.000000    -5.213173    -4.228198
+  642.000000   154.000000    60.000000    -5.213173    -4.228198
+  642.000000   154.000000    60.000000    -5.213173    -4.228198
+  642.000000   154.000000    60.000000    -5.213173    -4.228198
+  642.000000   154.000000    60.000000    -5.213173    -4.228198
+  642.000000   154.000000    60.000000    -5.228922    -4.228198
+  642.000000   154.000000    60.000000    -5.228922    -4.228198
+  642.000000   154.000000    60.000000    -5.228922    -4.228201
+  642.000000   154.000000    60.000000    -5.228922    -4.230609
+  642.000000   154.000000    60.000000    -5.238125    -4.230610
+  642.000000   154.000000    60.000000    -5.238125    -4.243708
+  643.000000   154.000000    60.000000    -5.238125    -4.243708
+  643.000000   154.000000    60.000000    -5.238125    -4.243708
+  643.000000   154.000000    60.000000    -5.238125    -4.373889
+  643.000000   154.000000    61.000000    -5.238125    -4.373889
+  643.000000   154.000000    61.000000    -5.250409    -4.373889
+  643.000000   154.000000    61.000000    -5.250409    -4.373889
+  643.000000   154.000000    61.000000    -5.250409    -4.373889
+  643.000000   154.000000    61.000000    -5.262263    -4.373889
+  643.000000   154.000000    61.000000    -5.306309    -4.373889
+  643.000000   154.000000    61.000000    -5.306309    -4.373889
+  643.000000   154.000000    61.000000    -5.306309    -4.379805
+  643.000000   154.000000    61.000000    -5.306309    -4.379805
+  643.000000   154.000000    61.000000    -5.306309    -4.379805
+  643.000000   154.000000    61.000000    -5.314027    -4.379805
+  643.000000   154.000000    62.000000    -5.314027    -4.383758
+  643.000000   154.000000    62.000000    -5.314027    -4.383758
+  643.000000   154.000000    62.000000    -5.314027    -4.383758
+  644.000000   154.000000    62.000000    -5.314027    -4.383758
+  644.000000   155.000000    62.000000    -5.314027    -4.383758
+  644.000000   155.000000    62.000000    -5.314027    -4.383758
+  644.000000   155.000000    62.000000    -5.337548    -4.383758
+  644.000000   155.000000    62.000000    -5.337548    -4.389375
+  644.000000   155.000000    62.000000    -5.337548    -4.389375
+  644.000000   155.000000    63.000000    -5.379943    -4.389375
+  644.000000   155.000000    63.000000    -5.379943    -4.389375
+  645.000000   155.000000    63.000000    -5.379943    -4.389375
+  645.000000   155.000000    63.000000    -5.379943    -4.395289
+  645.000000   155.000000    63.000000    -5.379943    -4.395289
+  645.000000   155.000000    63.000000    -5.382931    -4.397701
+  645.000000   155.000000    63.000000    -5.382931    -4.397701
+  645.000000   155.000000    63.000000    -5.382931    -4.400861
+  645.000000   155.000000    63.000000    -5.382931    -4.400861
+  645.000000   155.000000    63.000000    -5.382931    -4.400861
+  645.000000   155.000000    63.000000    -5.382931    -4.400861
+  645.000000   155.000000    63.000000    -5.382931    -4.400861
+  645.000000   155.000000    63.000000    -5.429679    -4.401658
+  645.000000   155.000000    63.000000    -5.429679    -4.401658
+  646.000000   155.000000    63.000000    -5.429679    -4.401658
+  646.000000   155.000000    63.000000    -5.429679    -4.401658
+  646.000000   155.000000    63.000000    -5.440402    -4.401869
+  646.000000   155.000000    63.000000    -5.441520    -4.401869
+  646.000000   155.000000    63.000000    -5.441520    -4.403272
+  646.000000   155.000000    63.000000    -5.441520    -4.404033
+  647.000000   155.000000    63.000000    -5.464831    -4.409699
+  648.000000   155.000000    63.000000    -5.464831    -4.409699
+  648.000000   155.000000    63.000000    -5.464831    -4.409699
+  648.000000   155.000000    63.000000    -5.464831    -4.409699
+  648.000000   155.000000    63.000000    -5.464831    -4.409699
+  648.000000   155.000000    63.000000    -5.464831    -4.409699
+  648.000000   155.000000    63.000000    -5.464831    -4.409699
+  648.000000   155.000000    63.000000    -5.464831    -4.409699
+  648.000000   155.000000    63.000000    -5.464831    -4.409699
+  648.000000   155.000000    64.000000    -5.465908    -4.409699
+  648.000000   156.000000     0.000000    -5.465908    -4.419782
+  650.000000   156.000000     0.000000    -5.465908    -4.419782
+  650.000000   156.000000     0.000000    -5.465908    -4.419782
+  650.000000   156.000000     0.000000    -5.487067    -4.419782
+  650.000000   156.000000     0.000000    -5.487067    -4.419782
+  650.000000   156.000000     0.000000    -5.492830    -4.419782
+  650.000000   156.000000     0.000000    -5.492830    -4.419782
+  650.000000   156.000000     0.000000    -5.492830    -4.422150
+  650.000000   156.000000     0.000000    -5.497572    -4.422150
+  650.000000   156.000000     0.000000    -5.497572    -4.606305
+  650.000000   156.000000     0.000000    -5.497572    -4.606305
+  650.000000   156.000000     0.000000    -5.497572    -4.606408
+  651.000000   156.000000     0.000000    -5.497572    -4.606408
+  651.000000   156.000000     0.000000    -5.497572    -4.606408
+  651.000000   156.000000     0.000000    -5.497572    -4.606408
+  651.000000   156.000000     0.000000    -5.519808    -4.607973
+  651.000000   156.000000     0.000000    -5.519808    -4.607973
+  652.000000   156.000000     0.000000    -5.534848    -4.607973
+  652.000000   156.000000     0.000000    -5.534848    -4.607973
+  652.000000   156.000000     0.000000    -5.534848    -4.607973
+  653.000000   156.000000     0.000000    -5.534848    -4.607973
+  653.000000   156.000000     0.000000    -5.534848    -4.607973
+  653.000000   156.000000     0.000000    -5.534848    -4.607973
+  653.000000   156.000000     0.000000    -5.534848    -4.607973
+  653.000000   156.000000     0.000000    -5.534848    -4.608820
+  653.000000   156.000000     0.000000    -5.534848    -4.621086
+  653.000000   156.000000     0.000000    -5.535358    -4.621086
+  653.000000   156.000000     0.000000    -5.535764    -4.621086
+  653.000000   156.000000     0.000000    -5.537825    -4.621086
+  653.000000   156.000000     0.000000    -5.537825    -4.621086
+  653.000000   156.000000     0.000000    -5.537825    -4.621086
+  653.000000   156.000000     0.000000    -5.537825    -4.621086
+  653.000000   156.000000     0.000000    -5.537825    -4.621086
+  654.000000   156.000000     0.000000    -5.550398    -4.647526
+  654.000000   156.000000     0.000000    -5.550398    -4.649712
+  654.000000   156.000000     0.000000    -5.550398    -4.649712
+  654.000000   156.000000     0.000000    -5.553374    -4.649712
+  654.000000   156.000000     0.000000    -5.553374    -4.649712
+  654.000000   156.000000     0.000000    -5.553374    -4.649938
+  655.000000   156.000000     0.000000    -5.553374    -4.651440
+  655.000000   156.000000     0.000000    -5.553374    -4.651440
+  655.000000   156.000000     0.000000    -5.553386    -4.651896
+  655.000000   156.000000     0.000000    -5.553791    -4.651896
+  655.000000   156.000000     0.000000    -5.553791    -4.653397
+  655.000000   156.000000     0.000000    -5.553791    -4.653397
+  655.000000   156.000000     0.000000    -5.553791    -4.653397
+  656.000000   156.000000     0.000000    -5.553791    -4.653397
+  656.000000   157.000000     0.000000    -5.553791    -4.653430
+  656.000000   157.000000     0.000000    -5.553791    -4.653430
+  656.000000   157.000000     0.000000    -5.569330    -4.653430
+  656.000000   157.000000     0.000000    -5.569330    -4.653658
+  656.000000   157.000000     0.000000    -5.569330    -4.653658
+  657.000000   157.000000     0.000000    -5.569330    -4.787525
+  657.000000   157.000000     0.000000    -5.569330    -4.787525
+  657.000000   157.000000     0.000000    -5.569330    -4.787525
+  657.000000   157.000000     0.000000    -5.569330    -4.787525
+  657.000000   157.000000     0.000000    -5.569330    -4.798067
+  657.000000   157.000000     0.000000    -5.569330    -4.798067
+  657.000000   157.000000     0.000000    -5.569330    -4.798067
+  657.000000   157.000000     0.000000    -5.569341    -4.798067
+  658.000000   158.000000     0.000000    -5.569341    -4.798067
+  658.000000   158.000000     0.000000    -5.569341    -4.798067
+  658.000000   158.000000     0.000000    -5.569341    -4.798067
+  658.000000   158.000000     0.000000    -5.573495    -4.798067
+  658.000000   158.000000     0.000000    -5.573495    -4.798067
+  658.000000   158.000000     0.000000    -5.573495    -4.798067
+  658.000000   158.000000     0.000000    -5.589045    -4.798067
+  658.000000   158.000000     0.000000    -5.589045    -4.798067
+  658.000000   158.000000     0.000000    -5.589045    -4.801652
+  658.000000   158.000000     0.000000    -5.589045    -4.801652
+  659.000000   158.000000     0.000000    -5.589045    -4.801652
+  659.000000   158.000000     0.000000    -5.589045    -4.944911
+  659.000000   158.000000     0.000000    -5.589045    -4.944911
+  659.000000   158.000000     0.000000    -5.589045    -4.944911
+  659.000000   158.000000     0.000000    -5.589045    -4.944911
+  659.000000   158.000000     0.000000    -5.589045    -4.944911
+  659.000000   158.000000     0.000000    -5.589045    -4.944911
+  660.000000   158.000000     0.000000    -5.589045    -4.944911
+  660.000000   158.000000     0.000000    -5.589045    -4.944911
+  660.000000   158.000000     0.000000    -5.589045    -4.944911
+  660.000000   158.000000     0.000000    -5.589045    -4.948857
+  660.000000   158.000000     0.000000    -5.589045    -4.948857
+  660.000000   158.000000     0.000000    -5.589045    -4.948857
+  660.000000   158.000000     0.000000    -5.589045    -4.948857
+  662.000000   158.000000     0.000000    -5.589045    -4.948857
+  662.000000   158.000000     0.000000    -5.589045    -4.948857
+  662.000000   158.000000     0.000000    -5.605510    -4.948857
+  662.000000   158.000000     0.000000    -5.605510    -4.948857
+  662.000000   158.000000     0.000000    -5.605510    -4.948857
+  662.000000   158.000000     0.000000    -5.605510    -4.954346
+  662.000000   158.000000     0.000000    -5.605510    -4.954346
+  662.000000   158.000000     0.000000    -5.605510    -5.005344
+  662.000000   158.000000     0.000000    -5.605510    -5.005344
+  662.000000   158.000000     0.000000    -5.605510    -5.005344
+  662.000000   158.000000     0.000000    -5.605510    -5.005344
+  662.000000   158.000000     0.000000    -5.605510    -5.005344
+  662.000000   158.000000     0.000000    -5.605510    -5.005344
+  662.000000   158.000000     0.000000    -5.605510    -5.005344
+  662.000000   159.000000     0.000000    -5.605510    -5.005344
+  662.000000   159.000000     0.000000    -5.605510    -5.005344
+  663.000000   159.000000     0.000000    -5.605510    -5.005344
+  663.000000   159.000000     0.000000    -5.605510    -5.018093
+  663.000000   159.000000     0.000000    -5.605510    -5.055250
+  663.000000   159.000000     0.000000    -5.605510    -5.055250
+  663.000000   159.000000     0.000000    -5.605510    -5.055250
+  663.000000   159.000000     0.000000    -5.605510    -5.055250
+  664.000000   159.000000     0.000000    -5.614935    -5.067872
+  664.000000   159.000000     0.000000    -5.614935    -5.141387
+  664.000000   159.000000     0.000000    -5.614935    -5.160269
+  664.000000   159.000000     0.000000    -5.614935    -5.160269
+  664.000000   159.000000     0.000000    -5.614948    -5.160269
+  664.000000   159.000000     0.000000    -5.614948    -5.160269
+  664.000000   159.000000     0.000000    -5.614948    -5.160269
+  664.000000   159.000000     0.000000    -5.614948    -5.160269
+  665.000000   159.000000     0.000000    -5.614948    -5.160269
+  665.000000   159.000000     0.000000    -5.614948    -5.160269
+  665.000000   159.000000     0.000000    -5.614948    -5.274921
+  665.000000   159.000000     0.000000    -5.614948    -5.274921
+  665.000000   159.000000     0.000000    -5.614948    -5.274921
+  665.000000   159.000000     0.000000    -5.614948    -5.274921
+  665.000000   159.000000     0.000000    -5.614948    -5.274921
+  665.000000   159.000000     0.000000    -5.614948    -5.274921
+  665.000000   159.000000     0.000000    -5.614948    -5.274921
+  665.000000   159.000000     0.000000    -5.614948    -5.274921
+  665.000000   159.000000     0.000000    -5.614948    -5.274921
+  666.000000   159.000000     0.000000    -5.616782    -5.277120
+  666.000000   159.000000     0.000000    -5.622101    -5.282820
+  666.000000   159.000000     0.000000    -5.622101    -5.282820
+  666.000000   159.000000     0.000000    -5.631400    -5.282820
+  666.000000   159.000000     0.000000    -5.632102    -5.287278
+  667.000000   159.000000     0.000000    -5.632102    -5.287278
+  667.000000   159.000000     0.000000    -5.632102    -5.287278
+  667.000000   159.000000     0.000000    -5.650993    -5.287278
+  667.000000   159.000000     0.000000    -5.650993    -5.287278
+  667.000000   159.000000     0.000000    -5.650993    -5.287278
+  667.000000   159.000000     0.000000    -5.667292    -5.287278
+  667.000000   159.000000     0.000000    -5.667292    -5.287278
+  667.000000   159.000000     0.000000    -5.667292    -5.287278
+  667.000000   159.000000     0.000000    -5.667292    -5.287278
+  667.000000   159.000000     0.000000    -5.667292    -5.287278
+  667.000000   159.000000     0.000000    -5.667292    -5.287278
+  667.000000   159.000000     0.000000    -5.667292    -5.336208
+  667.000000   159.000000     0.000000    -5.667292    -5.336208
+  667.000000   159.000000     0.000000    -5.667292    -5.336208
+  667.000000   159.000000     0.000000    -5.667292    -5.336208
+  667.000000   159.000000     0.000000    -5.667292    -5.336208
+  667.000000   159.000000     0.000000    -5.667292    -5.336208
+  668.000000   159.000000     0.000000    -5.667292    -5.336208
+  668.000000   159.000000     0.000000    -5.667292    -5.336208
+  668.000000   159.000000     0.000000    -5.667292    -5.336208
+  668.000000   159.000000     0.000000    -5.667292    -5.336208
+  670.000000   159.000000     0.000000    -5.667292    -5.338620
+  670.000000   159.000000     0.000000    -5.667292    -5.338746
+  670.000000   159.000000     0.000000    -5.667304    -5.338746
+  670.000000   159.000000     0.000000    -5.667304    -5.338746
+  670.000000   159.000000     0.000000    -5.667304    -5.338746
+  670.000000   159.000000     0.000000    -5.667304    -5.340796
+  670.000000   159.000000     0.000000    -5.667304    -5.340796
+  670.000000   159.000000     0.000000    -5.667304    -5.340796
+  670.000000   159.000000     0.000000    -5.667304    -5.340796
+  670.000000   159.000000     0.000000    -5.667304    -5.350500
+  670.000000   159.000000     0.000000    -5.667304    -5.350500
+  670.000000   159.000000     0.000000    -5.667304    -5.430467
+  670.000000   159.000000     0.000000    -5.667304    -5.430467
+  670.000000   159.000000     0.000000    -5.667304    -5.430467
+  670.000000   159.000000     0.000000    -5.667304    -5.430467
+  670.000000   159.000000     0.000000    -5.667304    -5.430467
+  670.000000   159.000000     0.000000    -5.667304    -5.430467
+  670.000000   159.000000     0.000000    -5.667304    -5.430467
+  670.000000   159.000000     0.000000    -5.667304    -5.430467
+  670.000000   159.000000     0.000000    -5.667304    -5.430467
+  671.000000   159.000000     0.000000    -5.667304    -5.430467
+  671.000000   159.000000     0.000000    -5.667304    -5.435055
+  671.000000   159.000000     0.000000    -5.667304    -5.435055
+  671.000000   159.000000     0.000000    -5.667304    -5.435055
+  672.000000   159.000000     0.000000    -5.667304    -5.435055
+  672.000000   159.000000     0.000000    -5.680452    -5.435055
+  672.000000   159.000000     0.000000    -5.680452    -5.435055
+  672.000000   159.000000     0.000000    -5.680452    -5.435055
+  672.000000   159.000000     0.000000    -5.682618    -5.435055
+  672.000000   160.000000     0.000000    -5.682618    -5.435055
+  672.000000   160.000000     0.000000    -5.682618    -5.435055
+  672.000000   160.000000     0.000000    -5.697775    -5.435313
+  672.000000   160.000000     0.000000    -5.697775    -5.483751
+  672.000000   160.000000     0.000000    -5.697775    -5.483751
+  672.000000   160.000000     0.000000    -5.697775    -5.483751
+  672.000000   160.000000     0.000000    -5.697775    -5.483751
+  672.000000   160.000000     0.000000    -5.697775    -5.483751
+  674.000000   160.000000     0.000000    -5.697775    -5.483751
+  674.000000   160.000000     0.000000    -5.697775    -5.483751
+  674.000000   160.000000     0.000000    -5.697775    -5.483751
+  675.000000   160.000000     0.000000    -5.697775    -5.483751
+  675.000000   160.000000     0.000000    -5.697775    -5.483751
+  675.000000   160.000000     0.000000    -5.697775    -5.483751
+  675.000000   160.000000     0.000000    -5.697775    -5.483751
+  675.000000   160.000000     0.000000    -5.697775    -5.483751
+  675.000000   160.000000     0.000000    -5.698353    -5.483751
+  675.000000   160.000000     0.000000    -5.698353    -5.488335
+  675.000000   160.000000     0.000000    -5.698353    -5.488335
+  675.000000   160.000000     0.000000    -5.698353    -5.488335
+  675.000000   160.000000     0.000000    -5.698353    -5.488335
+  677.000000   160.000000     0.000000    -5.698353    -5.488336
+  677.000000   160.000000     0.000000    -5.698353    -5.502630
+  677.000000   160.000000     0.000000    -5.698353    -5.502630
+  677.000000   160.000000     0.000000    -5.698353    -5.502630
+  677.000000   160.000000     0.000000    -5.698353    -5.502630
+  677.000000   160.000000     0.000000    -5.698353    -5.502631
+  677.000000   160.000000     0.000000    -5.698353    -5.502631
+  677.000000   160.000000     0.000000    -5.698353    -5.502631
+  677.000000   160.000000     0.000000    -5.698353    -5.502631
+  677.000000   160.000000     0.000000    -5.698353    -5.502631
+  677.000000   160.000000     0.000000    -5.698353    -5.502631
+  677.000000   160.000000     0.000000    -5.698353    -5.527014
+  677.000000   160.000000     0.000000    -5.698353    -5.527014
+  677.000000   160.000000     0.000000    -5.698353    -5.539466
+  677.000000   160.000000     0.000000    -5.698353    -5.539466
+  677.000000   160.000000     0.000000    -5.698353    -5.539466
+  677.000000   160.000000     0.000000    -5.698353    -5.539466
+  677.000000   160.000000     0.000000    -5.698353    -5.539487
+  677.000000   160.000000     0.000000    -5.698353    -5.539487
+  679.000000   160.000000     0.000000    -5.698353    -5.611336
+  679.000000   160.000000     0.000000    -5.698353    -5.611336
+  679.000000   160.000000     0.000000    -5.698353    -5.611343
+  679.000000   160.000000     0.000000    -5.698353    -5.625224
+  679.000000   160.000000     0.000000    -5.698353    -5.625224
+  679.000000   160.000000     0.000000    -5.698353    -5.625224
+  679.000000   160.000000     0.000000    -5.698353    -5.625231
+  680.000000   160.000000     0.000000    -5.698353    -5.625231
+  680.000000   160.000000     0.000000    -5.698353    -5.625231
+  680.000000   160.000000     0.000000    -5.698353    -5.625231
+  680.000000   160.000000     0.000000    -5.698353    -5.625231
+  680.000000   160.000000     0.000000    -5.698353    -5.625231
+  680.000000   160.000000     0.000000    -5.698353    -5.625231
+  680.000000   160.000000     0.000000    -5.698353    -5.625231
+  680.000000   160.000000     0.000000    -5.698353    -5.625231
+  680.000000   160.000000     0.000000    -5.698353    -5.625231
+  680.000000   160.000000     0.000000    -5.698353    -5.625231
+  680.000000   160.000000     0.000000    -5.698353    -5.625231
+  680.000000   160.000000     0.000000    -5.698353    -5.661825
+  680.000000   160.000000     0.000000    -5.698353    -5.661825
+  680.000000   160.000000     0.000000    -5.698353    -5.661825
+  680.000000   160.000000     0.000000    -5.698353    -5.661825
+  680.000000   160.000000     0.000000    -5.698353    -5.661825
+  680.000000   160.000000     0.000000    -5.698353    -5.662061
+  681.000000   161.000000     0.000000    -5.698353    -5.662061
+  681.000000   161.000000     0.000000    -5.698353    -5.662061
+  681.000000   161.000000     0.000000    -5.698353    -5.662061
+  682.000000   161.000000     0.000000    -5.698353    -5.665403
+  682.000000   161.000000     0.000000    -5.698353    -5.665403
+  682.000000   161.000000     0.000000    -5.698353    -5.665403
+  682.000000   161.000000     0.000000    -5.698353    -5.665969
+  682.000000   161.000000     0.000000    -5.698353    -5.665969
+  682.000000   161.000000     0.000000    -5.698353    -5.665969
+  682.000000   161.000000     0.000000    -5.698353    -5.665969
+  682.000000   161.000000     0.000000    -5.698353    -5.665969
+  683.000000   161.000000     0.000000    -5.698353    -5.665969
+  683.000000   161.000000     0.000000    -5.698353    -5.665969
+  683.000000   161.000000     0.000000    -5.698353    -5.669372
+  683.000000   161.000000     0.000000    -5.698353    -5.669372
+  683.000000   161.000000     0.000000    -5.698353    -5.684138
+  683.000000   161.000000     0.000000    -5.698353    -5.684138
+  683.000000   161.000000     0.000000    -5.698353    -5.684138
+  683.000000   161.000000     0.000000    -5.698353    -5.684138
+  684.000000   161.000000     0.000000    -5.698353    -5.684138
+  684.000000   161.000000     0.000000    -5.698353    -5.684138
+  684.000000   161.000000     0.000000    -5.698353    -5.684138
+  684.000000   161.000000     0.000000    -5.698353    -5.684138
+  684.000000   161.000000     0.000000    -5.698353    -5.684138
+  684.000000   161.000000     0.000000    -5.698353    -5.684138
+  685.000000   161.000000     0.000000    -5.698353    -5.702812
+  685.000000   161.000000     0.000000    -5.698353    -5.702812
+  685.000000   161.000000     0.000000    -5.698353    -5.702812
+  685.000000   161.000000     0.000000    -5.698353    -5.709978
+  685.000000   161.000000     0.000000    -5.698353    -5.709978
+  685.000000   161.000000     0.000000    -5.698353    -5.709978
+  685.000000   161.000000     0.000000    -5.698353    -5.709978
+  685.000000   161.000000     0.000000    -5.698353    -5.709978
+  685.000000   161.000000     0.000000    -5.698353    -5.709978
+  685.000000   161.000000     0.000000    -5.698353    -5.709978
+  685.000000   161.000000     0.000000    -5.698353    -5.709978
+  685.000000   161.000000     0.000000    -5.698353    -5.709978
+  686.000000   161.000000     0.000000    -5.698353    -5.710102
+  686.000000   161.000000     0.000000    -5.698353    -5.710102
+  686.000000   161.000000     0.000000    -5.698353    -5.710365
+  686.000000   161.000000     0.000000    -5.698353    -5.710365
+  687.000000   161.000000     0.000000    -5.698353    -5.710365
+  687.000000   161.000000     0.000000    -5.698353    -5.715440
+  687.000000   161.000000     0.000000    -5.698353    -5.715440
+  687.000000   161.000000     0.000000    -5.698353    -5.715446
+  687.000000   161.000000     0.000000    -5.698353    -5.717538
+  687.000000   162.000000     0.000000    -5.698353    -5.717538
+  687.000000   162.000000     0.000000    -5.698353    -5.717538
+  688.000000   162.000000     0.000000    -5.698353    -5.717538
+  688.000000   162.000000     0.000000    -5.698353    -5.717538
+  688.000000   162.000000     0.000000    -5.698353    -5.717538
+  688.000000   162.000000     0.000000    -5.698353    -5.717538
+  688.000000   162.000000     0.000000    -5.698353    -5.722613
+  688.000000   162.000000     0.000000    -5.698353    -5.722613
+  688.000000   162.000000     0.000000    -5.698353    -5.722613
+  688.000000   162.000000     0.000000    -5.698353    -5.722731
+  688.000000   162.000000     0.000000    -5.698353    -5.722731
+  689.000000   162.000000     0.000000    -5.698353    -5.730166
+  689.000000   162.000000     0.000000    -5.698353    -5.730166
+  689.000000   162.000000     0.000000    -5.698353    -5.730166
+  691.000000   162.000000     0.000000    -5.698353    -5.730173
+  691.000000   162.000000     0.000000    -5.698353    -5.730173
+  691.000000   162.000000     0.000000    -5.698353    -5.730173
+  691.000000   162.000000     0.000000    -5.698353    -5.730173
+  691.000000   162.000000     0.000000    -5.698353    -5.730173
+  691.000000   162.000000     0.000000    -5.698353    -5.730173
+  691.000000   162.000000     0.000000    -5.698353    -5.730173
+  691.000000   162.000000     0.000000    -5.698353    -5.745885
+  691.000000   162.000000     0.000000    -5.698353    -5.745885
+  691.000000   162.000000     0.000000    -5.698353    -5.745885
+  691.000000   162.000000     0.000000    -5.698353    -5.745885
+  691.000000   162.000000     0.000000    -5.698353    -5.745885
+  691.000000   162.000000     0.000000    -5.698353    -5.811050
+  691.000000   162.000000     0.000000    -5.698353    -5.811050
+  692.000000   162.000000     0.000000    -5.698353    -5.811050
+  692.000000   162.000000     0.000000    -5.698353    -5.811050
+  692.000000   162.000000     0.000000    -5.698353    -5.811050
+  692.000000   162.000000     0.000000    -5.698353    -5.811050
+  692.000000   162.000000     0.000000    -5.698353    -5.811050
+  692.000000   162.000000     0.000000    -5.698353    -5.811050
+  692.000000   162.000000     0.000000    -5.698353    -5.811050
+  692.000000   162.000000     0.000000    -5.698353    -5.811050
+  692.000000   162.000000     0.000000    -5.698353    -5.811050
+  692.000000   162.000000     0.000000    -5.698353    -5.811050
+  692.000000   162.000000     0.000000    -5.698353    -5.811050
+  692.000000   162.000000     0.000000    -5.698353    -5.811050
+  692.000000   162.000000     0.000000    -5.698353    -5.811050
+  692.000000   162.000000     0.000000    -5.698353    -5.811050
+  692.000000   162.000000     0.000000    -5.698353    -5.811050
+  692.000000   162.000000     0.000000    -5.698353    -5.811050
+  692.000000   162.000000     0.000000    -5.698353    -5.826762
+  692.000000   162.000000     0.000000    -5.698353    -5.826762
+  692.000000   162.000000     0.000000    -5.698353    -5.826762
+  692.000000   162.000000     0.000000    -5.698353    -5.827023
+  692.000000   162.000000     0.000000    -5.698353    -5.827023
+  692.000000   162.000000     0.000000    -5.698353    -5.847000
+  692.000000   162.000000     0.000000    -5.698353    -5.847255
+  692.000000   162.000000     0.000000    -5.698353    -5.847255
+  693.000000   162.000000     0.000000    -5.698353    -5.847255
+  693.000000   162.000000     0.000000    -5.698353    -5.847255
+  693.000000   162.000000     0.000000    -5.698353    -5.847261
+  693.000000   162.000000     0.000000    -5.698353    -5.847261
+  693.000000   162.000000     0.000000    -5.698353    -5.938183
+  693.000000   162.000000     0.000000    -5.698353    -5.938183
+  693.000000   162.000000     0.000000    -5.698353    -5.938183
+  693.000000   162.000000     0.000000    -5.698353    -5.938183
+  693.000000   162.000000     0.000000    -5.698353    -5.938183
+  693.000000   162.000000     0.000000    -5.698353    -5.938183
+  693.000000   163.000000     0.000000    -5.698353    -5.938183
+  693.000000   163.000000     0.000000    -5.698353    -5.938183
+  693.000000   163.000000     0.000000    -5.698353    -5.938183
+  693.000000   163.000000     0.000000    -5.698353    -5.938183
+  693.000000   163.000000     0.000000    -5.698353    -5.938183
+  693.000000   163.000000     0.000000    -5.698353    -5.938183
+  694.000000   163.000000     0.000000    -5.698353    -5.938183
+  694.000000   163.000000     0.000000    -5.698353    -5.938183
+  694.000000   163.000000     0.000000    -5.698353    -5.954016
+  696.000000   163.000000     0.000000    -5.698353    -5.954016
+  696.000000   163.000000     0.000000    -5.698353    -5.954016
+  696.000000   163.000000     0.000000    -5.698353    -5.954016
+  696.000000   163.000000     0.000000    -5.698353    -5.954057
+  696.000000   163.000000     0.000000    -5.698353    -5.954057
+  696.000000   163.000000     0.000000    -5.698353    -5.954058
+  696.000000   163.000000     0.000000    -5.698353    -6.010316
+  696.000000   163.000000     0.000000    -5.698353    -6.010316
+  696.000000   163.000000     0.000000    -5.698353    -6.010316
+  696.000000   163.000000     0.000000    -5.698353    -6.010316
+  696.000000   163.000000     0.000000    -5.698353    -6.010316
+  696.000000   163.000000     0.000000    -5.698353    -6.010316
+  696.000000   163.000000     0.000000    -5.698353    -6.030555
+  696.000000   163.000000     0.000000    -5.698353    -6.030555
+  696.000000   163.000000     0.000000    -5.698353    -6.031038
+  696.000000   163.000000     0.000000    -5.698353    -6.045291
+  696.000000   163.000000     0.000000    -5.698353    -6.045291
+  697.000000   163.000000     0.000000    -5.698353    -6.045291
+  697.000000   163.000000     0.000000    -5.698353    -6.045291
+  697.000000   163.000000     0.000000    -5.698353    -6.045291
+  697.000000   163.000000     0.000000    -5.698353    -6.045291
+  698.000000   163.000000     0.000000    -5.698353    -6.045291
+  698.000000   163.000000     0.000000    -5.698353    -6.045291
+  698.000000   163.000000     0.000000    -5.698353    -6.045291
+  698.000000   163.000000     0.000000    -5.698353    -6.045291
+  698.000000   163.000000     0.000000    -5.698353    -6.045291
+  698.000000   163.000000     0.000000    -5.698353    -6.045293
+  698.000000   163.000000     0.000000    -5.698353    -6.045293
+  698.000000   163.000000     0.000000    -5.698353    -6.045293
+  699.000000   163.000000     0.000000    -5.698353    -6.045293
+  699.000000   163.000000     0.000000    -5.698353    -6.045293
+  699.000000   163.000000     0.000000    -5.698353    -6.045293
+  699.000000   163.000000     0.000000    -5.698353    -6.045293
+  699.000000   163.000000     0.000000    -5.698353    -6.045293
+  699.000000   163.000000     0.000000    -5.698353    -6.045293
+  699.000000   163.000000     0.000000    -5.698353    -6.045293
+  699.000000   163.000000     0.000000    -5.698353    -6.045293
+  699.000000   163.000000     0.000000    -5.698353    -6.045293
+  699.000000   163.000000     0.000000    -5.698353    -6.045293
+  699.000000   163.000000     0.000000    -5.698353    -6.045293
+  700.000000   163.000000     0.000000    -5.698353    -6.047031
+  700.000000   163.000000     0.000000    -5.698353    -6.047031
+  700.000000   163.000000     0.000000    -5.698353    -6.047031
+  700.000000   163.000000     0.000000    -5.698353    -6.047031
+  700.000000   163.000000     0.000000    -5.698353    -6.047031
+  700.000000   163.000000     0.000000    -5.698353    -6.047031
+  700.000000   163.000000     0.000000    -5.698353    -6.091928
+  700.000000   163.000000     0.000000    -5.698353    -6.091928
+  700.000000   163.000000     0.000000    -5.698353    -6.091928
+  700.000000   163.000000     0.000000    -5.698353    -6.091928
+  700.000000   164.000000     0.000000    -5.698353    -6.091928
+  700.000000   164.000000     0.000000    -5.698353    -6.091928
+  701.000000   164.000000     0.000000    -5.698353    -6.091928
+  701.000000   164.000000     0.000000    -5.698353    -6.091928
+  701.000000   164.000000     0.000000    -5.698353    -6.091928
+  701.000000   164.000000     0.000000    -5.698353    -6.091928
+  701.000000   164.000000     0.000000    -5.698353    -6.091928
+  701.000000   164.000000     0.000000    -5.698353    -6.091928
+  701.000000   164.000000     0.000000    -5.698353    -6.091998
+  701.000000   164.000000     0.000000    -5.698353    -6.091998
+  701.000000   164.000000     0.000000    -5.698353    -6.107778
+  701.000000   164.000000     0.000000    -5.698353    -6.107778
+  702.000000   164.000000     0.000000    -5.698353    -6.107778
+  702.000000   164.000000     0.000000    -5.698353    -6.107778
+  702.000000   164.000000     0.000000    -5.698353    -6.107780
+  702.000000   164.000000     0.000000    -5.698353    -6.107780
+  702.000000   164.000000     0.000000    -5.698353    -6.107780
+  702.000000   165.000000     0.000000    -5.698353    -6.107780
+  702.000000   165.000000     0.000000    -5.698353    -6.107780
+  702.000000   165.000000     0.000000    -5.698353    -6.107780
+  703.000000   165.000000     0.000000    -5.698353    -6.107780
+  703.000000   165.000000     0.000000    -5.698353    -6.107780
+  703.000000   165.000000     0.000000    -5.698353    -6.108072
+  703.000000   165.000000     0.000000    -5.698353    -6.118456
+  703.000000   165.000000     0.000000    -5.698353    -6.118456
+  703.000000   165.000000     0.000000    -5.698353    -6.118456
+  703.000000   165.000000     0.000000    -5.698353    -6.118456
+  703.000000   165.000000     0.000000    -5.698353    -6.118456
+  703.000000   165.000000     0.000000    -5.698353    -6.119399
+  703.000000   165.000000     0.000000    -5.698353    -6.119399
+  703.000000   165.000000     0.000000    -5.698353    -6.119399
+  703.000000   165.000000     0.000000    -5.698353    -6.119399
+  703.000000   165.000000     0.000000    -5.698353    -6.119399
+  704.000000   165.000000     0.000000    -5.698353    -6.119889
+  704.000000   165.000000     0.000000    -5.698353    -6.119889
+  704.000000   165.000000     0.000000    -5.698353    -6.119889
+  704.000000   165.000000     0.000000    -5.698353    -6.119889
+  704.000000   165.000000     0.000000    -5.698353    -6.119889
+  705.000000   165.000000     0.000000    -5.698353    -6.122217
+  705.000000   165.000000     0.000000    -5.698353    -6.122237
+  705.000000   165.000000     0.000000    -5.698353    -6.122237
+  705.000000   166.000000     0.000000    -5.698353    -6.122237
+  705.000000   166.000000     0.000000    -5.698353    -6.123205
+  705.000000   166.000000     0.000000    -5.698353    -6.123205
+  705.000000   166.000000     0.000000    -5.698353    -6.123205
+  706.000000   166.000000     0.000000    -5.698353    -6.123205
+  706.000000   166.000000     0.000000    -5.698353    -6.123205
+  706.000000   166.000000     0.000000    -5.698353    -6.123205
+  706.000000   166.000000     0.000000    -5.698353    -6.247289
+  707.000000   166.000000     0.000000    -5.698353    -6.247289
+  707.000000   166.000000     0.000000    -5.698353    -6.247289
+  707.000000   166.000000     0.000000    -5.698353    -6.247289
+  707.000000   166.000000     0.000000    -5.698353    -6.247488
+  707.000000   166.000000     0.000000    -5.698353    -6.247488
+  707.000000   166.000000     0.000000    -5.698353    -6.247488
+  707.000000   166.000000     0.000000    -5.698353    -6.247488
+  707.000000   166.000000     0.000000    -5.698353    -6.250651
+  707.000000   166.000000     0.000000    -5.698353    -6.250651
+  707.000000   166.000000     0.000000    -5.698353    -6.250651
+  707.000000   166.000000     0.000000    -5.698353    -6.251815
+  708.000000   166.000000     0.000000    -5.698353    -6.251815
+  708.000000   166.000000     0.000000    -5.698353    -6.251815
+  708.000000   166.000000     0.000000    -5.698353    -6.251815
+  708.000000   166.000000     0.000000    -5.698353    -6.251815
+  708.000000   166.000000     0.000000    -5.698353    -6.251815
+  708.000000   166.000000     0.000000    -5.698353    -6.284965
+  708.000000   166.000000     0.000000    -5.698353    -6.284965
+  709.000000   166.000000     0.000000    -5.698353    -6.284965
+  709.000000   166.000000     0.000000    -5.698353    -6.284965
+  709.000000   166.000000     0.000000    -5.698353    -6.284965
+  709.000000   166.000000     0.000000    -5.698353    -6.284965
+  709.000000   166.000000     0.000000    -5.698353    -6.284965
+  709.000000   166.000000     0.000000    -5.698353    -6.284965
+  709.000000   166.000000     0.000000    -5.698353    -6.284965
+  709.000000   166.000000     0.000000    -5.698353    -6.284965
+  709.000000   166.000000     0.000000    -5.698353    -6.284965
+  710.000000   166.000000     0.000000    -5.698353    -6.284965
+  710.000000   166.000000     0.000000    -5.698353    -6.284965
+  710.000000   166.000000     0.000000    -5.698353    -6.284965
+  710.000000   166.000000     0.000000    -5.698353    -6.284965
+  711.000000   166.000000     0.000000    -5.698353    -6.284965
+  711.000000   166.000000     0.000000    -5.698353    -6.284965
+  711.000000   166.000000     0.000000    -5.698353    -6.295472
+  711.000000   166.000000     0.000000    -5.698353    -6.295472
+  711.000000   166.000000     0.000000    -5.698353    -6.295472
+  711.000000   166.000000     0.000000    -5.698353    -6.295472
+  712.000000   166.000000     0.000000    -5.698353    -6.295472
+  712.000000   166.000000     0.000000    -5.698353    -6.310901
+  712.000000   166.000000     0.000000    -5.698353    -6.310901
+  712.000000   166.000000     0.000000    -5.698353    -6.310901
+  712.000000   166.000000     0.000000    -5.698353    -6.310901
+  712.000000   166.000000     0.000000    -5.698353    -6.310901
+  712.000000   166.000000     0.000000    -5.698353    -6.310901
+  712.000000   166.000000     0.000000    -5.698353    -6.310901
+  712.000000   166.000000     0.000000    -5.698353    -6.310901
+  712.000000   166.000000     0.000000    -5.698353    -6.310901
+  712.000000   166.000000     0.000000    -5.698353    -6.310901
+  712.000000   166.000000     0.000000    -5.698353    -6.310901
+  712.000000   166.000000     0.000000    -5.698353    -6.310901
+  712.000000   166.000000     0.000000    -5.698353    -6.310901
+  713.000000   166.000000     0.000000    -5.698353    -6.310901
+  713.000000   166.000000     0.000000    -5.698353    -6.310901
+  713.000000   166.000000     0.000000    -5.698353    -6.310901
+  713.000000   166.000000     0.000000    -5.698353    -6.310901
+  713.000000   166.000000     0.000000    -5.698353    -6.310901
+  713.000000   166.000000     0.000000    -5.698353    -6.325036
+  713.000000   166.000000     0.000000    -5.698353    -6.325036
+  713.000000   166.000000     0.000000    -5.698353    -6.325036
+  713.000000   166.000000     0.000000    -5.698353    -6.325036
+  713.000000   166.000000     0.000000    -5.698353    -6.325036
+  713.000000   166.000000     0.000000    -5.698353    -6.325059
+  714.000000   166.000000     0.000000    -5.698353    -6.325059
+  714.000000   166.000000     0.000000    -5.698353    -6.325059
+  714.000000   166.000000     0.000000    -5.698353    -6.325059
+  714.000000   166.000000     0.000000    -5.698353    -6.331798
+  714.000000   166.000000     0.000000    -5.698353    -6.331798
+  714.000000   166.000000     0.000000    -5.698353    -6.331798
+  714.000000   166.000000     0.000000    -5.698353    -6.331798
+  714.000000   166.000000     0.000000    -5.698353    -6.331798
+  714.000000   166.000000     0.000000    -5.698353    -6.331798
+  714.000000   166.000000     0.000000    -5.698353    -6.331798
+  714.000000   166.000000     0.000000    -5.698353    -6.331798
+  715.000000   167.000000     0.000000    -5.698353    -6.331798
+  715.000000   167.000000     0.000000    -5.698353    -6.331798
+  715.000000   167.000000     0.000000    -5.698353    -6.331798
+  715.000000   167.000000     0.000000    -5.698353    -6.331798
+  715.000000   167.000000     0.000000    -5.698353    -6.331798
+  715.000000   167.000000     0.000000    -5.698353    -6.331798
+  715.000000   167.000000     0.000000    -5.698353    -6.331798
+  716.000000   167.000000     0.000000    -5.698353    -6.331798
+  716.000000   167.000000     0.000000    -5.698353    -6.331798
+  716.000000   167.000000     0.000000    -5.698353    -6.331798
+  716.000000   167.000000     0.000000    -5.698353    -6.331798
+  716.000000   167.000000     0.000000    -5.698353    -6.331798
+  716.000000   167.000000     0.000000    -5.698353    -6.331798
+  716.000000   167.000000     0.000000    -5.698353    -6.331798
+  716.000000   167.000000     0.000000    -5.698353    -6.331798
+  717.000000   167.000000     0.000000    -5.698353    -6.331798
+  717.000000   167.000000     0.000000    -5.698353    -6.331798
+  717.000000   167.000000     0.000000    -5.698353    -6.331798
+  717.000000   167.000000     0.000000    -5.698353    -6.331821
+  717.000000   167.000000     0.000000    -5.698353    -6.331873
+  718.000000   167.000000     0.000000    -5.698353    -6.332235
+  718.000000   167.000000     0.000000    -5.698353    -6.332235
+  718.000000   167.000000     0.000000    -5.698353    -6.332235
+  718.000000   167.000000     0.000000    -5.698353    -6.332987
+  718.000000   167.000000     0.000000    -5.698353    -6.332987
+  718.000000   167.000000     0.000000    -5.698353    -6.332987
+  718.000000   167.000000     0.000000    -5.698353    -6.332987
+  718.000000   167.000000     0.000000    -5.698353    -6.332987
+  718.000000   167.000000     0.000000    -5.698353    -6.332987
+  718.000000   167.000000     0.000000    -5.698353    -6.332987
+  719.000000   167.000000     0.000000    -5.698353    -6.332987
+  719.000000   167.000000     0.000000    -5.698353    -6.332987
+  719.000000   167.000000     0.000000    -5.698353    -6.332987
+  719.000000   167.000000     0.000000    -5.698353    -6.332987
+  721.000000   167.000000     0.000000    -5.698353    -6.334864
+  721.000000   167.000000     0.000000    -5.698353    -6.334864
+  721.000000   167.000000     0.000000    -5.698353    -6.334864
+  721.000000   167.000000     0.000000    -5.698353    -6.334864
+  721.000000   167.000000     0.000000    -5.698353    -6.334864
+  721.000000   167.000000     0.000000    -5.698353    -6.334864
+  721.000000   167.000000     0.000000    -5.698353    -6.334864
+  721.000000   167.000000     0.000000    -5.698353    -6.334864
+  721.000000   167.000000     0.000000    -5.698353    -6.334864
+  721.000000   167.000000     0.000000    -5.698353    -6.334864
+  721.000000   167.000000     0.000000    -5.698353    -6.334864
+  721.000000   167.000000     0.000000    -5.698353    -6.334864
+  721.000000   167.000000     0.000000    -5.698353    -6.334882
+  721.000000   167.000000     0.000000    -5.698353    -6.334882
+  721.000000   167.000000     0.000000    -5.698353    -6.334882
+  721.000000   167.000000     0.000000    -5.698353    -6.334882
+  721.000000   167.000000     0.000000    -5.698353    -6.334882
+  721.000000   167.000000     0.000000    -5.698353    -6.334882
+  721.000000   167.000000     0.000000    -5.698353    -6.334882
+  721.000000   167.000000     0.000000    -5.698353    -6.334882
+  721.000000   167.000000     0.000000    -5.698353    -6.334882
+  721.000000   167.000000     0.000000    -5.698353    -6.334882
+  721.000000   167.000000     0.000000    -5.698353    -6.334882
+  721.000000   167.000000     0.000000    -5.698353    -6.334882
+  721.000000   167.000000     0.000000    -5.698353    -6.334882
+  721.000000   167.000000     0.000000    -5.698353    -6.335392
+  721.000000   168.000000     0.000000    -5.698353    -6.335392
+  721.000000   168.000000     0.000000    -5.698353    -6.335392
+  722.000000   168.000000     0.000000    -5.698353    -6.335392
+  722.000000   168.000000     0.000000    -5.698353    -6.335392
+  722.000000   168.000000     0.000000    -5.698353    -6.335392
+  722.000000   168.000000     0.000000    -5.698353    -6.335392
Index: trunk/optimizer/src/pgapack/pgapack/test/pgapackf.h
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/test/pgapackf.h	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/test/pgapackf.h	(revision 816)
@@ -0,0 +1,1 @@
+link ../include/pgapackf.h
Index: trunk/optimizer/src/pgapack/pgapack/util/README
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/util/README	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/util/README	(revision 816)
@@ -0,0 +1,14 @@
+PGAPack Utilities
+
+convertfortran.pl  -- Simple perl script to convert the fortran examples to 
+		      work on "64-bit" machines -- Alpha, Power Challenge, T3D.
+
+upgrade_script.pl  -- Script to _assist_ in the upgrade from version 0.2 to 
+		      version 1.0.  Will catch _most_ of the changes.
+
+wordsizes.c        -- C program to show the sizes of various datastructues
+                      used by PGAPack.  Useful for configuration.  See
+                      wordsizes.c for more information.
+
+
+
Index: trunk/optimizer/src/pgapack/pgapack/util/convertfortran.pl
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/util/convertfortran.pl	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/util/convertfortran.pl	(revision 816)
@@ -0,0 +1,22 @@
+#!/usr/local/bin/perl
+#
+#  Convert fortran examples to 64-bit compatable codes.
+#
+#  This script will replace all occurances of "integer ctx" and 
+#  "integer comm" with "integer*8 ctx" and "integer*8 comm", respectively.
+#  (Uncomment the commented lines below to convert back to 32-bit examples.)
+#
+#  WARNING:  This is done inplace -- no backup files are created!
+#
+foreach (@ARGV) {
+    print "Converting $_\n";
+    $file = $_;
+    open(In, "$file"); @Stuff = <In>; close(In);
+    foreach (@Stuff) {
+        s/integer\s*ctx/integer\*8 ctx/g;
+        s/integer\s*comm/integer\*8 comm/g;
+#        s/integer\*8\s*ctx/integer ctx/g;
+#        s/integer\*8\s*comm/integer comm/g;
+    }
+    open(Out, ">$file"); print Out @Stuff; close(Out);
+}    
Index: trunk/optimizer/src/pgapack/pgapack/util/upgrade_script.pl
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/util/upgrade_script.pl	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/util/upgrade_script.pl	(revision 816)
@@ -0,0 +1,119 @@
+#!/usr/local/bin/perl
+#
+#  This is a simple script to help in upgrading from V0.2 to V1.0.  It will
+#  make most (if not all) of the function name and #define name changes, and
+#  will print a message where they are done.
+#
+#  Not guaranteed to work 100%, but should take the majority of the pain
+#  out of it.
+#
+#  One thing to pay careful attention to is PGASetMutateOnlyNoCross.  This
+#  was replaced by two functions, PGASetMuataionOrCrossoverFlag and
+#  PGASetMuatationAndCrossoverFlag.  Here, we replace it with the first.
+#
+#  Usage:
+#      upgrade_script.pl <FilesToUpgrade>
+#
+#      It will move the original files to filename.old, and create the 
+#      new files with the original name.
+#
+
+if (ARGV eq 0) {
+    print "Usage: upgrade_script.pl <FilesToUpgrade>\n";
+    exit(-1);
+}
+
+foreach $filename (@ARGV) {
+    rename($filename, "$filename.bak");
+    open(INPUT, "$filename.bak");
+    open(OUTPUT, ">$filename");
+    while (<INPUT>) {
+        &do_rename;
+        print OUTPUT $_;
+    }
+    close(OUTPUT);
+    close(INPUT);
+}
+
+
+sub do_rename {
+    s/PGABinaryBuildIndividualDatatype/PGABinaryBuildDatatype/g;
+    s/PGABinaryRandomize/PGABinaryInitString/g;
+    s/PGABinaryWrite/PGABinaryPrint/g;
+    s/PGABinaryWriteString/PGABinaryPrintString/g;
+    s/PGABuildIndividualDatatype/PGABuildDatatype/g;
+    s/PGACharacterBuildIndividualDatatype/PGACharacterBuildDatatype/g;
+    s/PGACharacterRandomize/PGACharacterInitString/g;
+    s/PGACharacterWriteString/PGACharacterPrintString/g;
+    s/PGAFitnessLinNor/PGAFitnessLinearNormal/g;
+    s/PGAFitnessLinRank/PGAFitnessLinearRank/g;
+    s/PGAFitnessMinRecprl/PGAFitnessMinReciprocal/g;
+    s/PGAGetEvalUpToDate/PGAGetEvaluationUpToDateFlag/g;
+    s/PGAGetEvaluate/PGAGetEvaluation/g;
+    s/PGAGetFitnessRankMax/PGAGetMaxFitnessRank/g;
+    s/PGAGetBest/PGAGetBestIndex/g;
+    s/PGAGetWorst/PGAGetWorstIndex/g;
+    s/PGAGetInitIntegerMax/PGAGetMaxIntegerInitValue/g;
+    s/PGAGetInitIntegerMin/PGAGetMinIntegerInitValue/g;
+    s/PGAGetInitRealMax/PGAGetMaxRealInitValue/g;
+    s/PGAGetInitRealMin/PGAGetMinRealInitValue/g;
+    s/PGAGetIntegerType/PGAGetIntegerInitType/g;
+    s/PGAGetIter/PGAGetGAIterValue/g;
+    s/PGAGetMaxDouble/PGAGetMaxMachineDoubleValue/g;
+    s/PGAGetMaxInt/PGAGetMaxMachineIntValue/g;
+    s/PGAGetMaxIter/PGAGetMaxGAIterValue/g;
+    s/PGAGetMinDouble/PGAGetMinMachineDoubleValue/g;
+    s/PGAGetMinInt/PGAGetMinMachineIntValue/g;
+    s/PGAGetMutateIntegerVal/PGAGetMutationIntegerValue/g;
+    s/PGAGetMutateOnlyNoCross/PGAGetMutationAndCrossoverFlag/g;
+    s/PGAGetMutateRealVal/PGAGetMutationRealValue/g;
+    s/PGAGetNoDuplicates/PGAGetNoDuplicatesFlag/g;
+    s/PGAGetNprocs/PGAGetNumProcs/g;
+    s/PGAGetNumReplace/PGAGetNumReplaceValue/g;
+    s/PGAGetOptDir/PGAGetOptDirFlag/g;
+    s/PGAGetPID/PGAGetRank/g;
+    s/PGAGetPopReplace/PGAGetPopReplaceType/g;
+    s/PGAGetPrintFreq/PGAGetPrintFrequency/g;
+    s/PGAGetRandomInit/PGAGetRandomInitFlag/g;
+    s/PGAGetRestart/PGAGetRestartFlag/g;
+    s/PGAGetRestartFrequency/PGAGetRestartFrequencyValue/g;
+    s/PGAGetSortPop/PGAGetSortedPopIndex/g;
+    s/PGAGetStoppingRule/PGAGetStoppingRuleType/g;
+    s/PGAGetStringLen/PGAGetStringLength/g;
+    s/PGAGetUniformCrossProb/PGAGetUniformCrossoverProb/g;
+    s/PGAIntegerBuildIndividualDatatype/PGAIntegerBuildDatatype/g;
+    s/PGAIntegerRandomize/PGAIntegerInitString/g;
+    s/PGAIntegerWriteString/PGAIntegerPrintString/g;
+    s/PGAParallelDone/PGADoneMS/g;
+    s/PGAParallelEvaluateMS/PGAEvaluateMS/g;
+    s/PGAPrintContext/PGAPrintContextVariable/g;
+    s/PGAPrintVersion/PGAPrintVersionNumber/g;
+    s/PGARealBuildIndividualDatatype/PGARealBuildDatatype/g;
+    s/PGARealRandomize/PGARealInitString/g;
+    s/PGARealWriteString/PGARealPrintString/g;
+    s/PGARunMutateAndCross/PGARunMutationAndCrossover/g;
+    s/PGARunMutateOrCross/PGARunMutationOrCrossover/g;
+    s/PGASelectNext/PGASelectNextIndex/g;
+    s/PGASetCharacterInit/PGASetCharacterInitType/g;
+    s/PGASetEvaluate/PGASetEvaluation/g;
+    s/PGASetEvalUpToDate/PGASetEvaluationUpToDateFlag/g;
+    s/PGASetFitnessRankMax/PGASetMaxFitnessRank/g;
+    s/PGASetMaxIter/PGASetMaxGAIterValue/g;
+    s/PGASetMaxNoChange/PGASetMaxNoChangeValue/g;
+    s/PGASetMaxSimilarity/PGASetMaxSimilarityValue/g;
+    s/PGASetMutateOnlyNoCross/PGASetMutationOrCrossoverFlag/g;
+    s/PGASetMutationIntegerVal/PGASetMutationIntegerValue/g;
+    s/PGASetMutationRealVal/PGASetMutationRealValue/g;
+    s/PGASetNoDuplicates/PGASetNoDuplicatesFlag/g;
+    s/PGASetNumReplace/PGASetNumReplaceValue/g;
+    s/PGASetPopReplacement/PGASetPopReplacementType/g;
+    s/PGASetPrintFreq/PGASetPrintFrequencyValue/g;
+    s/PGASetRandomInit/PGASetRandomInitFlag/g;
+    s/PGASetRestart/PGASetRestartFlag/g;
+    s/PGASetRestartFrequency/PGASetRestartFrequencyValue/g;
+    s/PGASetStoppingRule/PGASetStoppingRuleType/g;
+    s/PGASetSupportingDebugFlags/PGASetDebugFlag/g;
+    s/PGASetUniformCrossProb/PGASetUniformCrossoverProb/g;
+    s/PGAWriteString/PGAPrintString/g;
+}
+
Index: trunk/optimizer/src/pgapack/pgapack/util/wordsizes.c
===================================================================
--- trunk/optimizer/src/pgapack/pgapack/util/wordsizes.c	(revision 816)
+++ trunk/optimizer/src/pgapack/pgapack/util/wordsizes.c	(revision 816)
@@ -0,0 +1,34 @@
+
+#define WL 32
+#define FAKE_MPI
+
+#include <stdio.h>
+#include "../include/pgapack.h"
+
+/*
+ *  Compile with: cc -o wordsizes wordsizes.c
+ *
+ *  Any size WL can be used -- it will not affect the sizes below.
+ *
+ *  FAKE_MPI will also not affect the sizes of the structures below,
+ *  but will simplify the compilation.  
+ *
+ *  If PGAContext * is 8 bytes, then you have a "64-bit" machine.  Be
+ *  sure to use integer*8 for the PGAContext variable, and integer*4
+ *  (usually just integer) for everything else.
+ *
+ */
+void main(void) {
+    printf("Sizes of various datatypes in bytes.\n\n");
+    printf("sizeof(PGAContext *):      %2d\n", sizeof(PGAContext *));
+    printf("sizeof(PGABinary):         %2d\n", sizeof(PGABinary));
+    printf("sizeof(PGAReal):           %2d\n", sizeof(PGAReal));
+    printf("sizeof(PGAInteger):        %2d\n", sizeof(PGAInteger));
+    printf("sizeof(PGACharacter):      %2d\n", sizeof(PGACharacter));
+
+    printf("sizeof(int):               %2d\n", sizeof(int));
+    printf("sizeof(long int):          %2d\n", sizeof(long int));
+
+    printf("sizeof(double):            %2d\n", sizeof(double));
+    printf("sizeof(char):              %2d\n", sizeof(char));
+}
