/*
* File name: CleaningScheduler.java (package eas.simulation.users.lukas.cleaningLiveDemo)
* Author(s): Lukas König
* Java version: 6.0
* Generation date: 10.12.2010 (10:30:37)
*
* (c) This file and the EAS (Easy Agent Simulation) framework containing it
* is protected by Creative Commons by-nc-sa license. Any altered or
* further developed versions of this file have to meet the agreements
* stated by the license conditions.
*
* In a nutshell
* -------------
* You are free:
* - to Share -- to copy, distribute and transmit the work
* - to Remix -- to adapt the work
*
* Under the following conditions:
* - Attribution -- You must attribute the work in the manner specified by the
* author or licensor (but not in any way that suggests that they endorse
* you or your use of the work).
* - Noncommercial -- You may not use this work for commercial purposes.
* - Share Alike -- If you alter, transform, or build upon this work, you may
* distribute the resulting work only under the same or a similar license to
* this one.
*
* + Detailed license conditions (Germany):
* http://creativecommons.org/licenses/by-nc-sa/3.0/de/
* + Detailed license conditions (unported):
* http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en
*
* This header must be placed in the beginning of any version of this file.
*/
package eas.users.lukas.marbImplicitEvolution.mazeEnvironment;
import java.util.Random;
import eas.math.geometry.Vector2D;
import eas.plugins.masterScheduler.AbstractDefaultMaster;
import eas.simulation.ConstantsSimulation;
import eas.simulation.spatial.sim2D.standardAgents.AbstractAgent2D;
import eas.simulation.spatial.sim2D.standardAgents.jasmine.JasmineRobot;
import eas.simulation.spatial.standardBrains.marb.MARBBrain;
import eas.startSetup.ParCollection;
/**
* @author Lukas König
*
*/
public class MARBScheduler extends
AbstractDefaultMaster<MARBMazeEnvironment> {
/**
*
*/
private static final long serialVersionUID = 8860483546146256043L;
@Override
public MARBMazeEnvironment[] generateRunnables(ParCollection params) {
MARBMazeEnvironment env = new MARBMazeEnvironment(0, params);
JasmineRobot agent;
MARBBrain<AbstractAgent2D<?>> brain;
Random rand = new Random(params.getSeed());
Vector2D pos;
double richt = rand.nextDouble() * 360;
for (int j = 0; j < 50; j++) {
agent = new JasmineRobot(j, env, rand, params, false, 0);
brain = new MARBBrain<AbstractAgent2D<?>>(
agent,
// "001, 003, 003, 001, 000, 012, 004, 196, 000, 015, 000, 012, 007, 135, 000, 006, 000, 010, 000, 000, 001, 001, 000, 012, 001, 191, 000, 004, 000, 012, 001, 032, 000, 005, 000, 012, 003, 073, 000, 015, 000, 011, 000, 012, 004, 170, 000, 016, 000, 010, 000, 010, 000, 000, 005, 001, 000, 012, 004, 000, 012, 007, 000, 015, 000, 012, 001, 073, 000, 008, 000, 011, 000, 000, 011, 001, 000, 000, 000, 015, 003, 003, 001, 000, 000, 000, 011, 004, 001, 001, 000, 012, 006, 031, 000, 008, 000, 000, 022, 001, 000, 000, 000, 026, 003, 005, 001, 000, 000, 000, 010, 002, 005, 001, 000, 000, 000, 009, 003, 004, 001, 000, 012, 006, 108, 000, 009, 000, 012, 004, 140, 000, 016, 000, 010, 000, 012, 006, 125, 000, 008, 000, 011, 000, 000, 010, 001, 000, 012, 001, 092, 000, 016, 000, 012, 003, 113, 000, 016, 000, 012, 001, 017, 000, 015, 000, 012, 003, 000, 012, 001, 000, 008, 000, 011, 000, 010, 000, 010, 000, 000, 006, 001, 000, 012, 001, 163, 000, 009, 000, 012, 003, 000, 012, 001, 000, 015, 000, 010, 000, 000, 015, 001, 000, 012, 002, 013, 000, 016, 000, 012, 005, 091, 000, 006, 000, 010, 000, 000, 011, 001, 000, 000, 000, 022, 004, 005, 001, 000, 012, 003, 140, 000, 009, 000, 012, 007, 098, 000, 009, 000, 010, 000, 012, 001, 071, 000, 008, 000, 012, 007, 210, 000, 008, 000, 011, 000, 010, 000, 000, 015, 001, 000, 000, 000, 006, 005, 003, 001, 000, 012, 006, 045, 000, 015, 000, 000, 011, 001, 000, 000, 000, 005, 005, 009, 001, 000, 012, 006, 158, 000, 015, 000, 012, 006, 132, 000, 009, 000, 012, 004, 080, 000, 009, 000, 012, 002, 000, 012, 005, 000, 016, 000, 010, 000, 011, 000, 011, 000, 000, 006, 001, 000, 012, 003, 247, 000, 008, 000, 012, 004, 089, 000, 008, 000, 011, 000, 000, 009, 001, 000, 012, 005, 253, 000, 016, 000, 000, 004, 001, 000, 012, 005, 095, 000, 009, 000, 012, 006, 045, 000, 009, 000, 010, 000, 000, 019, 001, 000, 012, 005, 081, 000, 015, 000, 012, 005, 213, 000, 009, 000, 010, 000, 000, 026, 001, 000, 012, 007, 000, 012, 005, 000, 015, 000, 000, 011, 001, 000, 000, 000, 004, 005, 003, 001, 000, 000, 000, 019, 005, 001, 001, 000, 012, 007, 000, 012, 002, 000, 015, 000, 000, 002, 001, 000, 000, 000, 002, 005, 004, 001, 000, 012, 006, 143, 000, 008, 000, 012, 007, 199, 000, 015, 000, 011, 000, 000, 002, 001, 000, 000, 000",
"001, 003, 001, 001, 000, 000, 000",
params);
agent.implantBrain(brain);
pos = new Vector2D(
rand.nextDouble() * (env.getBoundingBox(false).lowerRightCorner().x - env.getBoundingBox(false).upperLeftCorner().x) + env.getBoundingBox(false).upperLeftCorner().x,
rand.nextDouble() * (env.getBoundingBox(false).lowerRightCorner().y - env.getBoundingBox(false).upperLeftCorner().y) + env.getBoundingBox(false).upperLeftCorner().y);
while (!env.addCollidingAgent(
agent,
pos, richt)) {
pos = new Vector2D(
rand.nextDouble() * (env.getBoundingBox(false).lowerRightCorner().x - env.getBoundingBox(false).upperLeftCorner().x) + env.getBoundingBox(false).upperLeftCorner().x,
rand.nextDouble() * (env.getBoundingBox(false).lowerRightCorner().y - env.getBoundingBox(false).upperLeftCorner().y) + env.getBoundingBox(false).upperLeftCorner().y);
}
}
return new MARBMazeEnvironment[] { env };
}
@Override
public String id() {
return ConstantsSimulation.DEFAULT_MASTER_SCHEDULER_ID + "-marbEvolution";
}
}