Commit 1e0e0635 authored by Hans-Peter Deifel's avatar Hans-Peter Deifel
Browse files

wta: Make --different-values optional

It doesn't make much sense for powerset, so now it's possible to omit it.
parent 76705fa2
......@@ -11,14 +11,18 @@ import scipy.stats as st
samples = 5
def from_maybe(default, x):
return default if x is None else x
# Edge Spec should be ("transitions", str) or ("zero-frequency", str)
def coalg_file(states, monoid, symbols, edge_spec, different_values, i):
if edge_spec[0] == "transitions":
return "bench/wta_%s_%s_t%s_%s_%s_%d" % (monoid, symbols, edge_spec[1],
different_values, states, i)
from_maybe("", different_values), states, i)
else:
return "bench/wta_%s_%s_%s_%s_%s_%d" % (monoid, symbols, edge_spec[1],
different_values, states, i)
from_maybe("", different_values), states, i)
def check_zerotrans(args):
......@@ -54,7 +58,8 @@ def generate(args):
cmd = [generator, "--states", states, "--monoid", monoid, "--symbols", symbols]
cmd += ["--" + edge_spec[0], edge_spec[1]]
cmd += ["--different-values", different_values]
if not (different_values is None):
cmd += ["--different-values", different_values]
subprocess.run(cmd, stdout=open(f, "w+"))
......@@ -82,7 +87,7 @@ def run_one(args, i):
stats['monoid'] = monoid
stats['symbols'] = symbols
stats['edge-spec'] = str(edge_spec)
stats['mon-values'] = different_values
stats['mon-values'] = from_maybe("", different_values)
stats['i'] = i
return stats
......@@ -257,7 +262,7 @@ def main():
gen_parser.add_argument('--symbols', required=True)
gen_parser.add_argument('--zero-frequency')
gen_parser.add_argument('--transitions')
gen_parser.add_argument('--different-values', required=True)
gen_parser.add_argument('--different-values')
gen_parser.set_defaults(func=generate)
run_parser = subparsers.add_parser('run')
......@@ -267,7 +272,7 @@ def main():
run_parser.add_argument('--symbols', required=True)
run_parser.add_argument('--zero-frequency')
run_parser.add_argument('--transitions')
run_parser.add_argument('--different-values', required=True)
run_parser.add_argument('--different-values')
run_parser.add_argument(
'--stddev', action='store_true', help="report stddev for timings")
run_parser.add_argument(
......@@ -283,7 +288,7 @@ def main():
bisect_parser.add_argument('--symbols', required=True)
bisect_parser.add_argument('--zero-frequency')
bisect_parser.add_argument('--transitions')
bisect_parser.add_argument('--different-values', required=True)
bisect_parser.add_argument('--different-values')
bisect_parser.add_argument('--start-states', type=int, default=50)
bisect_parser.add_argument('--good', type=int)
bisect_parser.add_argument('--bad', type=int)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment