18 #ifndef GawronCalculator_h
19 #define GawronCalculator_h
38 template<
class R,
class E,
class V>
47 void setCosts(R* route,
const double costs,
const bool isActive =
false)
const {
49 route->setCosts(costs);
51 route->setCosts(
myBeta * costs + ((
double) 1.0 -
myBeta) * route->getCosts());
57 for (
typename std::vector<R*>::iterator i = alternatives.begin(); i != alternatives.end() - 1; i++) {
59 for (
typename std::vector<R*>::iterator j = i + 1; j != alternatives.end(); j++) {
63 (pS->getCosts() - pR->getCosts()) /
64 (pS->getCosts() + pR->getCosts());
66 double newPR =
gawronF(pR->getProbability(), pS->getProbability(), delta);
67 double newPS = pR->getProbability() + pS->getProbability() - newPR;
69 newPR = pS->getCosts() > pR->getCosts()
71 newPS = pS->getCosts() > pR->getCosts()
74 newPR =
MIN2((
double)
MAX2(newPR, (
double) 0), (
double) 1);
75 newPS =
MIN2((
double)
MAX2(newPS, (
double) 0), (
double) 1);
76 pR->setProbability(newPR);
77 pS->setProbability(newPS);
85 double gawronF(
const double pdr,
const double pds,
const double x)
const {
87 return std::numeric_limits<double>::max();
95 double gawronG(
const double a,
const double x)
const {
96 if (((1.0 - (x * x)) == 0)) {
97 return std::numeric_limits<double>::max();
99 return (
double) exp((a * x) / (1.0 - (x * x)));