Search in sources :

Example 36 with StatSummary

use of utilities.StatSummary in project SimpleAsteroids by ljialin.

the class SimpleGA method fitness.

double fitness(int[] sol) {
    if (nSamples == 1)
        return evaluator.evaluate(sol);
    // otherwise ...
    StatSummary ss = new StatSummary();
    for (int i = 0; i < nSamples; i++) {
        double fitness = evaluator.evaluate(sol);
        ss.add(fitness);
    }
    return ss.mean();
}
Also used : StatSummary(utilities.StatSummary)

Example 37 with StatSummary

use of utilities.StatSummary in project SimpleAsteroids by ljialin.

the class AsteroidsSimpleTest method main.

public static void main(String[] args) throws Exception {
    StatSummary ss = new StatSummary();
    int nTrials = 10;
    for (int i = 0; i < nTrials; i++) {
        ss.add(runOnce());
        System.out.println();
        System.out.println("After trial: " + (i + 1));
        System.out.println("Total game ticks:  " + AsteroidsLinkState.totalGameTicks);
        System.out.println("Total game copies: " + AsteroidsLinkState.totalGameCopies);
    }
    System.out.println(ss);
}
Also used : StatSummary(utilities.StatSummary)

Example 38 with StatSummary

use of utilities.StatSummary in project SimpleAsteroids by ljialin.

the class AsteroidsTest method main.

public static void main(String[] args) throws Exception {
    StatSummary ss = new StatSummary();
    int nTrials = 10;
    for (int i = 0; i < nTrials; i++) {
        ss.add(runOnce());
        System.out.println();
        System.out.println("After trial: " + (i + 1));
        System.out.println("Total game ticks:  " + AsteroidsLinkState.totalGameTicks);
        System.out.println("Total game copies: " + AsteroidsLinkState.totalGameCopies);
    }
    System.out.println(ss);
// System.out.println(Agent.useShiftBuffer);
}
Also used : StatSummary(utilities.StatSummary)

Example 39 with StatSummary

use of utilities.StatSummary in project SimpleAsteroids by ljialin.

the class AgentOptTest method runTrial.

public static double runTrial(EvoAlg evoAlg) {
    // ok, so the idea here is to modify ...
    // SimpleGASearchSpace eval = new SimpleGASearchSpace();
    // eval.setEvaluator(new EvalMaxM(50, 2, 0.0));
    AgentEvaluator eval = new AgentEvaluator();
    int[] solution = evoAlg.runTrial(eval, 10);
    // int[] solution = {0, 0, 0};
    System.out.println("Checking fitness");
    StatSummary ss = new StatSummary("Mean fitness");
    int nChecks = 5;
    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)

Example 40 with StatSummary

use of utilities.StatSummary in project SimpleAsteroids by ljialin.

the class GameRunner method runTrials.

public static StatSummary runTrials(SimplePlayerInterface agent, int nTicks, int nTrials) {
    StatSummary ss = new StatSummary("Score stats: " + agent.toString());
    for (int i = 0; i < nTrials; i++) {
        double score = runTrial(agent, nTicks);
        System.out.println(i + "\t " + score);
        ss.add(score);
    }
    return ss;
}
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