alogos.systems._shared.neighborhood

Shared neighborhood functions for several systems.

Functions

generate_combinations(num_choices_per_pos, distance, max_size=None)

Generate all combinations of choices available at each position.


Detailed object descriptions

alogos.systems._shared.neighborhood.generate_combinations(num_choices_per_pos, distance, max_size=None)[source]

Generate all combinations of choices available at each position.

In each returned combination, the value 0 means that the original choice shall be kept, while values > 0 mean that the alternative choice at position value-1 in the list of all alternatives shall be used.

Example

  • Input

    • num_choices_per_pos = [4, 1, 0, 7, 3]

    • distance = 1

  • Output

    • combinations = [[0, 0, 0, 0, 1], [0, 0, 0, 0, 2], [0, 0, 0, 0, 3], [0, 0, 0, 1, 0], …]