biogeme.expressions.comparison_expressions module

Arithmetic expressions accepted by Biogeme: comparison operators

Michel Bierlaire Wed Mar 26 13:17:40 2025

class biogeme.expressions.comparison_expressions.ComparisonOperator(left, right)[source]

Bases: BinaryOperator

Base class for comparison expressions.

Parameters:
  • left (ExpressionOrNumeric)

  • right (ExpressionOrNumeric)

class biogeme.expressions.comparison_expressions.Equal(left, right)[source]

Bases: ComparisonOperator

Logical equal

Parameters:
  • left (ExpressionOrNumeric)

  • right (ExpressionOrNumeric)

deep_flat_copy()[source]

Provides a copy of the expression. It is deep in the sense that it generates copies of the children. It is flat in the sense that any MultipleExpression is transformed into the currently selected expression. The flat part is irrelevant for this expression.

Return type:

Equal

get_value()[source]

Evaluates the value of the expression

Returns:

value of the expression

Return type:

float

recursive_construct_jax_function(numerically_safe)[source]

Generates recursively a function to be used by biogeme_jax. Must be overloaded by each expression :return: the function takes two parameters: the parameters, and one row of the database.

Parameters:

numerically_safe (bool)

class biogeme.expressions.comparison_expressions.Greater(left, right)[source]

Bases: ComparisonOperator

Logical greater

Parameters:
  • left (ExpressionOrNumeric)

  • right (ExpressionOrNumeric)

deep_flat_copy()[source]

Provides a copy of the expression. It is deep in the sense that it generates copies of the children. It is flat in the sense that any MultipleExpression is transformed into the currently selected expression. The flat part is irrelevant for this expression.

Return type:

Greater

get_value()[source]

Evaluates the value of the expression

Returns:

value of the expression

Return type:

float

recursive_construct_jax_function(numerically_safe)[source]

Generates recursively a function to be used by biogeme_jax. Must be overloaded by each expression :rtype: Callable[[Array, Array, Array, Array], array] :return: the function takes two parameters: the parameters, and one row of the database.

Parameters:

numerically_safe (bool)

Return type:

Callable[[Array, Array, Array, Array], array]

class biogeme.expressions.comparison_expressions.GreaterOrEqual(left, right)[source]

Bases: ComparisonOperator

Logical greater or equal

Parameters:
  • left (ExpressionOrNumeric)

  • right (ExpressionOrNumeric)

deep_flat_copy()[source]

Provides a copy of the expression. It is deep in the sense that it generates copies of the children. It is flat in the sense that any MultipleExpression is transformed into the currently selected expression. The flat part is irrelevant for this expression.

Return type:

GreaterOrEqual

get_value()[source]

Evaluates the value of the expression

Returns:

value of the expression

Return type:

float

recursive_construct_jax_function(numerically_safe)[source]

Generates recursively a function to be used by biogeme_jax. Must be overloaded by each expression :rtype: Callable[[Array, Array, Array, Array], array] :return: the function takes two parameters: the parameters, and one row of the database.

Parameters:

numerically_safe (bool)

Return type:

Callable[[Array, Array, Array, Array], array]

class biogeme.expressions.comparison_expressions.Less(left, right)[source]

Bases: ComparisonOperator

Logical less

Parameters:
  • left (ExpressionOrNumeric)

  • right (ExpressionOrNumeric)

deep_flat_copy()[source]

Provides a copy of the expression. It is deep in the sense that it generates copies of the children. It is flat in the sense that any MultipleExpression is transformed into the currently selected expression. The flat part is irrelevant for this expression.

Return type:

Less

get_value()[source]

Evaluates the value of the expression

Returns:

value of the expression

Return type:

float

recursive_construct_jax_function(numerically_safe)[source]

Generates recursively a function to be used by biogeme_jax. Must be overloaded by each expression :rtype: Callable[[Array, Array, Array, Array], array] :return: the function takes two parameters: the parameters, and one row of the database.

Parameters:

numerically_safe (bool)

Return type:

Callable[[Array, Array, Array, Array], array]

class biogeme.expressions.comparison_expressions.LessOrEqual(left, right)[source]

Bases: ComparisonOperator

Logical less or equal

Parameters:
  • left (ExpressionOrNumeric)

  • right (ExpressionOrNumeric)

deep_flat_copy()[source]

Provides a copy of the expression. It is deep in the sense that it generates copies of the children. It is flat in the sense that any MultipleExpression is transformed into the currently selected expression. The flat part is irrelevant for this expression.

Return type:

LessOrEqual

get_value()[source]

Evaluates the value of the expression

Returns:

value of the expression

Return type:

float

recursive_construct_jax_function(numerically_safe)[source]

Generates recursively a function to be used by biogeme_jax. Must be overloaded by each expression :rtype: Callable[[Array, Array, Array, Array], array] :return: the function takes two parameters: the parameters, and one row of the database.

Parameters:

numerically_safe (bool)

Return type:

Callable[[Array, Array, Array, Array], array]

class biogeme.expressions.comparison_expressions.NotEqual(left, right)[source]

Bases: ComparisonOperator

Logical not equal

Parameters:
  • left (ExpressionOrNumeric)

  • right (ExpressionOrNumeric)

deep_flat_copy()[source]

Provides a copy of the expression. It is deep in the sense that it generates copies of the children. It is flat in the sense that any MultipleExpression is transformed into the currently selected expression. The flat part is irrelevant for this expression.

Return type:

NotEqual

get_value()[source]

Evaluates the value of the expression

Returns:

value of the expression

Return type:

float

recursive_construct_jax_function(numerically_safe)[source]

Generates recursively a function to be used by biogeme_jax. Must be overloaded by each expression :rtype: Callable[[Array, Array, Array, Array], array] :return: the function takes two parameters: the parameters, and one row of the database.

Parameters:

numerically_safe (bool)

Return type:

Callable[[Array, Array, Array, Array], array]