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 | |
parent | ee8547cf3c89c51ff10603814e6f745466bc4c79 (diff) |
Try to make some more modular Fixpoint algorithms.
Diffstat (limited to 'impl/systems')
-rw-r--r-- | impl/systems/.long-fixpoint.swp | bin | 0 -> 188416 bytes | |||
-rw-r--r-- | impl/systems/generate-system.py | 25 | ||||
-rw-r--r-- | impl/systems/long-fixpoint | 100 | ||||
-rw-r--r-- | impl/systems/min-test | 3 | ||||
-rw-r--r-- | impl/systems/random-system | 1 | ||||
-rw-r--r-- | impl/systems/size-ten | 3 |
6 files changed, 132 insertions, 0 deletions
diff --git a/impl/systems/.long-fixpoint.swp b/impl/systems/.long-fixpoint.swp Binary files differnew file mode 100644 index 0000000..726d6ce --- /dev/null +++ b/impl/systems/.long-fixpoint.swp 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) diff --git a/impl/systems/long-fixpoint b/impl/systems/long-fixpoint new file mode 100644 index 0000000..1ab7897 --- /dev/null +++ b/impl/systems/long-fixpoint @@ -0,0 +1,100 @@ +x0 = 0 +x1 = x0 +x2 = x1 +x3 = x2 +x4 = x3 +x5 = x4 +x6 = x5 +x7 = x6 +x8 = x7 +x9 = x8 +x10 = x9 +x11 = x10 +x12 = x11 +x13 = x12 +x14 = x13 +x15 = x14 +x16 = x15 +x17 = x16 +x18 = x17 +x19 = x18 +x20 = x19 +x21 = x20 +x22 = x21 +x23 = x22 +x24 = x23 +x25 = x24 +x26 = x25 +x27 = x26 +x28 = x27 +x29 = x28 +x30 = x29 +x31 = x30 +x32 = x31 +x33 = x32 +x34 = x33 +x35 = x34 +x36 = x35 +x37 = x36 +x38 = x37 +x39 = x38 +x40 = x39 +x41 = x40 +x42 = x41 +x43 = x42 +x44 = x43 +x45 = x44 +x46 = x45 +x47 = x46 +x48 = x47 +x49 = x48 +x50 = x49 +x51 = x50 +x52 = x51 +x53 = x52 +x54 = x53 +x55 = x54 +x56 = x55 +x57 = x56 +x58 = x57 +x59 = x58 +x60 = x59 +x61 = x60 +x62 = x61 +x63 = x62 +x64 = x63 +x65 = x64 +x66 = x65 +x67 = x66 +x68 = x67 +x69 = x68 +x70 = x69 +x71 = x70 +x72 = x71 +x73 = x72 +x74 = x73 +x75 = x74 +x76 = x75 +x77 = x76 +x78 = x77 +x79 = x78 +x80 = x79 +x81 = x80 +x82 = x81 +x83 = x82 +x84 = x83 +x85 = x84 +x86 = x85 +x87 = x86 +x88 = x87 +x89 = x88 +x90 = x89 +x91 = x90 +x92 = x91 +x93 = x92 +x94 = x93 +x95 = x94 +x96 = x95 +x97 = x96 +x98 = x97 +x99 = x98 diff --git a/impl/systems/min-test b/impl/systems/min-test new file mode 100644 index 0000000..a05a662 --- /dev/null +++ b/impl/systems/min-test @@ -0,0 +1,3 @@ +x1 = min(1, x1) +x2 = min(x2+1, x3) +x3 = 0 diff --git a/impl/systems/random-system b/impl/systems/random-system new file mode 100644 index 0000000..506c18a --- /dev/null +++ b/impl/systems/random-system @@ -0,0 +1 @@ +x = max() diff --git a/impl/systems/size-ten b/impl/systems/size-ten new file mode 100644 index 0000000..71ee74a --- /dev/null +++ b/impl/systems/size-ten @@ -0,0 +1,3 @@ +x1 = max(0, min(x1-1, x2)) +x2 = max(0, 5+x1, x1) +x3 = max(0, 1+x3, 0+x1) |