36 template<
class R,
class E,
class V>
45 void setCosts(R* route,
const double costs,
const bool isActive =
false)
const {
47 route->setCosts(costs);
49 route->setCosts(
myBeta * costs + ((
double) 1.0 -
myBeta) * route->getCosts());
55 for (
typename std::vector<R*>::iterator i = alternatives.begin(); i != alternatives.end() - 1; i++) {
57 for (
typename std::vector<R*>::iterator j = i + 1; j != alternatives.end(); j++) {
61 (pS->getCosts() - pR->getCosts()) /
62 (pS->getCosts() + pR->getCosts());
64 double newPR =
gawronF(pR->getProbability(), pS->getProbability(), delta);
65 double newPS = pR->getProbability() + pS->getProbability() - newPR;
66 if (std::isnan(newPR) || std::isnan(newPS)) {
67 newPR = pS->getCosts() > pR->getCosts()
69 newPS = pS->getCosts() > pR->getCosts()
72 newPR =
MIN2((
double)
MAX2(newPR, (
double) 0), (
double) 1);
73 newPS =
MIN2((
double)
MAX2(newPS, (
double) 0), (
double) 1);
74 pR->setProbability(newPR);
75 pS->setProbability(newPS);
83 double gawronF(
const double pdr,
const double pds,
const double x)
const {
85 return std::numeric_limits<double>::max();
93 double gawronG(
const double a,
const double x)
const {
94 if (((1.0 - (x * x)) == 0)) {
95 return std::numeric_limits<double>::max();
97 return (
double) exp((a * x) / (1.0 - (x * x)));
Cost calculation with Gawron's method.
GawronCalculator & operator=(const GawronCalculator &s)
invalidated assignment operator
virtual ~GawronCalculator()
Destructor.
GawronCalculator(const double beta, const double a)
Constructor.
const double myA
gawron a - value
void calculateProbabilities(std::vector< R * > alternatives, const V *const, const SUMOTime)
calculate the probabilities
void setCosts(R *route, const double costs, const bool isActive=false) const
double gawronF(const double pdr, const double pds, const double x) const
Performs the gawron - f() function From "Dynamic User Equilibria...".
double gawronG(const double a, const double x) const
Performs the gawron - g() function From "Dynamic User Equilibria...".
const double myBeta
gawron beta - value
Abstract base class providing static factory method.