diff --git a/pom.xml b/pom.xml
index bd6f2ef0..5eb5caf9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,8 +14,9 @@
org.matsim
matsim-all
-
- 2025.0-2024w36
+ 2025.0-PR3443
+
+
diff --git a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/EventBasedCarrierScorer4MultipleChainsInclToll.java b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/EventBasedCarrierScorer4MultipleChainsInclToll.java
index 3b3c3712..2b95f38f 100644
--- a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/EventBasedCarrierScorer4MultipleChainsInclToll.java
+++ b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/EventBasedCarrierScorer4MultipleChainsInclToll.java
@@ -28,7 +28,6 @@
import org.matsim.api.core.v01.Id;
import org.matsim.api.core.v01.Scenario;
import org.matsim.api.core.v01.events.*;
-import org.matsim.api.core.v01.events.handler.PersonMoneyEventHandler;
import org.matsim.api.core.v01.network.Network;
import org.matsim.api.core.v01.population.Person;
import org.matsim.core.scoring.ScoringFunction;
@@ -37,12 +36,11 @@
import org.matsim.freight.carriers.Carrier;
import org.matsim.freight.carriers.Tour;
import org.matsim.freight.carriers.controler.CarrierScoringFunctionFactory;
-import org.matsim.freight.carriers.events.CarrierServiceEndEvent;
-import org.matsim.freight.carriers.events.CarrierServiceStartEvent;
import org.matsim.freight.carriers.events.CarrierTourEndEvent;
import org.matsim.freight.carriers.events.CarrierTourStartEvent;
import org.matsim.freight.logistics.analysis.Driver2VehicleEventHandler;
import org.matsim.freight.logistics.analysis.Vehicle2CarrierEventHandler;
+import org.matsim.vehicles.Vehicle;
import org.matsim.vehicles.VehicleType;
import org.matsim.vehicles.VehicleUtils;
@@ -60,8 +58,6 @@ public ScoringFunction createScoringFunction(Carrier carrier) {
this.carrierId = carrier.getId();
SumScoringFunction sf = new SumScoringFunction();
sf.addScoringFunction(new EventBasedScoring());
- sf.addScoringFunction(new FindOtherEventsForDebuggingOnly_NO_Scoring());
- sf.addScoringFunction(new TollMoneyScoringForDebuggingOnly_NO_Scoring());
return sf;
}
@@ -116,8 +112,7 @@ private void handleEvent(CarrierTourStartEvent event) {
private void handleEvent(CarrierTourEndEvent event) {
v2c.handleEvent(event);
// Fix costs for vehicle usage
- final VehicleType vehicleType =
- (VehicleUtils.findVehicle(event.getVehicleId(), scenario)).getType();
+ final VehicleType vehicleType = (VehicleUtils.findVehicle(event.getVehicleId(), scenario)).getType();
double tourDuration = event.getTime() - tourStartTime.get(event.getTourId());
@@ -147,84 +142,20 @@ private void handleEvent(PersonMoneyEvent event) {
double tollValue = 0;
if (event.getPurpose().equals("toll")) {
- if (carrierId.equals(v2c.getCarrierOfVehicle(d2v.getVehicleOfDriver(event.getPersonId())))) {
+ Id vehicleId = d2v.getVehicleOfDriver(event.getPersonId());
+ if (vehicleId != null) {
+ Id carrierIdOfVehicle = v2c.getCarrierOfVehicle(vehicleId);
+ if (carrierId.equals(carrierIdOfVehicle)) {
// toll a person only once.
- if (!tolledPersons.contains(event.getPersonId())) {
- log.info("Tolling caused by event: {}", event);
- tolledPersons.add(event.getPersonId());
- tollValue = event.getAmount();
+ if (!tolledPersons.contains(event.getPersonId())) {
+ log.info("Tolling caused by event: {}", event);
+ tolledPersons.add(event.getPersonId());
+ tollValue = event.getAmount();
+ }
}
+ score = score - tollValue;
}
}
- score = score - tollValue;
- }
- }
-
- /**
- * Versuche nur mit dem Debugger die PersonMoneyEvents zu entdecken, die eigentlich da sein sollten.
- */
- private class FindOtherEventsForDebuggingOnly_NO_Scoring implements ArbitraryEventScoring {
-
- final Logger log = LogManager.getLogger(FindOtherEventsForDebuggingOnly_NO_Scoring.class);
-
-
- public FindOtherEventsForDebuggingOnly_NO_Scoring() {
- super();
- }
-
- @Override
- public void finish() {}
-
- @Override
- public double getScore() {
- return Double.MIN_VALUE;
- }
-
- @Override
- public void handleEvent(Event event) {
- log.debug(event.toString());
-
- switch (event) {
- case CarrierTourStartEvent carrierTourStartEvent -> {}
-// case CarrierTourEndEvent carrierTourEndEvent -> {}
- case CarrierServiceStartEvent carrierServiceStartEvent -> {}
- case CarrierServiceEndEvent carrierServiceEndEvent -> {}
- case LinkEnterEvent linkEnterEvent ->{}
- case LinkLeaveEvent linkLeaveEvent ->{}
-// case PersonMoneyEvent personMoneyEvent -> handleEvent(personMoneyEvent);
- default -> {handleOtherEvent(event);}
- }
- }
-
- private void handleOtherEvent(Event event) {
- log.info("Found another event: {}", event.toString());
- }
-
- }
-
-
- /**
- * Versuche nur mit dem Debugger die Einträge aus den PersonMoneyEvents zu entdecken, die eigentlich da sein sollten.
- */
- private static class TollMoneyScoringForDebuggingOnly_NO_Scoring implements SumScoringFunction.MoneyScoring, PersonMoneyEventHandler {
-
- private double score = 0.0;
- @Override
- public void addMoney(double amount) {
- // TODO Auto-generated method stub
- }
-
- @Override
- public void finish() { }
-
- @Override
- public double getScore() {
- return this.score;
- }
-
- @Override
- public void handleEvent(PersonMoneyEvent event) {
- // Todo: implement
}
}
diff --git a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleTwoLspsGroceryDeliveryMultipleChainsWithToll.java b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleTwoLspsGroceryDeliveryMultipleChainsWithToll.java
index 7b1c9c1e..c9ca9550 100644
--- a/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleTwoLspsGroceryDeliveryMultipleChainsWithToll.java
+++ b/src/main/java/org/matsim/freight/logistics/examples/multipleChains/ExampleTwoLspsGroceryDeliveryMultipleChainsWithToll.java
@@ -103,14 +103,12 @@ public static void main(String[] args) {
log.info("Add LSP(s) to the scenario");
Collection lsps = new LinkedList<>();
lsps.add(createLspWithTwoChains(scenario, "Edeka", MultipleChainsUtils.createLSPShipmentsFromCarrierShipments(carrierEdeka), getDepotLinkFromVehicle(carrierEdeka), HUB_LINK_ID_NEUKOELLN, vehicleTypes, vehicleTypes, vehicleTypes));
- lsps.add(createLspWithTwoChains(scenario, "Kaufland", MultipleChainsUtils.createLSPShipmentsFromCarrierShipments(carrierKaufland), getDepotLinkFromVehicle(carrierKaufland), HUB_LINK_ID_NEUKOELLN, vehicleTypes, vehicleTypes, vehicleTypes));
- lsps.add(createLspWithDirectChain(scenario, "Edeka_DIRECT", MultipleChainsUtils.createLSPShipmentsFromCarrierShipments(carrierEdeka), getDepotLinkFromVehicle(carrierEdeka), vehicleTypes));
- lsps.add(createLspWithDirectChain(scenario, "Kaufland_DIRECT", MultipleChainsUtils.createLSPShipmentsFromCarrierShipments(carrierKaufland), getDepotLinkFromVehicle(carrierKaufland), vehicleTypes));
+// lsps.add(createLspWithTwoChains(scenario, "Kaufland", MultipleChainsUtils.createLSPShipmentsFromCarrierShipments(carrierKaufland), getDepotLinkFromVehicle(carrierKaufland), HUB_LINK_ID_NEUKOELLN, vehicleTypes, vehicleTypes, vehicleTypes));
+// lsps.add(createLspWithDirectChain(scenario, "Edeka_DIRECT", MultipleChainsUtils.createLSPShipmentsFromCarrierShipments(carrierEdeka), getDepotLinkFromVehicle(carrierEdeka), vehicleTypes));
+// lsps.add(createLspWithDirectChain(scenario, "Kaufland_DIRECT", MultipleChainsUtils.createLSPShipmentsFromCarrierShipments(carrierKaufland), getDepotLinkFromVehicle(carrierKaufland), vehicleTypes));
LSPUtils.addLSPs(scenario, new LSPs(lsps));
-
-
log.info("Prepare controler");
Controler controler = new Controler(scenario);
controler.addOverridingModule(
@@ -217,7 +215,7 @@ private static Config prepareConfig(String[] args) {
ConfigUtils.applyCommandline(config, args);
} else {
config.controller().setOutputDirectory(OUTPUT_DIRECTORY);
- config.controller().setLastIteration(1);
+ config.controller().setLastIteration(0);
}
config.network().setInputFile(