Calculate the demands. More...
#include <demands.h>
Public Member Functions | |
DemandCalculator (LinkGraphJob *job) | |
Create the DemandCalculator and immediately do the calculation. | |
Private Member Functions | |
template<class Tscaler > | |
void | CalcDemand (LinkGraphJob *job, Tscaler scaler) |
Do the actual demand calculation, called from constructor. | |
Private Attributes | |
int32 | max_distance |
Maximum distance possible on the map. | |
int32 | mod_dist |
Distance modifier, determines how much demands decrease with distance. | |
int32 | accuracy |
Accuracy of the calculation. |
Calculate the demands.
This class has a state, but is recreated for each call to of DemandHandler::Run.
Definition at line 133 of file demands.h.
DemandCalculator::DemandCalculator | ( | LinkGraphJob * | job | ) |
Create the DemandCalculator and immediately do the calculation.
job | Job to calculate the demands for. |
Definition at line 158 of file demands.cpp.
References LinkGraphSettings::accuracy, accuracy, LinkGraphSettings::demand_distance, LinkGraphSettings::demand_size, DT_ASYMMETRIC, DT_SYMMETRIC, LinkGraph::GetCargo(), LinkGraphJob::Graph(), mod_dist, and LinkGraphJob::Settings().
void DemandCalculator::CalcDemand | ( | LinkGraphJob * | job, | |
Tscaler | scaler | |||
) | [private] |
Do the actual demand calculation, called from constructor.
job | Job to calculate the demands for. |
Tscaler | Scaler to be used for scaling demands. |
Definition at line 59 of file demands.cpp.
References accuracy, Node::demand, Edge::distance, LinkGraph::GetEdge(), LinkGraphJob::GetNode(), LinkGraph::GetNode(), LinkGraph::GetSize(), LinkGraphJob::Graph(), max_distance, min(), mod_dist, Node::supply, and NodeAnnotation::undelivered_supply.