42 #ifdef CHECK_MEMORY_LEAKS
44 #endif // CHECK_MEMORY_LEAKS
47 #ifdef DEBUG_VEHICLE_GUI_SELECTION
59 #define LOOK_FORWARD_SPEED_DIVIDER 14.
61 #define LOOK_FORWARD_FAR 15.
62 #define LOOK_FORWARD_NEAR 5.
67 #define JAM_FACTOR2 1.
75 myChangeProbability(0),
76 myLeadingBlockerLength(0), myLeftSpace(0) {}
86 const std::pair<MSVehicle*, SUMOReal>& leader,
87 const std::pair<MSVehicle*, SUMOReal>& neighLead,
88 const std::pair<MSVehicle*, SUMOReal>& neighFollow,
90 const std::vector<MSVehicle::LaneQ>& preb,
94 return (laneOffset == -1 ?
95 wantsChangeToRight(msgPass, blocked, leader, neighLead, neighFollow, neighLane, preb, lastBlocked, firstBlocked)
96 :
wantsChangeToLeft(msgPass, blocked, leader, neighLead, neighFollow, neighLane, preb, lastBlocked, firstBlocked));
104 const std::pair<MSVehicle*, SUMOReal>& leader,
105 const std::pair<MSVehicle*, SUMOReal>& neighLead,
106 const std::pair<MSVehicle*, SUMOReal>& neighFollow,
108 const std::vector<MSVehicle::LaneQ>& preb,
112 #ifdef DEBUG_VEHICLE_GUI_SELECTION
118 int bestLaneOffset = 0;
129 for (
int p = 0; p < (
int) preb.size(); ++p) {
130 if (preb[p].lane == prebLane && p > 0) {
133 currentDist = curr.
length;
135 neighDist = preb[p - 1].length;
136 neighExtDist = preb[p - 1].lane->getLength();
137 best = preb[p + bestLaneOffset];
146 if (leader.first != 0
163 if ((*lastBlocked) != 0) {
199 if (neighLead.second > 0 && neighLead.second > leader.second) {
205 if (neighLead.first != 0 && (neighLead.first->getLaneChangeModel().getOwnState()&
LCA_LEFT) != 0) {
223 SUMOReal maxJam =
MAX2(preb[currIdx - 1].occupation, preb[currIdx].occupation);
236 if (currExtDist > neighExtDist && (neighLeftPlace * 2. < rv)) {
252 (
currentDistAllows(neighDist, bestLaneOffset, rv) || neighDist >= currentDist)) {
272 if (neighLead.first == 0) {
278 if (leader.first == 0) {
287 if (thisLaneVSafe - neighLaneVSafe > 5. / 3.6) {
300 if (neighLaneVSafe >= vmax) {
316 const std::pair<MSVehicle*, SUMOReal>& leader,
317 const std::pair<MSVehicle*, SUMOReal>& neighLead,
318 const std::pair<MSVehicle*, SUMOReal>& neighFollow,
320 const std::vector<MSVehicle::LaneQ>& preb,
324 #ifdef DEBUG_VEHICLE_GUI_SELECTION
330 int bestLaneOffset = 0;
341 for (
int p = 0; p < (
int) preb.size(); ++p) {
342 if (preb[p].lane == prebLane) {
345 currentDist = curr.
length;
347 neighDist = preb[p + 1].length;
348 neighExtDist = preb[p + 1].lane->getLength();
349 best = preb[p + bestLaneOffset];
358 if (leader.first != 0
375 if ((*lastBlocked) != 0) {
411 if (neighLead.second > 0 && neighLead.second > leader.second) {
417 if (neighLead.first != 0 && (neighLead.first->getLaneChangeModel().getOwnState()&
LCA_RIGHT) != 0) {
435 SUMOReal maxJam =
MAX2(preb[currIdx + 1].occupation, preb[currIdx].occupation);
448 if (currExtDist > neighExtDist && (neighLeftPlace * 2. < lv)) {
473 (
currentDistAllows(neighDist, bestLaneOffset, lv) || neighDist >= currentDist)) {
491 if (neighLead.first == 0) {
497 if (leader.first == 0) {
505 if (thisLaneVSafe > neighLaneVSafe) {
525 #ifdef DEBUG_VEHICLE_GUI_SELECTION
543 return MAX2(min, safe);
557 for (std::vector<SUMOReal>::const_iterator i =
myVSafes.begin(); i !=
myVSafes.end(); ++i) {
559 if (v >= min && v <= max) {
560 nVSafe =
MIN2(v, nVSafe);
575 return (min + wanted) / (
SUMOReal) 2.0;
578 return (max + wanted) / (
SUMOReal) 2.0;
580 return (min + wanted) / (
SUMOReal) 2.0;
591 return (min + wanted) / (
SUMOReal) 2.0;
604 return (max + wanted) / (
SUMOReal) 2.0;
610 return (min + wanted) / (
SUMOReal) 2.0;
642 const std::pair<MSVehicle*, SUMOReal>& neighLead,
643 const std::pair<MSVehicle*, SUMOReal>& neighFollow) {
645 assert(neighFollow.first != 0);
660 if (neighLead.first != 0 && neighLead.second > 0) {