Skip to content

Commit

Permalink
Merge remote-tracking branch 'matsim-org/java-21' into consolidateZon…
Browse files Browse the repository at this point in the history
…esTest
  • Loading branch information
nkuehnel committed Apr 30, 2024
2 parents 9eea4d5 + 3404094 commit 8bf0df2
Show file tree
Hide file tree
Showing 19 changed files with 501 additions and 436 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/code-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: 'zulu'
cache: 'maven'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: 'zulu'
cache: 'maven'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-on-pr-merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: 'zulu'
cache: 'maven'
server-id: 'matsim-releases'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-on-release-created.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: 'zulu'
cache: 'maven'
server-id: matsim-releases
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-weekly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: 'zulu'
cache: 'maven'
server-id: 'matsim-releases'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/full-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: 'zulu'
cache: 'maven'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/verify-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
if: ${{matrix.module != 'matsim' || steps.detect-changes.outputs.outside-contribs == 'true'}}
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: 'zulu'
cache: 'maven'

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,13 @@ public class GenerateSmallScaleCommercialTrafficDemand implements MATSimAppComma
// Option 3: Leerkamp (nur in RVR Modell).

private static final Logger log = LogManager.getLogger(GenerateSmallScaleCommercialTrafficDemand.class);
private static IntegrateExistingTrafficToSmallScaleCommercial integrateExistingTrafficToSmallScaleCommercial;

private enum CreationOption {
useExistingCarrierFileWithSolution, createNewCarrierFile, useExistingCarrierFileWithoutSolution
}

private enum SmallScaleCommercialTrafficType {
public enum SmallScaleCommercialTrafficType {
commercialPersonTraffic, goodsTraffic, completeSmallScaleCommercialTraffic
}

Expand Down Expand Up @@ -167,6 +168,15 @@ private enum SmallScaleCommercialTrafficType {

private Index indexZones;

public GenerateSmallScaleCommercialTrafficDemand() {
integrateExistingTrafficToSmallScaleCommercial = new DefaultIntegrateExistingTrafficToSmallScaleCommercialImpl();
log.info("Using default {} if existing models are integrated!", DefaultIntegrateExistingTrafficToSmallScaleCommercialImpl.class.getSimpleName());
}
public GenerateSmallScaleCommercialTrafficDemand(IntegrateExistingTrafficToSmallScaleCommercial integrateExistingTrafficToSmallScaleCommercial) {
GenerateSmallScaleCommercialTrafficDemand.integrateExistingTrafficToSmallScaleCommercial = integrateExistingTrafficToSmallScaleCommercial;
log.info("Using {} if existing models are integrated!", integrateExistingTrafficToSmallScaleCommercial.getClass().getSimpleName());
}

public static void main(String[] args) {
System.exit(new CommandLine(new GenerateSmallScaleCommercialTrafficDemand()).execute(args));
}
Expand Down Expand Up @@ -443,8 +453,8 @@ else if (smallScaleCommercialTrafficType.equals("commercialPersonTraffic"))
.createTrafficVolume_stop(resultingDataPerZone, output, sample, modesORvehTypes, smallScaleCommercialTrafficType);

if (includeExistingModels) {
SmallScaleCommercialTrafficUtils.readExistingModels(scenario, sample, linksPerZone);
TrafficVolumeGeneration.reduceDemandBasedOnExistingCarriers(scenario, linksPerZone, smallScaleCommercialTrafficType,
integrateExistingTrafficToSmallScaleCommercial.readExistingCarriersFromFolder(scenario, sample, linksPerZone);
integrateExistingTrafficToSmallScaleCommercial.reduceDemandBasedOnExistingCarriers(scenario, linksPerZone, smallScaleCommercialTrafficType,
trafficVolumePerTypeAndZone_start, trafficVolumePerTypeAndZone_stop);
}
final TripDistributionMatrix odMatrix = createTripDistribution(trafficVolumePerTypeAndZone_start,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.matsim.smallScaleCommercialTrafficGeneration;

import it.unimi.dsi.fastutil.objects.Object2DoubleMap;
import org.matsim.api.core.v01.Id;
import org.matsim.api.core.v01.Scenario;
import org.matsim.api.core.v01.network.Link;

import java.util.Map;

public interface IntegrateExistingTrafficToSmallScaleCommercial {

void readExistingCarriersFromFolder(Scenario scenario, double sampleScenario,
Map<String, Map<Id<Link>, Link>> linksPerZone) throws Exception;

void reduceDemandBasedOnExistingCarriers(Scenario scenario,
Map<String, Map<Id<Link>, Link>> linksPerZone, String smallScaleCommercialTrafficType,
Map<TrafficVolumeGeneration.TrafficVolumeKey, Object2DoubleMap<Integer>> trafficVolumePerTypeAndZone_start,
Map<TrafficVolumeGeneration.TrafficVolumeKey, Object2DoubleMap<Integer>> trafficVolumePerTypeAndZone_stop);
}
Loading

0 comments on commit 8bf0df2

Please sign in to comment.