Skip to content

Commit

Permalink
Fix cost bug
Browse files Browse the repository at this point in the history
Remove the definition and using of CF_Modified_Cost
  • Loading branch information
becarie committed Mar 14, 2023
1 parent cf824d4 commit c40b68a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,11 @@ _deps
# End of https://www.gitignore.io/api/c++,cmake

.vscode
build
build
src/Graph/Algorithms/SymuMaster.log
src/Graph/Model/SymuMaster.log
.idea/inspectionProfiles/profiles_settings.xml
.idea/misc.xml
.idea/modules.xml
.idea/symucore.iml
.idea/vcs.xml
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/Graph/Algorithms/Dijkstra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,19 +484,19 @@ Cost Dijkstra::GetTotalPatternCost(int iSimulationInstance, Pattern* pPattern, d
{
// Special case of null cost patterns (touching areas with null area costs used by SymuVia for example),
// we use directly the percentage as the penalized cost to avoid infinite loops when computing k-shortest paths
resCost.setCostValue(CF_Modified_Cost, penalysingFactor);
resCost.setCostValue(CF_TravelTime, penalysingFactor);
}
else
{
resCost.setCostValue(CF_Modified_Cost, pCost->getCostValue() * (1 + penalysingFactor));
resCost.setCostValue(CF_TravelTime, pCost->getCostValue() * (1 + penalysingFactor));
}
}
resCost.setUsedCostFunction(CF_Modified_Cost);
resCost.setUsedCostFunction(CF_TravelTime);

// if euclidian heuristic, add the functional class related term :
if (m_eHeuristic == SPH_EUCLIDIAN)
{
resCost.setCostValue(CF_Modified_Cost, resCost.getCostValue() + pCost->getCostValue() * m_dbAStarBeta * pPattern->getFuncClass());
resCost.setCostValue(CF_TravelTime, resCost.getCostValue() + pCost->getCostValue() * m_dbAStarBeta * pPattern->getFuncClass());
}

return resCost;
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/SymuCoreConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace SymuCore {
enum CostFunction //define each possible cost function here
{
CF_Undefined = 0,
CF_Modified_Cost,
//CF_Modified_Cost,
CF_Total_Cost_Sum,
CF_DriveTime,
CF_PassiveRideTime,
Expand Down

0 comments on commit c40b68a

Please sign in to comment.