Skip to content

Commit

Permalink
Merge branch 'master' into developParkingSearch
Browse files Browse the repository at this point in the history
  • Loading branch information
rewertvsp authored Oct 20, 2023
2 parents 2145cf2 + 8e64186 commit cffffc9
Show file tree
Hide file tree
Showing 1,450 changed files with 29,864 additions and 29,095 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: ["*"]
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@v3
with:
java-version: 17
distribution: 'zulu'
cache: 'maven'

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
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@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:java"
11 changes: 8 additions & 3 deletions .github/workflows/deploy-on-pr-merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ 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

Expand All @@ -25,7 +25,7 @@ jobs:
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
2 changes: 1 addition & 1 deletion .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 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
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
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public ControlerListener get() {
}
AccessibilityUtils.assignAdditionalFacilitiesDataToMeasurePoint(measuringPoints, measurePointGeometryMap, additionalFacs);

String outputDirectory = scenario.getConfig().controler().getOutputDirectory() + "/" + activityType;
String outputDirectory = scenario.getConfig().controller().getOutputDirectory() + "/" + activityType;
AccessibilityComputationShutdownListener accessibilityShutdownListener = new AccessibilityComputationShutdownListener(scenario, measuringPoints, opportunities, outputDirectory);

// for (Modes4Accessibility mode : acg.getIsComputingMode()) {
Expand All @@ -150,14 +150,14 @@ public ControlerListener get() {
final TravelDisutilityFactory travelDisutilityFactory = travelDisutilityFactories.get(TransportMode.car);
Gbl.assertNotNull(travelDisutilityFactory);
calculator = new NetworkModeAccessibilityExpContributionCalculator(mode, new FreeSpeedTravelTime(), travelDisutilityFactory, scenario);
} else if ( config.plansCalcRoute().getNetworkModes().contains( mode ) ) {
} else if ( config.routing().getNetworkModes().contains( mode ) ) {
final TravelTime nwModeTravelTime = travelTimes.get(mode);
Gbl.assertNotNull(nwModeTravelTime);
final TravelDisutilityFactory nwModeTravelDisutility = travelDisutilityFactories.get(mode);
Gbl.assertNotNull( nwModeTravelDisutility );
calculator = new NetworkModeAccessibilityExpContributionCalculator(mode, nwModeTravelTime, nwModeTravelDisutility, scenario);
} else if ( TransportMode.pt.equals( mode ) ){
calculator = new SwissRailRaptorAccessibilityContributionCalculator( mode, config.planCalcScore(), scenario );
calculator = new SwissRailRaptorAccessibilityContributionCalculator( mode, config.scoring(), scenario );
} else if ( Modes4Accessibility.matrixBasedPt.name().equals( mode ) ) {
throw new RuntimeException("currently not supported because implementation not consistent with guice grapher. kai, sep'19") ;
// calculator = new LeastCostPathCalculatorAccessibilityContributionCalculator(
Expand All @@ -175,7 +175,7 @@ public ControlerListener get() {
if ( travelDisutilityFactory==null ) {
throw new RuntimeException("mode=" + mode + "; travelDisutilityFactory is null!") ;
}
calculator = new TripRouterAccessibilityContributionCalculator(mode, tripRouter, config.planCalcScore(), scenario,
calculator = new TripRouterAccessibilityContributionCalculator(mode, tripRouter, config.scoring(), scenario,
travelTime, travelDisutilityFactory );
}

Expand All @@ -195,7 +195,7 @@ public ControlerListener get() {
}
Set <String> additionalFacInfo = additionalFacs.keySet();
accessibilityShutdownListener.addFacilityDataExchangeListener(new GeoserverUpdater(acg.getOutputCrs(),
config.controler().getRunId() + "_" + activityType, measurePointGeometryMap, additionalFacInfo,
config.controller().getRunId() + "_" + activityType, measurePointGeometryMap, additionalFacInfo,
outputDirectory, pushing2Geoserver, createQGisOutput));
}

Expand Down
Loading

0 comments on commit cffffc9

Please sign in to comment.