Search in sources :

Example 1 with EvoAgentSearchSpace

use of planetwar.EvoAgentSearchSpace in project SimpleAsteroids by ljialin.

the class TestHyperParamPlanetWars method main.

public static void main(String[] args) {
    int nEvals = 288;
    if (args.length == 1) {
        nEvals = Integer.parseInt(args[0]);
    }
    System.out.println("Optimization budget: " + nEvals);
    NTupleBanditEA ntbea = new NTupleBanditEA().setKExplore(1);
    GameState.includeBuffersInScore = true;
    EvoAgentSearchSpace.tickBudget = 2000;
    EvoAlg[] evoAlgs = { // new SimpleRMHC(5),
    ntbea };
    int nChecks = 100;
    int nTrials = 100;
    ElapsedTimer timer = new ElapsedTimer();
    for (EvoAlg evoAlg : evoAlgs) {
        // LineChart lineChart = new LineChart();
        // lineChart.yAxis = new LineChartAxis(new double[]{-2, -1, 0, 1, 2});
        // lineChart.setYLabel("Fitness");
        HyperParamTuneRunner runner = new HyperParamTuneRunner();
        // runner.verbose = true;
        // runner.setLineChart(lineChart);
        runner.nChecks = nChecks;
        runner.nTrials = nTrials;
        runner.nEvals = nEvals;
        runner.plotChecks = 0;
        AnnotatedFitnessSpace testPlanetWars = new EvoAgentSearchSpace();
        System.out.println("Testing: " + evoAlg);
        runner.runTrials(evoAlg, testPlanetWars);
        System.out.println("Finished testing: " + evoAlg);
    // note, this is a bit of a hack: it only reports the final solution
    // System.out.println(new EvoAgentSearchSpace().report(runner.solution));
    }
    // System.out.println(ntbea.getModel().s);
    System.out.println("Time for all experiments: " + timer);
}
Also used : AnnotatedFitnessSpace(evodef.AnnotatedFitnessSpace) ElapsedTimer(utilities.ElapsedTimer) NTupleBanditEA(ntuple.NTupleBanditEA) EvoAlg(evodef.EvoAlg) EvoAgentSearchSpace(planetwar.EvoAgentSearchSpace)

Example 2 with EvoAgentSearchSpace

use of planetwar.EvoAgentSearchSpace in project SimpleAsteroids by ljialin.

the class TestSolutionPlanetWars method main.

public static void main(String[] args) {
    // use this code to re-rest a particular point in the search space
    GameState.includeBuffersInScore = true;
    EvoAgentSearchSpace.tickBudget = 2000;
    int[] solution = { 2, 1, 0, 0, 2 };
    // int[] solution = {1, 0, 0, 0, 4};
    solution = new int[] { 3, 1, 1, 0, 3 };
    solution = new int[] { 3, 1, 1, 0, 2 };
    System.out.println(new EvoAgentSearchSpace().report(solution));
    int nChecks = 100;
    ElapsedTimer timer = new ElapsedTimer();
    new HyperParamTuneRunner().runChecks(new EvoAgentSearchSpace(), solution, nChecks);
    System.out.println(timer);
}
Also used : ElapsedTimer(utilities.ElapsedTimer) EvoAgentSearchSpace(planetwar.EvoAgentSearchSpace)

Aggregations

EvoAgentSearchSpace (planetwar.EvoAgentSearchSpace)2 ElapsedTimer (utilities.ElapsedTimer)2 AnnotatedFitnessSpace (evodef.AnnotatedFitnessSpace)1 EvoAlg (evodef.EvoAlg)1 NTupleBanditEA (ntuple.NTupleBanditEA)1