opensbt.evaluation package

Submodules

opensbt.evaluation.critical module

class opensbt.evaluation.critical.Critical[source]

Bases: object

This class defines an interface for concrete oracle functions. The functions name and eval have to be implemented.

eval(vector_fitness: ndarray, simout: SimulationOutput) bool[source]

Evaluate whether a test has failed or passed. To be implemented based on specific conditions.

Parameters:
  • vector_fitness (np.ndarray) – List of fitness values.

  • simout (SimulationOutput) – SimulationOutput instance

Returns:

Returns True if simulation is critical/failed or otherwise False.

Return type:

bool

property name

The name of the criticality function. To be overriden for specific name. Otherwise class name is used.

Returns:

Name of the criticality function.

Return type:

str

class opensbt.evaluation.critical.CriticalAdasDistanceVelocity[source]

Bases: Critical

eval(vector_fitness, simout: SimulationOutput | None = None)[source]

Evaluate whether a test has failed or passed. To be implemented based on specific conditions.

Parameters:
  • vector_fitness (np.ndarray) – List of fitness values.

  • simout (SimulationOutput) – SimulationOutput instance

Returns:

Returns True if simulation is critical/failed or otherwise False.

Return type:

bool

class opensbt.evaluation.critical.CriticalAdasExplicitRearCollision[source]

Bases: Critical

ADAS problems

eval(vector_fitness: List[float], simout: SimulationOutput | None = None)[source]

Evaluate whether a test has failed or passed. To be implemented based on specific conditions.

Parameters:
  • vector_fitness (np.ndarray) – List of fitness values.

  • simout (SimulationOutput) – SimulationOutput instance

Returns:

Returns True if simulation is critical/failed or otherwise False.

Return type:

bool

class opensbt.evaluation.critical.CriticalAdasFrontCollisions[source]

Bases: Critical

eval(vector_fitness, simout: SimulationOutput | None = None)[source]

Evaluate whether a test has failed or passed. To be implemented based on specific conditions.

Parameters:
  • vector_fitness (np.ndarray) – List of fitness values.

  • simout (SimulationOutput) – SimulationOutput instance

Returns:

Returns True if simulation is critical/failed or otherwise False.

Return type:

bool

class opensbt.evaluation.critical.CriticalAdasTTC[source]

Bases: Critical

eval(vector_fitness, simout: SimulationOutput | None = None)[source]

Evaluate whether a test has failed or passed. To be implemented based on specific conditions.

Parameters:
  • vector_fitness (np.ndarray) – List of fitness values.

  • simout (SimulationOutput) – SimulationOutput instance

Returns:

Returns True if simulation is critical/failed or otherwise False.

Return type:

bool

class opensbt.evaluation.critical.CriticalAdasTTCVelocity[source]

Bases: Critical

eval(vector_fitness, simout: SimulationOutput | None = None)[source]

Evaluate whether a test has failed or passed. To be implemented based on specific conditions.

Parameters:
  • vector_fitness (np.ndarray) – List of fitness values.

  • simout (SimulationOutput) – SimulationOutput instance

Returns:

Returns True if simulation is critical/failed or otherwise False.

Return type:

bool

class opensbt.evaluation.critical.CriticalBnh[source]

Bases: Critical

eval(vector_fitness)[source]

Evaluate whether a test has failed or passed. To be implemented based on specific conditions.

Parameters:
  • vector_fitness (np.ndarray) – List of fitness values.

  • simout (SimulationOutput) – SimulationOutput instance

Returns:

Returns True if simulation is critical/failed or otherwise False.

Return type:

bool

class opensbt.evaluation.critical.CriticalBnhDivided[source]

Bases: Critical

eval(vector_fitness: ndarray, simout=None)[source]

Evaluate whether a test has failed or passed. To be implemented based on specific conditions.

Parameters:
  • vector_fitness (np.ndarray) – List of fitness values.

  • simout (SimulationOutput) – SimulationOutput instance

Returns:

Returns True if simulation is critical/failed or otherwise False.

Return type:

bool

class opensbt.evaluation.critical.CriticalRastrigin[source]

Bases: Critical

eval(fitness)[source]

Evaluate whether a test has failed or passed. To be implemented based on specific conditions.

Parameters:
  • vector_fitness (np.ndarray) – List of fitness values.

  • simout (SimulationOutput) – SimulationOutput instance

Returns:

Returns True if simulation is critical/failed or otherwise False.

Return type:

bool

class opensbt.evaluation.critical.MockCritical[source]

Bases: object

eval(vector_fitness: ndarray, simout: SimulationOutput) bool[source]
property name

opensbt.evaluation.fitness module

class opensbt.evaluation.fitness.Fitness[source]

Bases: object

This class defines an interface for concrete fitness functions.

eval(simout: SimulationOutput, **kwargs) Tuple[float][source]

Returns the fitness value of a given SimulationOutput instance.

Parameters:
  • simout (SimulationOutput) – SimulationOutput instance.

  • kwargs (**Dict) – Further optional variables needed for fitness evaluation.

Return::

Return the fitness value for the given simulation results. Each tuple element corresponds to value for the specific fitness dimension.

:rtype Tuple[float]

property min_or_max

Defines for each objective if it is minimized or maximized. Returns a tuple, where each element holds the value “min” or “max”.

property name

Defines the name of the fitness funtion as a tuple, where each element corresponds to the name of the objective

class opensbt.evaluation.fitness.FitnessAdaptedDistSpeedRelVelocity[source]

Bases: Fitness

eval(simout: SimulationOutput, **kwargs) float[source]

Returns the fitness value of a given SimulationOutput instance.

Parameters:
  • simout (SimulationOutput) – SimulationOutput instance.

  • kwargs (**Dict) – Further optional variables needed for fitness evaluation.

Return::

Return the fitness value for the given simulation results. Each tuple element corresponds to value for the specific fitness dimension.

:rtype Tuple[float]

fitness_parallel(z_parallel, car_length)[source]
Input:

z_parallel, which is a projection of relative position of a car’s front bumper and a pedestrian to the axis, parallel to a car velocity. car_length, which is a length of a car.

Returns:

a value between 0 and 1, indicating severeness of the relative position of a car and a pedestrian in the parallel direction. The higher the value - the more severe a scenario is.

The fitness function is composed of exponential functions and constant functions. step_back characterizes steepness of decay of the fitness function behind the front bumper. step_front characterizes steepness of decay of the fitness function in front of the front bumper. The value of the fitness function for positions of a pedestrian behind the back bumper is 0.

fitness_perpendicular(z_perpendicular, car_width)[source]
Input:

z_perpendicular, which is a projection of relative position of a car’s center and a pedestrian to the axis, perpendicular to a car velocity. car_width, which is a width of a car.

Returns:

a value between 0 and 1, indicating severeness of the relative position of a car and a pedestrian in the perpendicular direction. The higher the value - the more severe a scenario is.

The fitness function is composed of a “bell-shaped” function segments on the sides, and a constant function in the middle equal to 1. A “bell-shaped” function is a gaussian function. sigma is proportional to the width of a “bell”. A constant segment has a length of the car_width. The parallel fitness function, combined with the perpendicular fitness function, e.g. by multiplication, results in a proximity function, which defines a severeness of the relative position of a car and a pedestrian.

property min_or_max

Defines for each objective if it is minimized or maximized. Returns a tuple, where each element holds the value “min” or “max”.

property name

Defines the name of the fitness funtion as a tuple, where each element corresponds to the name of the objective

class opensbt.evaluation.fitness.FitnessAdaptedDistanceSpeed[source]

Bases: Fitness

eval(simout: SimulationOutput, **kwargs) float[source]

Returns the fitness value of a given SimulationOutput instance.

Parameters:
  • simout (SimulationOutput) – SimulationOutput instance.

  • kwargs (**Dict) – Further optional variables needed for fitness evaluation.

Return::

Return the fitness value for the given simulation results. Each tuple element corresponds to value for the specific fitness dimension.

:rtype Tuple[float]

property min_or_max

Defines for each objective if it is minimized or maximized. Returns a tuple, where each element holds the value “min” or “max”.

property name

Defines the name of the fitness funtion as a tuple, where each element corresponds to the name of the objective

class opensbt.evaluation.fitness.FitnessAdaptedDistanceSpeedTTC[source]

Bases: Fitness

eval(simout: SimulationOutput, **kwargs) float[source]

Returns the fitness value of a given SimulationOutput instance.

Parameters:
  • simout (SimulationOutput) – SimulationOutput instance.

  • kwargs (**Dict) – Further optional variables needed for fitness evaluation.

Return::

Return the fitness value for the given simulation results. Each tuple element corresponds to value for the specific fitness dimension.

:rtype Tuple[float]

property min_or_max

Defines for each objective if it is minimized or maximized. Returns a tuple, where each element holds the value “min” or “max”.

property name

Defines the name of the fitness funtion as a tuple, where each element corresponds to the name of the objective

class opensbt.evaluation.fitness.FitnessMinDistance[source]

Bases: Fitness

eval(simout: SimulationOutput, **kwargs) Tuple[float][source]

Returns the fitness value of a given SimulationOutput instance.

Parameters:
  • simout (SimulationOutput) – SimulationOutput instance.

  • kwargs (**Dict) – Further optional variables needed for fitness evaluation.

Return::

Return the fitness value for the given simulation results. Each tuple element corresponds to value for the specific fitness dimension.

:rtype Tuple[float]

property min_or_max

Defines for each objective if it is minimized or maximized. Returns a tuple, where each element holds the value “min” or “max”.

property name

Defines the name of the fitness funtion as a tuple, where each element corresponds to the name of the objective

class opensbt.evaluation.fitness.FitnessMinDistanceVelocity[source]

Bases: Fitness

eval(simout: SimulationOutput, **kwargs) Tuple[float][source]

Returns the fitness value of a given SimulationOutput instance.

Parameters:
  • simout (SimulationOutput) – SimulationOutput instance.

  • kwargs (**Dict) – Further optional variables needed for fitness evaluation.

Return::

Return the fitness value for the given simulation results. Each tuple element corresponds to value for the specific fitness dimension.

:rtype Tuple[float]

property min_or_max

Defines for each objective if it is minimized or maximized. Returns a tuple, where each element holds the value “min” or “max”.

property name

Defines the name of the fitness funtion as a tuple, where each element corresponds to the name of the objective

class opensbt.evaluation.fitness.FitnessMinDistanceVelocityFrontOnly[source]

Bases: Fitness

eval(simout: SimulationOutput, **kwargs) Tuple[float][source]

Returns the fitness value of a given SimulationOutput instance.

Parameters:
  • simout (SimulationOutput) – SimulationOutput instance.

  • kwargs (**Dict) – Further optional variables needed for fitness evaluation.

Return::

Return the fitness value for the given simulation results. Each tuple element corresponds to value for the specific fitness dimension.

:rtype Tuple[float]

property min_or_max

Defines for each objective if it is minimized or maximized. Returns a tuple, where each element holds the value “min” or “max”.

property name

Defines the name of the fitness funtion as a tuple, where each element corresponds to the name of the objective

class opensbt.evaluation.fitness.FitnessMinTTC[source]

Bases: Fitness

eval(simout: SimulationOutput, **kwargs) Tuple[float][source]

Returns the fitness value of a given SimulationOutput instance.

Parameters:
  • simout (SimulationOutput) – SimulationOutput instance.

  • kwargs (**Dict) – Further optional variables needed for fitness evaluation.

Return::

Return the fitness value for the given simulation results. Each tuple element corresponds to value for the specific fitness dimension.

:rtype Tuple[float]

property min_or_max

Defines for each objective if it is minimized or maximized. Returns a tuple, where each element holds the value “min” or “max”.

property name

Defines the name of the fitness funtion as a tuple, where each element corresponds to the name of the objective

class opensbt.evaluation.fitness.FitnessMinTTCVelocity[source]

Bases: Fitness

eval(simout: SimulationOutput, **kwargs) float[source]

Returns the fitness value of a given SimulationOutput instance.

Parameters:
  • simout (SimulationOutput) – SimulationOutput instance.

  • kwargs (**Dict) – Further optional variables needed for fitness evaluation.

Return::

Return the fitness value for the given simulation results. Each tuple element corresponds to value for the specific fitness dimension.

:rtype Tuple[float]

property min_or_max

Defines for each objective if it is minimized or maximized. Returns a tuple, where each element holds the value “min” or “max”.

property name

Defines the name of the fitness funtion as a tuple, where each element corresponds to the name of the objective

class opensbt.evaluation.fitness.MockFitness[source]

Bases: object

eval(simout: SimulationOutput, **kwargs) Tuple[float][source]
property min_or_max
property name

Module contents