pacman.model.constraints.key_allocator_constraints package

Submodules

pacman.model.constraints.key_allocator_constraints.abstract_key_allocator_constraint module

class pacman.model.constraints.key_allocator_constraints.abstract_key_allocator_constraint.AbstractKeyAllocatorConstraint[source]

Bases: pacman.model.constraints.abstract_constraint.AbstractConstraint

A constraint on key allocation

pacman.model.constraints.key_allocator_constraints.contiguous_key_range_constraint module

class pacman.model.constraints.key_allocator_constraints.contiguous_key_range_constraint.ContiguousKeyRangeContraint[source]

Bases: pacman.model.constraints.key_allocator_constraints.abstract_key_allocator_constraint.AbstractKeyAllocatorConstraint

Key allocator constraint that keeps the keys allocated to a contiguous range. Without this constraint, keys can be allocated across the key space.

pacman.model.constraints.key_allocator_constraints.fixed_key_and_mask_constraint module

class pacman.model.constraints.key_allocator_constraints.fixed_key_and_mask_constraint.FixedKeyAndMaskConstraint(keys_and_masks, key_list_function=None)[source]

Bases: pacman.model.constraints.key_allocator_constraints.abstract_key_allocator_constraint.AbstractKeyAllocatorConstraint

Key allocator constraint that fixes the key and mask of an edge

Parameters:
  • keys_and_masks (iterable of pacman.model.routing_info.BaseKeyAndMask) – The key and mask combinations to fix
  • key_list_function ((iterable of pacman.model.routing_info.BaseKeyAndMask, pacman.model.graph.machine.MachineEdge, int) -> iterable of int) – Optional function which will be called to translate the keys_and_masks list into individual keys. If missing, the keys will be generated by iterating through the keys_and_masks list directly. The function parameters are: * An iterable of keys and masks * A machine edge * Number of keys to generate (may be None)
key_list_function

A function to call to generate the keys

Returns:A python function, or None if the default function can be used
keys_and_masks

The keys and masks to be fixed

Returns:An iterable of key and mask combinations
Return type:iterable of pacman.model.routing_info.BaseKeyAndMask

pacman.model.constraints.key_allocator_constraints.fixed_key_field_constraint module

class pacman.model.constraints.key_allocator_constraints.fixed_key_field_constraint.FixedKeyFieldConstraint(fields=None)[source]

Bases: pacman.model.constraints.key_allocator_constraints.abstract_key_allocator_constraint.AbstractKeyAllocatorConstraint

Constraint that indicates fields in the mask of a key

Parameters:fields (iterable of pacman.utilities.field.Field) – any fields that define regions in the mask with further limitations
Raises:PacmanInvalidParameterException – if any of the fields are outside of the mask i.e. mask & field.mask != field.mask or if any of the field masks overlap i.e. field.mask & other_field.mask != 0
fields

Any fields in the mask - i.e. ranges of the mask that have further limitations

Returns:Iterable of fields, ordered by mask with the highest bit range first
Return type:iterable of pacman.utilities.field.Field

pacman.model.constraints.key_allocator_constraints.fixed_mask_constraint module

class pacman.model.constraints.key_allocator_constraints.fixed_mask_constraint.FixedMaskConstraint(mask)[source]

Bases: pacman.model.constraints.key_allocator_constraints.abstract_key_allocator_constraint.AbstractKeyAllocatorConstraint

A key allocator that fixes the mask to be assigned to an edge

Parameters:mask (int) – the mask to be used during key allocation
mask

The mask to be used

Returns:The mask to be used
Return type:int

pacman.model.constraints.key_allocator_constraints.flexi_key_field_constraint module

class pacman.model.constraints.key_allocator_constraints.flexi_key_field_constraint.FlexiKeyFieldConstraint(fields)[source]

Bases: pacman.model.constraints.key_allocator_constraints.abstract_key_allocator_constraint.AbstractKeyAllocatorConstraint

Constraint that indicates fields in the mask without a specific size or position

fields

Module contents

class pacman.model.constraints.key_allocator_constraints.AbstractKeyAllocatorConstraint[source]

Bases: pacman.model.constraints.abstract_constraint.AbstractConstraint

A constraint on key allocation

class pacman.model.constraints.key_allocator_constraints.ContiguousKeyRangeContraint[source]

Bases: pacman.model.constraints.key_allocator_constraints.abstract_key_allocator_constraint.AbstractKeyAllocatorConstraint

Key allocator constraint that keeps the keys allocated to a contiguous range. Without this constraint, keys can be allocated across the key space.

class pacman.model.constraints.key_allocator_constraints.FixedKeyFieldConstraint(fields=None)[source]

Bases: pacman.model.constraints.key_allocator_constraints.abstract_key_allocator_constraint.AbstractKeyAllocatorConstraint

Constraint that indicates fields in the mask of a key

Parameters:fields (iterable of pacman.utilities.field.Field) – any fields that define regions in the mask with further limitations
Raises:PacmanInvalidParameterException – if any of the fields are outside of the mask i.e. mask & field.mask != field.mask or if any of the field masks overlap i.e. field.mask & other_field.mask != 0
fields

Any fields in the mask - i.e. ranges of the mask that have further limitations

Returns:Iterable of fields, ordered by mask with the highest bit range first
Return type:iterable of pacman.utilities.field.Field
class pacman.model.constraints.key_allocator_constraints.FixedKeyAndMaskConstraint(keys_and_masks, key_list_function=None)[source]

Bases: pacman.model.constraints.key_allocator_constraints.abstract_key_allocator_constraint.AbstractKeyAllocatorConstraint

Key allocator constraint that fixes the key and mask of an edge

Parameters:
  • keys_and_masks (iterable of pacman.model.routing_info.BaseKeyAndMask) – The key and mask combinations to fix
  • key_list_function ((iterable of pacman.model.routing_info.BaseKeyAndMask, pacman.model.graph.machine.MachineEdge, int) -> iterable of int) – Optional function which will be called to translate the keys_and_masks list into individual keys. If missing, the keys will be generated by iterating through the keys_and_masks list directly. The function parameters are: * An iterable of keys and masks * A machine edge * Number of keys to generate (may be None)
key_list_function

A function to call to generate the keys

Returns:A python function, or None if the default function can be used
keys_and_masks

The keys and masks to be fixed

Returns:An iterable of key and mask combinations
Return type:iterable of pacman.model.routing_info.BaseKeyAndMask
class pacman.model.constraints.key_allocator_constraints.FixedMaskConstraint(mask)[source]

Bases: pacman.model.constraints.key_allocator_constraints.abstract_key_allocator_constraint.AbstractKeyAllocatorConstraint

A key allocator that fixes the mask to be assigned to an edge

Parameters:mask (int) – the mask to be used during key allocation
mask

The mask to be used

Returns:The mask to be used
Return type:int
class pacman.model.constraints.key_allocator_constraints.FlexiKeyFieldConstraint(fields)[source]

Bases: pacman.model.constraints.key_allocator_constraints.abstract_key_allocator_constraint.AbstractKeyAllocatorConstraint

Constraint that indicates fields in the mask without a specific size or position

fields