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);
}
}