plafosim.formation_algorithm module
- class plafosim.formation_algorithm.ABC[source]
Bases:
object
Helper class that provides a standard way to create an ABC using inheritance.
- _abc_impl = <_abc_data object>
- class plafosim.formation_algorithm.FormationAlgorithm(owner: object)[source]
Bases:
ABC
Abstract base class for any type of platoon formation algorithm (i.e., assignment calculation).
Implementing sub-classes need to override the do_formation() method.
- __init__(owner: object)[source]
Initialize an instance of a formation algorithm.
- Parameters:
owner (object) – The owning object that is execution this algorithm. This can be either a PlatooningVehicle or an Infrastructure.
- abstract add_parser_argument_group(parser: ArgumentParser) _ArgumentGroup [source]
Abstract method for performing any type of platoon formation (i.e., assignment calculation).
This methods needs to be overridden in implementing sub-classes.
- Returns:
The specific argument group for this algorithm.
- Return type:
argparse._ArgumentGroup
- abstract do_formation()[source]
Abstract method for performing any type of platoon formation (i.e., assignment calculation).
This methods needs to be overridden in implementing sub-classes.
- _abc_impl = <_abc_data object>
- property name
Print the name of the formation algorithm.
- plafosim.formation_algorithm.abstractmethod(funcobj)[source]
A decorator indicating abstract methods.
Requires that the metaclass is ABCMeta or derived from it. A class that has a metaclass derived from ABCMeta cannot be instantiated unless all of its abstract methods are overridden. The abstract methods can be called using any of the normal ‘super’ call mechanisms. abstractmethod() may be used to declare abstract methods for properties and descriptors.
Usage:
- class C(metaclass=ABCMeta):
@abstractmethod def my_abstract_method(self, …):
…