/** * Preparing hot start: Copying recent matsim plans file to a specified location (Matsim config). * Matsim will check this location for plans file on run and activates hot start if the plans file * is there */ public static void prepareHotStart(ScenarioImpl scenario) { M4UControlerConfigModuleV3 module = ConfigurationUtils.getMATSim4UrbaSimControlerConfigModule(scenario); UrbanSimParameterConfigModuleV3 uspModule = M4UConfigUtils.getUrbanSimParameterConfigAndPossiblyConvert(scenario.getConfig()); String hotStartFile = module.getHotStartPlansFileLocation().trim(); if (exists(hotStartFile)) { String plansFile = uspModule.getMATSim4OpusOutput() + InternalConstants.GENERATED_PLANS_FILE_NAME; try { log.info("Preparing hot start for next MATSim run ..."); FileCopy.fileCopy(new File(plansFile), new File(hotStartFile)); } catch (Exception e) { log.error("Error while copying plans file, i. e. hot start will not work!"); e.printStackTrace(); } log.info("Hot start preparation successful!"); } else { log.info("can not prepare hotStart. hotstart-file does not exist: " + hotStartFile); } }
public static void runBackup(ScenarioImpl scenario) { UrbanSimParameterConfigModuleV3 module = ConfigurationUtils.getUrbanSimParameterConfigModule(scenario); if (module == null) log.error( "UrbanSimParameterConfigModule module is null. Can't determine if backup option is activated. No backup will be performed."); else if (module.isBackup()) { // saving results from current run saveRunOutputs(scenario); // cleanUrbanSimOutput(scenario); // tnicolai dec'12 not needed } }