39 #ifdef CHECK_MEMORY_LEAKS
41 #endif // CHECK_MEMORY_LEAKS
44 #ifdef DEBUG_VEHICLE_GUI_SELECTION
56 #define LOOK_FORWARD_SPEED_DIVIDER 14.
58 #define LOOK_FORWARD_FAR 15.
59 #define LOOK_FORWARD_NEAR 5.
64 #define JAM_FACTOR2 1.
72 myChangeProbability(0),
73 myLeadingBlockerLength(0), myLeftSpace(0) {}
83 const std::pair<MSVehicle*, SUMOReal> &leader,
84 const std::pair<MSVehicle*, SUMOReal> &neighLead,
85 const std::pair<MSVehicle*, SUMOReal> &neighFollow,
87 const std::vector<MSVehicle::LaneQ> &preb,
89 #ifdef DEBUG_VEHICLE_GUI_SELECTION
95 int bestLaneOffset = 0;
101 for (
int p = 0; p < (
int) preb.size(); ++p) {
105 currentDist = curr.
length;
107 neighDist = preb[p - 1].length;
108 neighExtDist = preb[p - 1].lane->getLength();
109 best = preb[p + bestLaneOffset];
117 if (leader.first != 0
134 if ((*lastBlocked) != 0) {
138 if ((*lastBlocked)->getSpeed() < 0.1) {
168 if (neighLead.second > 0 && neighLead.second > leader.second) {
174 if (neighLead.first != 0 && (neighLead.first->getLaneChangeModel().getOwnState()&
LCA_LEFT) != 0) {
192 SUMOReal maxJam =
MAX2(preb[currIdx - 1].occupation, preb[currIdx].occupation);
205 if (currExtDist > neighExtDist && (neighLeftPlace * 2. < rv)) {
221 (
currentDistAllows(neighDist, bestLaneOffset, rv) || neighDist >= currentDist)) {
241 if (neighLead.first == 0) {
247 if (leader.first == 0) {
256 if (thisLaneVSafe - neighLaneVSafe > 5. / 3.6) {
269 if (neighLaneVSafe >= vmax) {
300 const std::pair<MSVehicle*, SUMOReal> &leader,
301 const std::pair<MSVehicle*, SUMOReal> &neighLead,
302 const std::pair<MSVehicle*, SUMOReal> &neighFollow,
304 const std::vector<MSVehicle::LaneQ> &preb,
306 #ifdef DEBUG_VEHICLE_GUI_SELECTION
312 int bestLaneOffset = 0;
318 for (
int p = 0; p < (
int) preb.size(); ++p) {
322 currentDist = curr.
length;
324 neighDist = preb[p + 1].length;
325 neighExtDist = preb[p + 1].lane->getLength();
326 best = preb[p + bestLaneOffset];
334 if (leader.first != 0
351 if ((*lastBlocked) != 0) {
355 if ((*lastBlocked)->getSpeed() < 0.1) {
387 if (neighLead.second > 0 && neighLead.second > leader.second) {
393 if (neighLead.first != 0 && (neighLead.first->getLaneChangeModel().getOwnState()&
LCA_RIGHT) != 0) {
411 SUMOReal maxJam =
MAX2(preb[currIdx + 1].occupation, preb[currIdx].occupation);
424 if (currExtDist > neighExtDist && (neighLeftPlace * 2. < lv)) {
449 (
currentDistAllows(neighDist, bestLaneOffset, lv) || neighDist >= currentDist)) {
467 if (neighLead.first == 0) {
473 if (leader.first == 0) {
481 if (thisLaneVSafe > neighLaneVSafe) {
508 #ifdef DEBUG_VEHICLE_GUI_SELECTION
527 return MAX2(min, safe);
541 for (std::vector<SUMOReal>::const_iterator i =
myVSafes.begin(); i !=
myVSafes.end(); ++i) {
543 if (v >= min && v <= max) {
544 nVSafe =
MIN2(v, nVSafe);
559 return (min + wanted) / (
SUMOReal) 2.0;
562 return (max + wanted) / (
SUMOReal) 2.0;
564 return (min + wanted) / (
SUMOReal) 2.0;
575 return (min + wanted) / (
SUMOReal) 2.0;
588 return (max + wanted) / (
SUMOReal) 2.0;
594 return (min + wanted) / (
SUMOReal) 2.0;
625 const std::pair<MSVehicle*, SUMOReal> &neighLead,
626 const std::pair<MSVehicle*, SUMOReal> &neighFollow) {
628 assert(neighFollow.first != 0);
643 if (neighLead.first != 0 && neighLead.second > 0) {