Coding Guidelines

Style guide

Follow the recommendations from PEP 8 – Style Guide for Python Code.

Docstring

Docstrings should use the reStructuredText (reST) format. For details see, e.g., this stackoverflow question, the Sphinx + ReadTheDocs documentation or the example below.

Example:

def my_function(param1):
    """
    This is a reStructuredText style.

    :param param1: first param
    :type param1: type of first param
    :return: description of what is returned
    :rtype: type of return value
    :raises keyError: raises an exception
    """

Further reading:

Important notes

  • Memory allocation: If expanding or modifying crossover or mutation functionalities, care must be taken to only modify deep copies of offspring route objects. Otherwise, modifications might lead to overwriting of parent objects and thus undefined behaviour of the optimisation process.