Source code for kosmos.dqc_scheduling.assignment_strategies.assignment_strategy
from abc import ABC, abstractmethod
from kosmos.dqc_scheduling.space_time_matrix import SpaceTimeMatrix
from kosmos.partitioning.partition import Partition
from kosmos.topology.net import Network
[docs]
class AssignmentStrategy(ABC):
"""Base class for partition assignment strategies.
Attributes:
network (Network): The network topology.
"""
def __init__(self, network: Network) -> None:
"""Initialize with network topology.
Args:
network (Network): Network containing QPU nodes with capacity info.
"""
self.network = network
[docs]
@abstractmethod
def allocate(self, partition: Partition) -> SpaceTimeMatrix:
"""Allocate partition into a space-time matrix.
Args:
partition (Partition): Partition to allocate.
Returns:
SpaceTimeMatrix: Matrix with allocated partition.
"""