Commit ce6e9a63 authored by Sebastian Hörl's avatar Sebastian Hörl
Browse files

update

parent 945fed90
## Creating the scenarios
...
\ No newline at end of file
......@@ -6,15 +6,13 @@ df.crs = {"init": "EPSG:2056"}
df = df[["geometry", "Gebietstyp"]]
scenarios = {
"scenario_sa": ("S", "A"),
"scenario_lu": ("LU",),
"scenario_lg": ("LG",)
"sa": ("S", "A"),
"lu": ("LU",),
"lg": ("LG",)
}
for scenario, types in scenarios.items():
df.loc[df["Gebietstyp"].isin(types), "scenario"] = scenario
df = df.dissolve(by = "scenario").reset_index()[["scenario", "geometry"]]
for scenario in scenarios.keys():
shape = df[df["scenario"] == scenario].to_file("scenarios/%s.shp" % scenario)
df.to_file("scenarios/scenarios.shp")
package ch.ethz.matsim.projects.astra_2018_002.scenarios.long_distance;
package ch.ethz.matsim.projects.astra_2018_002.long_distance;
import java.util.ArrayList;
import java.util.Collection;
......
package ch.ethz.matsim.projects.astra_2018_002.scenarios.run;
package ch.ethz.matsim.projects.astra_2018_002.long_distance;
import java.util.Collection;
import java.util.Collections;
......@@ -30,7 +30,6 @@ import org.matsim.pt.PtConstants;
import ch.ethz.matsim.baseline_scenario.config.CommandLine;
import ch.ethz.matsim.baseline_scenario.config.CommandLine.ConfigurationException;
import ch.ethz.matsim.projects.astra_2018_002.scenarios.long_distance.LinkInteractionFinder;
public class MakeLongDistanceScenario {
private final static Logger logger = Logger.getLogger(MakeLongDistanceScenario.class);
......
......@@ -4,7 +4,10 @@ import org.matsim.api.core.v01.Coord;
import org.matsim.api.core.v01.population.Activity;
import org.matsim.core.population.PopulationUtils;
import ch.ethz.matsim.baseline_scenario.config.CommandLine;
import ch.ethz.matsim.baseline_scenario.config.CommandLine.ConfigurationException;
import ch.ethz.matsim.discrete_mode_choice.model.DiscreteModeChoiceTrip;
import ch.ethz.matsim.projects.astra_2018_002.mode_choice.SwissDiscreteModeChoiceModule;
import ch.ethz.matsim.projects.astra_2018_002.mode_choice.SwissUtilityEstimator;
import ch.ethz.matsim.projects.astra_2018_002.mode_choice.SwissUtilityParameters;
import ch.ethz.matsim.projects.astra_2018_002.mode_choice.SwissUtilityParameters.UtilitySet;
......@@ -17,11 +20,16 @@ import ch.ethz.matsim.projects.astra_2018_002.mode_choice.cost.CostModel;
import ch.ethz.matsim.projects.astra_2018_002.mode_choice.cost.CostParameters;
public class TestUtility {
static public void main(String[] args) {
static public void main(String[] args) throws ConfigurationException {
CommandLine cmd = new CommandLine.Builder(args) //
.allowPrefixes(SwissDiscreteModeChoiceModule.COMMAND_LINE_PREFIX) //
.build();
CostParameters costParameters = new CostParameters();
CostModel costModel = new CostModel(costParameters);
SwissUtilityParameters parameters = SwissUtilityParameters.build(UtilitySet.CHAPTER_3_2_3, true, false);
SwissUtilityParameters parameters = SwissUtilityParameters.build(UtilitySet.APPENDIX_A5, true, false);
SwissUtilityParameters.adaptFromCommandLine(parameters, cmd);
SwissUtilityEstimator estimator = new SwissUtilityEstimator(null, null, null, costModel, null, parameters);
......@@ -47,24 +55,24 @@ public class TestUtility {
TripVariablesCar tripVariablesCar = new TripVariablesCar();
double carUtility = estimator.estimateCarTrip(trip, personVariables, tripVariablesCar);
System.out.println("Walk utility: " + walkUtility);
System.out.println("Bike utility: " + bikeUtility);
System.out.println("Pt utility: " + ptUtility);
System.out.println("Car utility: " + carUtility);
double denominator = Math.exp(walkUtility) + Math.exp(bikeUtility) + Math.exp(ptUtility) + Math.exp(carUtility);
double probability = 0.0;
probability = Math.exp(walkUtility) / denominator;
System.out.println("Walk probability: " + probability);
probability = Math.exp(bikeUtility) / denominator;
System.out.println("Bike probability: " + probability);
probability = Math.exp(ptUtility) / denominator;
System.out.println("Pt probability: " + probability);
probability = Math.exp(carUtility) / denominator;
System.out.println("Car probability: " + probability);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment