📄 masterreproducer.java
字号:
package com.well.www.user.xanthian.java.genetic;import com.coyotegulch.genetic.*;import com.well.www.user.xanthian.java.genetic.reproducers.asexual.*;import com.well.www.user.xanthian.java.genetic.reproducers.consultive.*;import com.well.www.user.xanthian.java.genetic.reproducers.sexual.*;import com.well.www.user.xanthian.java.ui.*;public class MasterReproducer{ public static ReproducerVector hookReproducers() { // define the reproduction operators ReproducerVector reproducers = new ReproducerVector();/*** In general, we don't want the clone reproducer to run at all, it is** just here so that the reproducer vector cannot be empty despite user** choices, so choose a very small weight which will work as a very big** weight if it is the only reproducer in the vector.*/ reproducers.addReproducer(new Clone(), 0.01F); if ( CheckBoxControls.getState ( CheckBoxControls.CBC_HEURISTIC_CYCLIC_CROSSOVER ) ) { reproducers.addReproducer(new CyclicCrossover(), 50.0F); } if ( CheckBoxControls.getState ( CheckBoxControls.CBC_HEURISTIC_EDGE_PRESERVING_CROSSOVER ) ) { reproducers.addReproducer(new EdgePreservingCyclicCrossover(), 50.0F); } if ( CheckBoxControls.getState ( CheckBoxControls.CBC_HEURISTIC_ORDERED_CROSSOVER ) ) { reproducers.addReproducer(new OrderedCrossover(), 50.0F); } if ( CheckBoxControls.getState ( CheckBoxControls.CBC_HEURISTIC_PARTIAL_MATCH_CROSSOVER ) ) { reproducers.addReproducer(new PartialMatchCrossover(), 50.0F); } if ( CheckBoxControls.getState ( CheckBoxControls.CBC_HEURISTIC_ROLLING_CROSSOVER ) ) { reproducers.addReproducer(new RollingCrossover(), 100.0F); } if ( CheckBoxControls.getState(CheckBoxControls.CBC_HEURISTIC_INVER_OVER) ) { reproducers.addReproducer(new InverOver(), 50.0F); } if ( CheckBoxControls.getState ( CheckBoxControls.CBC_HEURISTIC_DEWRINKLER ) ) { reproducers.addReproducer(new Dewrinkler(), 10.0F); } if ( CheckBoxControls.getState ( CheckBoxControls.CBC_HEURISTIC_DISORDERED_SLIDE ) ) { reproducers.addReproducer(new DisorderedSlide(), 10.0F); } if ( CheckBoxControls.getState(CheckBoxControls.CBC_HEURISTIC_INVERT) ) { reproducers.addReproducer(new Invert(), 10.0F); } if (CheckBoxControls.getState(CheckBoxControls.CBC_HEURISTIC_MOVE)) { reproducers.addReproducer(new Move(), 10.0F); } if ( CheckBoxControls.getState ( CheckBoxControls.CBC_HEURISTIC_OPTIMIZE_NODES_AND_EDGES_NEAR_A_POINT ) ) { reproducers.addReproducer(new OptimizeNodesAndEdgesNearAPoint(), 10.0F); } if ( CheckBoxControls.getState ( CheckBoxControls.CBC_HEURISTIC_OPTIMIZE_NODES_AND_EDGES_NEAR_EVERY_CITY ) ) { reproducers.addReproducer ( new OptimizeNodesAndEdgesNearEveryCity(), 10.0F ); } if ( CheckBoxControls.getState ( CheckBoxControls.CBC_HEURISTIC_OPTIMIZE_NODES_NEAR_A_POINT ) ) { reproducers.addReproducer(new OptimizeNodesNearAPoint(), 10.0F); } if ( CheckBoxControls.getState ( CheckBoxControls.CBC_HEURISTIC_OPTIMIZE_NODES_NEAR_EVERY_CITY ) ) { reproducers.addReproducer(new OptimizeNodesNearEveryCity(), 10.0F); } if (CheckBoxControls.getState(CheckBoxControls.CBC_HEURISTIC_ORDERED_SLIDE)) { reproducers.addReproducer(new OrderedSlide(), 10.0F); } if ( CheckBoxControls.getState ( CheckBoxControls.CBC_HEURISTIC_PERMUTE_A_SUBLIST ) ) { reproducers.addReproducer ( new PermuteCitiesWithinASublist(), 10.0F ); } if ( CheckBoxControls.getState ( CheckBoxControls.CBC_HEURISTIC_PERMUTE_CUTS_NEAR_A_POINT ) ) { reproducers.addReproducer ( new PermuteCutsNearAPoint(), 10.0F ); } if ( CheckBoxControls.getState ( CheckBoxControls.CBC_HEURISTIC_PERMUTE_CUTS_NEAR_EVERY_CITY ) ) { reproducers.addReproducer ( new PermuteCutsNearEveryCity(), 10.0F ); } if ( CheckBoxControls.getState ( CheckBoxControls.CBC_HEURISTIC_PERMUTE_SINGLES ) ) { reproducers.addReproducer(new PermuteScatteredCities(), 10.0F); } if ( CheckBoxControls.getState ( CheckBoxControls.CBC_HEURISTIC_PERMUTE_SUBLISTS ) ) { reproducers.addReproducer ( new PermuteSeveralSublistsOfCities(), 10.0F ); } if ( CheckBoxControls .getState(CheckBoxControls.CBC_HEURISTIC_QUASI_QUICK_SORT) ) { reproducers.addReproducer(new QuasiQuickSort(), 10.0F); } if ( CheckBoxControls .getState(CheckBoxControls.CBC_HEURISTIC_QUASI_SHELL_SORT_INVERTER) ) { reproducers.addReproducer(new QuasiShellSortInverter(), 10.0F); } if ( CheckBoxControls .getState(CheckBoxControls.CBC_HEURISTIC_QUASI_SHELL_SORT_SWAPPER) ) { reproducers.addReproducer(new QuasiShellSortSwapper(), 10.0F); } if ( CheckBoxControls.getState ( CheckBoxControls.CBC_HEURISTIC_RANDOM_LOOP_CUTS ) ) { reproducers.addReproducer(new RandomCityLoopForNearbyCuts(), 10.0F); } if ( CheckBoxControls.getState ( CheckBoxControls.CBC_HEURISTIC_RANDOM_LOOP_NODES ) ) { reproducers.addReproducer(new RandomCityLoopForNearbyNodes(), 10.0F); } if ( CheckBoxControls.getState ( CheckBoxControls.CBC_HEURISTIC_RANDOM_LOOP_NODES_AND_EDGES ) ) { reproducers.addReproducer(new RandomCityLoopForNearbyNodesAndEdges(), 10.0F); } if ( CheckBoxControls.getState(CheckBoxControls.CBC_HEURISTIC_SMOOTHER) ) { reproducers.addReproducer(new Smoother(), 10.0F); } if ( CheckBoxControls.getState(CheckBoxControls.CBC_HEURISTIC_SNOW_PLOW) ) { reproducers.addReproducer(new SnowPlow(), 10.0F); } if ( CheckBoxControls.getState(CheckBoxControls.CBC_HEURISTIC_SNOW_PLOW_SQUEEZEBOX) ) { reproducers.addReproducer(new SnowPlowSqueezebox(), 10.0F); } if (CheckBoxControls.getState(CheckBoxControls.CBC_HEURISTIC_SWAP)) { reproducers.addReproducer(new Swap(), 10.0F); } return reproducers; } public static MutatorVector hookMutators() { // define the mutation operators MutatorVector mutators = new MutatorVector();/*** I have been wanting to have more than one of these for a very long** time.*/ mutators.addMutator(new DisorderedSlide(), 10.0F); mutators.addMutator(new OrderedSlide(), 10.0F); mutators.addMutator(new Invert(), 10.0F); mutators.addMutator(new Move(), 10.0F); mutators.addMutator(new Swap(), 10.0F); return mutators; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -