Skip to content

Commit

Permalink
Merge branch 'main' of github.com:eclipse-sumo/sumo into Netedit_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Dec 20, 2024
2 parents 1968d6b + 653a78b commit 6a0cb31
Show file tree
Hide file tree
Showing 1,015 changed files with 9,185 additions and 6,437 deletions.
30 changes: 17 additions & 13 deletions .github/workflows/cibuildwheel.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
name: cibuildwheel

on:
push: # run on push events
paths-ignore: # but ignore everything in the docs subfolder
- 'docs/**'
- 'src/gui*/**'
- 'src/netedit/**'
- 'tests/netedit/**'
branches:
- '**'
tags:
- '*'
pull_request: # run on pull requests
paths-ignore: # but ignore everything in the docs subfolder
- 'docs/**'
# push: # run on push events
# paths-ignore: # but ignore everything in the docs subfolder
# - 'docs/**'
# - 'src/gui*/**'
# - 'src/netedit/**'
# - 'tests/netedit/**'
# branches:
# - '**'
# tags:
# - '*'
# pull_request: # run on pull requests
# paths-ignore: # but ignore everything in the docs subfolder
# - 'docs/**'
workflow_dispatch:
schedule:
- cron: '25 1 * * *'

jobs:
build-wheels:
Expand Down Expand Up @@ -60,6 +63,7 @@ jobs:
output-dir: wheelhouse
env:
CIBW_BEFORE_ALL_MACOS: brew update && brew install --cask xquartz && brew install xerces-c fox proj gdal gl2ps ccache googletest fmt swig eigen
CIBW_BUILD: cp3*
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9"
# CIBW_REPAIR_WHEEL_COMMAND_MACOS: "" # disable repair process to inspect the wheel
# CIBW_BUILD_VERBOSITY: 2
Expand Down
94 changes: 60 additions & 34 deletions src/netbuild/NBNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1394,7 +1394,7 @@ NBNode::computeLanes2Lanes() {
for (NBEdge* e : myIncomingEdges) {
const std::vector<NBEdge::Connection>& elv = e->getConnections();
for (std::vector<NBEdge::Connection>::const_iterator k = elv.begin(); k != elv.end(); ++k) {
std::cout << " " << e->getID() << "_" << (*k).fromLane << " -> " << (*k).toEdge->getID() << "_" << (*k).toLane << "\n";
std::cout << " " << e->getID() << "_" << (*k).fromLane << " -> " << Named::getIDSecure((*k).toEdge) << "_" << (*k).toLane << "\n";
}
}
}
Expand Down Expand Up @@ -1486,7 +1486,7 @@ NBNode::computeLanes2Lanes() {
for (NBEdge* e : myIncomingEdges) {
const std::vector<NBEdge::Connection>& elv = e->getConnections();
for (std::vector<NBEdge::Connection>::const_iterator k = elv.begin(); k != elv.end(); ++k) {
std::cout << " " << e->getID() << "_" << (*k).fromLane << " -> " << (*k).toEdge->getID() << "_" << (*k).toLane << "\n";
std::cout << " " << e->getID() << "_" << (*k).fromLane << " -> " << Named::getIDSecure((*k).toEdge) << "_" << (*k).toLane << "\n";
}
}
}
Expand Down Expand Up @@ -1520,40 +1520,28 @@ NBNode::recheckVClassConnections(NBEdge* currentOutgoing) {
}
#endif
int fromLane = 0;
// first attempt: try to use a dedicated fromLane
while (unsatisfied != 0 && fromLane < incoming->getNumLanes()) {
if (incoming->getPermissions(fromLane) == unsatisfied) {
unsatisfied = findToLaneForPermissions(currentOutgoing, fromLane, incoming, unsatisfied);
}
fromLane++;
}
// second attempt: try to re-use a fromLane that already connects to currentOutgoing
// (because we don't wont to create extra turn lanes)
fromLane = 0;
while (unsatisfied != 0 && fromLane < incoming->getNumLanes()) {
if ((incoming->getPermissions(fromLane) & unsatisfied) != 0
&& incoming->getConnectionsFromLane(fromLane, currentOutgoing, -1).size() > 0) {
unsatisfied = findToLaneForPermissions(currentOutgoing, fromLane, incoming, unsatisfied);
}
fromLane++;
}
// third attempt: use any possible fromLane
fromLane = 0;
while (unsatisfied != 0 && fromLane < incoming->getNumLanes()) {
if ((incoming->getPermissions(fromLane) & unsatisfied) != 0) {
for (int toLane = 0; toLane < currentOutgoing->getNumLanes(); ++toLane) {
const SVCPermissions satisfied = incoming->getPermissions(fromLane) & currentOutgoing->getPermissions(toLane) & unsatisfied;
if (satisfied != 0 && !incoming->getLaneStruct(fromLane).connectionsDone) {
if (incoming->hasConnectionTo(currentOutgoing, toLane)
&& unsatisfied == SVC_TRAM
&& incoming->getPermissions(fromLane) == currentOutgoing->getPermissions(toLane)) {
// avoid double tram connection by shifting an existing connection
for (auto con : incoming->getConnections()) {
if (con.toEdge == currentOutgoing && con.toLane == toLane) {
#ifdef DEBUG_CONNECTION_GUESSING
if (DEBUGCOND) {
std::cout << " shifting connection from=" << con.fromLane << " to=" << currentOutgoing->getID() << "_" << toLane << ": newFromLane=" << fromLane << " satisfies=" << getVehicleClassNames(satisfied) << "\n";
}
#endif
incoming->getConnectionRef(con.fromLane, con.toEdge, toLane).fromLane = fromLane;
unsatisfied &= ~satisfied;
break;
}
}
} else {
// other modes (i.e. bus) can fix lane permissions NBPTLineCont::fixPermissions but do not wish to create parallel tram tracks here
bool mayUseSameDestination = unsatisfied == SVC_TRAM || (unsatisfied & SVC_PASSENGER) != 0;
incoming->setConnection((int)fromLane, currentOutgoing, toLane, NBEdge::Lane2LaneInfoType::COMPUTED, mayUseSameDestination);
#ifdef DEBUG_CONNECTION_GUESSING
if (DEBUGCOND) {
std::cout << " new connection from=" << fromLane << " to=" << currentOutgoing->getID() << "_" << toLane << " satisfies=" << getVehicleClassNames(satisfied) << "\n";
}
#endif
unsatisfied &= ~satisfied;
}
}
}
unsatisfied = findToLaneForPermissions(currentOutgoing, fromLane, incoming, unsatisfied);
}
fromLane++;
}
Expand Down Expand Up @@ -1642,6 +1630,44 @@ NBNode::getReduction(const NBEdge* in, const NBEdge* out, int& inOffset, int& in
}


SVCPermissions
NBNode::findToLaneForPermissions(NBEdge* currentOutgoing, int fromLane, NBEdge* incoming, SVCPermissions unsatisfied) {
for (int toLane = 0; toLane < currentOutgoing->getNumLanes(); ++toLane) {
const SVCPermissions satisfied = incoming->getPermissions(fromLane) & currentOutgoing->getPermissions(toLane) & unsatisfied;
if (satisfied != 0 && !incoming->getLaneStruct(fromLane).connectionsDone) {
if (incoming->hasConnectionTo(currentOutgoing, toLane)
&& unsatisfied == SVC_TRAM
&& incoming->getPermissions(fromLane) == currentOutgoing->getPermissions(toLane)) {
// avoid double tram connection by shifting an existing connection
for (auto con : incoming->getConnections()) {
if (con.toEdge == currentOutgoing && con.toLane == toLane) {
#ifdef DEBUG_CONNECTION_GUESSING
if (DEBUGCOND) {
std::cout << " shifting connection from=" << con.fromLane << " to=" << currentOutgoing->getID() << "_" << toLane << ": newFromLane=" << fromLane << " satisfies=" << getVehicleClassNames(satisfied) << "\n";
}
#endif
incoming->getConnectionRef(con.fromLane, con.toEdge, toLane).fromLane = fromLane;
unsatisfied &= ~satisfied;
break;
}
}
} else {
// other modes (i.e. bus) can fix lane permissions NBPTLineCont::fixPermissions but do not wish to create parallel tram tracks here
bool mayUseSameDestination = unsatisfied == SVC_TRAM || (unsatisfied & SVC_PASSENGER) != 0;
incoming->setConnection((int)fromLane, currentOutgoing, toLane, NBEdge::Lane2LaneInfoType::COMPUTED, mayUseSameDestination);
#ifdef DEBUG_CONNECTION_GUESSING
if (DEBUGCOND) {
std::cout << " new connection from=" << fromLane << " to=" << currentOutgoing->getID() << "_" << toLane << " satisfies=" << getVehicleClassNames(satisfied) << "\n";
}
#endif
unsatisfied &= ~satisfied;
}
}
}
return unsatisfied;
}


int
NBNode::addedLanesRight(NBEdge* out, int addedLanes) const {
if (out->isOffRamp()) {
Expand Down
3 changes: 3 additions & 0 deletions src/netbuild/NBNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,9 @@ class NBNode : public Named, public Parameterised {
/// @brief get the reduction in driving lanes at this junction
void getReduction(const NBEdge* in, const NBEdge* out, int& inOffset, int& inEnd, int& outOffset, int& outEnd, int& reduction) const;

/// @brief helper function to add connections for unsatisfied modes
SVCPermissions findToLaneForPermissions(NBEdge* currentOutgoing, int fromLane, NBEdge* incoming, SVCPermissions unsatisfied);

/// @brief check whether this edge has extra lanes on the right side
int addedLanesRight(NBEdge* out, int addedLanes) const;

Expand Down
5 changes: 5 additions & 0 deletions src/netedit/frames/GNEOverlappedInspection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ GNEOverlappedInspection::clearOverlappedInspection() {
}


void
GNEOverlappedInspection::hiderOverlappedInspection() {
hide();
}

void
GNEOverlappedInspection::refreshOverlappedInspection() {
// show modul depending of number of overlapped elements
Expand Down
3 changes: 3 additions & 0 deletions src/netedit/frames/GNEOverlappedInspection.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ class GNEOverlappedInspection : public MFXGroupBoxModule {
/// @brief clear overlapped inspection
void clearOverlappedInspection();

/// @brief hide overlapped inspection
void hiderOverlappedInspection();

/// @brief check if overlappedInspection modul is shown
bool overlappedInspectionShown() const;

Expand Down
7 changes: 2 additions & 5 deletions src/netedit/frames/common/GNEInspectorFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ GNEInspectorFrame::refreshInspection() {
}
} else {
getFrameHeaderLabel()->setText(TL("Inspect"));
myOverlappedInspection->hiderOverlappedInspection();
}
// update frame width
setFrameWidth(myViewNet->getViewParent()->getFrameAreaWidth());
Expand Down Expand Up @@ -481,11 +482,7 @@ GNEInspectorFrame::onCmdInspectPreviousElement(FXObject*, FXSelector, void*) {

void
GNEInspectorFrame::updateFrameAfterUndoRedo() {
myAttributesEditor->refreshAttributesEditor();
myFlowAttributesEditor->refreshAttributesEditor();
myGEOAttributesEditor->refreshAttributesEditor();
myParametersEditor->refreshParametersEditor();
myHierarchicalElementTree->refreshHierarchicalElementTree();
refreshInspection();
}


Expand Down
14 changes: 11 additions & 3 deletions src/netload/NLBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,17 @@ NLBuilder::build() {
// routes from FCD files
MSDevice_FCDReplay::init();
// load routes
if (myOptions.isSet("route-files") && string2time(myOptions.getString("route-steps")) <= 0) {
if (!load("route-files")) {
return false;
if (myOptions.isSet("route-files")) {
if (string2time(myOptions.getString("route-steps")) <= 0) {
// incremental loading is disabled. Load route files fully
if (!load("route-files")) {
return false;
}
} else {
// message must come after additional-files have been loaded (but buildRouteLoaderControl was called earlier)
for (std::string file : myOptions.getStringVector("route-files")) {
WRITE_MESSAGE(TLF("Loading route-files incrementally from '%'", file));
}
}
}
// optionally switch off traffic lights
Expand Down
11 changes: 6 additions & 5 deletions tests/complex/sumo/b50/output.complex
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
Success.
Loading configuration ... done.
Loading net-file from 'net.net.xml' ... done (1ms).
Loading net-file from 'net.net.xml' ... done (4ms).
Loading route-files incrementally from 'input_routes.rou.xml'
Loading done.
Simulation version v1_21_0+1188-de3782bea46 started with time: 0.00.
Simulation version v1_21_0+1557-fb9ec070d59 started with time: 0.00.
Simulation ended at time: 8210.00.
Reason: All vehicles have left the simulation.
Performance:
Duration: 3.90s
Real time factor: 2106.21
UPS: 472379.425346
Duration: 7.22s
Real time factor: 1137.91
UPS: 255209.286209
Vehicles:
Inserted: 3000
Running: 0
Expand Down
59 changes: 32 additions & 27 deletions tests/complex/sumo/max_depart/output.complex
Original file line number Diff line number Diff line change
@@ -1,74 +1,79 @@
Loading configuration ... done.
Loading net-file from 'net.net.xml' ... done (2ms).
Loading additional-files from 'input_additional.add.xml' ... done (18ms).
Loading net-file from 'net.net.xml' ... done (1ms).
Loading additional-files from 'input_additional.add.xml' ... done (11ms).
Loading route-files incrementally from 'input_routes.rou.xml'
Loading done.
Simulation version v1_20_0+0782-2de3bc16e35 started with time: 0.00.
Simulation version v1_21_0+1557-fb9ec070d59 started with time: 0.00.
Simulation ended at time: 10000.00.
Reason: The final simulation step has been reached.
Performance:
Duration: 2.37s
Real time factor: 4226.54
UPS: 221632.290786
Duration: 0.99s
Real time factor: 10101
UPS: 529678.787879
Vehicles:
Inserted: 4411 (Loaded: 6000)
Running: 61
Waiting: 1589
Loading configuration ... done.
Loading net-file from 'net.net.xml' ... done (2ms).
Loading additional-files from 'input_additional.add.xml' ... done (16ms).
Loading net-file from 'net.net.xml' ... done (0ms).
Loading additional-files from 'input_additional.add.xml' ... done (6ms).
Loading route-files incrementally from 'input_routes.rou.xml'
Loading done.
Simulation version v1_20_0+0782-2de3bc16e35 started with time: 0.00.
Simulation version v1_21_0+1557-fb9ec070d59 started with time: 0.00.
Simulation ended at time: 10000.00.
Reason: The final simulation step has been reached.
Performance:
Duration: 2.39s
Real time factor: 4192.87
UPS: 335113.207547
Duration: 0.88s
Real time factor: 11389.5
UPS: 910301.822323
Vehicles:
Inserted: 4941 (Loaded: 6000)
Running: 97
Waiting: 1059
Loading configuration ... done.
Loading net-file from 'net.net.xml' ... done (1ms).
Loading additional-files from 'input_additional.add.xml' ... done (18ms).
Loading additional-files from 'input_additional.add.xml' ... done (5ms).
Loading route-files incrementally from 'input_routes.rou.xml'
Loading done.
Simulation version v1_20_0+0782-2de3bc16e35 started with time: 0.00.
Simulation version v1_21_0+1557-fb9ec070d59 started with time: 0.00.
Simulation ended at time: 10000.00.
Reason: The final simulation step has been reached.
Performance:
Duration: 2.56s
Real time factor: 3910.83
UPS: 336759.874853
Duration: 0.93s
Real time factor: 10799.1
UPS: 929908.207343
Vehicles:
Inserted: 4971 (Loaded: 6000)
Running: 101
Waiting: 1029
Loading configuration ... done.
Loading net-file from 'net.net.xml' ... done (0ms).
Loading additional-files from 'input_additional.add.xml' ... done (14ms).
Loading net-file from 'net.net.xml' ... done (1ms).
Loading additional-files from 'input_additional.add.xml' ... done (5ms).
Loading route-files incrementally from 'input_routes.rou.xml'
Loading done.
Simulation version v1_20_0+0782-2de3bc16e35 started with time: 0.00.
Simulation version v1_21_0+1557-fb9ec070d59 started with time: 0.00.
Simulation ended at time: 10000.00.
Reason: The final simulation step has been reached.
Performance:
Duration: 1.72s
Real time factor: 5830.9
UPS: 335330.612245
Duration: 0.85s
Real time factor: 11820.3
UPS: 679777.777778
Vehicles:
Inserted: 4481 (Loaded: 6000)
Running: 62
Waiting: 1519
Loading configuration ... done.
Loading net-file from 'net.net.xml' ... done (1ms).
Loading additional-files from 'input_additional.add.xml' ... done (9ms).
Loading route-files incrementally from 'input_routes.rou.xml'
Loading done.
Simulation version v1_20_0+0782-2de3bc16e35 started with time: 0.00.
Simulation version v1_21_0+1557-fb9ec070d59 started with time: 0.00.
Simulation ended at time: 10000.00.
Reason: The final simulation step has been reached.
Performance:
Duration: 1.42s
Real time factor: 7042.25
UPS: 433771.126761
Duration: 0.67s
Real time factor: 15037.6
UPS: 926248.120301
Vehicles:
Inserted: 4764 (Loaded: 6000)
Running: 70
Expand Down
Loading

0 comments on commit 6a0cb31

Please sign in to comment.