PyANGKernel.GKODMatrix¶
- class GKODMatrix¶
An OD matrix that belongs to one (and only one) centroid configuration (
GKCentroidConfiguration).Details
This class holds the trips from origin to destination for a particular vehicle type and for a specific time interval.
Centroids in the matrix pertains to the centroid configuration where the matrix is. To access or set the trip information by centroids never use the catalog to get the centroids (as it will return all the centroids no matter the configuration) but instead the centroid configuration (
getCentroids).Synopsis¶
Methods¶
def
__init__()def
addTrips()def
centroidAdded()def
getEnableStore()def
getLocation()def
getMaxValue()def
getMinValue()def
getRoutes()def
getStoreId()def
getStoreType()def
getTrips()def
getTripsToList()def
hasICSP()def
lerp()def
multiply()def
multiplyColumn()def
multiplyRow()def
ownedByAimsun()def
removeTrips()def
setEnableStore()def
setLocation()def
setMatrixDense()def
setStoreId()def
setStoreType()def
setTrips()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
- class GKODMatrixGroupTripSetting¶
OD grouping trip setting type: - eByODPair: set given value to each OD pair belonging to the groupings - eEvenlyForAll: split given value evenly for all OD pairs belonging to the groupings - eEvenlyForExistingTrips: split given value evenly for all OD pairs with a positive number of trips - eProportionalToExistingTrips: split given value proportionally for all OD pairs with a positive number of trips
- class GKODMatrixStoreId¶
When storing the OD in an external source which attribute is used as the ID
- class GKODMatrixStoreType¶
OD storage type: - eInternal: in the Aimsun database - eAsciiFile: in an ASCII file - eODBC: in a ODBC database using the GKModel::getDatabase settings. - eOracle: in a Oracle database using the GKModel::getDatabase settings.
- class Content¶
- class Unit¶
- class CarAvailability¶
- class AssignmentOutput¶
- __init__()¶
- __init__(src)
- Parameters:
src –
GKODMatrix
Copy constructor
Warning
Only internal ODMatrixValues are actually duplicated. All any other data, including ID and external objects, are shared between the new object and the source one.
- addTrips(from, to, trips)¶
- Parameters:
from –
GKCentroidto –
GKCentroidtrips – float
Adds the trip to trips that goes from “from” to “to”. Both centroids must be part of the centroid configuration in where this matrix is.
- addTrips(from, to, trips)
- Parameters:
from – int
to – int
trips – float
Adds the trip to trips that goes from “from” to “to” centroid indexes. Both centroid indexes must be part of the centroid configuration in where this matrix is.
- anyTripsByDestination(to)¶
- Parameters:
to –
GKCentroid- Return type:
Returns true if is any trip to a destination from all the origin centroids. Note: This function is thread safe.
- anyTripsByOrigin(from)¶
- Parameters:
from –
GKCentroid- Return type:
Returns true if is any trip from an origin to all the destination centroids. Note: This function is thread safe.
- calculateSummary([canAskUser=true])¶
- Parameters:
canAskUser – bool
Calculate the summary info from the start. * UnknownCommand canAskUser If true and the external file cannot be found, a dialog asking for the location will be shown.
- centroidAdded(centroid)¶
- Parameters:
centroid –
GKCentroid
A centroid has been created
- centroidAdded(centroid, fromTrips, toTrips)
- Parameters:
centroid –
GKCentroidfromTrips – Dictionary with keys of type .GKCentroid and values of type float.
toTrips – Dictionary with keys of type .GKCentroid and values of type float.
- centroidRemoved(centroid)¶
- Parameters:
centroid –
GKCentroid
A centroid has been destroyed
- changeLocationToResources()¶
Change location to point into the resources folder it’s not already.
- clearICSPPercentage()¶
Clears the Initially Calculated Shortest Paths Percentage
- clearRoutesPercentages()¶
Removes all the routes use.
- consolidateInBase()¶
If it’s an external matrix, copy the file into the base resources. * To be used when consolidating a revision into the base.
- ensureMatrixData([documentUUID=QUuid()[, canAskUser=true]])¶
Ensures that the matrix has data. In case the matrix is externally stored it restores the content. UnknownCommand canAskUser If true and the external file cannot be found, a dialog asking for the location will be shown. Returns false if data cannot be restored. To force a reload of the data call
removeTrips()before calling this function.- getCentroidConfiguration()¶
- Return type:
Get the centroid configuration
If true the OD is saved when saving the network, if false the OD is not saved (it is read only from Aimsun Next point of view).
Gets extra data needed by the external storer (if any). The string format is “Separator@Format”.
- getFunctionComponent()¶
- Return type:
- getICSPPercentage(from, to)¶
- Parameters:
from –
GKCentroidto –
GKCentroid
- Return type:
Gets the Initially Calculated Shortest Paths Percentage
- getInternalTrips(from, to, ensureMatrix)¶
- Parameters:
from –
GKCentroidto –
GKCentroidensureMatrix – bool
- Return type:
Returns the number of trips from an origin to a destination centroid. Note that if from is not a valid origin or to a valid destination then 0 is returned (no trips). Ensure Matrix is optional in this case.
When storing this OD in a file, its path.
Get maximum value of matrix
Get minimum value of matrix
Gets the percentage usage of a route. It returns 0 if the route is not used.
- getRoutes()¶
- Return type:
Dictionary with keys of type .const GKODRoute and values of type float.
Gets the list of routes in this OD matrix
- getStoreId()¶
- Return type:
When storing the OD in an external source which attribute is used as the ID
- getStoreType()¶
- Return type:
OD storage type. -
eInternal: in the Aimsun database -eAsciiFile: in an ASCII file - eODBC: in a ODBC database using the GKModel::getDatabase settings. -eOracle: in a Oracle database using the GKModel::getDatabase settings.Returns the number of trips from an origin group of centroid to a destination group of centroid.
- getTrips(from, to)
- Parameters:
from –
GKCentroidto –
GKCentroid
- Return type:
Returns the number of trips from an origin to a destination centroid. Note that if from is not a valid origin or to a valid destination then 0 is returned (no trips)
- getTrips(from, to)
- Parameters:
from – int
to – int
- Return type:
Returns the number of trips from an origin to a destination centroid using the centroid index as returned by
indexOfCentroidNote that if from is not a valid origin or to a valid destination then 0 is returned (no trips)- getTripsByDestination(to)¶
- Parameters:
to –
GKCentroid- Return type:
Returns the number of trips to a destination from all the origin centroids. Note that if to is not a valid destination then 0 is returned (no trips)
- getTripsByOrigin(from)¶
- Parameters:
from –
GKCentroid- Return type:
Returns the number of trips from an origin to all the destination centroids. Note that if from is not a valid origin then 0 is returned (no trips)
Returns true if this matrix has any Initially Calculated Shortest Paths Percentage data
The matrix has negative values.
- indexOfCentroid(centroid)¶
- Parameters:
centroid –
GKCentroid- Return type:
Returns the index of the Centroid inside the centroids map.
- invalidateSummary()¶
Invalidates current summary.
Returns true if the data between the OD Pairs is available. False in case the matrix is external and its file has not been retrieved nor found
- lerp(m1, m2, f)¶
- Parameters:
m1 –
GKODMatrixm2 –
GKODMatrixf – float
Lerp: set this as returns (1-f)*m1 + m2*f
- multiply(f)¶
- Parameters:
f – float
Multiply this matrix by a factor
- multiplyColumn(iCol, iFactor)¶
- Parameters:
iCol – int
iFactor – float
Multiply column by a factor
- multiplyRow(iRow, iFactor)¶
- Parameters:
iRow – int
iFactor – float
Multiply row by a factor
Returns true if the external matrix data is owned by Aimsun Next. If so Aimsun Next will delete the file when the
GKODMatrixis deleted.- removeTrips()¶
Removes all trips from this matrix.
Returns true if the matrix data is not yet in memory
Restores the matrix data (trips) from an external source. Called automatically by GKODMatrix::restore. Can be used to force a restore from python or SDK.
Returns false if data cannot be restored.
This function is deprecated and will be set as private. Use
ensureMatrixDatainstead- setCentroidConfiguration(cent)¶
- Parameters:
cent –
GKCentroidConfiguration
Set (when created) the centroid configuration of this matrix.
- setEnableStore(value)¶
- Parameters:
value – bool
If true the OD is saved when saving the network, if false the OD is not saved (it is read only from Aimsun Next point of view).
- setExtraLocationData(value)¶
- Parameters:
value – str
Sets extra data needed by the external storer (if any). Info is the separator (TAB, comma) and Format (Aimsun, VISUM, EMME, SATURN, AimsunBinary), separated by @. That is, the string format is “Separator@Format”. For example, valid strings are “@Aimsun” for TAB, “,@Aimsun” for comma separator, both with Aimsun Next format.
- setFunctionComponent(component)¶
- Parameters:
component –
GKFunctionComponent
- setICSPPercentage(from, to, percentage)¶
- Parameters:
from –
GKCentroidto –
GKCentroidpercentage – float
Sets the Initially Calculated Shortest Paths Percentage
- setLocation(value)¶
- Parameters:
value – str
When storing this OD in a file, its path.
- setMatrixDense()¶
Change matrix internal structure to dense. Obtain an increase of write/read speed using more memory.
- setMatrixSparse()¶
Change matrix internal structure to sparse. * Uses less memory if the data has a lot of zeros.
Sets the percentage usage of a route in this OD matrix. If percentage is 0.0 then the route will be removed from this matrix. No check is done to ensure that the sum of all the possible percentages are between [0 and 100] for a pair of origin and destination centroids.
- setStoreId(value)¶
- Parameters:
value –
GKODMatrixStoreId
When storing the OD in an external source which attribute is used as the ID
- setStoreType(value)¶
- Parameters:
value –
GKODMatrixStoreType
OD storage type. -
eInternal: in the Aimsun database -eAsciiFile: in an ASCII file - eODBC: in a ODBC database using the GKModel::getDatabase settings. -eOracle: in a Oracle database using the GKModel::getDatabase settings.- setTrips(from, to, trips)¶
- Parameters:
from –
GKCentroidto –
GKCentroidtrips – float
Sets the trip that goes from “from” to “to”. Both centroids must be part of the centroid configuration in where this matrix is.
- setTrips(from, to, trips)
- Parameters:
from – int
to – int
trips – float
Sets the trip that goes from “from” to “to” centroid indexes. Both centroid indexes must be part of the centroid configuration in where this matrix is.
- setTrips(from, to, trips[, tripSetting=GKODMatrix.GKODMatrixGroupTripSetting.eByODPair])
- Parameters:
from –
GKGroupto –
GKGrouptrips – float
tripSetting –
GKODMatrixGroupTripSetting
Sets the trips for all centroids in the “from” group to the “to” group.
- setTripsFromList(list)¶
- Parameters:
list – .list of list of double
- setTripsFromMatrix(matrix)¶
- Parameters:
matrix –
GKODMatrix
Acts the trips for this matrix with the ones that matrix has defined. Note that both matrices have to belong to the same centroid configuration
- setValueToAllCells(f[, includingDiagonal=false])¶
- Parameters:
f – float
includingDiagonal – bool
Set the same value to all cells except the diagonal unless the includingDiagonal is set to True.
- storeExternalMatrix()¶