From bc2c3f3a3da897d456970aa2abdb9bf20fa27c31 Mon Sep 17 00:00:00 2001 From: Artur Meski Date: Wed, 3 Jan 2018 22:47:57 +0000 Subject: [PATCH] Powerset limited to max two components --- rs_testing.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rs_testing.py b/rs_testing.py index 7d0b514..bf3d20b 100644 --- a/rs_testing.py +++ b/rs_testing.py @@ -9,9 +9,11 @@ from itertools import chain, combinations import sys import resource -def powerset(iterable): +def powerset(iterable,N=None): + if N is None: + N = len(s) s = list(iterable) - return chain.from_iterable(combinations(s, r) for r in range(len(s)+1)) + return chain.from_iterable(combinations(s, r) for r in range(N+1)) def run_tests(cmd_args): @@ -89,7 +91,7 @@ def mutex(cmd_args): # the experiments starts with adding x and y: c.add_transition("0", init_ctx, "1") - all_act = powerset([E("act",i) for i in range(n_proc)]) + all_act = powerset([E("act",i) for i in range(n_proc)], 2) for actions in all_act: actions = list(actions)