utility

Various functions to help you handle linkages

The utility module provides various useful functions.

Created on Mon Jul 12 00:00:01 2021.

@author: HugoFara

pylinkage.utility.bounding_box(locus)

Compute the bounding box of a locus.

Parameters:

locus (list[tuple[float]]) – A list of points or any iterable with the same structure.

Returns:

Bounding box as (y_min, x_max, y_max, x_min).

Return type:

tuple[float, float, float, float]

pylinkage.utility.kinematic_default_test(func, error_penalty)

Standard run for any linkage before a complete fitness evaluation.

This decorator makes a kinematic simulation, before passing the loci to the decorated function.

Parameters:
  • func (Callable) – Fitness function to be decorated.

  • error_penalty (float) – Penalty value for unbuildable linkage. Common values include float(‘inf’) and 0.

pylinkage.utility.kinematic_maximization(func)

Standard run for any linkage before a complete fitness evaluation.

This decorator makes a kinematic simulation, before passing the loci to the decorated function. In case of error, the penalty value is -float(‘inf’)

Parameters:

func (Callable) – Fitness function to be decorated.

pylinkage.utility.kinematic_minimization(func)

Standard run for any linkage before a complete fitness evaluation.

This decorator makes a kinematic simulation, before passing the loci to the decorated function. In case of error, the penalty value is float(‘inf’)

Parameters:

func (Callable) – Fitness function to be decorated.

pylinkage.utility.movement_bounding_bow(loci)

Bounding box for a group of loci.

Parameters:

loci

Return type:

tuple[float, float, float, float]

Deprecated since version 0.6.0: Was replaced by movement_bounding_box(), will be removed in 0.7.0.

pylinkage.utility.movement_bounding_box(loci)

Bounding box for a group of loci.

Parameters:

loci

Return type:

tuple[float, float, float, float]