diff --git a/README.md b/README.md index e5aa46f..3d5365b 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ First, you need to add the following repository, which is a repository that can ``` Than you can add the dependency on our `aitoa-code` repository into your `dependencies` section. -Here, `0.8.50` is the current version of `aitoa-code`. +Here, `0.8.51` is the current version of `aitoa-code`. Notice that you may have more dependencies in your `dependencies` section, say on `junit`, but here I just put the one for `aitoa-code` as example. ```xml @@ -52,7 +52,7 @@ Notice that you may have more dependencies in your `dependencies` section, say o com.github.thomasWeise aitoa-code - 0.8.50 + 0.8.51 ``` diff --git a/pom.xml b/pom.xml index 95e9a53..207c192 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ aitoa aitoa-code - 0.8.50 + 0.8.51 jar aitoa-code Example Source Codes from the Book "Introduction to Optimization Algorithms" diff --git a/src/main/java/aitoa/algorithms/EA.java b/src/main/java/aitoa/algorithms/EA.java index e13d469..762c6aa 100644 --- a/src/main/java/aitoa/algorithms/EA.java +++ b/src/main/java/aitoa/algorithms/EA.java @@ -104,7 +104,7 @@ public final void printSetup(final Writer output) output.write(System.lineSeparator()); output.write(LogFormat.mapEntry("cr", this.cr));//$NON-NLS-1$ output.write(System.lineSeparator()); - output.write(LogFormat.mapEntry("pruning", false)); //$NON-NLS-1$ + output.write(LogFormat.mapEntry("clearing", false)); //$NON-NLS-1$ output.write(System.lineSeparator()); output.write(LogFormat.mapEntry("restarts", false)); //$NON-NLS-1$ output.write(System.lineSeparator()); diff --git a/src/main/java/aitoa/algorithms/EA1p1.java b/src/main/java/aitoa/algorithms/EA1p1.java index 7440aa0..2e04da7 100644 --- a/src/main/java/aitoa/algorithms/EA1p1.java +++ b/src/main/java/aitoa/algorithms/EA1p1.java @@ -88,7 +88,7 @@ public final void printSetup(final Writer output) output.write(System.lineSeparator()); output.write(LogFormat.mapEntry("cr", 0));//$NON-NLS-1$ output.write(System.lineSeparator()); - output.write(LogFormat.mapEntry("pruning", false)); //$NON-NLS-1$ + output.write(LogFormat.mapEntry("clearing", false)); //$NON-NLS-1$ output.write(System.lineSeparator()); output.write(LogFormat.mapEntry("restarts", false)); //$NON-NLS-1$ output.write(System.lineSeparator()); diff --git a/src/main/java/aitoa/algorithms/EA1p1WithFitness.java b/src/main/java/aitoa/algorithms/EA1p1WithFitness.java index 12e6720..f6b9755 100644 --- a/src/main/java/aitoa/algorithms/EA1p1WithFitness.java +++ b/src/main/java/aitoa/algorithms/EA1p1WithFitness.java @@ -111,7 +111,7 @@ public final void printSetup(final Writer output) output.write(System.lineSeparator()); output.write(LogFormat.mapEntry("cr", 0));//$NON-NLS-1$ output.write(System.lineSeparator()); - output.write(LogFormat.mapEntry("pruning", false)); //$NON-NLS-1$ + output.write(LogFormat.mapEntry("clearing", false)); //$NON-NLS-1$ output.write(System.lineSeparator()); output.write(LogFormat.mapEntry("restarts", false)); //$NON-NLS-1$ output.write(System.lineSeparator()); diff --git a/src/main/java/aitoa/algorithms/EAWithPruning.java b/src/main/java/aitoa/algorithms/EAWithClearing.java similarity index 78% rename from src/main/java/aitoa/algorithms/EAWithPruning.java rename to src/main/java/aitoa/algorithms/EAWithClearing.java index 73ed460..4451b4a 100644 --- a/src/main/java/aitoa/algorithms/EAWithPruning.java +++ b/src/main/java/aitoa/algorithms/EAWithClearing.java @@ -17,7 +17,7 @@ /** * An {@linkplain aitoa.algorithms.EA evolutionary algorithm} - * which prunes the population from candidate solutions with + * which clears the population from candidate solutions with * identical objective values before the reproduction step. This * ensures that all "parents" from which new points in the search * space are derived have a different solution quality. This, in @@ -40,7 +40,7 @@ * the solution space */ // start relevant -public final class EAWithPruning +public final class EAWithClearing implements IMetaheuristic { // end relevant @@ -61,7 +61,7 @@ public final class EAWithPruning * @param _lambda * the number of offspring to be created */ - public EAWithPruning(final double _cr, final int _mu, + public EAWithClearing(final double _cr, final int _mu, final int _lambda) { super(); if ((_cr < 0d) || (_cr > 1d) || (!(Double.isFinite(_cr)))) { @@ -99,7 +99,7 @@ public final void printSetup(final Writer output) output.write(System.lineSeparator()); output.write(LogFormat.mapEntry("cr", this.cr));//$NON-NLS-1$ output.write(System.lineSeparator()); - output.write(LogFormat.mapEntry("pruning", true)); //$NON-NLS-1$ + output.write(LogFormat.mapEntry("clearing", true)); //$NON-NLS-1$ output.write(System.lineSeparator()); output.write(LogFormat.mapEntry("restarts", false)); //$NON-NLS-1$ output.write(System.lineSeparator()); @@ -108,7 +108,7 @@ public final void printSetup(final Writer output) /** {@inheritDoc} */ @Override public final String toString() { - return ((((("eap_" + //$NON-NLS-1$ + return ((((("eac_" + //$NON-NLS-1$ this.mu) + '+') + this.lambda) + '@') + this.cr); } @@ -117,9 +117,10 @@ public final String toString() { @Override // start relevant public final void solve(final IBlackBoxProcess process) { -// omitted: initialize local variables random, searchSpace, +// omitted: Initialize local variables random, searchSpace, // nullary, unary, binary, and arrays P and P2 of length -// mu+lambda, and array T to null +// mu+lambda, and array T to null. Then fill the population with +// random individuals (you already know this). // end relevant // create local variables final Random random = process.getRandom(); @@ -134,70 +135,68 @@ public final void solve(final IBlackBoxProcess process) { Individual[] T = null, P = new Individual[this.mu + this.lambda], P2 = new Individual[P.length]; -// start relevant + // first generation: fill population with random individuals for (int i = P.length; (--i) >= 0;) { final X x = searchSpace.create(); nullary.apply(x, random); P[i] = new Individual<>(x, process.evaluate(x)); -// end relevant if (process.shouldTerminate()) { // we return return; // best solution is stored in process } -// start relevant } +// start relevant while (!process.shouldTerminate()) { // main loop -// shuffle P, so after sorting the order of unique recs is random +// Shuffle P: After sorting the order of unique recs is random. RandomUtils.shuffle(random, P, 0, P.length); -// sort the population: mu best individuals at front are selected +// Sort the population: mu best individuals are at the front. Arrays.sort(P); -// we now want to keep only the solutions with unique fitness +// We now want to keep only the solutions with unique quality. int unique = 0, done = 0, end = P.length; - T = P; // since array P is sorted, so we can do this by - P = P2; // processing it from begin to end and copying - P2 = T; // these individuals to the start of another array -// we switch the two arrays here so the rest is the same as EA + T = P; // First switch the arrays. P2 is sorted. We process + P = P2; // it from begin to end and copy the unique records + P2 = T; // to the start of P, the rest to the end of P. makeUnique: for (final Individual ind : P2) { - ++done; - if ((unique <= 0) || // + ++done; // Increase number of processed in individuals. + if ((unique <= 0) || // two lines: check for uniqueness (ind.quality > P[unique - 1].quality)) { - P[unique] = ind; - if ((++unique) >= this.mu) { // we are done and can + P[unique] = ind; // Individual unique -> copy to start + if ((++unique) >= this.mu) { // We got enough records: System.arraycopy(P2, done, P, unique, // copy the P.length - done); // remaining individuals break makeUnique; // directly, they do not need to - } // be unique, as they will be overwritten anyway + } // be unique, as they will be overwritten anyway. } else { // ind has an already-seen quality, so we copy P[--end] = ind; // it to the end of the array, where - } // it will eventually be overwritten + } // it will eventually be overwritten. } -// now we have 1 <= unique <= mu unique solutions -// shuffle the first unique solutions to ensure fairness +// Now we have 1 <= unique <= mu unique solutions. +// Shuffle the unique solutions again, to ensure fairness. RandomUtils.shuffle(random, P, 0, unique); int p1 = -1; // index to iterate over first parent -// override the worse (mu+lambda-unique) solutions +// Override the worse (mu + lambda - unique) solutions. for (int index = P.length; (--index) >= unique;) { - if (process.shouldTerminate()) { // we return - return; // best solution is stored in process + if (process.shouldTerminate()) { // Finished. + return; // The best solution is stored in process. } - final Individual dest = P[index]; - p1 = (p1 + 1) % unique; - final Individual sel = P[p1]; + final Individual dest = P[index]; // offspring + p1 = (p1 + 1) % unique; // parent 1 index + final Individual sel = P[p1]; // parent 1 if ((unique >= 2) && (random.nextDouble() <= this.cr)) { - int p2; // to hold index of second selected record + int p2; // p2 is the index of second selected parent. do { // find a second, different record p2 = random.nextInt(unique); - } while (p2 == p1); -// perform recombination of the two selected individuals + } while (p2 == p1); // Of course, can't be p1. +// Perform recombination of the two selected individuals. binary.apply(sel.x, P[p2].x, dest.x, random); - } else { -// create modified copy of parent using unary operator + } else { // Otherwise: Mutation. +// Create modified copy of parent using unary operator. unary.apply(sel.x, dest.x, random); } -// map to solution/schedule and evaluate quality +// Map to candidate solution and evaluate quality. dest.quality = process.evaluate(dest.x); } // the end of the offspring generation } // the end of the main loop diff --git a/src/main/java/aitoa/algorithms/EAWithFitness.java b/src/main/java/aitoa/algorithms/EAWithFitness.java index 3d682cc..c518159 100644 --- a/src/main/java/aitoa/algorithms/EAWithFitness.java +++ b/src/main/java/aitoa/algorithms/EAWithFitness.java @@ -92,7 +92,7 @@ public final void printSetup(final Writer output) output.write(System.lineSeparator()); output.write(LogFormat.mapEntry("cr", this.cr));//$NON-NLS-1$ output.write(System.lineSeparator()); - output.write(LogFormat.mapEntry("pruning", false)); //$NON-NLS-1$ + output.write(LogFormat.mapEntry("clearing", false)); //$NON-NLS-1$ output.write(System.lineSeparator()); output.write(LogFormat.mapEntry("restarts", false)); //$NON-NLS-1$ output.write(System.lineSeparator()); diff --git a/src/main/java/aitoa/algorithms/EAWithRestarts.java b/src/main/java/aitoa/algorithms/EAWithRestarts.java index 1033572..e67cc04 100644 --- a/src/main/java/aitoa/algorithms/EAWithRestarts.java +++ b/src/main/java/aitoa/algorithms/EAWithRestarts.java @@ -98,7 +98,7 @@ public final void printSetup(final Writer output) output.write(System.lineSeparator()); output.write(LogFormat.mapEntry("cr", this.cr));//$NON-NLS-1$ output.write(System.lineSeparator()); - output.write(LogFormat.mapEntry("pruning", false)); //$NON-NLS-1$ + output.write(LogFormat.mapEntry("clearing", false)); //$NON-NLS-1$ output.write(System.lineSeparator()); output.write(LogFormat.mapEntry("restarts", true)); //$NON-NLS-1$ output.write(System.lineSeparator()); diff --git a/src/main/java/aitoa/algorithms/MA.java b/src/main/java/aitoa/algorithms/MA.java index 574a46c..60e3d85 100644 --- a/src/main/java/aitoa/algorithms/MA.java +++ b/src/main/java/aitoa/algorithms/MA.java @@ -84,7 +84,7 @@ public final void printSetup(final Writer output) output.write(System.lineSeparator()); output.write(LogFormat.mapEntry("cr", 1d));//$NON-NLS-1$ output.write(System.lineSeparator()); - output.write(LogFormat.mapEntry("pruning", false)); //$NON-NLS-1$ + output.write(LogFormat.mapEntry("clearing", false)); //$NON-NLS-1$ output.write(System.lineSeparator()); output.write(LogFormat.mapEntry("restarts", false)); //$NON-NLS-1$ output.write(System.lineSeparator()); diff --git a/src/main/java/aitoa/algorithms/MAWithPruning.java b/src/main/java/aitoa/algorithms/MAWithClearing.java similarity index 96% rename from src/main/java/aitoa/algorithms/MAWithPruning.java rename to src/main/java/aitoa/algorithms/MAWithClearing.java index bd04614..6f3d23d 100644 --- a/src/main/java/aitoa/algorithms/MAWithPruning.java +++ b/src/main/java/aitoa/algorithms/MAWithClearing.java @@ -22,15 +22,15 @@ * always applies the binary operator to find new points in the * search space and then refines them with a * {@linkplain aitoa.algorithms.HillClimber2 first-improvement - * local search} based on a unary operator. This MA with pruning - * here also, well, prunes the population from candidate + * local search} based on a unary operator. This MA with clearing + * here also, well, clears the population from candidate * solutions with identical objective values before the * reproduction step. *

* All candidate solutions represented in the population will * always be local optima before entering the binary operators. * If these operators work well, they may jump close to other - * local optima. The pruning ensures that all "parents" from + * local optima. The clearing ensures that all "parents" from * which new points in the search space are derived have a * different solution quality. This, in turn, implies that they * are different candidate solutions. These, in turn, must be the @@ -50,7 +50,7 @@ * the solution space */ // start relevant -public final class MAWithPruning +public final class MAWithClearing implements IMetaheuristic { // end relevant @@ -71,7 +71,7 @@ public final class MAWithPruning * @param _maxLSSteps * the maximum number of local search steps */ - public MAWithPruning(final int _mu, final int _lambda, + public MAWithClearing(final int _mu, final int _lambda, final int _maxLSSteps) { super(); if ((_mu <= 1) || (_mu > 1_000_000)) { @@ -105,7 +105,7 @@ public final void printSetup(final Writer output) output.write(System.lineSeparator()); output.write(LogFormat.mapEntry("cr", 1d));//$NON-NLS-1$ output.write(System.lineSeparator()); - output.write(LogFormat.mapEntry("pruning", true)); //$NON-NLS-1$ + output.write(LogFormat.mapEntry("clearing", true)); //$NON-NLS-1$ output.write(System.lineSeparator()); output.write(LogFormat.mapEntry("restarts", false)); //$NON-NLS-1$ output.write(System.lineSeparator()); @@ -117,7 +117,7 @@ public final void printSetup(final Writer output) /** {@inheritDoc} */ @Override public final String toString() { - final String s = ((("map_" + //$NON-NLS-1$ + final String s = ((("mac_" + //$NON-NLS-1$ this.mu) + '+') + this.lambda); if (this.maxLSSteps >= Integer.MAX_VALUE) { return s; diff --git a/src/main/java/aitoa/algorithms/MAWithFitness.java b/src/main/java/aitoa/algorithms/MAWithFitness.java index 69295f2..e0d2716 100644 --- a/src/main/java/aitoa/algorithms/MAWithFitness.java +++ b/src/main/java/aitoa/algorithms/MAWithFitness.java @@ -88,7 +88,7 @@ public final void printSetup(final Writer output) output.write(System.lineSeparator()); output.write(LogFormat.mapEntry("cr", 1d));//$NON-NLS-1$ output.write(System.lineSeparator()); - output.write(LogFormat.mapEntry("pruning", false)); //$NON-NLS-1$ + output.write(LogFormat.mapEntry("clearing", false)); //$NON-NLS-1$ output.write(System.lineSeparator()); output.write(LogFormat.mapEntry("restarts", false)); //$NON-NLS-1$ output.write(System.lineSeparator()); diff --git a/src/main/java/aitoa/examples/jssp/EJSSPExperimentStage.java b/src/main/java/aitoa/examples/jssp/EJSSPExperimentStage.java index 25c72be..ba2a800 100644 --- a/src/main/java/aitoa/examples/jssp/EJSSPExperimentStage.java +++ b/src/main/java/aitoa/examples/jssp/EJSSPExperimentStage.java @@ -8,14 +8,14 @@ import java.util.stream.Stream; import aitoa.algorithms.EA; -import aitoa.algorithms.EAWithPruning; +import aitoa.algorithms.EAWithClearing; import aitoa.algorithms.EDA; import aitoa.algorithms.HillClimber; import aitoa.algorithms.HillClimber2; import aitoa.algorithms.HillClimber2WithRestarts; import aitoa.algorithms.HillClimberWithRestarts; import aitoa.algorithms.MA; -import aitoa.algorithms.MAWithPruning; +import aitoa.algorithms.MAWithClearing; import aitoa.algorithms.RandomSampling; import aitoa.algorithms.SimulatedAnnealing; import aitoa.algorithms.SingleRandomSample; @@ -219,7 +219,7 @@ public void configureBuilderForProblem( EJSSPExperimentStage._eas( new int[] { 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 16384, 32768, 65536 }, - new double[] { 0.05, 0.3 }, true)); + new double[] { 0.05 }, true)); } /** @@ -611,7 +611,7 @@ public void configureBuilderForProblem( ? new double[] { 0d, 0.05d, 0.3d } : crossoverRates)) { list.add(() -> new EA<>(cr, ps, ps)); if (withPruning) { - list.add(() -> new EAWithPruning<>(cr, ps, ps)); + list.add(() -> new EAWithClearing<>(cr, ps, ps)); } } } @@ -672,25 +672,25 @@ public void configureBuilderForProblem( _ma() { return Stream.of(// () -> new MA<>(16, 16, Integer.MAX_VALUE), // - () -> new MAWithPruning<>(16, 16, Integer.MAX_VALUE), // + () -> new MAWithClearing<>(16, 16, Integer.MAX_VALUE), // () -> new MA<>(16, 16, 10), // - () -> new MAWithPruning<>(16, 16, 10), // + () -> new MAWithClearing<>(16, 16, 10), // () -> new MA<>(16, 16, 100), // - () -> new MAWithPruning<>(16, 16, 100), // + () -> new MAWithClearing<>(16, 16, 100), // // () -> new MA<>(64, 64, Integer.MAX_VALUE), // - () -> new MAWithPruning<>(64, 64, Integer.MAX_VALUE), // + () -> new MAWithClearing<>(64, 64, Integer.MAX_VALUE), // () -> new MA<>(64, 64, 10), // - () -> new MAWithPruning<>(64, 64, 10), // + () -> new MAWithClearing<>(64, 64, 10), // () -> new MA<>(64, 64, 100), // - () -> new MAWithPruning<>(64, 64, 100), // + () -> new MAWithClearing<>(64, 64, 100), // // () -> new MA<>(256, 256, Integer.MAX_VALUE), // - () -> new MAWithPruning<>(256, 256, Integer.MAX_VALUE), // + () -> new MAWithClearing<>(256, 256, Integer.MAX_VALUE), // () -> new MA<>(256, 256, 10), // - () -> new MAWithPruning<>(256, 256, 10), // + () -> new MAWithClearing<>(256, 256, 10), // () -> new MA<>(256, 256, 100), // - () -> new MAWithPruning<>(64, 64, 100), // + () -> new MAWithClearing<>(64, 64, 100), // // () -> new MA<>(1024, 1024, Integer.MAX_VALUE), // () -> new MA<>(1024, 1024, 10), // diff --git a/src/main/java/aitoa/examples/jssp/JSSPExperimentOld.java b/src/main/java/aitoa/examples/jssp/JSSPExperimentOld.java index 4b18b89..900c3da 100644 --- a/src/main/java/aitoa/examples/jssp/JSSPExperimentOld.java +++ b/src/main/java/aitoa/examples/jssp/JSSPExperimentOld.java @@ -4,8 +4,8 @@ import java.nio.file.Path; import aitoa.algorithms.EA; +import aitoa.algorithms.EAWithClearing; import aitoa.algorithms.EAWithFitness; -import aitoa.algorithms.EAWithPruning; import aitoa.algorithms.EDA; import aitoa.algorithms.EDAWithFitness; import aitoa.algorithms.HillClimber; @@ -16,8 +16,8 @@ import aitoa.algorithms.HybridEDAWithFitness; import aitoa.algorithms.IntFFA; import aitoa.algorithms.MA; +import aitoa.algorithms.MAWithClearing; import aitoa.algorithms.MAWithFitness; -import aitoa.algorithms.MAWithPruning; import aitoa.algorithms.RandomSampling; import aitoa.algorithms.SimulatedAnnealing; import aitoa.algorithms.SingleRandomSample; @@ -161,8 +161,8 @@ public static final void main(final String[] args) unary, binary, inst, out); // the EA with pruning, i.e., which enforces population diversity JSSPExperimentOld.run( - new EAWithPruning<>(cr, mu, lambda), unary, - binary, inst, out); + new EAWithClearing<>(cr, mu, lambda), + unary, binary, inst, out); // the EA with frequency fitness assignment JSSPExperimentOld.run( new EAWithFitness<>(cr, mu, lambda, @@ -176,7 +176,7 @@ public static final void main(final String[] args) Integer.MAX_VALUE, 10, 100 }) { // memetic algorithms here rely on enumeration and use cr=1 JSSPExperimentOld.run( - new MAWithPruning<>(mu, lambda, steps), + new MAWithClearing<>(mu, lambda, steps), unary, binary, inst, out); JSSPExperimentOld.run( new MA<>(mu, lambda, steps), unary, binary, @@ -255,7 +255,7 @@ public static final void main(final String[] args) maxDepth, inst, out); // the EA with pruning, i.e., which enforces population diversity JSSPExperimentOld.__runGP( - new EAWithPruning<>(cr, mu, lambda), maxDepth, + new EAWithClearing<>(cr, mu, lambda), maxDepth, inst, out); JSSPExperimentOld.__runGP( new EAWithFitness<>(cr, mu, lambda, diff --git a/src/main/java/aitoa/utils/Experiment.java b/src/main/java/aitoa/utils/Experiment.java index c6a60ab..7d27d74 100644 --- a/src/main/java/aitoa/utils/Experiment.java +++ b/src/main/java/aitoa/utils/Experiment.java @@ -19,8 +19,8 @@ import aitoa.algorithms.EA; import aitoa.algorithms.EA1p1; import aitoa.algorithms.EA1p1WithFitness; +import aitoa.algorithms.EAWithClearing; import aitoa.algorithms.EAWithFitness; -import aitoa.algorithms.EAWithPruning; import aitoa.algorithms.EAWithRestarts; import aitoa.algorithms.EDA; import aitoa.algorithms.EDAWithFitness; @@ -31,8 +31,8 @@ import aitoa.algorithms.HybridEDA; import aitoa.algorithms.HybridEDAWithFitness; import aitoa.algorithms.MA; +import aitoa.algorithms.MAWithClearing; import aitoa.algorithms.MAWithFitness; -import aitoa.algorithms.MAWithPruning; import aitoa.algorithms.RandomSampling; import aitoa.algorithms.SimulatedAnnealing; import aitoa.algorithms.SingleRandomSample; @@ -1032,11 +1032,11 @@ public static final String defaultSetupName( if ((algorithm instanceof EA) || // (algorithm instanceof EA1p1WithFitness) || // (algorithm instanceof EAWithFitness) || // - (algorithm instanceof EAWithPruning) || // + (algorithm instanceof EAWithClearing) || // (algorithm instanceof EAWithRestarts) || // (algorithm instanceof MA) || // (algorithm instanceof MAWithFitness) || // - (algorithm instanceof MAWithPruning)) { + (algorithm instanceof MAWithClearing)) { return Experiment.nameFromObjectsMerge(name, // Objects.requireNonNull(// builder.getUnarySearchOperator()), // diff --git a/src/test/java/aitoa/algorithms/jssp/TestEAWithPruningOnJSSP.java b/src/test/java/aitoa/algorithms/jssp/TestEAWithClearingOnJSSP.java similarity index 78% rename from src/test/java/aitoa/algorithms/jssp/TestEAWithPruningOnJSSP.java rename to src/test/java/aitoa/algorithms/jssp/TestEAWithClearingOnJSSP.java index 3a0fe87..b3de8ba 100644 --- a/src/test/java/aitoa/algorithms/jssp/TestEAWithPruningOnJSSP.java +++ b/src/test/java/aitoa/algorithms/jssp/TestEAWithClearingOnJSSP.java @@ -3,16 +3,16 @@ import java.util.Random; import java.util.concurrent.ThreadLocalRandom; -import aitoa.algorithms.EAWithPruning; +import aitoa.algorithms.EAWithClearing; import aitoa.examples.jssp.JSSPCandidateSolution; import aitoa.examples.jssp.JSSPInstance; import aitoa.structure.IMetaheuristic; /** - * Test the {@linkplain aitoa.algorithms.EAWithPruning + * Test the {@linkplain aitoa.algorithms.EAWithClearing * evolutionary algorithm with pruning} on the JSSP */ -public class TestEAWithPruningOnJSSP +public class TestEAWithClearingOnJSSP extends TestMetaheuristicOnJSSP { /** {@inheritDoc} */ @@ -23,6 +23,6 @@ public class TestEAWithPruningOnJSSP final int mu = 1 + rand.nextInt(64); final int lambda = 1 + rand.nextInt(64); final double cr = (mu > 1) ? rand.nextDouble() : 0; - return new EAWithPruning<>(cr, mu, lambda); + return new EAWithClearing<>(cr, mu, lambda); } } diff --git a/src/test/java/aitoa/algorithms/jssp/TestMAWithPruningOnJSSP.java b/src/test/java/aitoa/algorithms/jssp/TestMAWithClearingOnJSSP.java similarity index 74% rename from src/test/java/aitoa/algorithms/jssp/TestMAWithPruningOnJSSP.java rename to src/test/java/aitoa/algorithms/jssp/TestMAWithClearingOnJSSP.java index a33ff94..427fb4b 100644 --- a/src/test/java/aitoa/algorithms/jssp/TestMAWithPruningOnJSSP.java +++ b/src/test/java/aitoa/algorithms/jssp/TestMAWithClearingOnJSSP.java @@ -3,16 +3,16 @@ import java.util.Random; import java.util.concurrent.ThreadLocalRandom; -import aitoa.algorithms.MAWithPruning; +import aitoa.algorithms.MAWithClearing; import aitoa.examples.jssp.JSSPCandidateSolution; import aitoa.examples.jssp.JSSPInstance; import aitoa.structure.IMetaheuristic; /** - * Test the {@linkplain aitoa.algorithms.MAWithPruning memetic + * Test the {@linkplain aitoa.algorithms.MAWithClearing memetic * algorithm with pruning} on the JSSP */ -public class TestMAWithPruningOnJSSP +public class TestMAWithClearingOnJSSP extends TestMetaheuristicOnJSSP { /** {@inheritDoc} */ @@ -22,6 +22,6 @@ public class TestMAWithPruningOnJSSP final Random rand = ThreadLocalRandom.current(); final int mu = 2 + rand.nextInt(64); final int lambda = 1 + rand.nextInt(64); - return new MAWithPruning<>(mu, lambda, Integer.MAX_VALUE); + return new MAWithClearing<>(mu, lambda, Integer.MAX_VALUE); } } diff --git a/src/test/java/aitoa/algorithms/jssp/TestMAWithPruningOnJSSP10.java b/src/test/java/aitoa/algorithms/jssp/TestMAWithClearingOnJSSP10.java similarity index 75% rename from src/test/java/aitoa/algorithms/jssp/TestMAWithPruningOnJSSP10.java rename to src/test/java/aitoa/algorithms/jssp/TestMAWithClearingOnJSSP10.java index d4868af..6aeb292 100644 --- a/src/test/java/aitoa/algorithms/jssp/TestMAWithPruningOnJSSP10.java +++ b/src/test/java/aitoa/algorithms/jssp/TestMAWithClearingOnJSSP10.java @@ -3,16 +3,16 @@ import java.util.Random; import java.util.concurrent.ThreadLocalRandom; -import aitoa.algorithms.MAWithPruning; +import aitoa.algorithms.MAWithClearing; import aitoa.examples.jssp.JSSPCandidateSolution; import aitoa.examples.jssp.JSSPInstance; import aitoa.structure.IMetaheuristic; /** - * Test the {@linkplain aitoa.algorithms.MAWithPruning memetic + * Test the {@linkplain aitoa.algorithms.MAWithClearing memetic * algorithm with pruning} on the JSSP */ -public class TestMAWithPruningOnJSSP10 +public class TestMAWithClearingOnJSSP10 extends TestMetaheuristicOnJSSP { /** {@inheritDoc} */ @@ -22,6 +22,6 @@ public class TestMAWithPruningOnJSSP10 final Random rand = ThreadLocalRandom.current(); final int mu = 2 + rand.nextInt(64); final int lambda = 1 + rand.nextInt(64); - return new MAWithPruning<>(mu, lambda, 10); + return new MAWithClearing<>(mu, lambda, 10); } }