Assisted specification

Assisted specification algorithm

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)[source]

Bases: Neighborhood

Class defining assisted specification problem for the VNS algorithm.

__init__(biogeme_object, multi_objectives, pareto_file_name, validity=None)[source]

Ctor

Parameters:
  • biogeme_object (BIOGEME) – object containnig the loglikelihood and the database

  • multi_objectives (fct(bioResults) --> list[float]) – function calculating the objectives to minimize

  • pareto_file_name (str) – file where to read and write the Pareto solutions

  • validity (fct(bioResults) --> Validity) – function verifying that the estimation results are valid. It must return a bool and an explanation why if it is invalid, or None otherwise

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.

__init__(biogeme_object, pareto_file_name)[source]

Ctor

Parameters:
  • biogeme_object (BIOGEME) – object containnig the loglikelihood and the database

  • pareto_file_name (str) – file where to read and write the Pareto solutions

log_statistics()[source]

Report some statistics about the process in the logger

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.