biogeme.assisted module

File assisted.py

author:

Michel Bierlaire

date:

Sun Mar 19 17:06:29 2023

New version of the assisted specification using Catalogs

class biogeme.assisted.AssistedSpecification(biogeme_object, multi_objectives, pareto_file_name, validity=None, parameter_file=None)[source]

Bases: Neighborhood

Class defining assisted specification problem for the VNS algorithm.

Parameters:
  • biogeme_object (BIOGEME)

  • multi_objectives (Callable[[bioResults | None], list[float]])

  • pareto_file_name (str)

  • validity (Callable[[bioResults], bool] | None)

  • parameter_file (str | None)

generate_operator(function)[source]
Defines an operator that takes a SetElement as an argument, to

comply with the interface of the VNS algorithm.

Parameters:

function (function(str, int) --> str, int) – one of the function implementing the operators from the central controller

Returns:

operator

Return type:

function(SetElement, int) –> SetElement, int

is_valid(element)[source]

Check the validity of the solution.

Parameters:

element (biogeme.pareto.SetElement) – solution to be checked

Returns:

valid, why where valid is True if the solution is valid, and False otherwise. why contains an explanation why it is invalid.

Return type:

tuple(bool, str)

run()[source]

Runs the VNS algorithm

Returns:

doct with the estimation results of the Pareto optimal models

Return type:

dict[bioResults]

class biogeme.assisted.ParetoPostProcessing(biogeme_object, pareto_file_name)[source]

Bases: object

Class to process an existing Pareto set.

Parameters:
  • biogeme_object (BIOGEME)

  • pareto_file_name (str)

log_statistics()[source]

Report some statistics about the process in the logger

Return type:

None

plot(objective_x=0, objective_y=1, label_x=None, label_y=None, margin_x=5, margin_y=5, ax=None)[source]
Plot the members of the set according to two

objective functions. They determine the x- and y-coordinate of the plot.

Parameters:
  • objective_x (int) – index of the objective function to use for the x-coordinate.

  • objective_y (int) – index of the objective function to use for the y-coordinate.

  • label_x (str) – label for the x_axis

  • label_y (str) – label for the y_axis

  • margin_x (int) – margin for the x axis

  • margin_y (int) – margin for the y axis

  • ax (matplotlib.Axes) – matplotlib axis for the plot

reestimate(recycle=False)[source]

The assisted specification uses quickEstimate to estimate the models. A complete estimation is necessary to obtain the full estimation results.

Return type:

dict[str, bioResults]

Parameters:

recycle (bool)