Examples of Simulator


Examples of rinde.sim.core.Simulator

    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
View Full Code Here

Examples of trams.simulation.Simulator

     * @param playerName a <code>String</code> with the player's name.
     * @return a <code>boolean</code> which is true iff the simulation was created successfully.
     */
    public boolean createSimulator ( String scenarioName, String playerName ) {
        Scenario scen = createScenarioObject(scenarioName, playerName, 800000.00, START_SATISFACTION);
        theSimulator = new Simulator(scen);
        //Now for the scenario - create supplied vehicles.
        logger.debug("Creating " + scen.getNumberSuppliedVehicles() + " vehicles!");
        for ( int i = 0; i < scen.getNumberSuppliedVehicles(); i++ ) {
          Calendar deliveryDate = theSimulator.getCurrentSimTime();
          deliveryDate.add(Calendar.DAY_OF_MONTH, -1);
View Full Code Here

Examples of trams.simulation.Simulator

            double balance = Double.parseDouble(scenario.getAttribute("balance"));
            int psgSatisfaction = Integer.parseInt(scenario.getAttribute("satisfaction"));
            //Now create the scenario object.
            Scenario myScenario = createScenarioObject(scenarioName, playerName, balance, psgSatisfaction);
            //Seventhly, create the simulation object.
            theSimulator = new Simulator(myScenario, document.getDocumentElement().getAttribute("time"), Integer.parseInt(document.getDocumentElement().getAttribute("increment")));
            //Set the difficulty level.
            theSimulator.setDifficultyLevel(document.getDocumentElement().getAttribute("difficulty"));
            //Now add the messages!!!!
            NodeList messageNode = (NodeList) xpath.evaluate("//scenario/message", document.getDocumentElement(), XPathConstants.NODESET);
            for ( int i = 0; i < messageNode.getLength(); i++ ) {
View Full Code Here

Examples of trams.simulation.Simulator

     * Create a new simulation.
     * @param scenario a <code>Scenario</code> with the scenario to simulate.
     * @return a <code>boolean</code> which is true iff the simulation was created successfully.
     */
    public boolean createSimulation ( Scenario scenario ) {
        theSimulator = new Simulator(scenario);
        return true;
    }
View Full Code Here

Examples of umontreal.iro.lecuyer.simevents.Simulator

      if (defaultSimulator instanceof ProcessSimulator) {
         defaultSimulator.init();
         return;
      }
      if (defaultSimulator instanceof Simulator) {
         Simulator temp = defaultSimulator;
         defaultSimulator = newInstance();
         defaultSimulator.init(temp.getEventList());
         return;
      }
      defaultSimulator = newInstance();
      defaultSimulator.init();
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.