@SuppressWarnings({ "rawtypes", "unchecked" }) @Test public void testAddAllObjectives() { MMNEAT.task = new TorusEvolvedPredatorsVsStaticPreyTask(); homoPred = (TorusEvolvedPredatorsVsStaticPreyTask)MMNEAT.task; ArrayList<ArrayList<GridTorusObjective<T>>> objectives = homoPred.objectives; ArrayList<ArrayList<GridTorusObjective<T>>> otherScores = homoPred.otherScores; assertEquals(objectives.size(), 1); assertTrue(objectives.get(0).isEmpty()); assertEquals(otherScores.size(), 1); assertEquals(otherScores.get(0).size(), numOthers); Parameters.initializeParameterCollections(new String[] { "io:false", "netio:false", "torusTimeLimit:1000", "torusPreys:2", "torusPredators:3", "staticPreyController:edu.utexas.cs.nn.gridTorus.controllers.PreyFleeClosestPredatorController", "predatorCatchClose:true", "preyRRM:true" }); MMNEAT.loadClasses(); MMNEAT.task = new TorusEvolvedPredatorsVsStaticPreyTask(); homoPred = (TorusEvolvedPredatorsVsStaticPreyTask)MMNEAT.task; objectives = homoPred.objectives; otherScores = homoPred.otherScores; assertEquals(objectives.size(), 1); assertFalse(objectives.get(0).isEmpty()); assertEquals(otherScores.size(), 1); assertEquals(otherScores.get(0).size(), numOthers); assertTrue(objectives.get(0).get(0) instanceof PredatorCatchCloseObjective); Parameters.initializeParameterCollections(new String[] { "io:false", "netio:false", "torusTimeLimit:1000", "torusPreys:2", "torusPredators:3", "staticPreyController:edu.utexas.cs.nn.gridTorus.controllers.PreyFleeClosestPredatorController", "predatorCatchClose:true", "preyRRM:true" }); MMNEAT.loadClasses(); MMNEAT.task = new CooperativePredatorsVsStaticPreyTask(); coPred = (CooperativePredatorsVsStaticPreyTask)MMNEAT.task; objectives = coPred.getLonerTaskInstance().objectives; otherScores = coPred.getLonerTaskInstance().otherScores; assertEquals(objectives.size(), 3); assertFalse(objectives.get(0).isEmpty()); assertEquals(otherScores.size(), 3); assertEquals(otherScores.get(0).size(), numOthers); assertTrue(objectives.get(0).get(0) instanceof PredatorCatchCloseObjective); assertTrue(otherScores.get(1).isEmpty()); assertTrue(otherScores.get(2).isEmpty()); assertTrue(objectives.get(1).get(0) instanceof PredatorCatchCloseObjective); assertTrue(objectives.get(2).get(0) instanceof PredatorCatchCloseObjective); assertEquals(objectives.get(0).size(), 1); assertEquals(objectives.get(1).size(), 1); assertEquals(objectives.get(2).size(), 1); Parameters.initializeParameterCollections(new String[] { "io:false", "netio:false", "torusTimeLimit:1000", "torusPreys:2", "torusPredators:3", "staticPreyController:edu.utexas.cs.nn.gridTorus.controllers.PreyFleeClosestPredatorController", "predatorCatchClose:true", "preyRRM:true" }); MMNEAT.loadClasses(); MMNEAT.task = new CompetitiveHomogeneousPredatorsVsPreyTask(); homoComp = (CompetitiveHomogeneousPredatorsVsPreyTask)MMNEAT.task; objectives = homoComp.getLonerTaskInstance().objectives; otherScores = homoComp.getLonerTaskInstance().otherScores; assertEquals(objectives.size(), 2); assertFalse(objectives.get(0).isEmpty()); assertEquals(otherScores.size(), 2); assertEquals(otherScores.get(0).size(), numOthersCompetitive); assertTrue(objectives.get(0).get(0) instanceof PredatorCatchCloseObjective); assertTrue(objectives.get(1).get(0) instanceof PreyRawalRajagopalanMiikkulainenObjective); assertTrue(otherScores.get(1).isEmpty()); assertEquals(objectives.get(0).size(), 1); assertEquals(objectives.get(1).size(), 1); }
public void addAllObjectives(){ addAllObjectives(0, false); }
TorusPredPreyTask extends NoisyLonerTask<T> implements TUGTask, NetworkTask, HyperNEATTask { public void addAllObjectives(){ addAllObjectives(0, false); } }
TorusPredPreyTask extends NoisyLonerTask<T> implements TUGTask, NetworkTask, HyperNEATTask { public void addAllObjectives(){ addAllObjectives(0, false); } TorusPredPreyTask();  TorusPredPreyTask(boolean preyEvolve);  TorusPredPreyTask(boolean preyEvolve, boolean competitive); }
TorusPredPreyTask extends NoisyLonerTask<T> implements TUGTask, NetworkTask, HyperNEATTask { public void addAllObjectives(){ addAllObjectives(0, false); } TorusPredPreyTask();  TorusPredPreyTask(boolean preyEvolve);  TorusPredPreyTask(boolean preyEvolve, boolean competitive); abstract TorusPredPreyController[] getPredAgents(Genotype<T> individual); abstract TorusPredPreyController[] getPreyAgents(Genotype<T> individual); final void addObjective(GridTorusObjective<T> o, ArrayList<ArrayList<GridTorusObjective<T>>> list, int pop); final void addObjective(GridTorusObjective<T> o, ArrayList<ArrayList<GridTorusObjective<T>>> list, boolean affectsSelection, int pop); @Override /** * A method that evaluates a single genotype Provides fitness for that * genotype based on the game time as well as other scores * * @param individual * genotype being evaluated * @param num * number of current evaluation * @return A Pair of double arrays containing the fitness and other scores */ Pair<double[], double[]> oneEval(Genotype<T> individual, int num); TorusPredPreyGame runEval(TorusPredPreyController[] predAgents, TorusPredPreyController[] preyAgents); @Override int numObjectives(); @Override int numOtherScores(); @Override double[] startingGoals(); @Override double[] minScores(); @Override String[] sensorLabels(); @Override String[] outputLabels(); static String[] outputLabels(boolean forPredators); @Override double getTimeStamp(); static TorusPredPreyController[] getStaticControllers(boolean isPred, int num); static void getEvolvedControllers(TorusPredPreyController[] container, Genotype<T> g, boolean isPred); static void getEvolvedControllers(TorusPredPreyController[] container, Genotype<T> g, boolean isPred, int startIndex, int numCopies); static void getEvolvedControllers(TorusPredPreyController[] container, Genotype<T>[] genotypes, boolean isPred); static void getEvolvedControllers(TorusPredPreyController[] container, Genotype<T>[] genotypes, boolean isPred, int startIndex); void addAllObjectives(); void addAllObjectives(int pop); void addAllObjectives(int pop, boolean isPreyPop); @Override List<Substrate> getSubstrateInformation(); @Override List<Triple<String, String, Boolean>> getSubstrateConnectivity(); double[] getSubstrateInputs(List<Substrate> subs); @Override int numCPPNInputs(); @Override double[] filterCPPNInputs(double[] fullInputs); }
TorusPredPreyTask extends NoisyLonerTask<T> implements TUGTask, NetworkTask, HyperNEATTask { public void addAllObjectives(){ addAllObjectives(0, false); } TorusPredPreyTask();  TorusPredPreyTask(boolean preyEvolve);  TorusPredPreyTask(boolean preyEvolve, boolean competitive); abstract TorusPredPreyController[] getPredAgents(Genotype<T> individual); abstract TorusPredPreyController[] getPreyAgents(Genotype<T> individual); final void addObjective(GridTorusObjective<T> o, ArrayList<ArrayList<GridTorusObjective<T>>> list, int pop); final void addObjective(GridTorusObjective<T> o, ArrayList<ArrayList<GridTorusObjective<T>>> list, boolean affectsSelection, int pop); @Override /** * A method that evaluates a single genotype Provides fitness for that * genotype based on the game time as well as other scores * * @param individual * genotype being evaluated * @param num * number of current evaluation * @return A Pair of double arrays containing the fitness and other scores */ Pair<double[], double[]> oneEval(Genotype<T> individual, int num); TorusPredPreyGame runEval(TorusPredPreyController[] predAgents, TorusPredPreyController[] preyAgents); @Override int numObjectives(); @Override int numOtherScores(); @Override double[] startingGoals(); @Override double[] minScores(); @Override String[] sensorLabels(); @Override String[] outputLabels(); static String[] outputLabels(boolean forPredators); @Override double getTimeStamp(); static TorusPredPreyController[] getStaticControllers(boolean isPred, int num); static void getEvolvedControllers(TorusPredPreyController[] container, Genotype<T> g, boolean isPred); static void getEvolvedControllers(TorusPredPreyController[] container, Genotype<T> g, boolean isPred, int startIndex, int numCopies); static void getEvolvedControllers(TorusPredPreyController[] container, Genotype<T>[] genotypes, boolean isPred); static void getEvolvedControllers(TorusPredPreyController[] container, Genotype<T>[] genotypes, boolean isPred, int startIndex); void addAllObjectives(); void addAllObjectives(int pop); void addAllObjectives(int pop, boolean isPreyPop); @Override List<Substrate> getSubstrateInformation(); @Override List<Triple<String, String, Boolean>> getSubstrateConnectivity(); double[] getSubstrateInputs(List<Substrate> subs); @Override int numCPPNInputs(); @Override double[] filterCPPNInputs(double[] fullInputs); static final String[] ALL_ACTIONS; static final String[] MOVEMENT_ACTIONS; static final int HYPERNEAT_OUTPUT_SUBSTRATE_DIMENSION; public TorusPredPreyController[] evolved; static boolean preyEvolve; final boolean competitive; public ArrayList<ArrayList<GridTorusObjective<T>>> objectives; public ArrayList<ArrayList<GridTorusObjective<T>>> otherScores; }