use of utilities.StatSummary in project SimpleAsteroids by ljialin.
the class TestEAGraph method resetStats.
public void resetStats() {
nTrueOpt = new StatSummary("n true optima");
trueFit = new StatSummary("true fitness stats");
linePlots = new ArrayList<>();
}
use of utilities.StatSummary in project SimpleAsteroids by ljialin.
the class SimpleEvaluator method evaluate.
public double evaluate(ParamValues evoParams, int nEvals) {
StatSummary ss = new StatSummary();
for (int i = 0; i < nEvals; i++) {
ss.add(evaluateOnce(evoParams));
}
System.out.println(ss);
return ss.mean();
}
use of utilities.StatSummary in project SimpleAsteroids by ljialin.
the class EvoSGATest method runTrial.
public static double runTrial(EvoAlg evoAlg) {
// ok, so the idea here is to modify ...
SimpleGASearchSpace eval = new SimpleGASearchSpace();
System.out.println("Search space size: " + SearchSpaceUtil.size(eval.searchSpace()));
eval.setEvaluator(new EvalMaxM(50, 2, 0.0));
int[] solution = evoAlg.runTrial(eval, 5000);
// int[] solution = {0, 0, 0};
System.out.println("Checking fitness");
StatSummary ss = new StatSummary("Mean fitness");
int nChecks = 50;
for (int i = 0; i < nChecks; i++) {
ss.add(eval.evaluate(solution));
}
System.out.println(ss);
System.out.println("Solution: " + Arrays.toString(solution));
System.out.println(eval.report(solution));
return ss.mean();
}
use of utilities.StatSummary in project SimpleAsteroids by ljialin.
the class OneMaxTest method main.
public static void main(String[] args) {
int minDim = 10;
int maxDim = 10;
int step = 10;
int nReps = 100;
ElapsedTimer t = new ElapsedTimer();
ArrayList<Double> means = new ArrayList<>();
System.out.println("N Samples per Fitness Eval = " + nVirtualSamples);
for (int i = minDim; i <= maxDim; i += step) {
// see how well actual evals matches prediction
StatSummary ss = new StatSummary();
for (int j = 0; j < nReps; j++) {
Integer nEvals = runTest(i);
if (nEvals != null)
ss.add(nEvals * nVirtualSamples);
}
System.out.println(ss);
means.add(ss.mean());
System.out.println(i + "\t " + ss.mean() + "\t " + predictNEvals(i));
}
System.out.println(t);
BarChart.display(means, "OneMax Scaling");
}
use of utilities.StatSummary in project SimpleAsteroids by ljialin.
the class OneMaxTestResampled method main.
public static void main(String[] args) {
int minDim = 100;
int maxDim = 100;
int step = 10;
int nReps = 100;
ElapsedTimer t = new ElapsedTimer();
ArrayList<Double> means = new ArrayList<>();
System.out.println("N Samples per Fitness Eval = " + nActualSamples);
for (int i = minDim; i <= maxDim; i += step) {
// see how well actual evals matches prediction
StatSummary ss = new StatSummary();
for (int j = 0; j < nReps; j++) {
Integer nEvals = runTest(i);
if (nEvals != null)
ss.add(nEvals);
}
System.out.println(ss);
means.add(ss.mean());
System.out.println(i + "\t " + ss.mean() + "\t " + predictNEvals(i));
}
System.out.println(t);
BarChart.display(means, "OneMax Scaling");
}
Aggregations