Revision: 3
http://sga.svn.sourceforge.net/sga/?rev=3&view=rev
Author: fragmad
Date: 2007-12-18 08:47:20 -0800 (Tue, 18 Dec 2007)
Log Message:
-----------
trunk.sga.c modified to include -h and -v command which display help and
version information respectively.
Modified Paths:
--------------
trunk/sga.c
Modified: trunk/sga.c
===================================================================
--- trunk/sga.c 2007-12-18 01:44:30 UTC (rev 2)
+++ trunk/sga.c 2007-12-18 16:47:20 UTC (rev 3)
@@ -54,6 +54,7 @@
/* accept the command line options */
while (--argc>0 && (*++argv)[0]=='-')
switch (*++argv[0]) {
+ case 'h': printf("SGA - The Simple Genetic Algorithm.\n\nSwitch Options\n\t\"-h\" - Displays this help page.\n\t\"-p\" - Sets the inital population size.\n\t\"-c\" - Sets the chromosome size.\n\t\"-x\" - Sets the crossover rate.\n\t\"-m\" - Sets the mutation rate.\n\t\"-f\" - Selects the fitness function used.\n\t\"-b\" - Boost fitness value.\n\t\"-r\" - Random number seed.\n\t\"-g\" - Sets the maximum number of generations.\n\t\"-s\" - Sets the display size.\n\t\"-d\" - Sets the display frequency.\n\t\"-v\" - Displays version information.\n");exit(0);
case 'p': if (*++argv[0])
popsize = atoi(argv[0]);
else if (--argc > 0)
@@ -104,14 +105,16 @@
else if (--argc > 0)
displfreq = atoi(*++argv);
break;
+ case 'v': printf("SGA - The Simple Gentic Algorithm Version 0.3.\nCopyright 2007 Tim Watson.\n Licenced Under the GNU Public Licence 3.0\n");exit(0);
+
default: break;
}
/* display the significant parameter settings */
printf("--------------------------------------------------\n");
- printf("popsize =%5d\tchromsize =%5d\n", popsize, chromsize);
- printf("crossrate =%5d\tmuterate =%5d\n", crossrate, muterate);
- printf("fitfunc =%5d\tboostfit =%5d\n", fitfunc, boostfit);
+ printf("population size =%5d\tchromosone size =%5d\n", popsize, chromsize);
+ printf("crossover rate =%5d\tmutation rate =%5d\n", crossrate, muterate);
+ printf("fitness function =%5d\tboostfit =%5d\n", fitfunc, boostfit);
printf("--------------------------------------------------\n");
/* initialise the population and the PRNG */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|