public AbstractMultithreadedModule(GlobalConfigGroup globalConfigGroup) { this.numOfThreads = globalConfigGroup.getNumberOfThreads(); }
public AbstractMultithreadedGenericStrategyModule(GlobalConfigGroup globalConfigGroup) { this( globalConfigGroup.getNumberOfThreads() ); }
public FastAStarLandmarksFactory() { // the value of 8 threads was the default that I found here when making this configurable without injection. // This was in the create method, with a comment from kai, nov 17. // Not sure why this is a good default. td, nov 18 this(8); }
@Inject public AStarLandmarksFactory(final GlobalConfigGroup globalConfigGroup) { this(globalConfigGroup.getNumberOfThreads()); }
@Inject public WithinDayEngine(EventsManager eventsManager, GlobalConfigGroup globalConfigGroup) { this.eventsManager = eventsManager; this.duringActivityReplannerFactory = new LinkedHashMap<>(); this.duringLegReplannerFactory = new LinkedHashMap<>(); log.info("Initialize Parallel Replanning Modules"); this.parallelInitialReplanner = new ParallelInitialReplanner(globalConfigGroup.getNumberOfThreads(), eventsManager); this.parallelDuringActivityReplanner = new ParallelDuringActivityReplanner(globalConfigGroup.getNumberOfThreads(), eventsManager); this.parallelDuringLegReplanner = new ParallelDuringLegReplanner(globalConfigGroup.getNumberOfThreads(), eventsManager); log.info("Initialize Replanning Modules"); this.initialReplanningModule = new InitialReplanningModule(parallelInitialReplanner); this.duringActivityReplanningModule = new DuringActivityReplanningModule(parallelDuringActivityReplanner); this.duringLegReplanningModule = new DuringLegReplanningModule(parallelDuringLegReplanner); }
public static GenericStrategyModule<GroupPlans> createRecomposeJointPlansModule( final Config config, final JointPlanFactory jpFactory, final PlanLinkIdentifier linkIdentifier) { return new RecomposeJointPlanModule( config.global().getNumberOfThreads(), jpFactory, linkIdentifier ); }
public static GenericStrategyModule<GroupPlans> createVehicleAllocationModule( final Config config, final VehicleRessources vehicles) { return new AllocateVehicleToPlansInGroupPlanModule( config.global().getNumberOfThreads(), vehicles, SharedVehicleUtils.DEFAULT_VEHICULAR_MODES, true, true); } }
public WithinDayTravelTime(Scenario scenario, Set<String> analyzedModes) { // log.setLevel(Level.DEBUG); /* * The parallelization should scale almost linear, therefore we do use * the number of available threads according to the config file. */ this.network = scenario.getNetwork(); this.numOfThreads = scenario.getConfig().global().getNumberOfThreads(); if (analyzedModes == null || analyzedModes.size() == 0) { this.filterModes = false; this.analyzedModes = null; } else { this.analyzedModes = new HashSet<>(analyzedModes); filterModes = true; } init(); }
public static GenericStrategyModule<GroupPlans> createSynchronizerModule( final Config config, final Provider<TripRouter> tripRouterFactory) { return new JointPlanBasedGroupStrategyModule( new SynchronizeCoTravelerPlansModule( config.global().getNumberOfThreads(), tripRouterFactory.get().getStageActivityTypes() ) ); }
isPopulationStreaming = false; if (scenario.getConfig().global().getNumberOfThreads() > 0) { this.numThreads = scenario.getConfig().global().getNumberOfThreads(); } else this.numThreads = 1;
public ChangeSingleLegMode(final GlobalConfigGroup globalConfigGroup, ChangeModeConfigGroup changeLegModeConfigGroup) { super(globalConfigGroup.getNumberOfThreads()); this.availableModes = changeLegModeConfigGroup.getModes(); this.ignoreCarAvailability = changeLegModeConfigGroup.getIgnoreCarAvailability(); if (changeLegModeConfigGroup.getBehavior().equals(ChangeModeConfigGroup.Behavior.fromSpecifiedModesToSpecifiedModes)) { this.allowSwitchFromListedModesOnly = true; } else this.allowSwitchFromListedModesOnly=false; }
public ChangeLegMode(final GlobalConfigGroup globalConfigGroup, ChangeModeConfigGroup changeLegModeConfigGroup) { super(globalConfigGroup.getNumberOfThreads()); this.availableModes = changeLegModeConfigGroup.getModes(); this.ignoreCarAvailability = changeLegModeConfigGroup.getIgnoreCarAvailability(); if (changeLegModeConfigGroup.getBehavior().equals(ChangeModeConfigGroup.Behavior.fromSpecifiedModesToSpecifiedModes)) { this.allowSwitchFromListedModesOnly = true; } else this.allowSwitchFromListedModesOnly=false; }
ParallelPersonAlgorithmUtils.run(population, globalConfigGroup.getNumberOfThreads(), new ParallelPersonAlgorithmUtils.PersonAlgorithmProvider() { @Override
public SubtourModeChoice(Provider<TripRouter> tripRouterProvider, GlobalConfigGroup globalConfigGroup, SubtourModeChoiceConfigGroup subtourModeChoiceConfigGroup) { this(globalConfigGroup.getNumberOfThreads(), subtourModeChoiceConfigGroup.getModes(), subtourModeChoiceConfigGroup.getChainBasedModes(), subtourModeChoiceConfigGroup.considerCarAvailability(), subtourModeChoiceConfigGroup.getProbaForRandomSingleTripMode(), tripRouterProvider ); this.setBehavior( subtourModeChoiceConfigGroup.getBehavior() ); }
public RandomJointLocationChoiceModule(final Scenario scenario) { this( scenario.getConfig().global().getNumberOfThreads(), (RandomJointLocationChoiceConfigGroup) scenario.getConfig().getModule( RandomJointLocationChoiceConfigGroup.GROUP_NAME ), scenario.getActivityFacilities(), (SocialNetwork) scenario.getScenarioElement( SocialNetwork.ELEMENT_NAME ) ); }
public ComputeMaxDCScoreMultiThreatedModule(String type, DestinationChoiceContext lcContext, DestinationSampler sampler) { super(lcContext.getScenario().getConfig().global().getNumberOfThreads()); this.type = type; this.lcContext = lcContext; /* * Get ActivityFacilies for type and then replace them with ActivityFacilityWithIndex * objects due to performance reasons. */ Map<Id<ActivityFacility>, ActivityFacility> map = lcContext.getScenario().getActivityFacilities().getFacilitiesForActivityType(lcContext.getConverter().convertType(type)); this.typedFacilities = new ActivityFacilityWithIndex[map.size()]; int i = 0; for (ActivityFacility activityFacility : map.values()) { int index = this.lcContext.getFacilityIndex(activityFacility.getId()); this.typedFacilities[i] = new ActivityFacilityWithIndex(activityFacility, index); i++; } if (this.typedFacilities.length == 0) { log.warn("There are no facilities for type : " + type); } this.sampler = sampler; }
@Override public GroupPlanStrategy get() { final GroupPlanStrategy strategy = instantiateStrategy( sc.getConfig() ); strategy.addStrategyModule( new AllocateVehicleToPlansInGroupPlanModule( sc.getConfig().global().getNumberOfThreads(), (VehicleRessources) sc.getScenarioElement( VehicleRessources.ELEMENT_NAME ), SharedVehicleUtils.DEFAULT_VEHICULAR_MODES, false, false)); strategy.addStrategyModule( GroupPlanStrategyFactoryUtils.createReRouteModule( sc.getConfig(), planRoutingAlgorithmFactory, tripRouterFactory) ); strategy.addStrategyModule( GroupPlanStrategyFactoryUtils.createRecomposeJointPlansModule( sc.getConfig(), ((JointPlans) sc.getScenarioElement( JointPlans.ELEMENT_NAME )).getFactory(), planLinkIdentifier)); return strategy; } }
@Override public GroupPlanStrategy get() { final GroupPlanStrategy strategy = instantiateStrategy( sc.getConfig() ); strategy.addStrategyModule( new IndividualBasedGroupStrategyModule( new AllocateVehicleToSubtourModule( sc.getConfig().global().getNumberOfThreads(), TransportMode.car, (VehicleRessources) sc.getScenarioElement( VehicleRessources.ELEMENT_NAME ), tripRouterFactory) ) ); strategy.addStrategyModule( GroupPlanStrategyFactoryUtils.createReRouteModule( sc.getConfig(), planRoutingAlgorithmFactory, tripRouterFactory) ); strategy.addStrategyModule( GroupPlanStrategyFactoryUtils.createRecomposeJointPlansModule( sc.getConfig(), ((JointPlans) sc.getScenarioElement( JointPlans.ELEMENT_NAME )).getFactory(), planLinkIdentifier)); return strategy; } }
strategy.addStrategyModule( new MutateActivityLocationsToLocationsOfOthersModule( sc.getConfig().global().getNumberOfThreads(), sc.getPopulation(), configGroup.getLocationChoiceActivityType() ) );
@Override public void notifyIterationStarts(IterationStartsEvent event) { PBox pBox = (PBox) operators ; final MatsimServices controler = event.getServices(); if(event.getIteration() == controler.getConfig().controler().getFirstIteration()){ log.info("This is the first iteration. All lines were added by notifyStartup event."); } else { pBox.notifyIterationStarts(event); removePreviousPTransitScheduleFromOriginalOne(event.getServices().getScenario().getTransitSchedule()); addPTransitScheduleToOriginalOne(event.getServices().getScenario().getTransitSchedule(), pBox.getpTransitSchedule()); removePreviousPVehiclesFromScenario(event.getServices().getScenario().getTransitVehicles()); addPVehiclesToOriginalOnes(event.getServices().getScenario().getTransitVehicles(), this.pVehiclesFactory.createVehicles(pBox.getpTransitSchedule())); event.getServices().getEvents().processEvent(new TransitScheduleChangedEvent(0.0)); if(this.agentsStuckHandler != null){ ParallelPersonAlgorithmUtils.run(controler.getScenario().getPopulation(), controler.getConfig().global().getNumberOfThreads(), new ParallelPersonAlgorithmUtils.PersonAlgorithmProvider() { @Override public AbstractPersonAlgorithm getPersonAlgorithm() { return stuckFactory.getReRouteStuck(new PlanRouter( controler.getTripRouterProvider().get(), controler.getScenario().getActivityFacilities() ), ((MutableScenario)controler.getScenario()), agentsStuckHandler.getAgentsStuck()); } }); } } this.dumpTransitScheduleAndVehicles(event.getServices(), event.getIteration()); }