Skip to content

Commit

Permalink
Merge pull request #3577 from matsim-org/developToolForFreightGeneration
Browse files Browse the repository at this point in the history
Develop tool for freight generation
  • Loading branch information
rewertvsp authored Nov 22, 2024
2 parents d16f858 + e5e1bfe commit a0cb977
Show file tree
Hide file tree
Showing 6 changed files with 414 additions and 169 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package org.matsim.freightDemandGeneration;

import org.matsim.api.core.v01.Scenario;

public class DefaultJobDurationCalculator implements JobDurationCalculator {
@Override
public double calculateServiceDuration(Integer serviceTimePerUnit, int demandForThisService) {
return getDefaultCalculation(serviceTimePerUnit, demandForThisService);
}

@Override
public double calculatePickupDuration(Integer pickupDurationPerUnit, int demandForThisShipment) {
return getDefaultCalculation(pickupDurationPerUnit, demandForThisShipment);
}

@Override
public double calculateDeliveryDuration(Integer deliveryDurationPerUnit, int demandForThisShipment) {
return getDefaultCalculation(deliveryDurationPerUnit, demandForThisShipment);
}

@Override
public void recalculateJobDurations(Scenario scenario) {
// do nothing
}

/**
* @param timePerUnit time per unit
* @param demandForThisService demand for this service
* @return default calculation
*/
private int getDefaultCalculation(int timePerUnit, int demandForThisService) {
if (demandForThisService == 0)
return timePerUnit;
else
return timePerUnit * demandForThisService;
}
}
Loading

0 comments on commit a0cb977

Please sign in to comment.