biogeme.mdcev.non_monotonic module

Implementation of the “non-monotonic” MDCEV model. See the technical report.

Michel Bierlaire Tue Apr 9 09:25:20 2024

class biogeme.mdcev.non_monotonic.NonMonotonic(model_name, baseline_utilities, gamma_parameters, mu_utilities, alpha_parameters=None, scale_parameter=None, weights=None)[source]

Bases: Mdcev

Implementation of the MDCEV model with non-monotonic utility function.

Parameters:
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:

Expression

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:

Expression

calculate_mu_utility(alternative_id, one_observation)[source]

As this function may be called many times with the same input in forecasting mode, we use the lru_cache decorator.

Return type:

float

Parameters:
  • alternative_id (int)

  • one_observation (Database)

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 lower bound on the dual variable.

Parameters:
  • chosen_alternatives (set[int]) – list of alternatives that are chosen at the optimal solution

  • one_observation (Database) – data for one observation.

  • epsilon (ndarray) – draws from the error term.

Return type:

float

Returns:

a lower bound and upper bound on the dual variable

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)

transformed_utility(the_id, the_consumption)[source]

Calculates the utility for one alternative. .

Return type:

Expression

Parameters:
utility_expression_one_alternative(the_id, the_consumption, unscaled_epsilon)[source]

Utility expression. Used only for code validation.

Return type:

Expression

Parameters:
utility_one_alternative(the_id, the_consumption, epsilon, one_observation)[source]

Utility needed for forecasting

Return type:

float

Parameters:
  • the_id (int)

  • the_consumption (float)

  • epsilon (float)

  • one_observation (Database)