biogeme.catalog.central_controller module

Defines central controller for multiple expressions.

Michel Bierlaire 15.04.2025 09:43

class biogeme.catalog.central_controller.CentralController(expression, maximum_number_of_configurations=None)[source]

Bases: object

Class controlling the complete multiple expression

Parameters:
  • expression (Expression)

  • maximum_number_of_configurations (int | None)

decreased_controller(controller_name, current_config, step)[source]

Decrease the selection of one controller by “step”

Parameters:
  • controller_name (str) – name of the controller to modify

  • current_config (Configuration) – current configuration

  • step (int) – number of steps to perform

Return type:

tuple[Configuration, int]

Returns:

ID of the new configuration and number of steps performed.

expression_configuration_iterator()[source]

Iterate over the expression corresponding to each configuration.

Return type:

Iterator[str]

expression_iterator()[source]

Iterate over the expression corresponding to each configuration.

Return type:

Iterator[NamedExpression]

get_configuration()[source]

Obtain the current configuration of the controllers

Return type:

Configuration

get_operator_decreased_controllers(controller_name)[source]
Return type:

Callable[[Configuration, int], tuple[Configuration, int]]

Parameters:

controller_name (str)

get_operator_increased_controllers(controller_name)[source]
Return type:

Callable[[Configuration, int], tuple[Configuration, int]]

Parameters:

controller_name (str)

get_operator_modify_random_controllers(increase)[source]
Return type:

Callable[[Configuration, int], tuple[Configuration, int]]

Parameters:

increase (bool)

get_operator_two_controllers(first_controller_name, second_controller_name, direction)[source]
Return type:

Callable[[Configuration, int], tuple[Configuration, int]]

Parameters:
  • first_controller_name (str)

  • second_controller_name (str)

  • direction (str)

increased_controller(controller_name, current_config, step)[source]

Increase the selection of one controller by “step”

Parameters:
  • controller_name (str) – name of the controller to modify

  • current_config (str) – current configuration

  • step (int) – number of steps to perform

Return type:

tuple[Configuration, int]

modify_random_controllers(increase, current_config, step)[source]

Increase the selection of “step” controllers by 1

Parameters:
  • increase (bool) – If True, the indices are increased . If False, they are decreased.

  • current_config (Configuration) – current configuration

  • step (int) – number of steps to perform

Return type:

tuple[Configuration, int]

number_of_configurations()[source]

Total number of configurations

Return type:

int

prepare_operators()[source]

Operators are functions that take a configuration and a size as arguments, and return a new configuration, and the actual number of modifications that have been implemented.

Return type:

dict[str, Callable[[Configuration, int], tuple[Configuration, int]]]

reset_selection()[source]
Return type:

None

set_configuration(configuration)[source]

Apply a configuration to the controllers

Parameters:

configuration (Configuration) – the configuration to be applied

Return type:

None

set_configuration_from_id(configuration_id)[source]

Apply a configuration to the controllers

Parameters:

configuration_id (str) – the ID of the configuration to be applied

Return type:

None

set_controller(controller_name, index)[source]

Set the given controller to the specified index

Parameters:
  • controller_name (string) – name of the controller

  • index (int) – index of the selection

Return type:

None

two_controllers(first_controller_name, second_controller_name, direction, current_config, step)[source]

Modification of two controllers. Meaning of direction:

  • NE (North-East): first controller increased by “step”, second

    controller increased by “step”

  • NW (North-West): first controller decreased by “step”, second

    controller increased by “step”

  • SE (South-East): first controller increased by “step”, second

    controller decreased by “step”

  • SW (South-West): first controller decreased by “step”, second

    controller decreased by “step”

Parameters:
  • first_controller_name (str) – name of the first_controller to modify

  • second_controller_name (str) – name of the second_controller to modify

  • direction (str) – direction based on the compass rose. Must be NE, NW, SE or SW

  • current_config (Configuration) – current configuration

  • step (int) – number of steps to perform

Return type:

tuple[Configuration, int]

Returns:

ID of the new configuration and number of steps performed.

biogeme.catalog.central_controller.count_number_of_specifications(expression)[source]
Parameters:

expression (Expression)

biogeme.catalog.central_controller.extract_multiple_expressions_controllers(the_expression)[source]
Return type:

list[Controller]

Parameters:

the_expression (Expression)