generated from matsim-scenarios/matsim-scenario-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
237 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
UTF-8 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
PROJCS["ETRS_1989_UTM_Zone_32N",GEOGCS["GCS_ETRS_1989",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",9.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'> | ||
<qgis version="3.26.3-Buenos Aires"> | ||
<identifier></identifier> | ||
<parentidentifier></parentidentifier> | ||
<language></language> | ||
<type>dataset</type> | ||
<title></title> | ||
<abstract></abstract> | ||
<contact> | ||
<name></name> | ||
<organization></organization> | ||
<position></position> | ||
<voice></voice> | ||
<fax></fax> | ||
<email></email> | ||
<role></role> | ||
</contact> | ||
<links/> | ||
<fees></fees> | ||
<encoding></encoding> | ||
<crs> | ||
<spatialrefsys nativeFormat="Wkt"> | ||
<wkt></wkt> | ||
<proj4></proj4> | ||
<srsid>0</srsid> | ||
<srid>0</srid> | ||
<authid></authid> | ||
<description></description> | ||
<projectionacronym></projectionacronym> | ||
<ellipsoidacronym></ellipsoidacronym> | ||
<geographicflag>false</geographicflag> | ||
</spatialrefsys> | ||
</crs> | ||
<extent> | ||
<spatial maxz="0" minx="0" miny="0" dimensions="2" minz="0" crs="" maxy="0" maxx="0"/> | ||
<temporal> | ||
<period> | ||
<start></start> | ||
<end></end> | ||
</period> | ||
</temporal> | ||
</extent> | ||
</qgis> |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
package org.matsim.run; | ||
|
||
import org.matsim.api.core.v01.Id; | ||
import org.matsim.api.core.v01.Scenario; | ||
import org.matsim.api.core.v01.TransportMode; | ||
import org.matsim.contrib.drt.optimizer.constraints.DefaultDrtOptimizationConstraintsSet; | ||
import org.matsim.contrib.drt.optimizer.constraints.DrtOptimizationConstraintsParams; | ||
import org.matsim.contrib.drt.optimizer.insertion.extensive.ExtensiveInsertionSearchParams; | ||
import org.matsim.contrib.drt.routing.DrtRoute; | ||
import org.matsim.contrib.drt.routing.DrtRouteFactory; | ||
import org.matsim.contrib.drt.run.DrtConfigGroup; | ||
import org.matsim.contrib.drt.run.DrtConfigs; | ||
import org.matsim.contrib.drt.run.MultiModeDrtConfigGroup; | ||
import org.matsim.contrib.dvrp.run.DvrpConfigGroup; | ||
import org.matsim.core.config.Config; | ||
import org.matsim.core.config.ConfigUtils; | ||
import org.matsim.core.config.groups.QSimConfigGroup; | ||
import org.matsim.core.config.groups.ScoringConfigGroup; | ||
import org.matsim.run.prepare.PrepareNetwork; | ||
import org.matsim.vehicles.Vehicle; | ||
import org.matsim.vehicles.VehicleCapacity; | ||
import org.matsim.vehicles.VehicleType; | ||
import org.matsim.vehicles.VehicleUtils; | ||
import picocli.CommandLine; | ||
|
||
import java.util.Set; | ||
|
||
/** | ||
* This class bundles some run parameter options and functionalities connected to drt-scenarios. | ||
*/ | ||
public class DrtOptions { | ||
@CommandLine.Option(names = "--drt-shp", description = "Path to shp file for adding drt not network links as an allowed mode.", defaultValue = "./input/v1.1/drt-area/nord-bautzen-waiting-times_utm32N.shp") | ||
private String drtAreaShp; | ||
|
||
@CommandLine.Option(names = "--typ-wt", description = "typical waiting time", defaultValue = "300") | ||
protected double typicalWaitTime; | ||
|
||
@CommandLine.Option(names = "--wt-std", description = "waiting time standard deviation", defaultValue = "0.3") | ||
protected double waitTimeStd; | ||
|
||
@CommandLine.Option(names = "--ride-time-alpha", description = "ride time estimator alpha", defaultValue = "1.25") | ||
protected double rideTimeAlpha; | ||
|
||
@CommandLine.Option(names = "--ride-time-beta", description = "ride time estimator beta", defaultValue = "300") | ||
protected double rideTimeBeta; | ||
|
||
@CommandLine.Option(names = "--ride-time-std", description = "ride duration standard deviation", defaultValue = "0.3") | ||
protected double rideTimeStd; | ||
|
||
/** | ||
* a helper method, which makes all necessary config changes to simulate drt. | ||
*/ | ||
void configureDrtConfig(Config config) { | ||
DvrpConfigGroup dvrpConfigGroup = ConfigUtils.addOrGetModule(config, DvrpConfigGroup.class); | ||
dvrpConfigGroup.networkModes = Set.of(TransportMode.drt); | ||
|
||
MultiModeDrtConfigGroup multiModeDrtConfigGroup = ConfigUtils.addOrGetModule(config, MultiModeDrtConfigGroup.class); | ||
|
||
if (multiModeDrtConfigGroup.getModalElements().isEmpty()) { | ||
DrtConfigGroup drtConfigGroup = new DrtConfigGroup(); | ||
drtConfigGroup.operationalScheme = DrtConfigGroup.OperationalScheme.serviceAreaBased; | ||
drtConfigGroup.stopDuration = 60.; | ||
drtConfigGroup.drtServiceAreaShapeFile = getDrtAreaShp(); | ||
|
||
// optimization params now are in its own paramSet, hence the below lines | ||
DrtOptimizationConstraintsParams optimizationConstraints = new DrtOptimizationConstraintsParams(); | ||
DefaultDrtOptimizationConstraintsSet optimizationConstraintsSet = new DefaultDrtOptimizationConstraintsSet(); | ||
optimizationConstraintsSet.maxWaitTime = 1200.; | ||
optimizationConstraintsSet.maxTravelTimeBeta = 1200.; | ||
optimizationConstraintsSet.maxTravelTimeAlpha = 1.5; | ||
optimizationConstraints.addParameterSet(optimizationConstraintsSet); | ||
drtConfigGroup.addParameterSet(optimizationConstraints); | ||
drtConfigGroup.addParameterSet(new ExtensiveInsertionSearchParams()); | ||
multiModeDrtConfigGroup.addParameterSet(drtConfigGroup); | ||
} | ||
|
||
// set to drt estimate and teleport | ||
// this enables the usage of the DrtEstimator by CL | ||
for (DrtConfigGroup drtConfigGroup : multiModeDrtConfigGroup.getModalElements()) { | ||
drtConfigGroup.simulationType = DrtConfigGroup.SimulationType.estimateAndTeleport; | ||
} | ||
|
||
// this is needed for DynAgents for DVRP | ||
config.qsim().setSimStarttimeInterpretation(QSimConfigGroup.StarttimeInterpretation.onlyUseStarttime); | ||
|
||
ScoringConfigGroup scoringConfigGroup = ConfigUtils.addOrGetModule(config, ScoringConfigGroup.class); | ||
|
||
if (!scoringConfigGroup.getModes().containsKey(TransportMode.drt)) { | ||
// ASC drt = ASC pt as discussed in PHD seminar24 | ||
// add mode params for drt if missing and set ASC + marg utility of traveling = 0 | ||
scoringConfigGroup.addModeParams(new ScoringConfigGroup.ModeParams(TransportMode.drt) | ||
.setConstant(scoringConfigGroup.getModes().get(TransportMode.pt).getConstant()) | ||
.setMarginalUtilityOfTraveling(-0.)); | ||
} | ||
|
||
// creates a drt staging activity and adds it to the scoring params | ||
DrtConfigs.adjustMultiModeDrtConfig(multiModeDrtConfigGroup, config.scoring(), config.routing()); | ||
} | ||
|
||
/** | ||
* a helper method, which makes all necessary scenario changes to simulate drt. | ||
*/ | ||
void configureDrtScenario(Scenario scenario) { | ||
|
||
// drt route factory has to be added as factory for drt routes, as there were no drt routes before. | ||
scenario.getPopulation() | ||
.getFactory() | ||
.getRouteFactories() | ||
.setRouteFactory(DrtRoute.class, new DrtRouteFactory()); | ||
|
||
// prepare network for drt | ||
PrepareNetwork.prepareDrtNetwork(scenario.getNetwork(), getDrtAreaShp()); | ||
// add drt veh type if not already existing | ||
Id<VehicleType> drtTypeId = Id.create(TransportMode.drt, VehicleType.class); | ||
if (!scenario.getVehicles().getVehicleTypes().containsKey(drtTypeId)) { | ||
// drt veh type = car veh type, but capacity 1 passenger | ||
VehicleType drtType = VehicleUtils.createVehicleType(drtTypeId); | ||
|
||
VehicleUtils.copyFromTo(scenario.getVehicles().getVehicleTypes().get(Id.create(TransportMode.car, VehicleType.class)), drtType); | ||
drtType.setDescription("drt vehicle copied from car vehicle type"); | ||
VehicleCapacity capacity = drtType.getCapacity(); | ||
capacity.setSeats(1); | ||
|
||
scenario.getVehicles().addVehicleType(drtType); | ||
|
||
Vehicle drtDummy = VehicleUtils.createVehicle(Id.createVehicleId("drtDummy"), drtType); | ||
drtDummy.getAttributes().putAttribute("dvrpMode", TransportMode.drt); | ||
drtDummy.getAttributes().putAttribute("startLink", "706048410#0"); | ||
drtDummy.getAttributes().putAttribute("serviceBeginTime", 0.); | ||
drtDummy.getAttributes().putAttribute("serviceEndTime", 86400.); | ||
|
||
scenario.getVehicles().addVehicle(drtDummy); | ||
} | ||
} | ||
|
||
public String getDrtAreaShp() { | ||
return drtAreaShp; | ||
} | ||
|
||
} |
Oops, something went wrong.