Search in sources :

Example 66 with StatSummary

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;
}
Also used : StatSummary(utilities.StatSummary)

Example 67 with StatSummary

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);
    }
}
Also used : StatSummary(utilities.StatSummary) SimpleRMHC(ga.SimpleRMHC) DefaultMutator(evodef.DefaultMutator) ElapsedTimer(utilities.ElapsedTimer)

Example 68 with StatSummary

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");
}
Also used : LineChartAxis(plot.LineChartAxis) StatSummary(utilities.StatSummary) JEasyFrame(utilities.JEasyFrame) LineChart(plot.LineChart)

Example 69 with StatSummary

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;
}
Also used : StatSummary(utilities.StatSummary)

Example 70 with StatSummary

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;
}
Also used : StatSummary(utilities.StatSummary)

Aggregations

StatSummary (utilities.StatSummary)88 ElapsedTimer (utilities.ElapsedTimer)27 ArrayList (java.util.ArrayList)10 JEasyFrame (utilities.JEasyFrame)8 SimpleRMHC (ga.SimpleRMHC)7 NTupleBanditEA (ntuple.NTupleBanditEA)6 EvoAlg (evodef.EvoAlg)4 Random (java.util.Random)4 LineChart (plot.LineChart)4 LineChartAxis (plot.LineChartAxis)4 StateObservationMulti (core.game.StateObservationMulti)3 DefaultMutator (evodef.DefaultMutator)3 TreeSet (java.util.TreeSet)3 Types (ontology.Types)3 LineGroup (plot.LineGroup)3 ElapsedCpuTimer (tools.ElapsedCpuTimer)3 Gson (com.google.gson.Gson)2 GsonBuilder (com.google.gson.GsonBuilder)2 AbstractMultiPlayer (core.player.AbstractMultiPlayer)2 ShortestPathTest (evomaze.ShortestPathTest)2