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.key_allocator_contiguous_range_constraint module

class pacman.model.constraints.key_allocator_constraints.key_allocator_contiguous_range_constraint.KeyAllocatorContiguousRangeContraint[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.key_allocator_fixed_field_constraint module

class pacman.model.constraints.key_allocator_constraints.key_allocator_fixed_field_constraint.KeyAllocatorFixedFieldConstraint(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.key_allocator_fixed_key_and_mask_constraint module

class pacman.model.constraints.key_allocator_constraints.key_allocator_fixed_key_and_mask_constraint.KeyAllocatorFixedKeyAndMaskConstraint(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.key_and_mask.BaseKeyAndMask) – The key and mask combinations to fix
  • key_list_function ((iterable of pacman.model.routing_info.key_and_mask.BaseKeyAndMask, pacman.model.graph.machine.machine_edge.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.key_and_mask.BaseKeyAndMask

pacman.model.constraints.key_allocator_constraints.key_allocator_fixed_mask_constraint module

class pacman.model.constraints.key_allocator_constraints.key_allocator_fixed_mask_constraint.KeyAllocatorFixedMaskConstraint(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.key_allocator_flexi_field_constraint module

class pacman.model.constraints.key_allocator_constraints.key_allocator_flexi_field_constraint.KeyAllocatorFlexiFieldConstraint(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.KeyAllocatorContiguousRangeContraint[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.KeyAllocatorFixedFieldConstraint(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.KeyAllocatorFixedKeyAndMaskConstraint(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.key_and_mask.BaseKeyAndMask) – The key and mask combinations to fix
  • key_list_function ((iterable of pacman.model.routing_info.key_and_mask.BaseKeyAndMask, pacman.model.graph.machine.machine_edge.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.key_and_mask.BaseKeyAndMask
class pacman.model.constraints.key_allocator_constraints.KeyAllocatorFixedMaskConstraint(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.KeyAllocatorFlexiFieldConstraint(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