40 #ifdef CHECK_MEMORY_LEAKS
42 #endif // CHECK_MEMORY_LEAKS
45 #ifdef DEBUG_VEHICLE_GUI_SELECTION
57 #define LOOK_FORWARD_SPEED_DIVIDER 14.
59 #define LOOK_FORWARD_FAR 15.
60 #define LOOK_FORWARD_NEAR 5.
65 #define JAM_FACTOR2 1.
73 myChangeProbability(0),
74 myLeadingBlockerLength(0), myLeftSpace(0) {}
84 const std::pair<MSVehicle*, SUMOReal>& leader,
85 const std::pair<MSVehicle*, SUMOReal>& neighLead,
86 const std::pair<MSVehicle*, SUMOReal>& neighFollow,
88 const std::vector<MSVehicle::LaneQ>& preb,
90 #ifdef DEBUG_VEHICLE_GUI_SELECTION
96 int bestLaneOffset = 0;
102 for (
int p = 0; p < (
int) preb.size(); ++p) {
106 currentDist = curr.
length;
108 neighDist = preb[p - 1].length;
109 neighExtDist = preb[p - 1].lane->getLength();
110 best = preb[p + bestLaneOffset];
118 if (leader.first != 0
135 if ((*lastBlocked) != 0) {
171 if (neighLead.second > 0 && neighLead.second > leader.second) {
177 if (neighLead.first != 0 && (neighLead.first->getLaneChangeModel().getOwnState()&
LCA_LEFT) != 0) {
195 SUMOReal maxJam =
MAX2(preb[currIdx - 1].occupation, preb[currIdx].occupation);
208 if (currExtDist > neighExtDist && (neighLeftPlace * 2. < rv)) {
224 (
currentDistAllows(neighDist, bestLaneOffset, rv) || neighDist >= currentDist)) {
244 if (neighLead.first == 0) {
250 if (leader.first == 0) {
259 if (thisLaneVSafe - neighLaneVSafe > 5. / 3.6) {
272 if (neighLaneVSafe >= vmax) {
303 const std::pair<MSVehicle*, SUMOReal>& leader,
304 const std::pair<MSVehicle*, SUMOReal>& neighLead,
305 const std::pair<MSVehicle*, SUMOReal>& neighFollow,
307 const std::vector<MSVehicle::LaneQ>& preb,
309 #ifdef DEBUG_VEHICLE_GUI_SELECTION
315 int bestLaneOffset = 0;
321 for (
int p = 0; p < (
int) preb.size(); ++p) {
325 currentDist = curr.
length;
327 neighDist = preb[p + 1].length;
328 neighExtDist = preb[p + 1].lane->getLength();
329 best = preb[p + bestLaneOffset];
337 if (leader.first != 0
354 if ((*lastBlocked) != 0) {
390 if (neighLead.second > 0 && neighLead.second > leader.second) {
396 if (neighLead.first != 0 && (neighLead.first->getLaneChangeModel().getOwnState()&
LCA_RIGHT) != 0) {
414 SUMOReal maxJam =
MAX2(preb[currIdx + 1].occupation, preb[currIdx].occupation);
427 if (currExtDist > neighExtDist && (neighLeftPlace * 2. < lv)) {
452 (
currentDistAllows(neighDist, bestLaneOffset, lv) || neighDist >= currentDist)) {
470 if (neighLead.first == 0) {
476 if (leader.first == 0) {
484 if (thisLaneVSafe > neighLaneVSafe) {
511 #ifdef DEBUG_VEHICLE_GUI_SELECTION
530 return MAX2(min, safe);
544 for (std::vector<SUMOReal>::const_iterator i =
myVSafes.begin(); i !=
myVSafes.end(); ++i) {
546 if (v >= min && v <= max) {
547 nVSafe =
MIN2(v, nVSafe);
562 return (min + wanted) / (
SUMOReal) 2.0;
565 return (max + wanted) / (
SUMOReal) 2.0;
567 return (min + wanted) / (
SUMOReal) 2.0;
578 return (min + wanted) / (
SUMOReal) 2.0;
591 return (max + wanted) / (
SUMOReal) 2.0;
597 return (min + wanted) / (
SUMOReal) 2.0;
629 const std::pair<MSVehicle*, SUMOReal>& neighLead,
630 const std::pair<MSVehicle*, SUMOReal>& neighFollow) {
632 assert(neighFollow.first != 0);
647 if (neighLead.first != 0 && neighLead.second > 0) {