Skip to content

Latest commit

 

History

History
90 lines (89 loc) · 5.19 KB

README.md

File metadata and controls

90 lines (89 loc) · 5.19 KB

A JobShop scheduling using Genetic Algorithm

Compile:

chmod +x build.sh
./build.sh

Usage:

This program can read configuration from the config file or the keyboard, determineded by the "-C" argument.

Usage:
(optional)-f <data_filepath>    read data from the file
(optional)-C <configFilePath>   read options from the config file
(optional)-o <output_file>      print the result into a file instead of console
OR:
-g <int>        the gap of the population
-m <double>     reproductive ratio,the number of units which can reproduce is <ALL>/<this_ratio>
-i <int>        the number of initial population
-p <int>        the max number of a population
-d <double>     dead ratio, in each generation,the new number of population is <number_of_old>*1/<this ratio>
-c <double>     mutational ratio, the number of mutational units is <ALL>/<this_ratio>
-h              show this help

Example:

gaojianli @ localhost:~$ bash build.sh

File input:

gaojianli @ localhost:~$./a.out -f 1.txt -C config.ini
M1 (153,8-2,240) (240,7-3,286) (366,2-5,378) (417,5-2,461) (461,6-7,556) (556,1-7,609) (634,10-6,703) (703,4-8,796) (796,9-10,874) (880,3-9,963)
M2 (0,4-1,87) (87,1-1,108) (108,8-1,153) (161,3-4,180) (286,7-4,377) (452,9-7,480) (480,2-7,522) (591,6-9,598) (640,5-6,689) (826,10-9,900)
M3 (0,6-1,35) (35,3-2,99) (99,7-2,158) (158,2-2,189) (195,4-3,282) (282,9-2,319) (319,5-1,417) (417,10-3,511) (511,1-6,545) (545,8-9,584)
M4 (0,3-1,34) (34,7-1,50) (50,6-2,126) (126,4-2,195) (240,8-3,281) (418,9-5,444) (607,10-5,634) (656,1-9,711) (862,5-9,879) (957,2-10,996)
M5 (0,2-1,55) (55,9-1,88) (164,6-5,225) (281,8-4,301) (301,3-5,393) (511,10-4,607) (607,7-9,635) (635,1-8,656) (689,5-7,785) (873,4-10,933)
M6 (126,6-3,154) (189,2-3,287) (385,9-4,418) (461,5-3,486) (486,8-8,495) (522,7-8,581) (796,4-9,873) (963,3-10,1000) (1000,10-10,1084) (1084,1-10,1179)
M7 (108,1-2,179) (225,6-6,234) (301,8-5,355) (470,7-7,522) (522,5-4,597) (597,4-7,638) (638,9-8,727) (748,10-8,826) (826,3-8,880) (880,2-9,957)
M8 (247,1-5,273) (282,4-4,320) (378,2-6,444) (444,9-6,452) (597,5-5,640) (640,3-7,683) (703,10-7,748) (748,7-10,775) (775,6-10,870) (870,8-10,941)
M9 (0,10-1,69) (99,3-3,161) (195,1-4,247) (319,9-3,385) (385,4-5,409) (420,7-6,470) (470,8-7,484) (556,6-8,591) (591,2-8,668) (879,5-10,958)
M10 (69,10-2,150) (154,6-4,164) (179,1-3,195) (287,2-4,366) (377,7-5,420) (420,8-6,463) (463,4-6,546) (546,3-6,625) (727,9-9,769) (785,5-8,862)
830
32.484375
gaojianli @ localhost:~$./a.out -f 1.txt -g 300 -m 1.75 -i 400 -p 800 -d 1.1 -c 1
M1 (98,5-2,142) (142,8-2,229) (293,7-3,339) (452,1-7,505) (541,10-6,610) (610,2-5,622) (622,6-7,717) (717,3-9,800) (812,4-8,905) (943,9-10,1021)
M2 (0,1-1,21) (21,8-1,66) (66,4-1,153) (261,3-4,280) (285,5-6,334) (339,7-4,430) (430,9-7,458) (752,6-9,759) (771,10-9,845) (845,2-7,887)
M3 (0,5-1,98) (98,9-2,135) (135,3-2,199) (199,6-1,234) (234,7-2,293) (293,2-2,324) (324,10-3,418) (418,1-6,452) (452,4-3,539) (688,8-9,727)
M4 (0,7-1,16) (16,3-1,50) (153,4-2,222) (234,6-2,310) (310,8-3,351) (371,9-5,397) (514,10-5,541) (596,1-9,651) (825,5-9,842) (1041,2-10,1080)
M5 (0,9-1,33) (33,2-1,88) (280,3-5,372) (372,8-4,392) (418,10-4,514) (514,6-5,575) (575,1-8,596) (596,5-7,692) (752,7-9,780) (982,4-10,1042)
M6 (142,5-3,167) (310,6-3,338) (338,9-4,371) (371,2-3,469) (679,8-8,688) (693,7-8,752) (752,1-10,847) (847,3-10,884) (905,4-9,982) (982,10-10,1066)
M7 (21,1-2,92) (167,5-4,242) (392,8-5,446) (494,3-8,548) (575,6-6,584) (641,7-7,693) (693,10-8,771) (771,4-7,812) (812,9-8,901) (964,2-9,1041)
M8 (242,5-5,285) (379,1-5,405) (405,9-6,413) (451,3-7,494) (539,4-4,577) (610,10-7,655) (655,2-6,721) (780,7-10,807) (807,6-10,902) (902,8-10,973)
M9 (0,10-1,69) (199,3-3,261) (261,9-3,327) (327,1-4,379) (591,7-6,641) (641,4-5,665) (665,8-7,679) (717,6-8,752) (887,2-8,964) (964,5-10,1043)
M10 (69,10-2,150) (150,1-3,166) (338,6-4,348) (372,3-6,451) (469,2-4,548) (548,7-5,591) (591,8-6,634) (665,4-6,748) (748,5-8,825) (901,9-9,943)
807
33.828125

Console input:

gaojianli @ localhost:~$ ./a.out -g 300 -m 1.75 -i 400 -p 800 -d 1.1 -c 1
10 10
1 21 6 71 9 16 8 52 7 26 2 34 0 53 4 21 3 55 5 95
4 55 2 31 5 98 9 79 0 12 7 66 1 42 8 77 6 77 3 39
3 34 2 64 8 62 1 19 4 92 9 79 7 43 6 54 0 83 5 37
1 87 3 69 2 87 7 38 8 24 9 83 6 41 0 93 5 77 4 60
2 98 0 44 5 25 6 75 7 43 1 49 4 96 9 77 3 17 8 79
2 35 3 76 5 28 9 10 4 61 6 9 0 95 8 35 1 7 7 95
3 16 2 59 0 46 1 91 9 43 8 50 6 52 5 59 4 28 7 27
1 45 0 87 3 41 4 20 6 54 9 43 8 14 5 9 2 39 7 71
4 33 2 37 8 66 5 33 3 26 7 8 1 28 6 89 9 42 0 78
8 69 9 81 2 94 4 96 3 27 0 69 7 45 6 78 1 74 5 84
...
gaojianli @ localhost:~$./a.out -C config.ini
10 10
1 21 6 71 9 16 8 52 7 26 2 34 0 53 4 21 3 55 5 95
4 55 2 31 5 98 9 79 0 12 7 66 1 42 8 77 6 77 3 39
3 34 2 64 8 62 1 19 4 92 9 79 7 43 6 54 0 83 5 37
1 87 3 69 2 87 7 38 8 24 9 83 6 41 0 93 5 77 4 60
2 98 0 44 5 25 6 75 7 43 1 49 4 96 9 77 3 17 8 79
2 35 3 76 5 28 9 10 4 61 6 9 0 95 8 35 1 7 7 95
3 16 2 59 0 46 1 91 9 43 8 50 6 52 5 59 4 28 7 27
1 45 0 87 3 41 4 20 6 54 9 43 8 14 5 9 2 39 7 71
4 33 2 37 8 66 5 33 3 26 7 8 1 28 6 89 9 42 0 78
8 69 9 81 2 94 4 96 3 27 0 69 7 45 6 78 1 74 5 84
...

File output

gaojianli @ localhost:~$./a.out -f 1.txt -C config.ini -o 2.txt
The result has been written to 2.txt.