Example #1
0
 @SuppressWarnings("null")
 @Override
 public Scenario get() {
   if (localCache == null) {
     localCache = (Scenario) ScenarioIO.read(serializedScenario, scenarioClass);
   }
   return localCache;
 }
Example #2
0
  static void constructTasks(
      Set<SimArgs> inputs,
      List<SimulationTask> tasks,
      IdMap<MASConfiguration> configMap,
      IdMap<ScenarioProvider> scenarioMap,
      IdMap<ObjectiveFunction> objFuncMap,
      IdMap<PostProcessor<?>> ppMap,
      Map<String, Scenario> scenariosMap) {

    for (final SimArgs args : inputs) {
      final String configId = configMap.storeAndGenerateId(args.getMasConfig());
      final String scenId =
          scenarioMap.storeAndGenerateId(
              new ScenarioProvider(
                  ScenarioIO.write(args.getScenario()), args.getScenario().getClass()));
      scenariosMap.put(scenId, args.getScenario());
      final String objFuncId = objFuncMap.storeAndGenerateId(args.getObjectiveFunction());

      final String postProcId = ppMap.storeAndGenerateId(args.getPostProcessor());
      tasks.add(new SimulationTask(args.getRandomSeed(), scenId, configId, objFuncId, postProcId));
    }
  }