public LexicographicForCompositionExtraPlanRemover( final int maxPlansPerComposition, final int maxPlansPerAgent) { this.maxPlansPerComposition = maxPlansPerComposition; this.maxPlansPerAgent = maxPlansPerAgent; this.random = MatsimRandom.getLocalInstance(); }
/** * Constructor * * @param eventsMonitors */ protected PerceptHandler(final EventsMonitorRegistry eventsMonitors) { Gbl.assertNotNull( eventsMonitors ); this.eventsMonitors = eventsMonitors ; }
/** Resets the random number generator with a default random seed. */ public static void reset() { reset(DEFAULT_RANDOM_SEED); }
/** * Tests that resetting the RandomObject creates the same random numbers again. */ public void testReset() { MatsimRandom.reset(); int value1 = MatsimRandom.getRandom().nextInt(); MatsimRandom.reset(); int value2 = MatsimRandom.getRandom().nextInt(); assertEquals(value1, value2); }
/** * Tests that local instances can be recreated (=are deterministic) if the * same random seed is used to generate them. */ public void testLocalInstances_deterministic() { MatsimRandom.reset(); Random local1a = MatsimRandom.getLocalInstance(); Random local1b = MatsimRandom.getLocalInstance(); MatsimRandom.reset(); Random local2a = MatsimRandom.getLocalInstance(); Random local2b = MatsimRandom.getLocalInstance(); assertEqualRandomNumberGenerators(local1a, local2a); assertEqualRandomNumberGenerators(local1b, local2b); }
/** * Test that MatsimRandom returns different values. */ public void testRandomness() { final double value1 = MatsimRandom.getRandom().nextDouble(); final double value2 = MatsimRandom.getRandom().nextDouble(); final double value3 = MatsimRandom.getRandom().nextDouble(); assertTrue(Math.abs(value1 - value2) > EPSILON); assertTrue(Math.abs(value1 - value3) > EPSILON); assertTrue(Math.abs(value2 - value3) > EPSILON); }
private void doRandomChoice(double now) { // When do I want to stop the current activity? endTime = now + MatsimRandom.getRandom().nextInt(100);// 1% chance that endTime == now } }
public final void testGetAsImage() { final Image logo = MatsimResource.getAsImage("matsim_logo_transparent.png"); // verify that the correct image was correctly loaded by testing its dimension assertEquals(256, logo.getWidth(null)); assertEquals(48, logo.getHeight(null)); }
@Override protected final void beforeFinishReplanningHook() { Gbl.printMemoryUsage(); }
public static final void printBuildInfo() { printBuildInfo("MATSim", "/revision.txt"); }
public static final String getBuildInfoString() { return getBuildInfoString("MATSim", "/revision.txt"); }
public GroupStrategyManager( final IterationStopWatch stopWatch, final GroupIdentifier groupIdentifier, final GroupStrategyRegistry registry ) { this.stopWatch = stopWatch; this.groupIdentifier = groupIdentifier; this.registry = registry; this.random = MatsimRandom.getLocalInstance(); }
public NetworkRoutingModule( final String mode, final PopulationFactory populationFactory, final Network network, final LeastCostPathCalculator routeAlgo) { Gbl.assertNotNull(network); // Gbl.assertIf( network.getLinks().size()>0 ) ; // otherwise network for mode probably not defined // makes many tests fail. this.network = network; this.routeAlgo = routeAlgo; this.mode = mode; this.populationFactory = populationFactory; }
public MatsimTestUtils() { MatsimRandom.reset(); }
@Override protected final void beforeFinishReplanningHook() { Gbl.printMemoryUsage() ; }
RandomizingTimeDistanceTravelDisutility( final TravelTime timeCalculator, final double marginalCostOfTime_s, final double marginalCostOfDistance_m, final double normalization, final double sigma) { this.timeCalculator = timeCalculator; this.marginalCostOfTime = marginalCostOfTime_s; this.marginalCostOfDistance = marginalCostOfDistance_m; this.normalization = normalization; this.sigma = sigma; this.random = sigma != 0 ? MatsimRandom.getLocalInstance() : null; }
public BoardingModelStochasticLinear() { random = MatsimRandom.getLocalInstance(); }
@Override public GenericPlanAlgorithm<GroupPlans> createAlgorithm(ReplanningContext replanningContext) { return new OptimizeVehicleAllocationAtTourLevelAlgorithm( stageActs, MatsimRandom.getLocalInstance(), vehicleRessources, vehicularModes, allowNullRoutes); } }
@Override public GenericPlanAlgorithm<GroupPlans> createAlgorithm(ReplanningContext replanningContext) { return new MutateActivityLocationsToLocationsOfOthersAlgorithm( choiceSet, MatsimRandom.getLocalInstance()); } }
@Override public GenericPlanAlgorithm<GroupPlans> createAlgorithm(ReplanningContext replanningContext) { return new JointPlanMergingAlgorithm( factory, probAcceptance, MatsimRandom.getLocalInstance() ); } }