Skip to content

Commit

Permalink
adding new router option. refs #14653
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed Apr 3, 2024
1 parent cc30054 commit e9b4970
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/activitygen/activitygen_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ loadNet(RONet& toFill, ROAbstractEdgeBuilder& eb) {
throw ProcessError(TLF("The network file '%' could not be accessed.", file));
}
PROGRESS_BEGIN_MESSAGE(TL("Loading net"));
RONetHandler handler(toFill, eb, true, 0);
RONetHandler handler(toFill, eb, true, 0, 0);
handler.setFileName(file);
if (!XMLSubSys::runParser(handler, file, true)) {
PROGRESS_FAILED_MESSAGE();
Expand Down
3 changes: 3 additions & 0 deletions src/router/ROFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ ROFrame::fillOptions(OptionsCont& oc, const bool isDUA, const bool isMA) {
oc.doRegister("weights.minor-penalty", new Option_Float(1.5));
oc.addDescription("weights.minor-penalty", "Processing", TL("Apply the given time penalty when computing routing costs for minor-link internal lanes"));

oc.doRegister("weights.tls-penalty", new Option_Float(0));
oc.addDescription("weights.tls-penalty", "Processing", TL("Apply the given time penalty when computing routing costs across a traffic light"));

if (!isMA) {
// register defaults options
oc.doRegister("departlane", new Option_String());
Expand Down
3 changes: 2 additions & 1 deletion src/router/ROLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ ROLoader::loadNet(RONet& toFill, ROAbstractEdgeBuilder& eb) {
}
PROGRESS_BEGIN_MESSAGE(TL("Loading net"));
RONetHandler handler(toFill, eb, !myOptions.exists("no-internal-links") || myOptions.getBool("no-internal-links"),
myOptions.exists("weights.minor-penalty") ? myOptions.getFloat("weights.minor-penalty") : 0);
myOptions.exists("weights.minor-penalty") ? myOptions.getFloat("weights.minor-penalty") : 0,
myOptions.exists("weights.tls-penalty") ? myOptions.getFloat("weights.tls-penalty") : 0);
handler.setFileName(file);
if (!XMLSubSys::runParser(handler, file, true)) {
PROGRESS_FAILED_MESSAGE();
Expand Down
5 changes: 3 additions & 2 deletions src/router/RONetHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@
// ===========================================================================
// method definitions
// ===========================================================================
RONetHandler::RONetHandler(RONet& net, ROAbstractEdgeBuilder& eb, const bool ignoreInternal, const double minorPenalty) :
RONetHandler::RONetHandler(RONet& net, ROAbstractEdgeBuilder& eb, const bool ignoreInternal, const double minorPenalty, double tlsPenalty) :
SUMOSAXHandler("sumo-network"),
myNet(net),
myNetworkVersion(0, 0),
myEdgeBuilder(eb), myIgnoreInternal(ignoreInternal),
myCurrentName(), myCurrentEdge(nullptr), myCurrentStoppingPlace(nullptr),
myMinorPenalty(minorPenalty)
myMinorPenalty(minorPenalty),
myTLSPenalty(tlsPenalty)
{}


Expand Down
3 changes: 2 additions & 1 deletion src/router/RONetHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class RONetHandler : public SUMOSAXHandler {
* @param[in] net The network instance to fill
* @param[in] eb The abstract edge builder to use
*/
RONetHandler(RONet& net, ROAbstractEdgeBuilder& eb, const bool ignoreInternal, const double minorPenalty);
RONetHandler(RONet& net, ROAbstractEdgeBuilder& eb, const bool ignoreInternal, const double minorPenalty, double tlsPenalty);


/// @brief Destructor
Expand Down Expand Up @@ -212,6 +212,7 @@ class RONetHandler : public SUMOSAXHandler {

/// @brief time penalty for passing a minor link
const double myMinorPenalty;
const double myTLSPenalty;

/// @brief temporary storage for bidi attributes (to be resolved after loading all edges)
std::map<ROEdge*, std::string> myBidiEdges;
Expand Down

0 comments on commit e9b4970

Please sign in to comment.