From 9bc20e93c110a0a800c8f69d1b4f47a8d0237e34 Mon Sep 17 00:00:00 2001 From: rakow Date: Sun, 5 Jan 2025 11:49:20 +0100 Subject: [PATCH] fix config option in experiment --- .../org/matsim/run/policies/OpenBerlinChoiceExperiment.java | 5 ++++- .../python/choicemodels/estimate_biogeme_plan_choice.py | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/matsim/run/policies/OpenBerlinChoiceExperiment.java b/src/main/java/org/matsim/run/policies/OpenBerlinChoiceExperiment.java index 91e517dd..b718deb6 100644 --- a/src/main/java/org/matsim/run/policies/OpenBerlinChoiceExperiment.java +++ b/src/main/java/org/matsim/run/policies/OpenBerlinChoiceExperiment.java @@ -56,7 +56,8 @@ public class OpenBerlinChoiceExperiment extends OpenBerlinScenario { @CommandLine.Option(names = "--balanced-innovation", description = "Use balanced innovation selection", defaultValue = "false") private boolean bi; - @CommandLine.Option(names = "--act-est", description = "Include estimation of activity utilities into score", defaultValue = "true") + @CommandLine.Option(names = "--no-act-est", description = "Include estimation of activity utilities into score", defaultValue = "true", + negatable = true) private boolean actEst; @CommandLine.Option(names = "--inv-beta", description = "Beta inv value for selection", defaultValue = "-1") @@ -177,6 +178,8 @@ protected void prepareControler(Controler controler) { if (actEst) { log.info("Including activity estimation into score"); builder.withActivityEstimator(DefaultActivityEstimator.class); + } else { + log.info("No activity estimation for score"); } if (ConfigUtils.hasModule(controler.getConfig(), AdvancedScoringConfigGroup.class)) { diff --git a/src/main/python/choicemodels/estimate_biogeme_plan_choice.py b/src/main/python/choicemodels/estimate_biogeme_plan_choice.py index 0ef53060..27e956ed 100644 --- a/src/main/python/choicemodels/estimate_biogeme_plan_choice.py +++ b/src/main/python/choicemodels/estimate_biogeme_plan_choice.py @@ -4,6 +4,7 @@ import argparse import os +import numpy as np import biogeme.biogeme as bio import biogeme.database as db import biogeme.models as models @@ -62,6 +63,11 @@ effort = {x: float(y) for x, y in args.effort} if effort: + # Nan values are estimated + for mode in effort: + if np.isnan(effort[mode]): + effort[mode] = Beta(f"BETA_DIST_{mode}", 0, None, None, ESTIMATE) + print("Using time effort", effort) # Variables for constants