ijhm

所属分类:数值算法/人工智能
开发工具:C/C++
文件大小:9KB
下载次数:1
上传日期:2018-02-07 07:03:39
上 传 者Wcnielr
说明:  遗传算法的c源代码,内含说明,只不过是英文!

文件列表:
genet.h (2033, 1992-08-17)
assign1.c (339, 1992-08-16)
cross.c (2437, 1992-08-16)
eval.c (353, 1992-08-16)
init.c (1920, 1992-08-16)
initial.c (464, 1992-08-16)
inv.c (129, 1992-08-16)
main.c (994, 1992-08-16)
mut.c (3034, 1992-08-16)
N0assign.c (381, 1992-08-16)
pr.c (272, 1992-08-16)
psf.c (88, 1992-08-16)
read_data.c (3293, 1992-08-16)
rep.c (571, 1992-08-16)
repl.c (3839, 1992-08-16)
sel_d.c (697, 1992-08-16)
sel_p.c (874, 1992-08-16)
sort.c (317, 1992-08-16)
input (485, 1992-08-17)
makefile (203, 1992-08-16)
output (4144, 1992-08-17)

COPYRIGHT NOTICE This software is copyright by Zbigniew Michalewicz. Permission is granted to copy and use the software for scientific, noncommercial purposes only. The software is provided "as is", i.e., without any warranties. GENERAL REMARKS The genetic2 aims at solving the linear transportation problem (minimization of the transportation cost). It is interesting to compare the results of the system with results from some linear programming package. The system was described in an article "A Genetic Algorithm for the Linear Transportation Problem}, IEEE Transactions on Systems, Man, and Cybernetics, Vol.21, No.2, 1991, pp.445--452. It is also described in my new book "Genetic Algorithms + Data Structures = Evolution Programs" (Springer Verlag, August 1992). The system was build over 3 years ago. It is the first and last version (I do not plan to work on the system in the future). It is quite primitive with almost all variables global. However, the ease of use is its main advantage. The current version of genetic2 should run without changes on any BSD-UN*X system (preferably on a Sun SPARC machine). Note, however, that the system was NOT designed with portability in mind, i.e., the partability was not the main factor in the design process. HOW TO RUN THE GENETIC2 SYSTEM To run the genetic2 system, there are two simple steps to follow: (1) prepare input file, say, "your_input", (2) type "genetic2 < your_input > your_output" ("your_output" is the name of the output file provided by you). A simple example follows. The input file of this example is the transferred file "input" you have now in your directory, the typical output is present in the file "output". INPUT FILE (and the explanations, line by line. Note that the explanations are NOT present in the real input file): ____________________________________________________ # Problem number 1 /* comment line */ nsource 8 /* number of sources */ ndest 6 /* number of destinations */ sources 12 7 6 11 10 4 4 3 /* all source values */ dests 13 11 9 7 3 14 /* all destinations values */ costs 1 3 8 11 4 4 /* the cost matrix for a given 4 0 12 1 1 1 linear transportation problem */ 3 3 1 5 7 9 9 4 1 0 0 5 8 9 14 11 11 10 19 12 40 1 39 11 18 2 5 7 9 9 4 6 9 1 0 9 optimum 0 /* if optimum is known, you can place its value here */ pop 40 /* population size */ cross 2 /* number of crossovers per generation */ inver 0 /* inversion is NOT implemented; keep it zero all the time */ mutat 8 /* number of mutations per generation */ sprob 0.9 /* a coefficient for probability distribution */ it 200 /* number of generations */ run 250 /* run id (optional) */ seed 1 /* seed */ run 251 /* for additional runs with different seeds: */ seed 9999 run 252 seed 1313 run 253 seed 13333 run 254 seed 33333 end __________________________________________________________ The output is given in the "output" file; it is self-explanatory. IMPORTANT REMARKS: (1) the maximum sizes of the number of sorces, destinations, and the population size are given in the genet.h file. If you run larger example, change these maximum values first. (2) keep the total of crossovers and mutations (cross + mutat) at approx. 25% of the population size for the best results. (3) there is a parameter "licz" in the genet.h file; licz = 2147483***7.0. This represents the largest integer number (converted into float) which can be generated by the standard function rand(). You may have to change this constant in your system. (4) All input data (except sprob) are integers. I hope this information would be sufficient to run the system. Zbigniew Michalewicz ****************************************************************************** * Mail: Department of Computer Science E-mail: zbyszek@mosaic.uncc.edu * * University of North Carolina Phone: (704) 547-4873 * * Charlotte, NC 28223 Fax: (704) 547-2352 * ******************************************************************************

近期下载者

相关文件


收藏者