Skip to content

Commit

Permalink
Merge branch 'master' into hybridsim-protobuf-pom
Browse files Browse the repository at this point in the history
  • Loading branch information
marecabo authored Oct 14, 2023
2 parents 837dcb4 + 15c5689 commit 1ba97d5
Show file tree
Hide file tree
Showing 107 changed files with 770 additions and 624 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
import org.matsim.core.controler.listener.StartupListener;
import org.matsim.core.utils.charts.XYLineChart;
import org.matsim.core.utils.io.IOUtils;
import org.matsim.core.utils.io.UncheckedIOException;

import java.awt.*;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.*;
import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
Expand All @@ -45,7 +46,6 @@
import org.matsim.core.controler.listener.StartupListener;
import org.matsim.core.utils.charts.XYLineChart;
import org.matsim.core.utils.io.IOUtils;
import org.matsim.core.utils.io.UncheckedIOException;

/**
* Calculates:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
import org.matsim.core.router.TripStructureUtils.Trip;
import org.matsim.core.utils.geometry.CoordUtils;
import org.matsim.core.utils.io.IOUtils;
import org.matsim.core.utils.io.UncheckedIOException;
import org.matsim.utils.objectattributes.ObjectAttributes;
import org.matsim.utils.objectattributes.ObjectAttributesXmlWriter;
import org.matsim.vehicles.Vehicle;

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.*;
import java.util.Map.Entry;

Expand Down Expand Up @@ -100,7 +100,7 @@ enum StatType {

private Vehicle2DriverEventHandler delegate = new Vehicle2DriverEventHandler() ;

// general trip counter. Would, in theory, not necessary to do this per StatType, but I find it too brittle
// general trip counter. Would, in theory, not necessary to do this per StatType, but I find it too brittle
// to avoid under- or over-counting with respect to loops.
// private final Map<StatType,Integer> legCount = new TreeMap<StatType,Integer>() ;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class CreateGeoJsonNetwork implements MATSimAppCommand {
@CommandLine.Option(names = "--match-id", description = "Pattern to filter links by id")
private String matchId;

@CommandLine.Option(names = "--mode-filter", split = ",", defaultValue = "car",
@CommandLine.Option(names = "--mode-filter", split = ",", defaultValue = "car,freight,drt",
description = "Only keep links if they have one of the specified modes. Specify 'none' to disable.")
private Set<String> modes;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
import org.matsim.application.options.ShpOptions;
import org.matsim.freight.carriers.jsprit.NetworkBasedTransportCosts;
import org.matsim.core.utils.io.IOUtils;
import org.matsim.core.utils.io.UncheckedIOException;
import org.matsim.vehicles.VehicleType;
import org.matsim.vehicles.VehicleUtils;
import org.opengis.feature.simple.SimpleFeature;
import org.matsim.smallScaleCommercialTrafficGeneration.TrafficVolumeGeneration.TrafficVolumeKey;

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.net.MalformedURLException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@
package org.matsim.contrib.common.csv;

import java.io.IOException;
import java.io.UncheckedIOException;
import java.io.Writer;

import org.matsim.core.utils.io.UncheckedIOException;

import com.opencsv.CSVWriter;

public class CompactCSVWriter extends CSVWriter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
import org.matsim.contrib.drt.extension.operations.shifts.shift.DrtShiftsSpecification;
import org.matsim.core.utils.collections.Tuple;
import org.matsim.core.utils.io.IOUtils;
import org.matsim.core.utils.io.UncheckedIOException;

import jakarta.inject.Provider;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.UncheckedIOException;
import java.util.HashMap;
import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
import org.matsim.contrib.drt.extension.operations.shifts.shift.DrtShiftsSpecification;
import org.matsim.core.utils.collections.Tuple;
import org.matsim.core.utils.io.IOUtils;
import org.matsim.core.utils.io.UncheckedIOException;

import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.UncheckedIOException;
import java.util.HashMap;
import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
import org.matsim.contrib.drt.extension.operations.shifts.shift.DrtShift;
import org.matsim.core.config.Config;
import org.matsim.core.utils.io.IOUtils;
import org.matsim.core.utils.io.UncheckedIOException;
import org.matsim.core.utils.misc.Time;

import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.UncheckedIOException;
import java.util.Set;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
import org.jfree.chart.plot.XYPlot;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
import org.matsim.core.utils.io.UncheckedIOException;

import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.io.UncheckedIOException;

/**
* @author nkuehnel / MOIA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
import org.matsim.core.gbl.Gbl;
import org.matsim.core.utils.collections.Tuple;
import org.matsim.core.utils.io.MatsimXmlWriter;
import org.matsim.core.utils.io.UncheckedIOException;

import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.*;
import java.util.stream.Collectors;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
import org.matsim.core.gbl.Gbl;
import org.matsim.core.utils.collections.Tuple;
import org.matsim.core.utils.io.MatsimXmlWriter;
import org.matsim.core.utils.io.UncheckedIOException;

import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.*;
import java.util.stream.Collectors;

Expand Down
15 changes: 1 addition & 14 deletions contribs/dvrp/src/main/java/org/matsim/contrib/zone/Zones.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,14 @@
package org.matsim.contrib.zone;

import java.io.File;
import java.io.UncheckedIOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import java.util.Map;

import org.geotools.geometry.jts.JTS;
import org.geotools.referencing.CRS;
import org.locationtech.jts.geom.MultiPolygon;
import org.locationtech.jts.geom.Polygon;
import org.locationtech.jts.geom.util.PolygonExtracter;
import org.matsim.api.core.v01.Id;
import org.matsim.contrib.zone.io.ZoneShpReader;
import org.matsim.contrib.zone.io.ZoneShpWriter;
import org.matsim.contrib.zone.io.ZoneXmlReader;
import org.matsim.contrib.zone.io.ZoneXmlWriter;
import org.matsim.core.utils.geometry.geotools.MGC;
import org.matsim.core.utils.io.UncheckedIOException;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.TransformException;

public class Zones {
public static Map<Id<Zone>, Zone> readZones(String zonesXmlFile, String zonesShpFile) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
import org.matsim.core.population.routes.NetworkRoute;
import org.matsim.core.utils.collections.Tuple;
import org.matsim.core.utils.io.MatsimXmlWriter;
import org.matsim.core.utils.io.UncheckedIOException;
import org.matsim.core.utils.misc.Time;
import org.matsim.utils.objectattributes.AttributeConverter;
import org.matsim.utils.objectattributes.attributable.AttributesXmlWriterDelegate;
import org.matsim.vehicles.VehicleType;

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
import org.matsim.core.controler.listener.StartupListener;
import org.matsim.core.utils.charts.XYLineChart;
import org.matsim.core.utils.io.IOUtils;
import org.matsim.core.utils.io.UncheckedIOException;
import org.matsim.freight.carriers.Carrier;
import org.matsim.freight.carriers.CarrierPlan;
import org.matsim.freight.carriers.Carriers;

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.Locale;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
import org.matsim.core.controler.listener.StartupListener;
import org.matsim.core.utils.charts.XYLineChart;
import org.matsim.core.utils.io.IOUtils;
import org.matsim.core.utils.io.UncheckedIOException;

import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.Locale;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
import org.matsim.freight.carriers.TimeWindow;
import org.matsim.core.api.internal.MatsimWriter;
import org.matsim.core.utils.io.MatsimXmlWriter;
import org.matsim.core.utils.io.UncheckedIOException;
import org.matsim.core.utils.misc.Counter;
import java.io.IOException;
import java.io.UncheckedIOException;

/**
* Writes a {@link Receivers} container in the MATSim XML format.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package org.matsim.contrib.locationchoice.frozenepsilons;

import java.io.UncheckedIOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
Expand All @@ -43,7 +44,6 @@
import org.matsim.core.utils.collections.CollectionUtils;
import org.matsim.core.utils.collections.QuadTree;
import org.matsim.core.utils.collections.Tuple;
import org.matsim.core.utils.io.UncheckedIOException;
import org.matsim.facilities.ActivityFacility;
import org.matsim.facilities.ActivityFacilityImpl;
import org.matsim.facilities.ActivityOption;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package org.matsim.contrib.locationchoice.frozenepsilons;

import java.io.UncheckedIOException;
import java.util.HashSet;
import java.util.List;

Expand All @@ -30,7 +31,6 @@
import org.matsim.api.core.v01.population.Plan;
import org.matsim.contrib.locationchoice.utils.ScaleEpsilon;
import org.matsim.core.router.TripStructureUtils;
import org.matsim.core.utils.io.UncheckedIOException;
import org.matsim.utils.objectattributes.ObjectAttributes;
import org.matsim.utils.objectattributes.ObjectAttributesXmlReader;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,29 @@
import org.apache.logging.log4j.Logger;
import org.matsim.api.core.v01.Scenario;
import org.matsim.api.core.v01.population.Person;
import org.matsim.core.utils.io.UncheckedIOException;
import org.matsim.facilities.ActivityFacility;
import org.matsim.utils.objectattributes.ObjectAttributes;
import org.matsim.utils.objectattributes.ObjectAttributesXmlReader;

class ReadOrCreateKVals {

import java.io.UncheckedIOException;

class ReadOrCreateKVals {

private static final Logger log = LogManager.getLogger(ReadOrCreateKVals.class);

private Scenario scenario;
private ObjectAttributes facilitiesKValues = new ObjectAttributes();
private ObjectAttributes personsKValues = new ObjectAttributes();
private RandomFromVarDistr rnd;

public ReadOrCreateKVals(long seed, Scenario scenario) {
this.scenario = scenario;
this.rnd = new RandomFromVarDistr();
this.rnd.setSeed(seed);
}

/*
* return 0 if files are read and 1 if k values are created.
* return 0 if files are read and 1 if k values are created.
* This is important to know for reading (case 0) or computation of maxDCScore (case 1)
*/
public int run() {
Expand All @@ -58,7 +59,7 @@ public int run() {
return 1;
}
log.info("at least one facility kValue or person kValue is missing, start crating all values");
if (pkValuesFileName != null && fkValuesFileName != null && maxEpsValuesFileName != null) {
if (pkValuesFileName != null && fkValuesFileName != null && maxEpsValuesFileName != null) {
ObjectAttributesXmlReader persKValuesReader = new ObjectAttributesXmlReader(this.personsKValues);
ObjectAttributesXmlReader facKValuesReader = new ObjectAttributesXmlReader(this.facilitiesKValues);
try {
Expand Down Expand Up @@ -108,7 +109,7 @@ public void assignKValues() {
this.assignKValuesPersons();
this.assignKValuesAlternatives();
}

// does not matter which distribution is chosen here
private void assignKValuesPersons() {
for (Person p : this.scenario.getPopulation().getPersons().values()) {
Expand All @@ -120,5 +121,5 @@ private void assignKValuesAlternatives() {
facility.getAttributes().putAttribute("k", rnd.getUniform(1.0));
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.List;
Expand All @@ -45,7 +46,6 @@
import org.matsim.core.controler.listener.StartupListener;
import org.matsim.core.utils.charts.XYLineChart;
import org.matsim.core.utils.io.IOUtils;
import org.matsim.core.utils.io.UncheckedIOException;

/**
* Calculates at the end of each iteration the following statistics:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.ArrayList;
import java.util.List;

Expand All @@ -42,7 +43,6 @@
import org.matsim.core.controler.listener.ShutdownListener;
import org.matsim.core.controler.listener.StartupListener;
import org.matsim.core.utils.io.IOUtils;
import org.matsim.core.utils.io.UncheckedIOException;
import org.matsim.pt.transitSchedule.api.TransitRoute;
import org.matsim.pt.transitSchedule.api.TransitStopFacility;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ public final void testPControler() {
filesToCheckFor.add(outputPath + scenarioName + ".0.actsFromParatransitUsers.txt");
filesToCheckFor.add(outputPath + scenarioName + ".pOperatorLogger.txt");
filesToCheckFor.add(outputPath + scenarioName + ".pStats.txt");
filesToCheckFor.add(outputPath + scenarioName + ".scorestats.txt");
filesToCheckFor.add(outputPath + scenarioName + ".stopwatch.txt");
filesToCheckFor.add(outputPath + scenarioName + ".traveldistancestats.txt");
filesToCheckFor.add(outputPath + scenarioName + ".scorestats.csv");
filesToCheckFor.add(outputPath + scenarioName + ".stopwatch.csv");
filesToCheckFor.add(outputPath + scenarioName + ".traveldistancestats.csv");
filesToCheckFor.add(outputPath + scenarioName + ".pStat_light.gexf.gz");
filesToCheckFor.add(outputPath + scenarioName + ".pStat.gexf.gz");

Expand Down
Loading

0 comments on commit 1ba97d5

Please sign in to comment.