Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into ana2
Browse files Browse the repository at this point in the history
# Conflicts:
#	contribs/application/src/main/java/org/matsim/freightDemandGeneration/DemandReaderFromCSV.java
  • Loading branch information
rewertvsp committed Jan 15, 2025
2 parents 01ecf5b + 4e7baf4 commit 2a45de0
Show file tree
Hide file tree
Showing 60 changed files with 1,445 additions and 460 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -689,9 +689,9 @@ else if (samplingOption.equals("changeNumberOfLocationsWithDemand")) {
Id<CarrierService> idNewService = Id.create(
createJobId(scenario, newDemandInformationElement, linkPersonPair.getLink().getId(), null),
CarrierService.class);
CarrierService thisService = CarrierService.Builder.newInstance(idNewService, linkPersonPair.getLink().getId())
.setDemand(demandForThisLink).setServiceDuration(serviceTime)
.setServiceStartTimeWindow(newDemandInformationElement.getFirstJobElementTimeWindow())
CarrierService .Builder builder = CarrierService.Builder.newInstance(idNewService, linkPersonPair.getLink().getId())
.setCapacityDemand(demandForThisLink).setServiceDuration(serviceTime);
CarrierService thisService = builder.setServiceStartingTimeWindow(newDemandInformationElement.getFirstJobElementTimeWindow())
.build();
CarriersUtils.getCarriers(scenario).getCarriers()
.get(Id.create(newDemandInformationElement.getCarrierName(), Carrier.class)).getServices()
Expand Down Expand Up @@ -730,9 +730,9 @@ else if (samplingOption.equals("changeNumberOfLocationsWithDemand")) {
createJobId(scenario, newDemandInformationElement, link.getId(), null),
CarrierService.class);
if (demandToDistribute > 0 && singleDemandForThisLink > 0) {
CarrierService thisService = CarrierService.Builder.newInstance(idNewService, link.getId())
.setDemand(singleDemandForThisLink).setServiceDuration(serviceTime)
.setServiceStartTimeWindow(newDemandInformationElement.getFirstJobElementTimeWindow())
CarrierService.Builder builder = CarrierService.Builder.newInstance(idNewService, link.getId())
.setCapacityDemand(singleDemandForThisLink).setServiceDuration(serviceTime);
CarrierService thisService = builder.setServiceStartingTimeWindow(newDemandInformationElement.getFirstJobElementTimeWindow())
.build();
thisCarrier.getServices().put(thisService.getId(), thisService);
}
Expand Down Expand Up @@ -781,9 +781,9 @@ else if (samplingOption.equals("changeNumberOfLocationsWithDemand")) {
Id<CarrierService> idNewService = Id.create(
createJobId(scenario, newDemandInformationElement, linkPersonPair.getLink().getId(), null), CarrierService.class);
if ((demandToDistribute > 0 && singleDemandForThisLink > 0) || demandToDistribute == 0) {
CarrierService thisService = CarrierService.Builder.newInstance(idNewService, linkPersonPair.getLink().getId())
.setDemand(singleDemandForThisLink).setServiceDuration(serviceTime)
.setServiceStartTimeWindow(newDemandInformationElement.getFirstJobElementTimeWindow())
CarrierService.Builder builder = CarrierService.Builder.newInstance(idNewService, linkPersonPair.getLink().getId())
.setCapacityDemand(singleDemandForThisLink).setServiceDuration(serviceTime);
CarrierService thisService = builder.setServiceStartingTimeWindow(newDemandInformationElement.getFirstJobElementTimeWindow())
.build();
CarriersUtils.getCarriers(scenario).getCarriers()
.get(Id.create(newDemandInformationElement.getCarrierName(), Carrier.class)).getServices()
Expand Down Expand Up @@ -1148,8 +1148,8 @@ private static void createSingleShipment(Scenario scenario, DemandInformationEle

CarrierShipment thisShipment = CarrierShipment.Builder
.newInstance(idNewShipment, linkPickup.getId(), linkDelivery.getId(), singleDemandForThisLink)
.setPickupDuration(serviceTimePickup).setPickupStartsTimeWindow(timeWindowPickup)
.setDeliveryDuration(serviceTimeDelivery).setDeliveryStartsTimeWindow(timeWindowDelivery)
.setPickupDuration(serviceTimePickup).setPickupStartingTimeWindow(timeWindowPickup)
.setDeliveryDuration(serviceTimeDelivery).setDeliveryStartingTimeWindow(timeWindowDelivery)
.build();
thisCarrier.getShipments().put(thisShipment.getId(), thisShipment);
if (demandForThisLink == 0)
Expand Down Expand Up @@ -1239,8 +1239,8 @@ private static void combineSimilarJobs(Scenario scenario) {
if (baseShipment.getId() != thisShipment.getId()
&& baseShipment.getPickupLinkId() == thisShipment.getPickupLinkId()
&& baseShipment.getDeliveryLinkId() == thisShipment.getDeliveryLinkId()) {
if (baseShipment.getPickupStartsTimeWindow() == thisShipment.getPickupStartsTimeWindow()) {
if (baseShipment.getDeliveryStartsTimeWindow() == thisShipment.getDeliveryStartsTimeWindow()) shipmentsToConnect.put(thisShipmentId, thisShipment);
if (baseShipment.getPickupStartingTimeWindow() == thisShipment.getPickupStartingTimeWindow()) {
if (baseShipment.getDeliveryStartingTimeWindow() == thisShipment.getDeliveryStartingTimeWindow()) shipmentsToConnect.put(thisShipmentId, thisShipment);
}
}
}
Expand All @@ -1250,17 +1250,17 @@ private static void combineSimilarJobs(Scenario scenario) {
double serviceTimePickup = 0;
double serviceTimeDelivery = 0;
for (CarrierShipment carrierShipment : shipmentsToConnect.values()) {
demandForThisLink = demandForThisLink + carrierShipment.getDemand();
demandForThisLink = demandForThisLink + carrierShipment.getCapacityDemand();
serviceTimePickup = serviceTimePickup + carrierShipment.getPickupDuration();
serviceTimeDelivery = serviceTimeDelivery + carrierShipment.getDeliveryDuration();
shipmentsToRemove.put(carrierShipment.getId(), carrierShipment);
}
CarrierShipment newShipment = CarrierShipment.Builder
.newInstance(idNewShipment, baseShipment.getPickupLinkId(), baseShipment.getDeliveryLinkId(), demandForThisLink)
.setPickupDuration(serviceTimePickup)
.setPickupStartsTimeWindow(baseShipment.getPickupStartsTimeWindow())
.setPickupStartingTimeWindow(baseShipment.getPickupStartingTimeWindow())
.setDeliveryDuration(serviceTimeDelivery)
.setDeliveryStartsTimeWindow(baseShipment.getDeliveryStartsTimeWindow()).build();
.setDeliveryStartingTimeWindow(baseShipment.getDeliveryStartingTimeWindow()).build();
shipmentsToAdd.add(newShipment);
}
}
Expand All @@ -1287,23 +1287,23 @@ private static void combineSimilarJobs(Scenario scenario) {
CarrierService thisService = thisCarrier.getServices().get(thisServiceId);
if (baseService.getId() != thisService.getId()
&& baseService.getServiceLinkId() == thisService.getServiceLinkId() && baseService
.getServiceStartTimeWindow() == thisService.getServiceStartTimeWindow())
.getServiceStaringTimeWindow() == thisService.getServiceStaringTimeWindow())
servicesToConnect.put(thisServiceId, thisService);
}
}
Id<CarrierService> idNewService = baseService.getId();
int demandForThisLink = 0;
double serviceTimeService = 0;
for (CarrierService carrierService : servicesToConnect.values()) {
demandForThisLink = demandForThisLink + carrierService.getDemand();
demandForThisLink = demandForThisLink + carrierService.getCapacityDemand();
serviceTimeService = serviceTimeService + carrierService.getServiceDuration();
servicesToRemove.put(carrierService.getId(), carrierService);
}
CarrierService newService = CarrierService.Builder
CarrierService.Builder builder = CarrierService.Builder
.newInstance(idNewService, baseService.getServiceLinkId())
.setServiceDuration(serviceTimeService)
.setServiceStartTimeWindow(baseService.getServiceStartTimeWindow())
.setDemand(demandForThisLink).build();
.setServiceDuration(serviceTimeService);
CarrierService newService = builder.setServiceStartingTimeWindow(baseService.getServiceStaringTimeWindow())
.setCapacityDemand(demandForThisLink).build();
servicesToAdd.add(newService);
}
}
Expand Down
Loading

0 comments on commit 2a45de0

Please sign in to comment.