diff --git a/Makefile b/Makefile index 74f1ee4a..1a125e5f 100644 --- a/Makefile +++ b/Makefile @@ -249,15 +249,15 @@ eval-opt: $p/berlin-initial-$V-25pct.experienced_plans.xml.gz --output $p/berlin-$V-25pct.plans_$(ERROR_METRIC).xml.gz $(sc) run --mode "routeChoice" --iterations 20 --all-car --output "output/eval-$(ERROR_METRIC)" --25pct --population "berlin-$V-25pct.plans_$(ERROR_METRIC).xml.gz"\ - --config $p/berlin-$V-base-calib.config.xml + --config $p/berlin-$V.config.xml # TODO: these needs to be renamed to plans-initial, because they are uncalibrated at this stage # These depend on the output of optimization runs -$p/berlin-$V-25pct.plans.xml.gz: $p/berlin-$V-facilities.xml.gz $p/berlin-$V-network.xml.gz $p/berlin-goodsTraffic-$V-25pct.plans.xml.gz $p/berlin-longHaulFreight-$V-25pct.plans.xml.gz +$p/berlin-$V-25pct.plans.xml.gz: $p/berlin-$V-facilities.xml.gz $p/berlin-$V-network.xml.gz $p/berlin-longHaulFreight-$V-25pct.plans.xml.gz $(sc) prepare filter-relevant-agents\ --input $p/berlin-$V-25pct.plans_log_error.xml.gz --output $@\ - --shp input/v6.0/area/area.shp\ + --shp input/$V/area/area.shp\ --facilities $<\ --network $(word 2,$^) @@ -271,7 +271,7 @@ $p/berlin-$V-25pct.plans.xml.gz: $p/berlin-$V-facilities.xml.gz $p/berlin-$V-net $(sc) prepare fix-subtour-modes --input $@ --output $@ --coord-dist 100 - $(sc) prepare merge-populations $@ $(word 3,$^) $(word 4,$^)\ + $(sc) prepare merge-populations $@ $(word 3,$^)\ --output $@ $(sc) prepare downsample-population $@\ diff --git a/src/main/java/org/matsim/prepare/opt/RunCountOptimization.java b/src/main/java/org/matsim/prepare/opt/RunCountOptimization.java index 59d59976..1fbce56f 100644 --- a/src/main/java/org/matsim/prepare/opt/RunCountOptimization.java +++ b/src/main/java/org/matsim/prepare/opt/RunCountOptimization.java @@ -178,15 +178,24 @@ private List processPopulation(Path input, Network network, Counts new IllegalStateException("No travel time for leg")); + double freeTravelTime = route.getLinkIds().stream() + .map(id -> network.getLinks().get(id)) + // Use ceil because traversal over links is always whole seconds during simulation + .mapToDouble(l -> Math.ceil(l.getLength() / l.getFreespeed())) + .sum(); + boolean relevant = route.getLinkIds().stream().anyMatch(links::contains); + // The actual travel time per link is not known + // The overall deviation is applied to all links equally + double factor = travelTime / freeTravelTime; + double time = leg.getDepartureTime().seconds(); if (relevant) { @@ -196,7 +205,7 @@ private List processPopulation(Path input, Network network, Counts