use of utilities.StatSummary in project SimpleAsteroids by ljialin.
the class SparseDistribution method add.
public SparseDistribution add(double x, double p) {
StatSummary ss = statMap.get(x);
if (ss == null) {
ss = new StatSummary();
statMap.put(x, ss);
}
ss.add(p);
tot += p;
return this;
}
use of utilities.StatSummary in project SimpleAsteroids by ljialin.
the class EvolveMarioLevelTest method main.
public static void main(String[] args) throws Exception {
int[][] level = getAndShowLevel(true);
int nTrials = 1;
SimpleRMHC simpleRMHC = new SimpleRMHC();
DefaultMutator mutator = new DefaultMutator(null);
mutator.flipAtLeastOneValue = true;
mutator.pointProb = 2;
mutator.setSwap(true);
simpleRMHC.setMutator(mutator);
// EvoAlg evoAlg = simpleRMHC;
// evoAlg = new SlidingMeanEDA().setHistoryLength(30);
// evoAlg = new CompactSlidingGA();
int nEvals = 20000;
StatSummary results = new StatSummary();
EvolveMarioLevelTest evolver = new EvolveMarioLevelTest();
for (int i = 0; i < nTrials; i++) {
ElapsedTimer timer = new ElapsedTimer();
results.add(evolver.runTrial(simpleRMHC, nEvals, level));
System.out.println(timer);
}
}
use of utilities.StatSummary in project SimpleAsteroids by ljialin.
the class EvolveMarioLevelTest method plotData.
private void plotData(ArrayList<Double> data) {
LineChart lineChart = LineChart.easyPlot(data);
int mid = (data.size() - 1) / 2;
int end = data.size() - 2;
System.out.println("Endpoint: " + end);
lineChart.xAxis = new LineChartAxis(new double[] { 0, mid, end });
StatSummary ss = new StatSummary().add(data);
lineChart.yAxis = new LineChartAxis(new double[] { ss.min(), ss.max() });
lineChart.title = "Evolution of Fitness";
lineChart.setXLabel("Iterations").setYLabel("Fitness");
new JEasyFrame(lineChart, "KL-Based PCG");
}
use of utilities.StatSummary in project SimpleAsteroids by ljialin.
the class RankCorrelationEDA method fitness.
static StatSummary fitness(SolutionEvaluator evaluator, int[] sol, int nSamples) {
StatSummary ss = new StatSummary();
for (int i = 0; i < nSamples; i++) {
double fitness = evaluator.evaluate(sol);
ss.add(fitness);
}
return ss;
}
use of utilities.StatSummary in project SimpleAsteroids by ljialin.
the class EvolutionLogger method reset.
public void reset() {
// System.out.println("RESETTING");
fa = new ArrayList<>();
solutions = new ArrayList<>();
bestYetSolutions = new ArrayList<>();
ss = new StatSummary();
bestYet = null;
bestGen = 0;
nOptimal = 0;
firstHit = null;
}
Aggregations