biogeme.mdcev.generalized module
Implementation of the “generalized translated utility function” MDCEV model. See the technical report.
Michel Bierlaire Tue Apr 9 08:44:12 2024
- class biogeme.mdcev.generalized.Generalized(model_name, baseline_utilities, gamma_parameters, alpha_parameters=None, scale_parameter=None, prices=None, weights=None)[source]
Bases:
Mdcev
Implementation of the MDCEV model with generalized translated utility function.
- Parameters:
model_name (str)
baseline_utilities (dict[int, Expression])
gamma_parameters (dict[int, Expression | None])
alpha_parameters (dict[int, Expression] | None)
scale_parameter (Expression | None)
prices (dict[int, Expression] | None)
weights (Expression | None)
- calculate_inverse_of_determinant_one_alternative(the_id, consumption)[source]
- Calculate the inverse of the entries for the determinant. For
the outside good, gamma is equal to 0.
- Parameters:
the_id (
int
) – identifier of the good.consumption (
Expression
) – expression for the consumption.
- Return type:
- calculate_log_determinant_one_alternative(the_id, consumption)[source]
- Calculate the log of the entries for the determinant. For
the outside good, gamma is equal to 0.
- Parameters:
the_id (
int
) – identifier of the good.consumption (
Expression
) – expression for the consumption.
- Return type:
- derivative_utility_one_alternative(the_id, the_consumption, epsilon, one_observation)[source]
Used in the optimization problem solved for forecasting tp calculate the dual variable.
- Return type:
float
- Parameters:
the_id (int)
the_consumption (float)
epsilon (float)
one_observation (Database)
- lower_bound_dual_variable(chosen_alternatives, one_observation, epsilon)[source]
Method providing model specific bounds on the dual variable. It not overloaded, default values are used.
- Parameters:
chosen_alternatives (
set
[int
]) – list of alternatives that are chosen at the optimal solutionone_observation (
Database
) – data for one observation.epsilon (
ndarray
) – draws from the error term.
- Return type:
float
- Returns:
a lower bound on the dual variable, such that the expenditure calculated for any larger value is
well-defined and non negative.
- optimal_consumption_one_alternative(the_id, dual_variable, epsilon, one_observation)[source]
Analytical calculation of the optimal consumption if the dual variable is known.
- Return type:
float
- Parameters:
the_id (int)
dual_variable (float)
epsilon (float)
one_observation (Database)
- sorting_utility_one_alternative(alternative_id, epsilon, one_observation)[source]
Utility used to sort the alternatives. Used in the forecasting algorithm to identify chosen and non chpsen alternatives
- Return type:
float
- Parameters:
alternative_id (int)
epsilon (float)
one_observation (Database)
- transformed_utility(the_id, the_consumption)[source]
Calculates the utility for one alternative.
- Return type:
- Parameters:
the_id (int)
the_consumption (Expression)
- utility_expression_one_alternative(the_id, the_consumption, unscaled_epsilon)[source]
Utility expression. Used only for code validation.
- Return type:
- Parameters:
the_id (int)
the_consumption (Expression)
unscaled_epsilon (Expression)