tsnkit.algorithms package

Submodules

tsnkit.algorithms.at module

Author: <Chuanyu> (skewcy@gmail.com) at.py (c) 2023 Desc: description Created: 2023-10-27T23:29:21.848Z

class tsnkit.algorithms.at.at(workers=1, num_window=5)[source]

Bases: object

add_delay_const() None[source]
add_flow_tran_const() None[source]
add_frame_const() None[source]
add_frame_isolation_const() None[source]
add_frame_to_window_range_const() None[source]
add_window_const() None[source]
add_window_order_const() None[source]
add_window_overlap_const() None[source]
get_delay() Delay[source]
get_gcl() GCL[source]
get_offset() Release[source]
get_queue() Queue[source]
get_route() Route[source]
init(task_path: str, net_path: str) None[source]
output() Config[source]
prepare() None[source]
solve(**kwargs)
tsnkit.algorithms.at.benchmark(name, task_path, net_path, output_path='./', workers=1) Statistics[source]

tsnkit.algorithms.cg module

Author: <Chuanyu> (skewcy@gmail.com) cg.py (c) 2023 Desc: description Created: 2023-11-25T22:06:52.279Z

class tsnkit.algorithms.cg.NodeCG(id: int, f: Stream, path: Path, offset: int)[source]

Bases: object

init() None[source]
tsnkit.algorithms.cg.benchmark(name, task_path, net_path, output_path='./', workers=1) Statistics[source]
class tsnkit.algorithms.cg.cg(workers=1, opt_w=5, graph_w=5, max_w=20)[source]

Bases: object

ILP() Tuple[bool, Set[int] | None][source]
add_vertex(v: NodeCG)[source]
generator(task_set) bool[source]
get_delay() Delay[source]
get_gcl() GCL[source]
get_offset() Release[source]
get_queue() Queue[source]
get_route() Route[source]
init(task_path, net_path) None[source]
luby() Tuple[bool, Set[int] | None][source]
nods_to_streams(nodes: Set[int]) Set[Stream][source]
output() Config[source]
prepare() None[source]
solve(**kwargs)
stateful_generator(i: Stream) Tuple[int, List[Tuple[int, int]]] | None[source]
trigger_completion(miss_num: int) bool[source]
trigger_sure() bool[source]
tsnkit.algorithms.cg.conflict(i: NodeCG, j: NodeCG) bool[source]
tsnkit.algorithms.cg.get_paths(g: DiGraph, i: int, j: int) List[List[Tuple[int, int]]][source]

tsnkit.algorithms.cp_wa module

Author: <Chuanyu> (skewcy@gmail.com) cp_wa.py (c) 2023 Desc: description Created: 2023-10-28T17:57:24.749Z

tsnkit.algorithms.cp_wa.benchmark(name, task_path, net_path, output_path='./', workers=1) Statistics[source]
class tsnkit.algorithms.cp_wa.cp_wa(workers=1)[source]

Bases: object

add_delay_const()[source]
add_flow_trans_const()[source]
add_frame_const()[source]
add_frame_isolation_const()[source]
get_delay() Delay[source]
get_gcl_list() GCL[source]
get_offset() Release[source]
get_queue_assignment() Queue[source]
get_route() Route[source]
init(task_path: str, net_path: str) None[source]
output() Config[source]
prepare()[source]
solve(**kwargs)

tsnkit.algorithms.dt module

Author: <Chuanyu> (skewcy@gmail.com) dt.py (c) 2023 Desc: description Created: 2023-11-25T22:06:42.306Z

tsnkit.algorithms.dt.benchmark(name, task_path, net_path, output_path='./', workers=1) Statistics[source]
class tsnkit.algorithms.dt.dt(workers=1)[source]

Bases: object

collision_free_interval(i: Stream, j: Stream, link: Link) tuple[source]
get_delay() Delay[source]
get_gcl() GCL[source]
get_offset() Release[source]
get_queue() Queue[source]
get_route() Route[source]
init(task_path, net_path) None[source]
output() Config[source]
prepare() None[source]
solve(**kwargs)
tsnkit.algorithms.dt.mod(dividend: int, divisor: int) int[source]

tsnkit.algorithms.i_ilp module

tsnkit.algorithms.i_omt module

Author: <Chuanyu> (skewcy@gmail.com) i_omt.py (c) 2023 Desc: description Created: 2023-10-29T04:56:09.748Z

tsnkit.algorithms.i_omt.benchmark(name, task_path, net_path, output_path='./', workers=1) Statistics[source]
class tsnkit.algorithms.i_omt.i_omt(workers=1, delta=14)[source]

Bases: object

add_delay_const(iter: int) None[source]
add_flow_isolation_const(iter: int) None[source]
add_flow_trans_const(iter: int)[source]
add_obj() None[source]
add_range_constraint(iter: int) None[source]
add_time_validity_const(iter: int) None[source]
get_delay() Delay[source]
get_gcl_list() GCL[source]
get_offset() Release[source]
get_queue_assignment() Queue[source]
get_route() Route[source]
static get_weight(s: Stream)[source]
increase_c_q(res: ModelRef) None[source]
init(task_path, net_path) None[source]
init_var()[source]
output() Config[source]
prepare() None[source]
queue_assignment() None[source]
solve(**kwargs)

tsnkit.algorithms.jrs_mc module

tsnkit.algorithms.jrs_mc.benchmark(name, task_path, net_path, output_path='./', workers=1) Statistics[source]
class tsnkit.algorithms.jrs_mc.jrs_mc(workers=1)[source]

Bases: object

add_delay_const()[source]
add_flow_trans_const()[source]
add_frame_const()[source]
add_route_const()[source]
get_delay() Delay[source]
get_gcl() GCL[source]
get_offset() Release[source]
get_queue() Queue[source]
get_route() Route[source]
get_route_space(task: Stream) Set[Link][source]
init(task_path: str, net_path: str) None[source]
output() Config[source]
prepare() None[source]
set_queue() None[source]
solve(**kwargs)

tsnkit.algorithms.jrs_nw module

Author: <Chuanyu> (skewcy@gmail.com) jrs_nw.py (c) 2023 Desc: description Created: 2023-10-24T01:34:49.259Z

tsnkit.algorithms.jrs_nw.benchmark(name, task_path, net_path, output_path='./', workers=1) Statistics[source]
class tsnkit.algorithms.jrs_nw.jrs_nw(workers=1)[source]

Bases: object

add_delay_const()[source]
add_flow_trans_const()[source]
add_frame_const()[source]
add_route_const()[source]
get_delay() Delay[source]
get_gcl() GCL[source]
get_offset() Release[source]
get_queue() Queue[source]
get_route() Route[source]
get_route_space(task: Stream) Set[Link][source]
init(task_path: str, net_path: str) None[source]
output()[source]
prepare()[source]
solve(**kwargs)

tsnkit.algorithms.jrs_nw_l module

Author: <Chuanyu> (skewcy@gmail.com) jr_nw_l.py (c) 2023 Desc: description Created: 2023-10-24T03:51:06.135Z

tsnkit.algorithms.jrs_nw_l.benchmark(name, task_path, net_path, output_path='./', workers=1) Statistics[source]
class tsnkit.algorithms.jrs_nw_l.jrs_nw_l(workers)[source]

Bases: object

add_delay_const()[source]
add_flow_trans_const()[source]
add_frame_const()[source]
add_route_const()[source]
get_adj_nodes()[source]
get_delay() Delay[source]
get_gcl() GCL[source]
get_offset() Release[source]
get_queue() Queue[source]
get_route() Route[source]
init(task_path: str, net_path: str) None[source]
output()[source]
prepare()[source]
solve(**kwargs)

tsnkit.algorithms.jrs_wa module

Author: <Chuanyu> (skewcy@gmail.com) jrs_wa.py (c) 2023 Desc: description Created: 2023-10-23T20:22:16.816Z

tsnkit.algorithms.jrs_wa.benchmark(name, task_path, net_path, output_path='./', workers=1) Statistics[source]
class tsnkit.algorithms.jrs_wa.jrs_wa(workers=1)[source]

Bases: object

add_delay_const() None[source]
add_flow_trans_const()[source]
add_frame_const() None[source]
add_routing_const() None[source]
get_delay() Delay[source]
get_gcl() GCL[source]
get_offset() Release[source]
get_queue() Queue[source]
get_route() Route[source]
get_route_space(task: Stream) Set[Link][source]
init(task_path: str, net_path: str) None[source]
output() Config[source]
prepare() None[source]
set_queue() None[source]
solve(**kwargs)

tsnkit.algorithms.ls module

Author: <Chuanyu> (skewcy@gmail.com) ls.py (c) 2023 Desc: description Created: 2023-11-06T00:26:19.423Z

tsnkit.algorithms.ls.benchmark(name, task_path, net_path, output_path='./', workers=1) Statistics[source]
class tsnkit.algorithms.ls.ls(workers=1)[source]

Bases: object

find_inject_time(s: Stream, path: Path)[source]
get_delay() Delay[source]
get_gcl() GCL[source]
static get_nw_delay(task: Stream, path: Path)[source]
get_offset() Release[source]
get_queue() Queue[source]
get_route() Route[source]
init(task_path: str, net_path: str) None[source]
static match_time(t, sche) int[source]

Find the index of entry that starts just before t

Args:

t (_type_): _description_ sche (_type_): [start, end, queue]

Returns:

int: _description_

output() Config[source]
prepare() None[source]
schedule(task: Stream) bool[source]
solve(**kwargs)

tsnkit.algorithms.ls_pl module

Author: <Chuanyu> (skewcy@gmail.com) ls_pl.py (c) 2023 Desc: description Created: 2023-11-25T22:07:33.985Z

tsnkit.algorithms.ls_pl.benchmark(name, task_path, net_path, output_path='./', workers=1) Statistics[source]
tsnkit.algorithms.ls_pl.collision(l: Link, s: Stream, offset: int, sched_f: Dict[Link, Dict[Stream, List]], task: StreamSet) bool[source]
tsnkit.algorithms.ls_pl.get_potential_violate(l: Link, s: Stream, offset: int, sched_f: Dict[Link, Dict[Stream, List]], task: StreamSet) List[List[Any]][source]
class tsnkit.algorithms.ls_pl.ls_pl(workers=1)[source]

Bases: object

get_delay() Delay[source]
get_gcl() GCL[source]
get_offset() Release[source]
get_queue() Queue[source]
get_route() Route[source]
init(task_path: str, net_path: str) None[source]
output() Config[source]
prepare() None[source]
solve(**kwargs)
tsnkit.algorithms.ls_pl.merge_dict(dict1, dict2)[source]
tsnkit.algorithms.ls_pl.order1(i: Stream, j: Stream, o_i: int, on_i: int, o_j: int, on_j: int, task: StreamSet)[source]
tsnkit.algorithms.ls_pl.order2(i: Stream, j: Stream, o_i: int, on_i: int, o_j: int, on_j: int, task: StreamSet)[source]
tsnkit.algorithms.ls_pl.schedule_and_update(l: Link, sched_f: Dict[Link, Dict[Stream, List]], result: Dict[Link, Dict[Stream, List]], l2f: Dict[Link, List[Stream]], task: StreamSet)[source]
tsnkit.algorithms.ls_pl.topology_sort(net: Dict[Link, List[Link]]) List[Set[Link]] | None[source]

tsnkit.algorithms.ls_tb module

Author: <Chuanyu> (skewcy@gmail.com) ls_tb.py (c) 2023 Desc: description Created: 2023-10-31T02:34:04.531Z

tsnkit.algorithms.ls_tb.benchmark(name, task_path, net_path, output_path='./', workers=1) Statistics[source]
class tsnkit.algorithms.ls_tb.ls_tb(workers=1)[source]

Bases: object

check(k: int, val: Tuple[int, int])[source]
crit(f: Tuple[Stream, Link]) float[source]
get_bounds(k: int)[source]

_summary_

Args:

k (int): Task index

Returns:

(int, int): (earliest time , queue)

get_delay() Delay[source]
get_gcl() GCL[source]
get_offset() Release[source]
get_queue() Queue[source]
get_route() Route[source]
get_var() Tuple[Stream, Link][source]
init(task_path, net_path) None[source]
output() Config[source]
prepare() None[source]
solve(**kwargs)

tsnkit.algorithms.smt_fr module

Author: <Chuanyu> (skewcy@gmail.com) smt_fr.py (c) 2023 Desc: description Created: 2023-10-28T13:58:46.205Z

tsnkit.algorithms.smt_fr.benchmark(name, task_path, net_path, output_path='./', workers=1) Statistics[source]
class tsnkit.algorithms.smt_fr.smt_fr(workers=1, u=5, mss=1500)[source]

Bases: object

add_delay_const() None[source]
add_frame_const() None[source]
add_seg_const() None[source]
get_delay() Delay[source]
get_delay_perhop() Dict[Stream, Dict[int, Dict[Link, ArithRef]]][source]
get_gcl_list() GCL[source]
get_queue_assignment() Queue[source]
get_release_time() Release[source]
get_route() Route[source]
get_size() Size[source]
init(task_path, net_path) None[source]
output() Config[source]
prepare() None[source]
solve(**kwargs)

tsnkit.algorithms.smt_nw module

Author: <Chuanyu> (skewcy@gmail.com) smt_nw.py (c) 2023 Desc: description Created: 2023-10-22T17:59:16.407Z

tsnkit.algorithms.smt_nw.benchmark(name, task_path, net_path, output_path='./', workers=1) Statistics[source]
class tsnkit.algorithms.smt_nw.smt_nw(workers=1)[source]

Bases: object

add_delay_const() None[source]
add_frame_const() None[source]
get_delay() Delay[source]
static get_delay_perhop(task: StreamSet) Dict[Stream, Dict[Link, int]][source]
get_gcl() GCL[source]
get_offset() Release[source]
get_queue() Queue[source]
get_route() Route[source]
init(task_path: str, net_path: str) None[source]
output()[source]
prepare() None[source]
solve(**kwargs)

tsnkit.algorithms.smt_pr module

Author: <Chuanyu> (skewcy@gmail.com) smt_pr.py (c) 2023 Desc: description Created: 2023-10-29T00:04:36.044Z

tsnkit.algorithms.smt_pr.benchmark(name, task_path, net_path, output_path='./', workers=1) Statistics[source]
class tsnkit.algorithms.smt_pr.smt_pr(workers=1, num_segs=1)[source]

Bases: object

add_delay_const()[source]
add_flow_trans_const()[source]
add_frame_const()[source]
add_segments_const()[source]
get_delay() Delay[source]
get_gcl_list() GCL[source]
get_queue_assignment() Queue[source]
get_release_time() Release[source]
get_route() Route[source]
init(task_path, net_path) None[source]
output() Config[source]
prepare() None[source]
set_queue_assignment() None[source]
set_task_var() None[source]
solve(**kwargs)

tsnkit.algorithms.smt_wa module

Author: Chuanyu (skewcy@gmail.com) smt_wa.py (c) 2023 Desc: description Created: 2023-10-11T01:17:57.050Z

tsnkit.algorithms.smt_wa.benchmark(name, task_path, net_path, output_path='./', workers=1) Statistics[source]
class tsnkit.algorithms.smt_wa.smt_wa(workers=1)[source]

Bases: object

static add_delay_const(solver: Solver, var: Dict[Stream, Dict[Link, Dict[str, ArithRef]]]) None[source]
static add_flow_trans_const(solver: Solver, var: Dict[Stream, Dict[Link, Dict[str, ArithRef]]]) None[source]
static add_frame_const(solver: Solver, var: Dict[Stream, Dict[Link, Dict[str, ArithRef]]]) None[source]
static add_frame_isolation_const(solver: Solver, var: Dict[Stream, Dict[Link, Dict[str, ArithRef]]], task: StreamSet) None[source]
static add_queue_range_const(solver: Solver, var: Dict[Stream, Dict[Link, Dict[str, ArithRef]]]) None[source]
static create_task_vars(tasks: StreamSet) Dict[Stream, Dict[Link, Dict[str, ArithRef]]][source]
static get_delay(result, var) Delay[source]
static get_gcl_list(result, var: Dict[Stream, Dict[Link, Dict[str, ArithRef]]], lcm: int) GCL[source]
static get_queue_assignment(result, var) Queue[source]
static get_release_time(result, var: Dict[Stream, Dict[Link, Dict[str, ArithRef]]]) Release[source]
static get_route(var) Route[source]
init(task_path, net_path) None[source]
output() Config[source]
prepare() None[source]
solve(**kwargs)

Module contents

Author: Chuanyu (skewcy@gmail.com) __init__.py (c) 2023 Desc: description Created: 2023-10-09T00:02:25.471Z

DESC:

This is the template for how to integrate a new method into this benchmark. Please refer other methods for more details.

class tsnkit.algorithms._Method(name)[source]

Bases: ABC

_abc_impl = <_abc._abc_data object>
abstractmethod init(task_path: str, network_path: str) bool[source]

Init the method with the task and network

Args:

task_path (str): file path of the task network_path (str): file path of the network

Returns:

bool: True if success

abstractmethod output() Config[source]

Return the standard output format

Returns:

Config object

abstractmethod prepare() bool[source]

Add constraints / preparation to the solver. Can simply return True if no constraints are needed (usually when no solver used).

Returns:

bool: True if success

abstractmethod solve() Statistics[source]

Solve the problem and return the statistics

Returns:

Statistics object

tsnkit.algorithms.benchmark(name: str, task_path: str, net_path: str, output_path: str = './', workers: int = 1) Statistics[source]

Implement this function to benchmark your method

Args:

name (str): experiment name task_path (str): file path of the task net_path (str): file path of the network output_path (str): output folder path workers (int): number of workers

Returns:

Statistics object