diff options
author | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-05-25 13:24:37 +1000 |
---|---|---|
committer | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-05-25 13:24:37 +1000 |
commit | 61f90f14af8796bbed074538882e76f1e1bf3333 (patch) | |
tree | 5d1dc744b47817a39b905418b1fc76bb828cea4a /impl/systems/generate-system.py | |
parent | ee8547cf3c89c51ff10603814e6f745466bc4c79 (diff) |
Try to make some more modular Fixpoint algorithms.
Diffstat (limited to 'impl/systems/generate-system.py')
-rw-r--r-- | impl/systems/generate-system.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/impl/systems/generate-system.py b/impl/systems/generate-system.py new file mode 100644 index 0000000..cc67df2 --- /dev/null +++ b/impl/systems/generate-system.py @@ -0,0 +1,25 @@ +#!/usr/bin/python + +import random + +size = 10 + +def generate_variable(size): + return "x" + str(random.randint(1, size)) + +def generate_expression(size): + if random.randint(1, 5) == 1: + operator = random.choice(['+', '-']) + return generate_variable(size) + operator + generate_expression(size); + else: + return generate_variable(size) + +def generate_min_expression(size): + return "min(" + ",".join(generate_expression(size) for i in xrange(random.randint(2, 3))) + ")" + +def generate_max_expression(size): + return "max(" + ",".join(generate_min_expression(size) for i in xrange(random.randint(2, 3))) + ")" + + +for i in xrange(size): + print "x"+str(i+1) + " = " + generate_max_expression(size) |