|
Putting it All Together
Compiling the Code
If you don't already have all the source files in one place, you can download them here. From a command prompt type the following command: javac -classpath .;OpenTS.jar *.java That will generate several .class files in your current directory. Running the Code
The command to run the code is very similar: java -classpath .;OpenTS.jar Main You should get something like the following on your screen: Best Solution: Solution value: 1025.509594617172 Sequence: [ 0, 4, 7, 6, 1, 8, 5, 12, 3, 13, 10, 16, 9, 2, 11, 19, 15, 14, 17, 18 ] 72.36062143209436 186.5986970577082 31.65330865904046 153.7776120384018 66.51727939444739 138.50626840743809 162.0462546930939 95.58307450675024 166.61826979420474 65.29515124758525 183.24577341373626 70.1724467685417 189.01469154596148 13.117008144132146 139.21366507607408 9.466871801969523 89.61552653863036 127.6305887567737 40.14429295263602 170.02917644462565 20.55498011060317 188.8716672695299 20.536646263235212 118.30519471918417 18.04865566274256 111.08005478256575 47.10475812952504 69.82307132497667 38.836647995939465 50.70319761183606 17.932880938130214 37.87442743261589 31.20277975254271 13.327835551901067 79.60378594606847 46.333632353910794 75.55484518831904 99.13175164522798 119.3827892351382 182.30827271981533 You might be wondering if this is a good solution. A quick trip to Excel gives us this chart of the solution. If you get something that looks like this then you got it right.
You may notice some obvious problems with the solution and say, "I could have done better with a pencil and paper!" Good, you're thinking. The tabu search we just built is embarrassingly primitive, but the premise of tabu search is that we can model a heuristic after the way humans think. Think about how you search for things and make an analogy to tabu search. Here are some things people have tried:
|
||