public class ODMatrix extends Object implements Serializable, org.opentrafficsim.base.Identifiable
Class
's that define the categorization.
Copyright (c) 2013-2017 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Constructor and Description |
---|
ODMatrix(String id,
List<org.opentrafficsim.core.network.Node> origins,
List<org.opentrafficsim.core.network.Node> destinations,
Categorization categorization,
org.djunits.value.vdouble.vector.TimeVector globalTimeVector,
Interpolation globalInterpolation)
Constructs an OD matrix.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(org.opentrafficsim.core.network.Node origin,
org.opentrafficsim.core.network.Node destination,
Category category) |
int |
destinationTotal(org.opentrafficsim.core.network.Node destination)
Calculates total number of trips over time for given destination.
|
boolean |
equals(Object obj) |
Set<Category> |
getCategories(org.opentrafficsim.core.network.Node origin,
org.opentrafficsim.core.network.Node destination)
Returns the categories specified for given origin-destination combination.
|
Categorization |
getCategorization() |
org.djunits.value.vdouble.scalar.Frequency |
getDemand(org.opentrafficsim.core.network.Node origin,
org.opentrafficsim.core.network.Node destination,
Category category,
org.djunits.value.vdouble.scalar.Time time,
boolean sliceStart)
Returns the demand at given time.
|
DemandPattern |
getDemandPattern(org.opentrafficsim.core.network.Node origin,
org.opentrafficsim.core.network.Node destination,
Category category) |
org.djunits.value.vdouble.vector.FrequencyVector |
getDemandVector(org.opentrafficsim.core.network.Node origin,
org.opentrafficsim.core.network.Node destination,
Category category) |
List<org.opentrafficsim.core.network.Node> |
getDestinations() |
Interpolation |
getGlobalInterpolation() |
org.djunits.value.vdouble.vector.TimeVector |
getGlobalTimeVector() |
String |
getId() |
Interpolation |
getInterpolation(org.opentrafficsim.core.network.Node origin,
org.opentrafficsim.core.network.Node destination,
Category category) |
List<org.opentrafficsim.core.network.Node> |
getOrigins() |
org.djunits.value.vdouble.vector.TimeVector |
getTimeVector(org.opentrafficsim.core.network.Node origin,
org.opentrafficsim.core.network.Node destination,
Category category) |
int |
getTrips(org.opentrafficsim.core.network.Node origin,
org.opentrafficsim.core.network.Node destination,
Category category,
int periodIndex)
Returns the number of trips in the given time period.
|
int[] |
getTripsVector(org.opentrafficsim.core.network.Node origin,
org.opentrafficsim.core.network.Node destination,
Category category) |
int |
hashCode() |
void |
increaseTrips(org.opentrafficsim.core.network.Node origin,
org.opentrafficsim.core.network.Node destination,
Category category,
int periodIndex,
int trips)
Adds a number of trips to given origin-destination combination, category and time period.
|
int |
matrixTotal()
Calculates total number of trips over time for the complete matrix.
|
int |
originDestinationTotal(org.opentrafficsim.core.network.Node origin,
org.opentrafficsim.core.network.Node destination)
Calculates total number of trips over time for given origin-destination combination.
|
int |
originTotal(org.opentrafficsim.core.network.Node origin)
Calculates total number of trips over time for given origin.
|
void |
print()
Prints the complete OD matrix with each demand data on a single line.
|
void |
putDemandVector(org.opentrafficsim.core.network.Node origin,
org.opentrafficsim.core.network.Node destination,
Category category,
org.djunits.value.vdouble.vector.FrequencyVector demand)
Add a demand vector to OD.
|
void |
putDemandVector(org.opentrafficsim.core.network.Node origin,
org.opentrafficsim.core.network.Node destination,
Category category,
org.djunits.value.vdouble.vector.FrequencyVector demand,
org.djunits.value.vdouble.vector.TimeVector timeVector,
Interpolation interpolation)
Add a demand vector to OD.
|
void |
putDemandVector(org.opentrafficsim.core.network.Node origin,
org.opentrafficsim.core.network.Node destination,
Category category,
org.djunits.value.vdouble.vector.FrequencyVector demand,
org.djunits.value.vdouble.vector.TimeVector timeVector,
Interpolation interpolation,
double fraction)
Add a demand vector to OD, by a fraction of total demand.
|
void |
putDemandVector(org.opentrafficsim.core.network.Node origin,
org.opentrafficsim.core.network.Node destination,
Category category,
org.djunits.value.vdouble.vector.FrequencyVector demand,
org.djunits.value.vdouble.vector.TimeVector timeVector,
Interpolation interpolation,
double[] fraction)
Add a demand vector to OD, by a fraction per time period of total demand.
|
void |
putTripsVector(org.opentrafficsim.core.network.Node origin,
org.opentrafficsim.core.network.Node destination,
Category category,
int[] trips) |
void |
putTripsVector(org.opentrafficsim.core.network.Node origin,
org.opentrafficsim.core.network.Node destination,
Category category,
int[] trips,
org.djunits.value.vdouble.vector.TimeVector timeVector)
Sets demand data by number of trips.
|
String |
toString() |
public ODMatrix(String id, List<org.opentrafficsim.core.network.Node> origins, List<org.opentrafficsim.core.network.Node> destinations, Categorization categorization, org.djunits.value.vdouble.vector.TimeVector globalTimeVector, Interpolation globalInterpolation)
id
- idorigins
- origin nodesdestinations
- destination nodescategorization
- categorization of dataglobalTimeVector
- default timeglobalInterpolation
- interpolation of demand dataNullPointerException
- if any input is nullpublic final String getId()
getId
in interface org.opentrafficsim.base.Identifiable
public final List<org.opentrafficsim.core.network.Node> getOrigins()
public final List<org.opentrafficsim.core.network.Node> getDestinations()
public final Categorization getCategorization()
public final org.djunits.value.vdouble.vector.TimeVector getGlobalTimeVector()
public final Interpolation getGlobalInterpolation()
public final void putDemandVector(org.opentrafficsim.core.network.Node origin, org.opentrafficsim.core.network.Node destination, Category category, org.djunits.value.vdouble.vector.FrequencyVector demand)
origin
- origindestination
- destinationcategory
- categorydemand
- demand data, length has to be equal to the global time vectorIllegalArgumentException
- if origin or destination is not part of the OD matrixIllegalArgumentException
- if the category does not belong to the categorizationIllegalArgumentException
- if the demand data has a different length than time data, or is less than 2IllegalArgumentException
- if demand is negative or time not strictly increasingIllegalArgumentException
- if the route (if in the category) is not from the origin to the destinationNullPointerException
- if an input is nullpublic final void putDemandVector(org.opentrafficsim.core.network.Node origin, org.opentrafficsim.core.network.Node destination, Category category, org.djunits.value.vdouble.vector.FrequencyVector demand, org.djunits.value.vdouble.vector.TimeVector timeVector, Interpolation interpolation)
origin
- origindestination
- destinationcategory
- categorydemand
- demand data, length has to be equal to the time vectortimeVector
- time vectorinterpolation
- interpolationIllegalArgumentException
- if origin or destination is not part of the OD matrixIllegalArgumentException
- if the category does not belong to the categorizationIllegalArgumentException
- if the demand data has a different length than time data, or is less than 2IllegalArgumentException
- if demand is negative or time not strictly increasingIllegalArgumentException
- if the route (if in the category) is not from the origin to the destinationNullPointerException
- if an input is nullpublic final void putDemandVector(org.opentrafficsim.core.network.Node origin, org.opentrafficsim.core.network.Node destination, Category category, org.djunits.value.vdouble.vector.FrequencyVector demand, org.djunits.value.vdouble.vector.TimeVector timeVector, Interpolation interpolation, double fraction)
origin
- origindestination
- destinationcategory
- categorydemand
- demand data, length has to be equal to the time vectortimeVector
- time vectorinterpolation
- interpolationfraction
- fraction of demand for this categoryIllegalArgumentException
- if origin or destination is not part of the OD matrixIllegalArgumentException
- if the category does not belong to the categorizationIllegalArgumentException
- if the demand data has a different length than time data, or is less than 2IllegalArgumentException
- if demand is negative or time not strictly increasingIllegalArgumentException
- if the route (if in the category) is not from the origin to the destinationNullPointerException
- if an input is nullpublic final void putDemandVector(org.opentrafficsim.core.network.Node origin, org.opentrafficsim.core.network.Node destination, Category category, org.djunits.value.vdouble.vector.FrequencyVector demand, org.djunits.value.vdouble.vector.TimeVector timeVector, Interpolation interpolation, double[] fraction)
origin
- origindestination
- destinationcategory
- categorydemand
- demand data, length has to be equal to the time vectortimeVector
- time vectorinterpolation
- interpolationfraction
- fraction of demand for this categoryIllegalArgumentException
- if origin or destination is not part of the OD matrixIllegalArgumentException
- if the category does not belong to the categorizationIllegalArgumentException
- if the demand data has a different length than time data, or is less than 2IllegalArgumentException
- if demand is negative or time not strictly increasingIllegalArgumentException
- if the route (if in the category) is not from the origin to the destinationNullPointerException
- if an input is nullpublic final org.djunits.value.vdouble.vector.FrequencyVector getDemandVector(org.opentrafficsim.core.network.Node origin, org.opentrafficsim.core.network.Node destination, Category category)
origin
- origindestination
- destinationcategory
- categorynull
if no data is givenIllegalArgumentException
- if origin or destination is not part of the OD matrixIllegalArgumentException
- if the category does not belong to the categorizationNullPointerException
- if an input is nullpublic final org.djunits.value.vdouble.vector.TimeVector getTimeVector(org.opentrafficsim.core.network.Node origin, org.opentrafficsim.core.network.Node destination, Category category)
origin
- origindestination
- destinationcategory
- categorynull
if no data is givenIllegalArgumentException
- if origin or destination is not part of the OD matrixIllegalArgumentException
- if the category does not belong to the categorizationNullPointerException
- if an input is nullpublic final Interpolation getInterpolation(org.opentrafficsim.core.network.Node origin, org.opentrafficsim.core.network.Node destination, Category category)
origin
- origindestination
- destinationcategory
- categorynull
if no data is givenIllegalArgumentException
- if origin or destination is not part of the OD matrixIllegalArgumentException
- if the category does not belong to the categorizationNullPointerException
- if an input is nullpublic final org.djunits.value.vdouble.scalar.Frequency getDemand(org.opentrafficsim.core.network.Node origin, org.opentrafficsim.core.network.Node destination, Category category, org.djunits.value.vdouble.scalar.Time time, boolean sliceStart)
origin
- Node; origindestination
- Node; destinationcategory
- Category; categorytime
- Duration; timesliceStart
- boolean; whether the time is at the start of an arbitrary time sliceIllegalArgumentException
- if origin or destination is not part of the OD matrixIllegalArgumentException
- if the category does not belong to the categorizationNullPointerException
- if an input is nullpublic DemandPattern getDemandPattern(org.opentrafficsim.core.network.Node origin, org.opentrafficsim.core.network.Node destination, Category category)
origin
- origindestination
- destinationcategory
- categoryIllegalArgumentException
- if origin or destination is not part of the OD matrixIllegalArgumentException
- if the category does not belong to the categorizationNullPointerException
- if an input is nullpublic final boolean contains(org.opentrafficsim.core.network.Node origin, org.opentrafficsim.core.network.Node destination, Category category)
origin
- origindestination
- destinationcategory
- categoryIllegalArgumentException
- if origin or destination is not part of the OD matrixIllegalArgumentException
- if the category does not belong to the categorizationNullPointerException
- if an input is nullpublic final Set<Category> getCategories(org.opentrafficsim.core.network.Node origin, org.opentrafficsim.core.network.Node destination)
origin
- origindestination
- destinationIllegalArgumentException
- if origin or destination is not part of the OD matrixNullPointerException
- if an input is nullpublic final void putTripsVector(org.opentrafficsim.core.network.Node origin, org.opentrafficsim.core.network.Node destination, Category category, int[] trips)
origin
- origindestination
- destinationcategory
- categorytrips
- trip data, length has to be equal to the global time vector - 1, each value is the number of trips during a
periodIllegalArgumentException
- if origin or destination is not part of the OD matrixIllegalArgumentException
- if the category does not belong to the categorizationIllegalArgumentException
- if the demand data has a different length than time data, or is less than 2IllegalArgumentException
- if demand is negative or time not strictly increasingIllegalArgumentException
- if the route (if in the category) is not from the origin to the destinationNullPointerException
- if an input is nullpublic final void putTripsVector(org.opentrafficsim.core.network.Node origin, org.opentrafficsim.core.network.Node destination, Category category, int[] trips, org.djunits.value.vdouble.vector.TimeVector timeVector)
origin
- origindestination
- destinationcategory
- categorytrips
- trip data, length has to be equal to the time vector - 1, each value is the number of trips during a periodtimeVector
- time vectorIllegalArgumentException
- if origin or destination is not part of the OD matrixIllegalArgumentException
- if the category does not belong to the categorizationIllegalArgumentException
- if the demand data has a different length than time data, or is less than 2IllegalArgumentException
- if demand is negative or time not strictly increasingIllegalArgumentException
- if the route (if in the category) is not from the origin to the destinationNullPointerException
- if an input is nullpublic final int[] getTripsVector(org.opentrafficsim.core.network.Node origin, org.opentrafficsim.core.network.Node destination, Category category)
origin
- origindestination
- destinationcategory
- categorynull
if no data is givenIllegalArgumentException
- if origin or destination is not part of the OD matrixIllegalArgumentException
- if the category does not belong to the categorizationNullPointerException
- if an input is nullpublic final int getTrips(org.opentrafficsim.core.network.Node origin, org.opentrafficsim.core.network.Node destination, Category category, int periodIndex)
origin
- origindestination
- destinationcategory
- categoryperiodIndex
- index of time periodIllegalArgumentException
- if origin or destination is not part of the OD matrixIllegalArgumentException
- if the category does not belong to the categorizationIndexOutOfBoundsException
- if the period is outside of the specified rangeNullPointerException
- if an input is nullpublic final void increaseTrips(org.opentrafficsim.core.network.Node origin, org.opentrafficsim.core.network.Node destination, Category category, int periodIndex, int trips)
origin
- origindestination
- destinationcategory
- categoryperiodIndex
- index of time periodtrips
- trips to add (may be negative)IllegalArgumentException
- if origin or destination is not part of the OD matrixIllegalArgumentException
- if the category does not belong to the categorizationIndexOutOfBoundsException
- if the period is outside of the specified rangeUnsupportedOperationException
- if the interpolation of the data is not stepwise, or demand becomes negtiveNullPointerException
- if an input is nullpublic final int originTotal(org.opentrafficsim.core.network.Node origin)
origin
- originIllegalArgumentException
- if origin is not part of the OD matrixNullPointerException
- if origin is nullpublic final int destinationTotal(org.opentrafficsim.core.network.Node destination)
destination
- destinationIllegalArgumentException
- if destination is not part of the OD matrixNullPointerException
- if destination is nullpublic final int matrixTotal()
IllegalArgumentException
- if origin or destination is not part of the OD matrixNullPointerException
- if an input is nullpublic final int originDestinationTotal(org.opentrafficsim.core.network.Node origin, org.opentrafficsim.core.network.Node destination)
origin
- origindestination
- destinationIllegalArgumentException
- if origin or destination is not part of the OD matrixNullPointerException
- if an input is nullpublic final void print()
Copyright © 2014–2018 Delft University of Technology. All rights reserved.