Class ProbabilisticRouteGenerator
- java.lang.Object
-
- org.opentrafficsim.core.network.route.ProbabilisticRouteGenerator
-
- All Implemented Interfaces:
Serializable
,Generator<Route>
public class ProbabilisticRouteGenerator extends Object implements Generator<Route>, Serializable
Generate one of a set of routes, based on a discrete probability density function.Copyright (c) 2013-2022 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.$LastChangedDate$, @version $Revision$, by $Author$, initial version 20 Mar 2015
- Author:
- Alexander Verbraeck, Peter Knoppers
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ProbabilisticRouteGenerator(List<Distribution.FrequencyAndObject<Route>> generators, StreamInterface stream)
Create a new Probabilistic Route Generator.
-
-
-
Constructor Detail
-
ProbabilisticRouteGenerator
public ProbabilisticRouteGenerator(List<Distribution.FrequencyAndObject<Route>> generators, StreamInterface stream) throws ProbabilityException
Create a new Probabilistic Route Generator.- Parameters:
generators
- List<Distribution.FrequencyAndObject<Route>>; list of routes and frequenciesstream
- StreamInterface; the entropy source- Throws:
ProbabilityException
- when the probabilities are invalid
-
-
Method Detail
-
draw
public final Route draw() throws ProbabilityException
Generate the next object.- Specified by:
draw
in interfaceGenerator<Route>
- Returns:
- O; an object randomly selected from the stored collection
- Throws:
ProbabilityException
- if the stored collection is empty
-
-