Search in sources :

Example 31 with StatSummary

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

Example 32 with StatSummary

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

Example 33 with StatSummary

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

Example 34 with StatSummary

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");
}
Also used : StatSummary(utilities.StatSummary) ArrayList(java.util.ArrayList) ElapsedTimer(utilities.ElapsedTimer)

Example 35 with StatSummary

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");
}
Also used : StatSummary(utilities.StatSummary) ArrayList(java.util.ArrayList) ElapsedTimer(utilities.ElapsedTimer)

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