Implementation of Scheduling Algorithms¶
Supported algorithms¶
Currently, the following scheduling algorithms are implemented in tsnkit. You can use them by running
## python3 -m tsnkit.algorithms.<algorithm> <task_file> <topo_file>
## For example:
python3 -m tsnkit.algorithms.smt_wa ./task.csv ./topo.csv
The detailed description of each algorithm and their corresponding system model can be found in our paper.
Contribution¶
Contributing new algorithms¶
It is very welcome to contribute new algorithms to tsnkit. To do so, you need to create a new class in tsnkit.algorithms with a new .py file that implements the interface class _Method. The full description can be found in tsnkit.algorithms.__init__.py file. You can refer the implementation of other algorithms in tsnkit.algorithms folder.
class _Method(ABC):
@abstractmethod
def init(self, task_path: str, network_path: str) -> bool
@abstractmethod
def prepare(self) -> bool
@abstractmethod
def solve(self) -> Statistics
@abstractmethod
def output(self) -> Config
We use github flow to propose changes to the codebase. Make sure you have done local testing with the provided simulation tool or by your hand before submitting a pull request.
Coding style:¶
Avoid directly loading algorithm input files. Instead, utilize the
load_streamandload_networkfunctions provided bytsnkit.core. These functions are essential as they perform checks on the input file format and ensure the integrity and fairness of benchmarking results. It is also recommended to use theStreamandNetworkdata structure.It is crucial to implement the benchmark entry function in your code. You may replicate this function from existing model files, ensuring to update the class name appropriately to fit your model.
This project follows PEP 484 type hints. Please make sure all the functions are annotated with type hints and pass the type check. Mypy static type checker is recommended during development process.