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 ).

Inheritance diagram of PyANGKernel.GKODMatrix

Synopsis

Methods

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:

srcGKODMatrix

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:

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:

toGKCentroid

Return type:

bool

Returns true if is any trip to a destination from all the origin centroids. Note: This function is thread safe.

anyTripsByOrigin(from)
Parameters:

fromGKCentroid

Return type:

bool

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:

centroidGKCentroid

A centroid has been created

centroidAdded(centroid, fromTrips, toTrips)
Parameters:
  • centroidGKCentroid

  • fromTrips – 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:

centroidGKCentroid

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]])
Parameters:
  • documentUUIDQUuid

  • canAskUser – bool

Return type:

bool

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:

GKCentroidConfiguration

Get the centroid configuration

getEnableStore()
Return type:

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).

getExtraLocationData()
Return type:

str

Gets extra data needed by the external storer (if any). The string format is “Separator@Format”.

getFunctionComponent()
Return type:

GKFunctionComponent

getICSPPercentage(from, to)
Parameters:
Return type:

float

Gets the Initially Calculated Shortest Paths Percentage

getInternalTrips(from, to, ensureMatrix)
Parameters:
Return type:

float

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.

getLocation()
Return type:

str

When storing this OD in a file, its path.

getMaxValue()
Return type:

float

Get maximum value of matrix

getMinValue()
Return type:

float

Get minimum value of matrix

getRoutePercentage(route)
Parameters:

routeGKODRoute

Return type:

float

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:

GKODMatrixStoreId

When storing the OD in an external source which attribute is used as the ID

getStoreType()
Return type:

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.

getTrips(from, to)
Parameters:
Return type:

float

Returns the number of trips from an origin group of centroid to a destination group of centroid.

getTrips(from, to)
Parameters:
Return type:

float

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:

float

Returns the number of trips from an origin to a destination centroid using the centroid index as returned by indexOfCentroid Note that if from is not a valid origin or to a valid destination then 0 is returned (no trips)

getTripsByDestination(to)
Parameters:

toGKCentroid

Return type:

float

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:

fromGKCentroid

Return type:

float

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)

getTripsToList()
Return type:

.list of list of double

hasICSP()
Return type:

bool

Returns true if this matrix has any Initially Calculated Shortest Paths Percentage data

hasNegativeValues()
Return type:

bool

The matrix has negative values.

indexOfCentroid(centroid)
Parameters:

centroidGKCentroid

Return type:

int

Returns the index of the Centroid inside the centroids map.

invalidateSummary()

Invalidates current summary.

isDataAvailable()
Return type:

bool

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:

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

ownedByAimsun()
Return type:

bool

Returns true if the external matrix data is owned by Aimsun Next. If so Aimsun Next will delete the file when the GKODMatrix is deleted.

removeTrips()

Removes all trips from this matrix.

requiresExternalRestore()
Return type:

bool

Returns true if the matrix data is not yet in memory

restoreExternalMatrix()
Return type:

bool

Note

This function is deprecated.

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 ensureMatrixData instead

setCentroidConfiguration(cent)
Parameters:

centGKCentroidConfiguration

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:

componentGKFunctionComponent

setICSPPercentage(from, to, percentage)
Parameters:

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.

setRoutePercentage(route, percentage)
Parameters:

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:

valueGKODMatrixStoreId

When storing the OD in an external source which attribute is used as the ID

setStoreType(value)
Parameters:

valueGKODMatrixStoreType

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:

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:

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:

matrixGKODMatrix

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.

shouldBeDenseMatrix()
Return type:

bool

storeExternalMatrix()