Пример #1
0
    def __init__(self, keys_and_masks, key_list_function=None):
        """

        :param keys_and_masks: The key and mask combinations to fix
        :type keys_and_masks: iterable of\
                    :py:class:`pacman.model.routing_info.key_and_mask.BaseKeyAndMask`
        :param key_list_function: 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 partitioned edge
                    * Number of keys to generate (may be None)
        :type key_list_function: (iterable of\
                    :py:class:`pacman.model.routing_info.key_and_mask.BaseKeyAndMask`,\
                    :py:class:`pacman.model.partitioned_graph.partitioned_edge.PartitionedEdge`,
                    int)\
                    -> iterable of int
        """
        AbstractKeyAllocatorConstraint.__init__(
            self, "key allocator constraint to fix the keys and masks to"
            " {}".format(keys_and_masks))

        for keys_and_mask in keys_and_masks:
            if not isinstance(keys_and_mask, BaseKeyAndMask):
                raise exceptions.PacmanConfigurationException(
                    "the keys and masks object contains a object that is not"
                    "a key_and_mask object")

        self._keys_and_masks = keys_and_masks
        self._key_list_function = key_list_function
    def __init__(self, mask, fields=None):
        """

        :param mask: the mask to be used during key allocation
        :type mask: int
        :param fields: any fields that define regions in the mask with further\
                    limitations
        :type fields: iterable of :py:class:`pacman.utilities.field.Field`
        :raise 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
        """
        AbstractKeyAllocatorConstraint.__init__(
            self, "key allocator constraint where subedges coming from the "
                  "vertex requires a specific mask")
        self._mask = mask
        self._fields = None
        if fields is not None:
            for field in fields:
                if field.mask & mask != field.mask:
                    raise PacmanInvalidParameterException(
                        "The field mask {} is outside of the mask {}"
                        .format(field.mask, mask))
                for other_field in fields:
                    if (other_field != field and
                            other_field.mask & field.mask != 0):
                        raise PacmanInvalidParameterException(
                            "Field masks {} and {} overlap".format(
                                field.mask, other_field.mask))
            self._fields = sorted(fields, key=lambda field: field.mask,
                                  reverse=True)
    def __init__(self, keys_and_masks, key_list_function=None):
        """

        :param keys_and_masks: The key and mask combinations to fix
        :type keys_and_masks: iterable of\
                    :py:class:`pacman.model.routing_info.key_and_mask.BaseKeyAndMask`
        :param key_list_function: 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 partitioned edge
                    * Number of keys to generate (may be None)
        :type key_list_function: (iterable of\
                    :py:class:`pacman.model.routing_info.key_and_mask.BaseKeyAndMask`,\
                    :py:class:`pacman.model.partitioned_graph.partitioned_edge.PartitionedEdge`,
                    int)\
                    -> iterable of int
        """
        AbstractKeyAllocatorConstraint.__init__(
            self, "key allocator constraint to fix the keys and masks to" " {}".format(keys_and_masks)
        )

        for keys_and_mask in keys_and_masks:
            if not isinstance(keys_and_mask, BaseKeyAndMask):
                raise exceptions.PacmanConfigurationException(
                    "the keys and masks object contains a object that is not" "a key_and_mask object"
                )

        self._keys_and_masks = keys_and_masks
        self._key_list_function = key_list_function
    def __init__(self, mask):
        """

        :param mask: the mask to be used during key allocation
        :type mask: int
        :param fields: any fields that define regions in the mask with further\
                    limitations
        :type fields: iterable of :py:class:`pacman.utilities.field.Field`
        :raise 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
        """
        AbstractKeyAllocatorConstraint.__init__(
            self, "key allocator constraint where subedges coming from the "
            "vertex requires a specific mask")
        self._mask = mask
 def __init__(self):
     AbstractKeyAllocatorConstraint.__init__(self, "Key allocator constraint to ensure that keys are not split")
Пример #6
0
 def __init__(self, fields):
     AbstractKeyAllocatorConstraint.__init__(
         self, "Key allocator constraint where subedges coming from the "
         "partitioned_graph requires a set of fields which are "
         "flexible in nature")
     self._fields = fields
Пример #7
0
 def __init__(self):
     AbstractKeyAllocatorConstraint.__init__(
         self, "Key allocator constraint to ensure that keys are not split")