Skip to content

Commit

Permalink
small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
rakow committed Jan 3, 2025
1 parent 40c4bc7 commit 9712007
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
6 changes: 6 additions & 0 deletions src/main/java/org/matsim/run/OpenBerlinScenario.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.ReplanningConfigGroup;
import org.matsim.core.config.groups.VspExperimentalConfigGroup;
import org.matsim.core.controler.AbstractModule;
import org.matsim.core.controler.Controler;
import org.matsim.core.replanning.strategies.DefaultPlanStrategiesModule;
Expand Down Expand Up @@ -120,6 +121,11 @@ protected Config prepareConfig(Config config) {
.setSubpopulation("person")
);

// Need to switch to warning for best score
if (planSelector.equals(DefaultPlanStrategiesModule.DefaultSelector.BestScore)) {
config.vspExperimental().setVspDefaultsCheckingLevel(VspExperimentalConfigGroup.VspDefaultsCheckingLevel.warn);
}

// Bicycle config must be present
ConfigUtils.addOrGetModule(config, BicycleConfigGroup.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,7 @@ public enum LoadPreferences {
* Variate values with random draw from specific distribution.
*/
public enum VariationType {
fixed, normal, truncatedNormal, gumbel,
/**
* Normal with mean at 0.5772 (Euler–Mascheroni constant). Can be used as coarse approximation to gumbel.
*/
eulerGammaNormal
fixed, normal, truncatedNormal, gumbel
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public double scoreTrip(Id<Person> personId, String mainMode, TripStructureUtils
return switch (distribution) {
case gumbel -> sampleGumbel(rng, 0, scale);
case normal -> sampleNormal(rng, 0, scale);
case eulerGammaNormal -> sampleNormal(rng, 0.5772156649015329, scale);
default -> throw new IllegalStateException("Unsupported distribution: " + distribution);
};
}
Expand Down
8 changes: 6 additions & 2 deletions src/main/python/choicemodels/estimate_biogeme_plan_choice.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
parser.add_argument("--exp-income", help="Exponent for income", type=float, default=1)
parser.add_argument("--util-money", help="Utility of money", type=float, default=1)
parser.add_argument("--est-util-money", help="Estimate utility of money", action="store_true")
parser.add_argument("--est-error-component", help="Add a normal error component to each trip choice", action="store_true")
parser.add_argument("--est-error-component", help="Add a normal error component to each trip choice", action="store_true")
parser.add_argument("--ec", help="Factor for error component", type=float, default=None)
parser.add_argument("--est-price-perception-car", help="Estimate price perception", action="store_true")
parser.add_argument("--est-price-perception-pt", help="Estimate price perception", action="store_true")
parser.add_argument("--same-price-perception", help="Only estimate one fixed price perception factor", action="store_true")
Expand Down Expand Up @@ -123,7 +124,10 @@
for j in range(7):
EC[m].append(bioDraws(f"ec_{m}_{j}", "NORMAL_ANTI"))

EC_S = Beta("ec_s", 0.5, 0, None, ESTIMATE)
if args.ec is None:
EC_S = Beta("ec_s", 0.5, 0, None, ESTIMATE)
else:
EC_S = args.ec

print("Using MXL modes", args.mxl_modes)
U = {}
Expand Down

0 comments on commit 9712007

Please sign in to comment.