private final BackingUpPrintStream generateSimulationResult(String[] commandLine)
      throws Exception {
    Simulator simulator = new Simulator();
    SimulatorInputData inputData =
        new SimulatorInputData(new SimulatorCommandLine(commandLine).getSimulationArguments());
    OperationManager manager = simulator.getSimulationData().getKappaSystem().getOperationManager();
    manager.perform(new SimulatorInitializationOperation(simulator, inputData));

    BackingUpPrintStream stream1 = new BackingUpPrintStream();
    simulator.getSimulationData().setConsolePrintStream(stream1);

    manager.perform(new TalkingAlotSimulationOperation(simulator));
    return stream1;
  }
Пример #2
0
  private void run() throws StoryStorageException {
    KappaSystem kappaSystem = mySimulator.getSimulationData().getKappaSystem();

    mySimulator
        .getSimulationData()
        .getKappaSystem()
        .getObservables()
        .calculateObs(
            currentTime, 1, mySimulator.getSimulationData().getSimulationArguments().isTime());
    mySimulator.getSimulationData().getKappaSystem().updateRuleActivities();
    myActiveRule = mySimulator.getSimulationData().getKappaSystem().getRandomRule();

    if (myActiveRule == null) {
      //			mySimulator.getSimulationData().getClock().setTimeLimit(currentTime);
      fail(myTestFileName + " : there's no active rules");
    }

    if (LOGGER.isDebugEnabled()) LOGGER.debug("Rule: " + myActiveRule.getName());

    // myCurrentInjectionsList = ruleProbabilityCalculation
    // .getSomeInjectionList(myActiveRule);
    myCurrentInjectionsList = kappaSystem.chooseInjectionsForRuleApplication(myActiveRule);
    currentTime += mySimulator.getSimulationData().getKappaSystem().getTimeValue();

    if (myCurrentInjectionsList != null) {
      // negative update
      if (LOGGER.isDebugEnabled()) LOGGER.debug("negative update");

      myActiveRule.applyRule(myCurrentInjectionsList, mySimulator.getSimulationData());
      UpdatesPerformer.doNegativeUpdate(myCurrentInjectionsList);
      if (isDoingPositive()) {
        mySimulator
            .getSimulationData()
            .getKappaSystem()
            .doPositiveUpdate(myActiveRule, myCurrentInjectionsList);
      }

    } else {
      if (LOGGER.isDebugEnabled()) LOGGER.debug("Clash");
    }
  }
Пример #3
0
 public Collection<Rule> getRules() {
   return mySimulator.getSimulationData().getKappaSystem().getRules();
 }