Skip to content

Commit

Permalink
Merge branch 'master' into freespeed-model
Browse files Browse the repository at this point in the history
# Conflicts:
#	contribs/sumo/src/test/java/org/matsim/contrib/sumo/SumoNetworkConverterTest.java
  • Loading branch information
rakow committed Jan 31, 2024
2 parents 29be703 + fa37f3d commit 5caaa88
Show file tree
Hide file tree
Showing 2,672 changed files with 104,275 additions and 63,183 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ updates:
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
groups:
github-actions:
patterns: ["*"]
4 changes: 2 additions & 2 deletions .github/workflows/code-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:

steps:
- name: Checkout git repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CodeQL

on:
push:
branches: 'master'

jobs:
analyze:
name: Analyze
runs-on: 'ubuntu-latest'
timeout-minutes: 360
permissions:
actions: read
contents: read
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
cache: 'maven'

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: 'java'
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:java"
15 changes: 10 additions & 5 deletions .github/workflows/deploy-on-pr-merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ on:
jobs:
deploy-snapshot:
name: deploy PR-labelled version
# for PR-labelled deployment -- only if closed by merging
if: github.event_name == 'push' || github.event.pull_request.merged == true
# only if PR closed by merging
if: github.event.pull_request.merged == true

runs-on: ubuntu-latest

steps:
- name: Checkout git repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
cache: 'maven'
server-id: ${{ github.event_name == 'push' && 'matsim-snapshots' || 'matsim-releases' }} #choose mvn repo
server-id: 'matsim-releases'
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD

Expand All @@ -43,5 +43,10 @@ jobs:
MAVEN_USERNAME: ${{ secrets.REPOMATSIM_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.REPOMATSIM_TOKEN }}

- name: Submit Dependency Graph
# Generate a complete dependency graph and submit the graph to the GitHub repository.
# The goal is to improve security alerts from dependabot, because dependabot is not able to compute the complete dependency graph.
uses: advanced-security/maven-dependency-submission-action@v3

env:
MAVEN_OPTS: -Xmx2g
4 changes: 2 additions & 2 deletions .github/workflows/deploy-on-release-created.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:

steps:
- name: Checkout git repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy-weekly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:

steps:
- name: Checkout git repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/full-integration.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: full-integration

on:
workflow_dispatch:
schedule:
- cron: '30 0 * * *' # daily at 0:30 UTC

Expand All @@ -13,18 +14,18 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- name: Prepare git
# turn off CRLF conversion (necessary on Windows)
run: git config --global core.autocrlf false

- name: Checkout git repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/verify-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ jobs:
- contribs/socnetsim
- contribs/sumo
- contribs/pseudosimulation
- contribs/railsim
- contribs/roadpricing
- contribs/analysis
- contribs/eventsBasedPTRouter
- contribs/hybridsim
- contribs/informed-mode-choice
- contribs/otfvis
Expand All @@ -70,7 +70,7 @@ jobs:

steps:
- name: Checkout git repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Detect changes against master
# we only want to build matsim (module) if changes are not limited to contribs
Expand All @@ -84,7 +84,7 @@ jobs:
- name: Setup Java
if: ${{matrix.module != 'matsim' || steps.detect-changes.outputs.outside-contribs == 'true'}}
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
Expand Down
8 changes: 6 additions & 2 deletions benchmark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,12 @@
<version>16.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class Benchmark {
public static void main(String[] args) throws IOException {
Config config = ConfigUtils.loadConfig(IOUtils.extendUrl(ExamplesUtils.getTestScenarioURL("benchmark"), "config.xml"));
Controler ctl = new Controler(config);
ctl.getConfig().controler().setCreateGraphs(false);
ctl.getConfig().controller().setCreateGraphs(false);
ctl.run();
}

Expand Down
1 change: 1 addition & 0 deletions contribs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ The MATSim core development team cannot make any guarantee that these extensions
| [parking](parking/README.md) | Parking infrastructure and supply constraints
| [protobuf](protobuf/README.md) | Protocol buffer implementation and converter for the MATSim event infrastructure
| [pseudosimulation](pseudosimulation/README.md) | Pseudo-simulation to speed-up simulation times
| [railsim](railsim/README.md) | A large-scale hybrid micro- and mesoscopic simulation approach for railway operation
| [roadpricing](roadpricing/README.md) | Functionality to simulate different road-pricing scenarios in MATSim
| [shared_mobility](shared_mobility/README.md) | Simulate human-driven shared mobility (i.e., micromobility)
| [signals](signals/README.md) | Simulate traffic lights microscopically
Expand Down
4 changes: 2 additions & 2 deletions contribs/accessibility/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<dependency>
<groupId>org.openstreetmap.osmosis</groupId>
<artifactId>osmosis-core</artifactId>
<version>0.48.3</version>
<version>${osmosis.version}</version>
<exclusions>
<!-- needed to compile in IntelliJ with Eclipse compiler -->
<!-- see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=536928 -->
Expand All @@ -65,7 +65,7 @@
<dependency>
<groupId>org.openstreetmap.osmosis</groupId>
<artifactId>osmosis-xml</artifactId>
<version>0.48.3</version>
<version>${osmosis.version}</version>
</dependency>
<dependency>
<groupId>org.matsim.contrib</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,26 @@
*/
class AccessibilityComputationNairobiLandUseLocalCopy {
public static final Logger LOG = LogManager.getLogger(AccessibilityComputationNairobiLandUseLocalCopy.class);

public static void main(String[] args) {
int tileSize_m = 500;
boolean push2Geoserver = false; // Set true for run on server
boolean createQGisOutput = true; // Set false for run on server

final Config config = ConfigUtils.createConfig(new AccessibilityConfigGroup());

Envelope envelope = new Envelope(246000, 271000, 9853000, 9863000); // Central part of Nairobi
String scenarioCRS = "EPSG:21037"; // EPSG:21037 = Arc 1960 / UTM zone 37S, for Nairobi, Kenya

config.network().setInputFile("../nairobi/data/nairobi/input/2015-10-15_network.xml");
config.facilities().setInputFile("../nairobi/data/land_use/Nairobi_LU_2010/facilities.xml");
String runId = "ke_nairobi_landuse_hexagons_" + tileSize_m;
config.controler().setOutputDirectory("../nairobi/data/nairobi/output/" + runId + "_lcpt_par4_car_tr-7_500/");
config.controler().setRunId(runId);
config.controler().setOverwriteFileSetting(OverwriteFileSetting.deleteDirectoryIfExists);
config.controler().setLastIteration(0);
config.controller().setOutputDirectory("../nairobi/data/nairobi/output/" + runId + "_lcpt_par4_car_tr-7_500/");
config.controller().setRunId(runId);

config.controller().setOverwriteFileSetting(OverwriteFileSetting.deleteDirectoryIfExists);
config.controller().setLastIteration(0);

AccessibilityConfigGroup acg = ConfigUtils.addOrGetModule(config, AccessibilityConfigGroup.class);
acg.setAreaOfAccessibilityComputation(AreaOfAccesssibilityComputation.fromBoundingBoxHexagons);
acg.setEnvelope(envelope);
Expand All @@ -69,17 +69,17 @@ public static void main(String[] args) {
acg.setOutputCrs(scenarioCRS);

//acg.setUseParallelization(false);

ConfigUtils.setVspDefaults(config);

final Scenario scenario = ScenarioUtils.loadScenario(config);

// final List<String> activityTypes = Arrays.asList(new String[]{"educational", "commercial", "industrial", "recreational", "water_body"});
final List<String> activityTypes = Arrays.asList(new String[]{"educational"});
final ActivityFacilities densityFacilities = AccessibilityUtils.createFacilityForEachLink(Labels.DENSITIY, scenario.getNetwork());

final Controler controler = new Controler(scenario);

for (String activityType : activityTypes) {
AccessibilityModule module = new AccessibilityModule();
module.setConsideredActivityType(activityType);
Expand All @@ -88,17 +88,17 @@ public static void main(String[] args) {
module.setCreateQGisOutput(createQGisOutput);
controler.addOverridingModule(module);
}

controler.run();

if (createQGisOutput) {
final Integer range = 9; // In the current implementation, this must always be 9
final Double lowerBound = -3.5; // (upperBound - lowerBound) ideally nicely divisible by (range - 2)
final Double upperBound = 3.5;
final int populationThreshold = (int) (10 / (1000/tileSize_m * 1000/tileSize_m)); // People per km^2 or roads (?)

String osName = System.getProperty("os.name");
String workingDirectory = config.controler().getOutputDirectory();
String workingDirectory = config.controller().getOutputDirectory();
for (String actType : activityTypes) {
String actSpecificWorkingDirectory = workingDirectory + actType + "/";
for (Modes4Accessibility mode : acg.getIsComputingMode()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@
import org.matsim.api.core.v01.Id;
import org.matsim.api.core.v01.Scenario;
import org.matsim.api.core.v01.TransportMode;
import org.matsim.api.core.v01.network.Node;
import org.matsim.contrib.accessibility.utils.AggregationObject;
import org.matsim.contrib.accessibility.utils.ProgressBar;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.PlanCalcScoreConfigGroup;
import org.matsim.core.config.groups.ScoringConfigGroup;
import org.matsim.core.controler.events.ShutdownEvent;
import org.matsim.core.controler.listener.ShutdownListener;
import org.matsim.core.gbl.Gbl;
Expand All @@ -58,9 +57,9 @@ final class AccessibilityComputationShutdownListener implements ShutdownListener
private final ArrayList<FacilityDataExchangeInterface> zoneDataExchangeListeners = new ArrayList<>();

private AccessibilityConfigGroup acg;
private final PlanCalcScoreConfigGroup cnScoringGroup;
private final ScoringConfigGroup cnScoringGroup;



public AccessibilityComputationShutdownListener(Scenario scenario, ActivityFacilities measuringPoints, ActivityFacilities opportunities,
String outputDirectory) {
this.measuringPoints = measuringPoints;
Expand All @@ -69,7 +68,7 @@ public AccessibilityComputationShutdownListener(Scenario scenario, ActivityFacil
this.outputDirectory = outputDirectory;

this.acg = ConfigUtils.addOrGetModule(scenario.getConfig(), AccessibilityConfigGroup.GROUP_NAME, AccessibilityConfigGroup.class);
this.cnScoringGroup = scenario.getConfig().planCalcScore();
this.cnScoringGroup = scenario.getConfig().scoring();

if (cnScoringGroup.getOrCreateModeParams(TransportMode.car).getMarginalUtilityOfDistance() != 0.) {
LOG.error("Marginal utility of distance for car different from zero, but not used in accessibility computations");
Expand Down Expand Up @@ -241,10 +240,10 @@ private void writeCSVFile(String adaptedOutputDirectory) {
writer.writeField(facility.getCoord().getX());
writer.writeField(facility.getCoord().getY());
writer.writeField(tuple.getSecond());

for (String mode : getModes() ) {
final double value = accessibilitiesMap.get(tuple).get(mode);
if (!Double.isNaN(value)) {
if (!Double.isNaN(value)) {
writer.writeField(value) ;
} else {
writer.writeField(Double.NaN) ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private AccessibilityFromEvents( Scenario scenario, String eventsFile, List<Faci
public void run() {
LinkedHashMap<String, TravelTime> map = new LinkedHashMap<>( ) ;
EventsManager events = EventsUtils.createEventsManager();
for( String mode : scenario.getConfig().plansCalcRoute().getNetworkModes() ){
for( String mode : scenario.getConfig().routing().getNetworkModes() ){
TravelTimeCalculator.Builder builder = new TravelTimeCalculator.Builder( scenario.getNetwork() );
builder.setCalculateLinkTravelTimes( true );
builder.setCalculateLinkToLinkTravelTimes( false );
Expand All @@ -74,7 +74,7 @@ public void run() {
install( new ScenarioByInstanceModule( scenario ) ) ;
install( new TripRouterModule() ) ;
install( new TimeInterpretationModule() );
for( String mode : getConfig().plansCalcRoute().getNetworkModes() ){
for( String mode : getConfig().routing().getNetworkModes() ){
addTravelTimeBinding( mode ).toInstance( map.get(mode) );
}
install( new TravelDisutilityModule() ) ;
Expand Down
Loading

0 comments on commit 5caaa88

Please sign in to comment.