run(false);
}
public static void run(boolean testing) throws IOException {
final MersenneTwister rand = new MersenneTwister(123);
final Simulator simulator = new Simulator(rand, Measure.valueOf(1000L,
SI.MILLI(SI.SECOND)));
final Graph<LengthData> graph = DotGraphSerializer
.getLengthGraphSerializer(new SelfCycleFilter()).read(
AgentCommunicationExample.class.getResourceAsStream(MAP_DIR));
// create models
final RoadModel roadModel = new GraphRoadModel(graph);
final CommunicationModel communicationModel = new CommunicationModel(rand,
false);
simulator.register(roadModel);
simulator.register(communicationModel);
simulator.configure();
// add agents
for (int i = 0; i < NUM_AGENTS; i++) {
final int radius = MIN_RADIUS + rand.nextInt(MAX_RADIUS - MIN_RADIUS);
final double speed = MIN_SPEED + (MAX_SPEED - MIN_SPEED)
* rand.nextDouble();
final double reliability = MIN_RELIABILITY
+ (rand.nextDouble() * (MAX_RELIABILITY - MIN_RELIABILITY));
final RandomWalkAgent agent = new RandomWalkAgent(speed, radius,
reliability);
simulator.register(agent);
}
// create GUI
final UiSchema schema = new UiSchema(false);
schema