43 #ifdef CHECK_MEMORY_LEAKS
45 #endif // CHECK_MEMORY_LEAKS
72 if (oc.
getString(
"route-choice-method") ==
"logit") {
74 }
else if (oc.
getString(
"route-choice-method") ==
"gawron") {
90 : myBeta(beta), myA(a) {}
108 for (std::vector<RORoute*>::iterator i = alternatives.begin(); i != alternatives.end() - 1; i++) {
110 for (std::vector<RORoute*>::iterator j = i + 1; j != alternatives.end(); j++) {
139 return (pdr * (pdr + pds) *
gawronG(
myA, x)) /
146 if (((1.0 - (x * x)) == 0)) {
149 return (
SUMOReal) exp((a * x) / (1.0 - (x * x)));
157 : myBeta(beta), myGamma(gamma), myTheta(theta) {}
175 for (std::vector<RORoute*>::const_iterator i = alternatives.begin(); i != alternatives.end(); i++) {
178 const std::vector<const ROEdge*>& edgesR = pR->
getEdgeVector();
179 for (std::vector<const ROEdge*>::const_iterator edge = edgesR.begin(); edge != edgesR.end(); ++edge) {
181 lengthR += (*edge)->getTravelTime(veh,
STEPS2TIME(time));
184 for (std::vector<RORoute*>::const_iterator j = alternatives.begin(); j != alternatives.end(); j++) {
188 const std::vector<const ROEdge*>& edgesS = pS->
getEdgeVector();
189 for (std::vector<const ROEdge*>::const_iterator edge = edgesS.begin(); edge != edgesS.end(); ++edge) {
190 lengthS += (*edge)->getTravelTime(veh,
STEPS2TIME(time));
191 if (std::find(edgesR.begin(), edgesR.end(), *edge) != edgesR.end()) {
192 overlapLength += (*edge)->getTravelTime(veh,
STEPS2TIME(time));
195 overlapSum += pow(overlapLength / sqrt(lengthR * lengthS),
myGamma);
200 for (std::vector<RORoute*>::iterator i = alternatives.begin(); i != alternatives.end(); i++) {
203 for (std::vector<RORoute*>::iterator j = alternatives.begin(); j != alternatives.end(); j++) {
215 for (std::vector<RORoute*>::const_iterator i = alternatives.begin(); i != alternatives.end(); i++) {
216 const SUMOReal cost = (*i)->getCosts() / 3600.;
231 for (std::vector<RORoute*>::const_iterator i = alternatives.begin(); i != alternatives.end(); i++) {
232 const SUMOReal cost = (*i)->getCosts() / 3600.;
239 for (std::vector<RORoute*>::const_iterator i = alternatives.begin(); i != alternatives.end(); i++) {
240 diff += pow((*i)->getCosts() / 3600. - meanCost, 2);
242 const SUMOReal cvCost = sqrt(diff /
SUMOReal(alternatives.size())) / meanCost;
245 return M_PI / (sqrt(6.) * cvCost * (min + 1.1)) / 3600.;
SUMOReal getCosts() const
Returns the costs of the route.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const SUMOReal myA
gawron a - value
const SUMOReal myBeta
logit beta - value
void setProbability(SUMOReal prob)
Sets the probability of the route.
SUMOReal getFloat(const std::string &name) const
Returns the SUMOReal-value of the named option (only for Option_Float)
static OptionsCont & getOptions()
Retrieves the options.
Abstract base class providing static factory method.
bool myKeepRoutes
Information whether all routes should be saved.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
SUMOReal gawronG(const SUMOReal a, const SUMOReal x) const
Performs the gawron - g() function From "Dynamic User Equilibria...".
A vehicle as used by router.
virtual ~ROCostCalculator()
Destructor.
ROCostCalculator()
Constructor.
void setCosts(RORoute *route, const SUMOReal costs, const bool isActive=false) const
void calculateProbabilities(std::vector< RORoute * > alternatives, const ROVehicle *const veh, const SUMOTime time)
calculate the probabilities
bool mySkipRouteCalculation
Information whether new routes should be calculated.
SUMOReal getProbability() const
Returns the probability the driver will take this route with.
void setCosts(SUMOReal costs)
Sets the costs of the route.
virtual ~ROGawronCalculator()
Destructor.
SUMOReal gawronF(const SUMOReal pdr, const SUMOReal pds, const SUMOReal x) const
Performs the gawron - f() function From "Dynamic User Equilibria...".
ROGawronCalculator(const SUMOReal beta, const SUMOReal a)
Constructor.
unsigned int myMaxRouteNumber
The maximum route alternatives number.
const SUMOReal myGamma
logit gamma - value
void calculateProbabilities(std::vector< RORoute * > alternatives, const ROVehicle *const veh, const SUMOTime time)
calculate the probabilities in the logit model
const std::vector< const ROEdge * > & getEdgeVector() const
Returns the list of edges this route consists of.
ROLogitCalculator(const SUMOReal beta, const SUMOReal gamma, const SUMOReal theta)
Constructor.
Cost calculation with c-logit or logit method.
A storage for options typed value containers)
Cost calculation with Gawron's method.
const SUMOReal myTheta
logit theta - value
SUMOReal getBetaForCLogit(const std::vector< RORoute * > alternatives) const
calculate the scaling factor in the logit model
static ROCostCalculator & getCalculator()
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
std::map< const RORoute *, SUMOReal > myCommonalities
The route commonality factors for c-logit.
static ROCostCalculator * myInstance
const SUMOReal myBeta
gawron beta - value
virtual ~ROLogitCalculator()
Destructor.
A complete router's route.
SUMOReal getThetaForCLogit(const std::vector< RORoute * > alternatives) const
calculate the scaling factor in the logit model
void setCosts(RORoute *route, const SUMOReal costs, const bool isActive=false) const