Browse Source

Initial push to public repository

Yentl Van Tendeloo 8 years ago
commit
d8129147f9
81 changed files with 32590 additions and 0 deletions
  1. 166 0
      examples/client.py
  2. 28 0
      examples/experiment.py
  3. 24 0
      examples/experiment_mem_forward.py
  4. 25 0
      examples/experiment_memdisk_periodical.py
  5. 29 0
      examples/experiment_time_backwards.py
  6. 42 0
      examples/experiment_time_fakejump.py
  7. 27 0
      examples/experiment_time_forward.py
  8. 29 0
      examples/experiment_time_jump.py
  9. 27 0
      examples/experiment_time_total.py
  10. 34 0
      examples/model.py
  11. 112 0
      examples/plot
  12. 16 0
      examples/result_10
  13. 911 0
      examples/result_10.eps
  14. 834 0
      examples/result_10_mini.eps
  15. 10 0
      examples/result_1a
  16. 847 0
      examples/result_1a.eps
  17. 10 0
      examples/result_1b
  18. 814 0
      examples/result_1b.eps
  19. 20 0
      examples/result_2a
  20. 20 0
      examples/result_2a-bis
  21. 864 0
      examples/result_2a-bis.eps
  22. 886 0
      examples/result_2a.eps
  23. 10 0
      examples/result_2b
  24. 867 0
      examples/result_2b.eps
  25. 16 0
      examples/result_3
  26. 777 0
      examples/result_3.eps
  27. 992 0
      examples/result_4.eps
  28. 100 0
      examples/result_4a
  29. 100 0
      examples/result_4b
  30. 1000 0
      examples/result_5a
  31. 2832 0
      examples/result_5a.eps
  32. 1000 0
      examples/result_5b
  33. 2843 0
      examples/result_5b.eps
  34. 10 0
      examples/result_6
  35. 878 0
      examples/result_6.eps
  36. 20 0
      examples/result_7a
  37. 897 0
      examples/result_7a.eps
  38. 20 0
      examples/result_7b
  39. 864 0
      examples/result_7b.eps
  40. 16 0
      examples/result_8
  41. 812 0
      examples/result_8.eps
  42. 10 0
      examples/result_9
  43. 834 0
      examples/result_9.eps
  44. 6 0
      examples/run_client.sh
  45. 227 0
      examples/run_experiments.py
  46. 6 0
      run_benchmarks.sh
  47. 536 0
      src/DEVS.py
  48. 17 0
      src/devsexception.py
  49. 1 0
      src/infinity.py
  50. 0 0
      src/python_runtime/__init__.py
  51. 9 0
      src/python_runtime/accurate_time.py
  52. 58 0
      src/python_runtime/event_queue.py
  53. 3 0
      src/python_runtime/infinity.py
  54. 1 0
      src/python_runtime/libs/__init__.py
  55. 59 0
      src/python_runtime/libs/drawing.py
  56. 107 0
      src/python_runtime/libs/ui.py
  57. 19 0
      src/python_runtime/libs/utils.py
  58. 22 0
      src/python_runtime/nextafter.py
  59. 941 0
      src/python_runtime/statecharts_core.py
  60. 21 0
      src/python_runtime/tkinter_eventloop.py
  61. 0 0
      src/python_sccd_compiler/__init__.py
  62. 14 0
      src/python_sccd_compiler/compiler_exceptions.py
  63. 911 0
      src/python_sccd_compiler/generic_generator.py
  64. 990 0
      src/python_sccd_compiler/generic_language_constructs.py
  65. 285 0
      src/python_sccd_compiler/javascript_writer.py
  66. 170 0
      src/python_sccd_compiler/lexer.py
  67. 701 0
      src/python_sccd_compiler/old_generators/csharp_generator.py
  68. 741 0
      src/python_sccd_compiler/old_generators/javascript_generator.py
  69. 644 0
      src/python_sccd_compiler/old_generators/python_generator.py
  70. 81 0
      src/python_sccd_compiler/path_calculator.py
  71. 353 0
      src/python_sccd_compiler/python_writer.py
  72. 1131 0
      src/python_sccd_compiler/sccd_constructs.py
  73. 129 0
      src/python_sccd_compiler/sccdc.py
  74. 156 0
      src/python_sccd_compiler/state_linker.py
  75. 222 0
      src/python_sccd_compiler/stateful_writer.py
  76. 52 0
      src/python_sccd_compiler/super_class_linker.py
  77. 118 0
      src/python_sccd_compiler/utils.py
  78. 30 0
      src/python_sccd_compiler/visitor.py
  79. 1940 0
      src/sccd.py
  80. 1040 0
      src/sccd.xml
  81. 176 0
      src/scheduler.py

+ 166 - 0
examples/client.py

@@ -0,0 +1,166 @@
+print("SCCD PythonPDEVS CLI interface")
+import sys
+import time
+sys.path.append("../src/")
+from python_runtime.statecharts_core import Event
+
+import sccd
+from model import Root
+# Omniscient = (max_seconds_to_jump, max_bytes_memory_used)
+omniscient = (0.5, 1000)
+#omniscient = (0, 1000)
+params = (10, 100, 0.001)
+controller = sccd.Controller(Root(*params), omniscient)
+reply_port = controller.addOutputListener('reply')
+
+def set_defaults(inp, defaultlist):
+    for i, v in enumerate(defaultlist):
+        if len(inp) == i + 1:
+            inp.append(v)
+
+def get_bool(val):
+    if val.lower() in ["true", "yes", "1"]:
+        return True
+    else:
+        return False
+
+def poll_port(port):
+    while 1:
+        try:
+            v = port.fetch(-1)
+            if v is not None:
+                print(v)
+        except:
+            pass
+
+try:
+    import threading
+    thrd = threading.Thread(target=poll_port,args=[reply_port])
+    thrd.daemon = True
+    thrd.start()
+    time.sleep(0.001)
+    controller.start()
+    print("READY for input")
+    print("Type 'help' for information")
+    while 1:
+        inp = raw_input().split(" ")
+        action = inp[0]
+        if inp[0] == "simulate":
+            set_defaults(inp, ['inf'])
+            params = [{"termination_time": float(inp[1])}]
+        elif inp[0] == "big_step":
+            set_defaults(inp, ['inf'])
+            params = [{"termination_time": float(inp[1])}]
+        elif inp[0] == "realtime":
+            set_defaults(inp, ['inf', 1.0])
+            params = [{"termination_time": float(inp[1]), "realtime_scale": float(inp[2])}]
+        elif inp[0] == "small_step":
+            set_defaults(inp, ['inf'])
+            params = [{"termination_time": float(inp[1])}]
+        elif inp[0] == "god_event":
+            if len(inp) != 4:
+                print("God Events require 3 parameters!")
+                continue
+            params = [{"model": inp[1], "attribute": inp[2], "value": inp[3]}]
+        elif inp[0] == "inject":
+            if len(inp) != 4:
+                print("Injects require 3 parameters!")
+                continue
+            params = [{"time": float(inp[1]), "port": inp[2], "event": inp[3]}]
+        elif inp[0] == "trace":
+            set_defaults(inp, [None])
+            params = [inp[1]]
+        elif inp[0] == "pause":
+            params = []
+        elif inp[0] == "exit" or inp[0] == "quit":
+            break
+        elif inp[0] == "add_breakpoint":
+            if len(inp) < 5:
+                print("Breakpoint removal requires 2 parameters!")
+                continue
+            # Merge together the final part again
+            inp = [inp[0], inp[1], " ".join(inp[2:-2]).replace("\\n", "\n"), get_bool(inp[-2]), get_bool(inp[-1])]
+            print("Generated parameters: " + str(inp))
+            params = inp[1:]
+        elif inp[0] == "del_breakpoint":
+            if len(inp) < 2:
+                print("Breakpoint removal requires 1 parameter!")
+                continue
+            params = [inp[1]]
+        elif inp[0] == "enable_breakpoint":
+            action = "toggle_breakpoint"
+            params = [inp[1], True]
+        elif inp[0] == "disable_breakpoint":
+            action = "toggle_breakpoint"
+            params = [inp[1], False]
+        elif inp[0] == "reset":
+            params = []
+        elif inp[0] == "backwards_step":
+            params = []
+        elif inp[0] == "jump":
+            if len(inp) != 2:
+                print("Jump requires a destination time")
+                continue
+            params = [float(inp[1])]
+        elif inp[0] == "help":
+            print("Supported operations:")
+            print("  simulate [termination_time]")
+            print("       Simulate until termination time is reached")
+            print("  big_step [termination_time]")
+            print("       Simulate a single step, unless termination time is reached")
+            print("  small_step [termination_time]")
+            print("       Simulate a single internal simulation step")
+            print("       Termination time is ONLY checked at the")
+            print("       check_termination phase")
+            print("  backwards_step")
+            print("       Step back to the previous time")
+            print("  jump time")
+            print("       Jump back in time")
+            print("  realtime [termination_time [realtime_scale]]")
+            print("       Simulate in realtime until simulation time is reached")
+            print("       realtime_scale can speed up or slow down the pace")
+            print("  god_event model_name attribute_name new_value")
+            print("       Modify the internal state of an arbitrary model")
+            print("       model_name should be the fully qualified name")
+            print("       attribute_name is the name of the attribute to alter")
+            print("       new_value is the value to assign")
+            print("       new_value can only be a string due to string-only input")
+            print("  inject time port_name event")
+            print("       Put a user-defined event on an input port")
+            print("       port_name should be a fully qualified port name")
+            print("       event should be the event to put on it, string only")
+            print("  trace [filename]")
+            print("       Write out trace information to the specified file.")
+            print("       Leave empty to disable tracing.")
+            print("  add_breakpoint id function enabled disable_on_trigger")
+            print("       Add a breakpoint that will pause simulation when function returns True")
+            print("       the function should contain a definition of the 'breakpoint' function")
+            print("       and must take 3 parameters: time, model and transitioned")
+            print("       enabled indicates whether or not the breakpoint should be checked")
+            print("       disable_on_trigger determines if the breakpoint should auto-disable")
+            print("       after being triggered")
+            print("  del_breakpoint id")
+            print("       Remove a breakpoint")
+            print("  enable_breakpoint id")
+            print("       Enable the provided breakpoint")
+            print("  disable_breakpoint id")
+            print("       Disable the provided breakpoint")
+            print("  reset")
+            print("       Reset the simulation")
+            print("  exit")
+            print("       Stop the client")
+            print("  pause")
+            print("       Pause the simulation")
+            print("  quit")
+            print("       Stop the client")
+            print("")
+            print("Defaults: ")
+            print("  termination_time = 'inf'")
+            print("  realtime_scale   = 1.0")
+            continue
+        else:
+            print("Command not understood: " + str(inp))
+            continue
+        controller.addInput(Event(action, "request", params))
+finally:
+    controller.stop()

+ 28 - 0
examples/experiment.py

@@ -0,0 +1,28 @@
+import sys
+import time
+sys.path.append("../src/")
+from python_runtime.statecharts_core import Event
+
+import random
+random.seed(1)
+
+import sccd
+from model import Root
+omniscient = (float(sys.argv[1]), int(sys.argv[2]))
+params = (int(sys.argv[3]), int(sys.argv[4]), float(sys.argv[5]))
+controller = sccd.Controller(Root(*params), omniscient)
+controller.start()
+reply_port = controller.addOutputListener('reply')
+
+params = [{"termination_time": 1000}]
+controller.addInput(Event("simulate", "request", params))
+reply_port.fetch(-1)
+reply_port.fetch(-1)
+params = [500]
+start = time.time()
+controller.addInput(Event("jump", "request", params))
+reply_port.fetch(-1)
+end = time.time()
+controller.stop()
+
+print(end - start)

+ 24 - 0
examples/experiment_mem_forward.py

@@ -0,0 +1,24 @@
+import sys
+import time
+sys.path.append("../src/")
+from python_runtime.statecharts_core import Event
+import resource
+
+import random
+random.seed(1)
+
+import sccd
+from model import Root
+omniscient = (float(sys.argv[1]), int(sys.argv[2]))
+params = (int(sys.argv[3]), int(sys.argv[4]), float(sys.argv[5]))
+model = Root(*params)
+controller = sccd.Controller(model, omniscient)
+controller.start()
+reply_port = controller.addOutputListener('reply')
+
+params = [{"termination_time": 1000}]
+controller.addInput(Event("simulate", "request", params))
+reply_port.fetch(-1)
+controller.stop()
+
+print(resource.getrusage(resource.RUSAGE_SELF).ru_maxrss * 1000)

+ 25 - 0
examples/experiment_memdisk_periodical.py

@@ -0,0 +1,25 @@
+import sys
+import time
+sys.path.append("../src/")
+from python_runtime.statecharts_core import Event
+import resource
+
+import shutil
+shutil.rmtree("store")
+
+import random
+random.seed(1)
+
+import sccd
+from model import Root
+omniscient = (float(sys.argv[1]), int(sys.argv[2]))
+params = (int(sys.argv[3]), int(sys.argv[4]), float(sys.argv[5]))
+model = Root(*params)
+controller = sccd.Controller(model, omniscient)
+controller.start()
+reply_port = controller.addOutputListener('reply')
+
+params = [{"termination_time": 1000, "monitor_memory": True}]
+controller.addInput(Event("simulate", "request", params))
+reply_port.fetch(-1)
+controller.stop()

+ 29 - 0
examples/experiment_time_backwards.py

@@ -0,0 +1,29 @@
+import sys
+import time
+sys.path.append("../src/")
+from python_runtime.statecharts_core import Event
+
+import random
+random.seed(1)
+
+import sccd
+from model import Root
+omniscient = (float(sys.argv[1]), int(sys.argv[2]))
+params = (int(sys.argv[3]), int(sys.argv[4]), float(sys.argv[5]))
+controller = sccd.Controller(Root(*params), omniscient)
+reply_port = controller.addOutputListener('reply')
+controller.start()
+
+params = [{"termination_time": 1000}]
+controller.addInput(Event("simulate", "request", params))
+reply_port.fetch(-1)
+reply_port.fetch(-1)
+reply_port.fetch(-1)
+start = time.time()
+params = []
+controller.addInput(Event("backwards_step", "request", params))
+reply_port.fetch(-1)
+end = time.time()
+controller.stop()
+
+print(end - start)

+ 42 - 0
examples/experiment_time_fakejump.py

@@ -0,0 +1,42 @@
+import sys
+import time
+import cPickle
+sys.path.append("../src/")
+from python_runtime.statecharts_core import Event
+
+import random
+random.seed(1)
+
+import sccd
+from model import Root
+omniscient = (float(sys.argv[1]), int(sys.argv[2]))
+params = (int(sys.argv[3]), int(sys.argv[4]), float(sys.argv[5]))
+model = Root(*params)
+controller = sccd.Controller(model, omniscient)
+reply_port = controller.addOutputListener('reply')
+controller.start()
+
+params = [{"termination_time": 100}]
+controller.addInput(Event("simulate", "request", params))
+reply_port.fetch(-1)
+reply_port.fetch(-1)
+reply_port.fetch(-1)
+
+repetitions = 10
+core_sim = list(controller.object_manager.instances)[0]
+core_sim.max_transition_time = float('inf')
+
+for i in reversed(range(0, 100)):
+    tottime = 0.0
+    for _ in range(repetitions):
+        start = time.time()
+        controller.addInput(Event("jump", "request", [i]))
+        reply_port.fetch(-1)    # Terminate
+        reply_port.fetch(-1)    # All states
+        tottime += (time.time() - start)
+        controller.addInput(Event("simulate", "request", params))
+        reply_port.fetch(-1)    # Terminate
+        reply_port.fetch(-1)    # All states
+    print("%s %s" % (i, (tottime / repetitions)))
+
+controller.stop()

+ 27 - 0
examples/experiment_time_forward.py

@@ -0,0 +1,27 @@
+import sys
+import time
+sys.path.append("../src/")
+from python_runtime.statecharts_core import Event
+
+import random
+random.seed(1)
+
+import sccd
+from model import Root
+omniscient = (float(sys.argv[1]), int(sys.argv[2]))
+params = (int(sys.argv[3]), int(sys.argv[4]), float(sys.argv[5]))
+model = Root(*params)
+controller = sccd.Controller(model, omniscient)
+reply_port = controller.addOutputListener('reply')
+controller.start()
+
+params = [{"termination_time": 1000}]
+start = time.time()
+controller.addInput(Event("simulate", "request", params))
+reply_port.fetch(-1)
+reply_port.fetch(-1)
+end = time.time()
+controller.stop()
+
+diff = end - start
+print(diff / sum([m.state.mem[0] for m in model.componentSet]))

+ 29 - 0
examples/experiment_time_jump.py

@@ -0,0 +1,29 @@
+import sys
+import time
+sys.path.append("../src/")
+from python_runtime.statecharts_core import Event
+
+import random
+random.seed(1)
+
+import sccd
+from model import Root
+omniscient = (float(sys.argv[1]), int(sys.argv[2]))
+params = (int(sys.argv[3]), int(sys.argv[4]), float(sys.argv[5]))
+controller = sccd.Controller(Root(*params), omniscient)
+reply_port = controller.addOutputListener('reply')
+controller.start()
+
+params = [{"termination_time": 1000}]
+controller.addInput(Event("simulate", "request", params))
+reply_port.fetch(-1)
+reply_port.fetch(-1)
+reply_port.fetch(-1)
+params = [500]
+start = time.time()
+controller.addInput(Event("jump", "request", params))
+reply_port.fetch(-1)
+end = time.time()
+controller.stop()
+
+print(end - start)

+ 27 - 0
examples/experiment_time_total.py

@@ -0,0 +1,27 @@
+import sys
+import time
+sys.path.append("../src/")
+from python_runtime.statecharts_core import Event
+
+import random
+random.seed(1)
+
+import sccd
+from model import Root
+omniscient = (float(sys.argv[1]), int(sys.argv[2]))
+params = (int(sys.argv[3]), int(sys.argv[4]), float(sys.argv[5]))
+model = Root(*params)
+controller = sccd.Controller(model, omniscient)
+reply_port = controller.addOutputListener('reply')
+controller.start()
+
+params = [{"termination_time": 1000}]
+start = time.time()
+controller.addInput(Event("simulate", "request", params))
+reply_port.fetch(-1)
+reply_port.fetch(-1)
+end = time.time()
+controller.stop()
+
+diff = end - start
+print(diff)

+ 34 - 0
examples/model.py

@@ -0,0 +1,34 @@
+import sys
+sys.path.append("../../pypdevs/src/")
+
+from DEVS import *
+from infinity import INFINITY
+
+import random
+import time
+
+class AtomicState(object):
+    def __init__(self, size):
+        self.mem = [0] * size
+
+class Atomic(AtomicDEVS):
+    def __init__(self, num, size, computation_time):
+        AtomicDEVS.__init__(self, "Atomic_%s" % num)
+        self.computation_time = computation_time
+        self.ta = random.randint(1, 10)
+        self.state = AtomicState(size)
+
+    def intTransition(self):
+        if self.computation_time > 0.0:
+            time.sleep(self.computation_time)
+        self.state.mem[0] += 1
+        return self.state
+
+    def timeAdvance(self):
+        return self.ta
+
+class Root(CoupledDEVS):
+    def __init__(self, number, size, computation):
+        CoupledDEVS.__init__(self, "C")
+        for i in range(number):
+            self.addSubModel(Atomic(i, size, computation))

+ 112 - 0
examples/plot

@@ -0,0 +1,112 @@
+reset
+set terminal postscript enhanced colour portrait size 6,6
+set key top left
+
+set style line 1 lw 4 linecolor rgb "red" dashtype 1
+set style line 2 lw 4 linecolor rgb "green" dashtype 1
+set style line 3 lw 4 linecolor rgb "blue" dashtype 2
+set style line 4 lw 4 linecolor rgb "black" dashtype 3
+
+set out 'result_1a.eps'
+set title "Influence of transition time for copy state saving"
+set xlabel "Transition time (s)"
+set ylabel "Execution time (s)"
+plot 'result_1a' using 1:($2) title "Forward step" w l ls 1, '' using 1:($3) title "Random jump" w l ls 2, '' using 1:($4) title "Backward step" w l ls 3
+
+set out 'result_1b.eps'
+set yrange [0:0.5]
+set title "Influence of transition time for periodic state saving"
+set xlabel "Transition time (s)"
+set ylabel "Execution time (s)"
+plot 'result_1b' using 1:($2) title "Forward step" w l ls 1, '' using 1:($3) title "Random jump" w l ls 2, '' using 1:($4) title "Backward step" w l ls 3
+unset yrange
+
+set out 'result_2b.eps'
+set title "Influence of number of models on memory"
+set xlabel "Number of models"
+set ylabel "Main memory used (KB)"
+plot 'result_2b' using 1:($2/1024) title "copy" w l ls 1, '' using 1:($3/1024) title "Periodic" w l ls 2
+
+set out 'result_3.eps'
+set title "Influence of state size on memory"
+set xlabel "Model state (B)"
+set ylabel "Main memory usage (KB)"
+plot 'result_3' using 1:($2/1024) title "copy" w l ls 1, '' using 1:($3/1024) title "Periodic" w l ls 2
+
+set out 'result_4.eps'
+set title "Jumping to specific points in time"
+set key top right
+set xlabel "Jump destination time"
+set ylabel "Latency (s)"
+plot 'result_4a' w l ls 1 title 'copy', 'result_4b' w l ls 2 title 'periodic'
+
+set key top left
+set out 'result_5a.eps'
+set title "Memory use during simulation for copy state saving"
+set xlabel "Simulation time"
+set ylabel "Main memory usage (KB)"
+plot 'result_5a' using 1:($2/1024) w l ls 1 title 'Main memory consumption', '' using 1:($3/1024) w l ls 2 title 'Disk consumption'
+
+set out 'result_5b.eps'
+set title "Memory use during simulation for periodic state saving"
+set xlabel "Simulation time"
+set ylabel "Main memory usage (KB)"
+plot 'result_5b' using 1:($2/1024) w l ls 1 title 'Main memory consumption', '' using 1:($3/1024) w l ls 2 title 'Disk consumption'
+
+set out 'result_9.eps'
+set title "Jump time comparison"
+set xlabel "Number of models"
+set ylabel "Execution time (s)"
+plot 'result_9' using 1:($2) title "copy" w l ls 1, '' using 1:($3) title "periodic" w l ls 2
+
+set out 'result_10.eps'
+set title "Influence of omniscient debugging"
+set xlabel "Model state (B)"
+set ylabel "Simulation execution time (s)"
+set logscale y
+plot 'result_10' using 1:($2) title "copy state saving" w l ls 1, '' using 1:($3) title "periodic state saving 0.1s" w l ls 2, '' using 1:($4) title "periodic state saving 0.5s" w l ls 3, '' using 1:($5) title "no omniscient debugging" w l ls 4
+
+set out 'result_10_mini.eps'
+set title "Influence of omniscient debugging"
+set xlabel "Model state (B)"
+set ylabel "Simulation execution time (s)"
+unset logscale
+plot 'result_10' using 1:($2) title "With omniscient debugging" w l ls 1, '' using 1:($5) title "Without omniscient debugging" w l ls 2
+
+# Optional things
+
+#set out 'result_2a.eps'
+#set title "Influence of number of models for copy state saving"
+#set xlabel "Number of models"
+#set ylabel "Execution time (s)"
+#plot 'result_2a' using 1:($2) title "Forward step" w l ls 1, '' using 1:($3) title "Random jump" w l ls 2, '' using 1:($4) title "Backward step" w l ls 3
+#
+#set out 'result_2a-bis.eps'
+#set title "Influence of number of models for periodic state saving"
+#set xlabel "Number of models"
+#set ylabel "Execution time (s)"
+#plot 'result_2a-bis' using 1:($2) title "Forward step" w l ls 1, '' using 1:($3) title "Random jump" w l ls 2, '' using 1:($4) title "Backward step" w l ls 3
+#
+#set out 'result_6.eps'
+#set title "Influence of maximum delay for periodic state saving"
+#set xlabel "Maximum delay (s)"
+#set ylabel "Execution time (s)"
+#plot 'result_6' using 1:($2) title "Forward step" w l ls 1, '' using 1:($3) title "Random jump" w l ls 2, '' using 1:($4) title "Backward step" w l ls 3
+#
+#set out 'result_7a.eps'
+#set title "Influence of maximum memory consumption for copy state saving"
+#set xlabel "Maximum memory (B)"
+#set ylabel "Execution time (s)"
+#plot 'result_7a' using 1:($2) title "Forward step" w l ls 1, '' using 1:($3) title "Random jump" w l ls 2, '' using 1:($4) title "Backward step" w l ls 3
+#
+#set out 'result_7b.eps'
+#set title "Influence of maximum memory consumption for periodic state saving"
+#set xlabel "Maximum memory (B)"
+#set ylabel "Execution time (s)"
+#plot 'result_7b' using 1:($2) title "Forward step" w l ls 1, '' using 1:($3) title "Random jump" w l ls 2, '' using 1:($4) title "Backward step" w l ls 3
+#
+#set out 'result_8.eps'
+#set title "Influence of state size on forward stepping"
+#set xlabel "Model state (B)"
+#set ylabel "Execution time (s)"
+#plot 'result_8' using 1:($2) title "copy" w l ls 1, '' using 1:($3) title "periodic" w l ls 2

+ 16 - 0
examples/result_10

@@ -0,0 +1,16 @@
+1 0.973410379887 0.819015705586 0.817120671272 0.816615319252 
+2 0.978228831291 0.822475326061 0.817195141315 0.816903114319 
+4 0.969707155228 0.81774135828 0.815685105324 0.811848759651 
+8 0.972782361507 0.819721543789 0.809342694283 0.825730454922 
+16 0.979645168781 0.81668510437 0.815784025192 0.815273106098 
+32 0.98894534111 0.811504101753 0.818178200722 0.806570851803 
+64 1.01892553568 0.816228175163 0.808189058304 0.817319107056 
+128 1.05559551716 0.811902439594 0.818397414684 0.820519208908 
+256 1.13353661299 0.823259723187 0.812516272068 0.817613625526 
+512 1.27167367935 0.823443853855 0.824309372902 0.814020776749 
+1024 1.53460384607 0.827203631401 0.824575018883 0.812964200974 
+2048 2.07942950726 0.843638300896 0.816518056393 0.807616901398 
+4096 3.16589803696 0.86812967062 0.823196530342 0.806401979923 
+8192 5.33872886896 0.955718433857 0.823277640343 0.803814208508 
+16384 9.6285325408 1.18148061037 0.838481199741 0.812381005287 
+32768 18.0306881666 2.15531765222 0.872014665604 0.81761033535 

+ 911 - 0
examples/result_10.eps

@@ -0,0 +1,911 @@
+%!PS-Adobe-2.0
+%%Title: result_10.eps
+%%Creator: gnuplot 5.0 patchlevel 1 (Gentoo revision r1)
+%%CreationDate: Fri Dec  2 10:30:14 2016
+%%DocumentFonts: (atend)
+%%BoundingBox: 50 50 482 482
+%%Orientation: Portrait
+%%Pages: (atend)
+%%EndComments
+%%BeginProlog
+/gnudict 256 dict def
+gnudict begin
+%
+% The following true/false flags may be edited by hand if desired.
+% The unit line width and grayscale image gamma correction may also be changed.
+%
+/Color true def
+/Blacktext false def
+/Solid false def
+/Dashlength 1 def
+/Landscape false def
+/Level1 false def
+/Level3 false def
+/Rounded false def
+/ClipToBoundingBox false def
+/SuppressPDFMark false def
+/TransparentPatterns false def
+/gnulinewidth 5.000 def
+/userlinewidth gnulinewidth def
+/Gamma 1.0 def
+/BackgroundColor {-1.000 -1.000 -1.000} def
+%
+/vshift -46 def
+/dl1 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul sub dup 0 le { pop 0.01 } if } if
+} def
+/dl2 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul add } if
+} def
+/hpt_ 31.5 def
+/vpt_ 31.5 def
+/hpt hpt_ def
+/vpt vpt_ def
+/doclip {
+  ClipToBoundingBox {
+    newpath 50 50 moveto 482 50 lineto 482 482 lineto 50 482 lineto closepath
+    clip
+  } if
+} def
+%
+% Gnuplot Prolog Version 5.0 (Dec 2014)
+%
+%/SuppressPDFMark true def
+%
+/M {moveto} bind def
+/L {lineto} bind def
+/R {rmoveto} bind def
+/V {rlineto} bind def
+/N {newpath moveto} bind def
+/Z {closepath} bind def
+/C {setrgbcolor} bind def
+/f {rlineto fill} bind def
+/g {setgray} bind def
+/Gshow {show} def   % May be redefined later in the file to support UTF-8
+/vpt2 vpt 2 mul def
+/hpt2 hpt 2 mul def
+/Lshow {currentpoint stroke M 0 vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Rshow {currentpoint stroke M dup stringwidth pop neg vshift R
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Cshow {currentpoint stroke M dup stringwidth pop -2 div vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/UP {dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def
+  /hpt2 hpt 2 mul def /vpt2 vpt 2 mul def} def
+/DL {Color {setrgbcolor Solid {pop []} if 0 setdash}
+ {pop pop pop 0 setgray Solid {pop []} if 0 setdash} ifelse} def
+/BL {stroke userlinewidth 2 mul setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/AL {stroke userlinewidth 2 div setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/UL {dup gnulinewidth mul /userlinewidth exch def
+	dup 1 lt {pop 1} if 10 mul /udl exch def} def
+/PL {stroke userlinewidth setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+3.8 setmiterlimit
+% Classic Line colors (version 5.0)
+/LCw {1 1 1} def
+/LCb {0 0 0} def
+/LCa {0 0 0} def
+/LC0 {1 0 0} def
+/LC1 {0 1 0} def
+/LC2 {0 0 1} def
+/LC3 {1 0 1} def
+/LC4 {0 1 1} def
+/LC5 {1 1 0} def
+/LC6 {0 0 0} def
+/LC7 {1 0.3 0} def
+/LC8 {0.5 0.5 0.5} def
+% Default dash patterns (version 5.0)
+/LTw {PL [] 1 setgray} def
+/LTb {BL [] LCb DL} def
+/LTa {AL [1 udl mul 2 udl mul] 0 setdash LCa setrgbcolor} def
+/LT0 {PL [] LC0 DL} def
+/LT1 {PL [2 dl1 3 dl2] LC1 DL} def
+/LT2 {PL [1 dl1 1.5 dl2] LC2 DL} def
+/LT3 {PL [6 dl1 2 dl2 1 dl1 2 dl2] LC3 DL} def
+/LT4 {PL [1 dl1 2 dl2 6 dl1 2 dl2 1 dl1 2 dl2] LC4 DL} def
+/LT5 {PL [4 dl1 2 dl2] LC5 DL} def
+/LT6 {PL [1.5 dl1 1.5 dl2 1.5 dl1 1.5 dl2 1.5 dl1 6 dl2] LC6 DL} def
+/LT7 {PL [3 dl1 3 dl2 1 dl1 3 dl2] LC7 DL} def
+/LT8 {PL [2 dl1 2 dl2 2 dl1 6 dl2] LC8 DL} def
+/SL {[] 0 setdash} def
+/Pnt {stroke [] 0 setdash gsave 1 setlinecap M 0 0 V stroke grestore} def
+/Dia {stroke [] 0 setdash 2 copy vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke
+  Pnt} def
+/Pls {stroke [] 0 setdash vpt sub M 0 vpt2 V
+  currentpoint stroke M
+  hpt neg vpt neg R hpt2 0 V stroke
+ } def
+/Box {stroke [] 0 setdash 2 copy exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke
+  Pnt} def
+/Crs {stroke [] 0 setdash exch hpt sub exch vpt add M
+  hpt2 vpt2 neg V currentpoint stroke M
+  hpt2 neg 0 R hpt2 vpt2 V stroke} def
+/TriU {stroke [] 0 setdash 2 copy vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke
+  Pnt} def
+/Star {2 copy Pls Crs} def
+/BoxF {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath fill} def
+/TriUF {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath fill} def
+/TriD {stroke [] 0 setdash 2 copy vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke
+  Pnt} def
+/TriDF {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath fill} def
+/DiaF {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath fill} def
+/Pent {stroke [] 0 setdash 2 copy gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore Pnt} def
+/PentF {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath fill grestore} def
+/Circle {stroke [] 0 setdash 2 copy
+  hpt 0 360 arc stroke Pnt} def
+/CircleF {stroke [] 0 setdash hpt 0 360 arc fill} def
+/C0 {BL [] 0 setdash 2 copy moveto vpt 90 450 arc} bind def
+/C1 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C2 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C3 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C4 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C5 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc
+	2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc} bind def
+/C6 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C7 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C8 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C9 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 450 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C10 {BL [] 0 setdash 2 copy 2 copy moveto vpt 270 360 arc closepath fill
+	2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C11 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C12 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C13 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C14 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 360 arc closepath fill
+	vpt 0 360 arc} bind def
+/C15 {BL [] 0 setdash 2 copy vpt 0 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/Rec {newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto
+	neg 0 rlineto closepath} bind def
+/Square {dup Rec} bind def
+/Bsquare {vpt sub exch vpt sub exch vpt2 Square} bind def
+/S0 {BL [] 0 setdash 2 copy moveto 0 vpt rlineto BL Bsquare} bind def
+/S1 {BL [] 0 setdash 2 copy vpt Square fill Bsquare} bind def
+/S2 {BL [] 0 setdash 2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S3 {BL [] 0 setdash 2 copy exch vpt sub exch vpt2 vpt Rec fill Bsquare} bind def
+/S4 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S5 {BL [] 0 setdash 2 copy 2 copy vpt Square fill
+	exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S6 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S7 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S8 {BL [] 0 setdash 2 copy vpt sub vpt Square fill Bsquare} bind def
+/S9 {BL [] 0 setdash 2 copy vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S10 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt Square fill
+	Bsquare} bind def
+/S11 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt2 vpt Rec fill
+	Bsquare} bind def
+/S12 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill Bsquare} bind def
+/S13 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S14 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S15 {BL [] 0 setdash 2 copy Bsquare fill Bsquare} bind def
+/D0 {gsave translate 45 rotate 0 0 S0 stroke grestore} bind def
+/D1 {gsave translate 45 rotate 0 0 S1 stroke grestore} bind def
+/D2 {gsave translate 45 rotate 0 0 S2 stroke grestore} bind def
+/D3 {gsave translate 45 rotate 0 0 S3 stroke grestore} bind def
+/D4 {gsave translate 45 rotate 0 0 S4 stroke grestore} bind def
+/D5 {gsave translate 45 rotate 0 0 S5 stroke grestore} bind def
+/D6 {gsave translate 45 rotate 0 0 S6 stroke grestore} bind def
+/D7 {gsave translate 45 rotate 0 0 S7 stroke grestore} bind def
+/D8 {gsave translate 45 rotate 0 0 S8 stroke grestore} bind def
+/D9 {gsave translate 45 rotate 0 0 S9 stroke grestore} bind def
+/D10 {gsave translate 45 rotate 0 0 S10 stroke grestore} bind def
+/D11 {gsave translate 45 rotate 0 0 S11 stroke grestore} bind def
+/D12 {gsave translate 45 rotate 0 0 S12 stroke grestore} bind def
+/D13 {gsave translate 45 rotate 0 0 S13 stroke grestore} bind def
+/D14 {gsave translate 45 rotate 0 0 S14 stroke grestore} bind def
+/D15 {gsave translate 45 rotate 0 0 S15 stroke grestore} bind def
+/DiaE {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke} def
+/BoxE {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke} def
+/TriUE {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke} def
+/TriDE {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke} def
+/PentE {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore} def
+/CircE {stroke [] 0 setdash 
+  hpt 0 360 arc stroke} def
+/Opaque {gsave closepath 1 setgray fill grestore 0 setgray closepath} def
+/DiaW {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V Opaque stroke} def
+/BoxW {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V Opaque stroke} def
+/TriUW {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V Opaque stroke} def
+/TriDW {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V Opaque stroke} def
+/PentW {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  Opaque stroke grestore} def
+/CircW {stroke [] 0 setdash 
+  hpt 0 360 arc Opaque stroke} def
+/BoxFill {gsave Rec 1 setgray fill grestore} def
+/Density {
+  /Fillden exch def
+  currentrgbcolor
+  /ColB exch def /ColG exch def /ColR exch def
+  /ColR ColR Fillden mul Fillden sub 1 add def
+  /ColG ColG Fillden mul Fillden sub 1 add def
+  /ColB ColB Fillden mul Fillden sub 1 add def
+  ColR ColG ColB setrgbcolor} def
+/BoxColFill {gsave Rec PolyFill} def
+/PolyFill {gsave Density fill grestore grestore} def
+/h {rlineto rlineto rlineto gsave closepath fill grestore} bind def
+%
+% PostScript Level 1 Pattern Fill routine for rectangles
+% Usage: x y w h s a XX PatternFill
+%	x,y = lower left corner of box to be filled
+%	w,h = width and height of box
+%	  a = angle in degrees between lines and x-axis
+%	 XX = 0/1 for no/yes cross-hatch
+%
+/PatternFill {gsave /PFa [ 9 2 roll ] def
+  PFa 0 get PFa 2 get 2 div add PFa 1 get PFa 3 get 2 div add translate
+  PFa 2 get -2 div PFa 3 get -2 div PFa 2 get PFa 3 get Rec
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+  clip
+  currentlinewidth 0.5 mul setlinewidth
+  /PFs PFa 2 get dup mul PFa 3 get dup mul add sqrt def
+  0 0 M PFa 5 get rotate PFs -2 div dup translate
+  0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 M 0 PFs V} for
+  0 PFa 6 get ne {
+	0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 2 1 roll M PFs 0 V} for
+ } if
+  stroke grestore} def
+%
+/languagelevel where
+ {pop languagelevel} {1} ifelse
+dup 2 lt
+	{/InterpretLevel1 true def
+	 /InterpretLevel3 false def}
+	{/InterpretLevel1 Level1 def
+	 2 gt
+	    {/InterpretLevel3 Level3 def}
+	    {/InterpretLevel3 false def}
+	 ifelse }
+ ifelse
+%
+% PostScript level 2 pattern fill definitions
+%
+/Level2PatternFill {
+/Tile8x8 {/PaintType 2 /PatternType 1 /TilingType 1 /BBox [0 0 8 8] /XStep 8 /YStep 8}
+	bind def
+/KeepColor {currentrgbcolor [/Pattern /DeviceRGB] setcolorspace} bind def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke} 
+>> matrix makepattern
+/Pat1 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke
+	0 4 M 4 8 L 8 4 L 4 0 L 0 4 L stroke}
+>> matrix makepattern
+/Pat2 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 0 8 L
+	8 8 L 8 0 L 0 0 L fill}
+>> matrix makepattern
+/Pat3 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 8 M 8 -4 L
+	0 12 M 12 0 L stroke}
+>> matrix makepattern
+/Pat4 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 0 M 8 12 L
+	0 -4 M 12 8 L stroke}
+>> matrix makepattern
+/Pat5 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 8 M 4 -4 L
+	0 12 M 8 -4 L 4 12 M 10 0 L stroke}
+>> matrix makepattern
+/Pat6 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 0 M 4 12 L
+	0 -4 M 8 12 L 4 -4 M 10 8 L stroke}
+>> matrix makepattern
+/Pat7 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 8 -2 M -4 4 L
+	12 0 M -4 8 L 12 4 M 0 10 L stroke}
+>> matrix makepattern
+/Pat8 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 -2 M 12 4 L
+	-4 0 M 12 8 L -4 4 M 8 10 L stroke}
+>> matrix makepattern
+/Pat9 exch def
+/Pattern1 {PatternBgnd KeepColor Pat1 setpattern} bind def
+/Pattern2 {PatternBgnd KeepColor Pat2 setpattern} bind def
+/Pattern3 {PatternBgnd KeepColor Pat3 setpattern} bind def
+/Pattern4 {PatternBgnd KeepColor Landscape {Pat5} {Pat4} ifelse setpattern} bind def
+/Pattern5 {PatternBgnd KeepColor Landscape {Pat4} {Pat5} ifelse setpattern} bind def
+/Pattern6 {PatternBgnd KeepColor Landscape {Pat9} {Pat6} ifelse setpattern} bind def
+/Pattern7 {PatternBgnd KeepColor Landscape {Pat8} {Pat7} ifelse setpattern} bind def
+} def
+%
+%
+%End of PostScript Level 2 code
+%
+/PatternBgnd {
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+} def
+%
+% Substitute for Level 2 pattern fill codes with
+% grayscale if Level 2 support is not selected.
+%
+/Level1PatternFill {
+/Pattern1 {0.250 Density} bind def
+/Pattern2 {0.500 Density} bind def
+/Pattern3 {0.750 Density} bind def
+/Pattern4 {0.125 Density} bind def
+/Pattern5 {0.375 Density} bind def
+/Pattern6 {0.625 Density} bind def
+/Pattern7 {0.875 Density} bind def
+} def
+%
+% Now test for support of Level 2 code
+%
+Level1 {Level1PatternFill} {Level2PatternFill} ifelse
+%
+/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont
+dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall
+currentdict end definefont pop
+%
+/MFshow {
+   { dup 5 get 3 ge
+     { 5 get 3 eq {gsave} {grestore} ifelse }
+     {dup dup 0 get findfont exch 1 get scalefont setfont
+     [ currentpoint ] exch dup 2 get 0 exch R dup 5 get 2 ne {dup dup 6
+     get exch 4 get {textshow} {stringwidth pop 0 R} ifelse }if dup 5 get 0 eq
+     {dup 3 get {2 get neg 0 exch R pop} {pop aload pop M} ifelse} {dup 5
+     get 1 eq {dup 2 get exch dup 3 get exch 6 get stringwidth pop -2 div
+     dup 0 R} {dup 6 get stringwidth pop -2 div 0 R 6 get
+     textshow 2 index {aload pop M neg 3 -1 roll neg R pop pop} {pop pop pop
+     pop aload pop M} ifelse }ifelse }ifelse }
+     ifelse }
+   forall} def
+/Gswidth {dup type /stringtype eq {stringwidth} {pop (n) stringwidth} ifelse} def
+/MFwidth {0 exch { dup 5 get 3 ge { 5 get 3 eq { 0 } { pop } ifelse }
+ {dup 3 get{dup dup 0 get findfont exch 1 get scalefont setfont
+     6 get Gswidth pop add} {pop} ifelse} ifelse} forall} def
+/MLshow { currentpoint stroke M
+  0 exch R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MRshow { currentpoint stroke M
+  exch dup MFwidth neg 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MCshow { currentpoint stroke M
+  exch dup MFwidth -2 div 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/XYsave    { [( ) 1 2 true false 3 ()] } bind def
+/XYrestore { [( ) 1 2 true false 4 ()] } bind def
+Level1 SuppressPDFMark or 
+{} {
+/SDict 10 dict def
+systemdict /pdfmark known not {
+  userdict /pdfmark systemdict /cleartomark get put
+} if
+SDict begin [
+  /Title (result_10.eps)
+  /Subject (gnuplot plot)
+  /Creator (gnuplot 5.0 patchlevel 1 (Gentoo revision r1))
+  /Author (yentl)
+%  /Producer (gnuplot)
+%  /Keywords ()
+  /CreationDate (Fri Dec  2 10:30:14 2016)
+  /DOCINFO pdfmark
+end
+} ifelse
+end
+%
+% Support for boxed text - Ethan A Merritt May 2005
+%
+/InitTextBox { userdict /TBy2 3 -1 roll put userdict /TBx2 3 -1 roll put
+           userdict /TBy1 3 -1 roll put userdict /TBx1 3 -1 roll put
+	   /Boxing true def } def
+/ExtendTextBox { Boxing
+    { gsave dup false charpath pathbbox
+      dup TBy2 gt {userdict /TBy2 3 -1 roll put} {pop} ifelse
+      dup TBx2 gt {userdict /TBx2 3 -1 roll put} {pop} ifelse
+      dup TBy1 lt {userdict /TBy1 3 -1 roll put} {pop} ifelse
+      dup TBx1 lt {userdict /TBx1 3 -1 roll put} {pop} ifelse
+      grestore } if } def
+/PopTextBox { newpath TBx1 TBxmargin sub TBy1 TBymargin sub M
+               TBx1 TBxmargin sub TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy1 TBymargin sub L closepath } def
+/DrawTextBox { PopTextBox stroke /Boxing false def} def
+/FillTextBox { gsave PopTextBox 1 1 1 setrgbcolor fill grestore /Boxing false def} def
+0 0 0 0 InitTextBox
+/TBxmargin 20 def
+/TBymargin 20 def
+/Boxing false def
+/textshow { ExtendTextBox Gshow } def
+%
+%%EndProlog
+%%Page: 1 1
+gnudict begin
+gsave
+doclip
+50 50 translate
+0.100 0.100 scale
+0 setgray
+newpath
+(Helvetica) findfont 140 scalefont setfont
+BackgroundColor 0 lt 3 1 roll 0 lt exch 0 lt or or not {gsave BackgroundColor C clippath fill grestore} if
+1.000 UL
+LTb
+LCb setrgbcolor
+686 448 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 448 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.1)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 794 M
+31 0 V
+3350 0 R
+-31 0 V
+686 997 M
+31 0 V
+3350 0 R
+-31 0 V
+686 1141 M
+31 0 V
+3350 0 R
+-31 0 V
+686 1252 M
+31 0 V
+3350 0 R
+-31 0 V
+686 1343 M
+31 0 V
+3350 0 R
+-31 0 V
+686 1420 M
+31 0 V
+3350 0 R
+-31 0 V
+686 1487 M
+31 0 V
+3350 0 R
+-31 0 V
+686 1546 M
+31 0 V
+3350 0 R
+-31 0 V
+686 1598 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 1598 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 1)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 1945 M
+31 0 V
+3350 0 R
+-31 0 V
+686 2147 M
+31 0 V
+3350 0 R
+-31 0 V
+686 2291 M
+31 0 V
+3350 0 R
+-31 0 V
+686 2402 M
+31 0 V
+3350 0 R
+-31 0 V
+686 2493 M
+31 0 V
+3350 0 R
+-31 0 V
+686 2570 M
+31 0 V
+3350 0 R
+-31 0 V
+686 2637 M
+31 0 V
+3350 0 R
+-31 0 V
+686 2696 M
+31 0 V
+3350 0 R
+-31 0 V
+686 2749 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 2749 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 10)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 3095 M
+31 0 V
+3350 0 R
+-31 0 V
+686 3298 M
+31 0 V
+3350 0 R
+-31 0 V
+686 3441 M
+31 0 V
+3350 0 R
+-31 0 V
+686 3553 M
+31 0 V
+3350 0 R
+-31 0 V
+686 3644 M
+31 0 V
+3350 0 R
+-31 0 V
+686 3721 M
+31 0 V
+3350 0 R
+-31 0 V
+686 3788 M
+31 0 V
+3350 0 R
+-31 0 V
+686 3846 M
+31 0 V
+3350 0 R
+-31 0 V
+686 3899 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 3899 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 100)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+686 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1169 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+1169 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 5000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1652 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+1652 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 10000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2135 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+2135 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 15000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2618 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+2618 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 20000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3101 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+3101 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 25000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3584 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+3584 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 30000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+4067 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+4067 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 35000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+686 3899 N
+686 448 L
+3381 0 V
+0 3451 V
+-3381 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+LCb setrgbcolor
+112 2173 M
+currentpoint gsave translate -270 rotate 0 0 moveto
+[ [(Helvetica) 140.0 0.0 true true 0 (Simulation execution time \(s\))]
+] -46.7 MCshow
+grestore
+LTb
+LCb setrgbcolor
+2376 98 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Model state \(B\))]
+] -46.7 MCshow
+LTb
+LCb setrgbcolor
+2376 4109 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Influence of omniscient debugging)]
+] -46.7 MCshow
+% Begin plot #1
+4.000 UL
+LTb
+1.00 0.00 0.00 C LCb setrgbcolor
+2954 3766 M
+[ [(Helvetica) 140.0 0.0 true true 0 (copy state saving)]
+] -46.7 MRshow
+4.000 UL
+LTb
+1.00 0.00 0.00 C 3038 3766 M
+399 0 V
+686 1585 M
+0 2 V
+0 -4 V
+1 2 V
+1 3 V
+1 5 V
+3 15 V
+6 17 V
+13 36 V
+24 57 V
+50 94 V
+99 152 V
+198 210 V
+395 261 V
+792 295 V
+1582 313 V
+% End plot #1
+% Begin plot #2
+stroke
+LTb
+0.00 1.00 0.00 C LCb setrgbcolor
+2954 3626 M
+[ [(Helvetica) 140.0 0.0 true true 0 (periodic state saving 0.1s)]
+] -46.7 MRshow
+4.000 UL
+LTb
+0.00 1.00 0.00 C 3038 3626 M
+399 0 V
+686 1499 M
+0 2 V
+0 -3 V
+1 1 V
+1 -2 V
+1 -3 V
+3 3 V
+6 -3 V
+13 7 V
+24 0 V
+50 3 V
+99 9 V
+198 15 V
+395 48 V
+792 106 V
+1582 300 V
+% End plot #2
+% Begin plot #3
+stroke
+LTb
+LT1
+0.00 0.00 1.00 C LCb setrgbcolor
+2954 3486 M
+[ [(Helvetica) 140.0 0.0 true true 0 (periodic state saving 0.5s)]
+] -46.7 MRshow
+4.000 UL
+LTb
+LT1
+0.00 0.00 1.00 C 3038 3486 M
+399 0 V
+686 1497 M
+1 -4 V
+1 4 V
+1 1 V
+3 -6 V
+6 6 V
+13 -3 V
+24 7 V
+50 0 V
+99 -5 V
+198 4 V
+395 0 V
+792 9 V
+1582 20 V
+% End plot #3
+% Begin plot #4
+stroke
+LTb
+LT2
+0.00 0.00 0.00 C LCb setrgbcolor
+2954 3346 M
+[ [(Helvetica) 140.0 0.0 true true 0 (no omniscient debugging)]
+] -46.7 MRshow
+4.000 UL
+LTb
+LT2
+0.00 0.00 0.00 C 3038 3346 M
+399 0 V
+686 1497 M
+0 -3 V
+1 9 V
+1 -7 V
+1 -5 V
+3 7 V
+6 2 V
+13 -2 V
+24 -2 V
+50 -1 V
+99 -3 V
+198 -1 V
+395 -2 V
+792 6 V
+1582 3 V
+% End plot #4
+stroke
+2.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+686 3899 N
+686 448 L
+3381 0 V
+0 3451 V
+-3381 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+stroke
+grestore
+end
+showpage
+%%Trailer
+%%DocumentFonts: Helvetica
+%%Pages: 1

+ 834 - 0
examples/result_10_mini.eps

@@ -0,0 +1,834 @@
+%!PS-Adobe-2.0
+%%Title: result_10_mini.eps
+%%Creator: gnuplot 5.0 patchlevel 1 (Gentoo revision r1)
+%%CreationDate: Fri Dec  2 10:30:14 2016
+%%DocumentFonts: (atend)
+%%BoundingBox: 50 50 482 482
+%%Orientation: Portrait
+%%Pages: (atend)
+%%EndComments
+%%BeginProlog
+/gnudict 256 dict def
+gnudict begin
+%
+% The following true/false flags may be edited by hand if desired.
+% The unit line width and grayscale image gamma correction may also be changed.
+%
+/Color true def
+/Blacktext false def
+/Solid false def
+/Dashlength 1 def
+/Landscape false def
+/Level1 false def
+/Level3 false def
+/Rounded false def
+/ClipToBoundingBox false def
+/SuppressPDFMark false def
+/TransparentPatterns false def
+/gnulinewidth 5.000 def
+/userlinewidth gnulinewidth def
+/Gamma 1.0 def
+/BackgroundColor {-1.000 -1.000 -1.000} def
+%
+/vshift -46 def
+/dl1 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul sub dup 0 le { pop 0.01 } if } if
+} def
+/dl2 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul add } if
+} def
+/hpt_ 31.5 def
+/vpt_ 31.5 def
+/hpt hpt_ def
+/vpt vpt_ def
+/doclip {
+  ClipToBoundingBox {
+    newpath 50 50 moveto 482 50 lineto 482 482 lineto 50 482 lineto closepath
+    clip
+  } if
+} def
+%
+% Gnuplot Prolog Version 5.0 (Dec 2014)
+%
+%/SuppressPDFMark true def
+%
+/M {moveto} bind def
+/L {lineto} bind def
+/R {rmoveto} bind def
+/V {rlineto} bind def
+/N {newpath moveto} bind def
+/Z {closepath} bind def
+/C {setrgbcolor} bind def
+/f {rlineto fill} bind def
+/g {setgray} bind def
+/Gshow {show} def   % May be redefined later in the file to support UTF-8
+/vpt2 vpt 2 mul def
+/hpt2 hpt 2 mul def
+/Lshow {currentpoint stroke M 0 vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Rshow {currentpoint stroke M dup stringwidth pop neg vshift R
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Cshow {currentpoint stroke M dup stringwidth pop -2 div vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/UP {dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def
+  /hpt2 hpt 2 mul def /vpt2 vpt 2 mul def} def
+/DL {Color {setrgbcolor Solid {pop []} if 0 setdash}
+ {pop pop pop 0 setgray Solid {pop []} if 0 setdash} ifelse} def
+/BL {stroke userlinewidth 2 mul setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/AL {stroke userlinewidth 2 div setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/UL {dup gnulinewidth mul /userlinewidth exch def
+	dup 1 lt {pop 1} if 10 mul /udl exch def} def
+/PL {stroke userlinewidth setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+3.8 setmiterlimit
+% Classic Line colors (version 5.0)
+/LCw {1 1 1} def
+/LCb {0 0 0} def
+/LCa {0 0 0} def
+/LC0 {1 0 0} def
+/LC1 {0 1 0} def
+/LC2 {0 0 1} def
+/LC3 {1 0 1} def
+/LC4 {0 1 1} def
+/LC5 {1 1 0} def
+/LC6 {0 0 0} def
+/LC7 {1 0.3 0} def
+/LC8 {0.5 0.5 0.5} def
+% Default dash patterns (version 5.0)
+/LTw {PL [] 1 setgray} def
+/LTb {BL [] LCb DL} def
+/LTa {AL [1 udl mul 2 udl mul] 0 setdash LCa setrgbcolor} def
+/LT0 {PL [] LC0 DL} def
+/LT1 {PL [2 dl1 3 dl2] LC1 DL} def
+/LT2 {PL [1 dl1 1.5 dl2] LC2 DL} def
+/LT3 {PL [6 dl1 2 dl2 1 dl1 2 dl2] LC3 DL} def
+/LT4 {PL [1 dl1 2 dl2 6 dl1 2 dl2 1 dl1 2 dl2] LC4 DL} def
+/LT5 {PL [4 dl1 2 dl2] LC5 DL} def
+/LT6 {PL [1.5 dl1 1.5 dl2 1.5 dl1 1.5 dl2 1.5 dl1 6 dl2] LC6 DL} def
+/LT7 {PL [3 dl1 3 dl2 1 dl1 3 dl2] LC7 DL} def
+/LT8 {PL [2 dl1 2 dl2 2 dl1 6 dl2] LC8 DL} def
+/SL {[] 0 setdash} def
+/Pnt {stroke [] 0 setdash gsave 1 setlinecap M 0 0 V stroke grestore} def
+/Dia {stroke [] 0 setdash 2 copy vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke
+  Pnt} def
+/Pls {stroke [] 0 setdash vpt sub M 0 vpt2 V
+  currentpoint stroke M
+  hpt neg vpt neg R hpt2 0 V stroke
+ } def
+/Box {stroke [] 0 setdash 2 copy exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke
+  Pnt} def
+/Crs {stroke [] 0 setdash exch hpt sub exch vpt add M
+  hpt2 vpt2 neg V currentpoint stroke M
+  hpt2 neg 0 R hpt2 vpt2 V stroke} def
+/TriU {stroke [] 0 setdash 2 copy vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke
+  Pnt} def
+/Star {2 copy Pls Crs} def
+/BoxF {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath fill} def
+/TriUF {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath fill} def
+/TriD {stroke [] 0 setdash 2 copy vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke
+  Pnt} def
+/TriDF {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath fill} def
+/DiaF {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath fill} def
+/Pent {stroke [] 0 setdash 2 copy gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore Pnt} def
+/PentF {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath fill grestore} def
+/Circle {stroke [] 0 setdash 2 copy
+  hpt 0 360 arc stroke Pnt} def
+/CircleF {stroke [] 0 setdash hpt 0 360 arc fill} def
+/C0 {BL [] 0 setdash 2 copy moveto vpt 90 450 arc} bind def
+/C1 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C2 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C3 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C4 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C5 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc
+	2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc} bind def
+/C6 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C7 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C8 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C9 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 450 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C10 {BL [] 0 setdash 2 copy 2 copy moveto vpt 270 360 arc closepath fill
+	2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C11 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C12 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C13 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C14 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 360 arc closepath fill
+	vpt 0 360 arc} bind def
+/C15 {BL [] 0 setdash 2 copy vpt 0 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/Rec {newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto
+	neg 0 rlineto closepath} bind def
+/Square {dup Rec} bind def
+/Bsquare {vpt sub exch vpt sub exch vpt2 Square} bind def
+/S0 {BL [] 0 setdash 2 copy moveto 0 vpt rlineto BL Bsquare} bind def
+/S1 {BL [] 0 setdash 2 copy vpt Square fill Bsquare} bind def
+/S2 {BL [] 0 setdash 2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S3 {BL [] 0 setdash 2 copy exch vpt sub exch vpt2 vpt Rec fill Bsquare} bind def
+/S4 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S5 {BL [] 0 setdash 2 copy 2 copy vpt Square fill
+	exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S6 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S7 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S8 {BL [] 0 setdash 2 copy vpt sub vpt Square fill Bsquare} bind def
+/S9 {BL [] 0 setdash 2 copy vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S10 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt Square fill
+	Bsquare} bind def
+/S11 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt2 vpt Rec fill
+	Bsquare} bind def
+/S12 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill Bsquare} bind def
+/S13 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S14 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S15 {BL [] 0 setdash 2 copy Bsquare fill Bsquare} bind def
+/D0 {gsave translate 45 rotate 0 0 S0 stroke grestore} bind def
+/D1 {gsave translate 45 rotate 0 0 S1 stroke grestore} bind def
+/D2 {gsave translate 45 rotate 0 0 S2 stroke grestore} bind def
+/D3 {gsave translate 45 rotate 0 0 S3 stroke grestore} bind def
+/D4 {gsave translate 45 rotate 0 0 S4 stroke grestore} bind def
+/D5 {gsave translate 45 rotate 0 0 S5 stroke grestore} bind def
+/D6 {gsave translate 45 rotate 0 0 S6 stroke grestore} bind def
+/D7 {gsave translate 45 rotate 0 0 S7 stroke grestore} bind def
+/D8 {gsave translate 45 rotate 0 0 S8 stroke grestore} bind def
+/D9 {gsave translate 45 rotate 0 0 S9 stroke grestore} bind def
+/D10 {gsave translate 45 rotate 0 0 S10 stroke grestore} bind def
+/D11 {gsave translate 45 rotate 0 0 S11 stroke grestore} bind def
+/D12 {gsave translate 45 rotate 0 0 S12 stroke grestore} bind def
+/D13 {gsave translate 45 rotate 0 0 S13 stroke grestore} bind def
+/D14 {gsave translate 45 rotate 0 0 S14 stroke grestore} bind def
+/D15 {gsave translate 45 rotate 0 0 S15 stroke grestore} bind def
+/DiaE {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke} def
+/BoxE {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke} def
+/TriUE {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke} def
+/TriDE {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke} def
+/PentE {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore} def
+/CircE {stroke [] 0 setdash 
+  hpt 0 360 arc stroke} def
+/Opaque {gsave closepath 1 setgray fill grestore 0 setgray closepath} def
+/DiaW {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V Opaque stroke} def
+/BoxW {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V Opaque stroke} def
+/TriUW {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V Opaque stroke} def
+/TriDW {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V Opaque stroke} def
+/PentW {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  Opaque stroke grestore} def
+/CircW {stroke [] 0 setdash 
+  hpt 0 360 arc Opaque stroke} def
+/BoxFill {gsave Rec 1 setgray fill grestore} def
+/Density {
+  /Fillden exch def
+  currentrgbcolor
+  /ColB exch def /ColG exch def /ColR exch def
+  /ColR ColR Fillden mul Fillden sub 1 add def
+  /ColG ColG Fillden mul Fillden sub 1 add def
+  /ColB ColB Fillden mul Fillden sub 1 add def
+  ColR ColG ColB setrgbcolor} def
+/BoxColFill {gsave Rec PolyFill} def
+/PolyFill {gsave Density fill grestore grestore} def
+/h {rlineto rlineto rlineto gsave closepath fill grestore} bind def
+%
+% PostScript Level 1 Pattern Fill routine for rectangles
+% Usage: x y w h s a XX PatternFill
+%	x,y = lower left corner of box to be filled
+%	w,h = width and height of box
+%	  a = angle in degrees between lines and x-axis
+%	 XX = 0/1 for no/yes cross-hatch
+%
+/PatternFill {gsave /PFa [ 9 2 roll ] def
+  PFa 0 get PFa 2 get 2 div add PFa 1 get PFa 3 get 2 div add translate
+  PFa 2 get -2 div PFa 3 get -2 div PFa 2 get PFa 3 get Rec
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+  clip
+  currentlinewidth 0.5 mul setlinewidth
+  /PFs PFa 2 get dup mul PFa 3 get dup mul add sqrt def
+  0 0 M PFa 5 get rotate PFs -2 div dup translate
+  0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 M 0 PFs V} for
+  0 PFa 6 get ne {
+	0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 2 1 roll M PFs 0 V} for
+ } if
+  stroke grestore} def
+%
+/languagelevel where
+ {pop languagelevel} {1} ifelse
+dup 2 lt
+	{/InterpretLevel1 true def
+	 /InterpretLevel3 false def}
+	{/InterpretLevel1 Level1 def
+	 2 gt
+	    {/InterpretLevel3 Level3 def}
+	    {/InterpretLevel3 false def}
+	 ifelse }
+ ifelse
+%
+% PostScript level 2 pattern fill definitions
+%
+/Level2PatternFill {
+/Tile8x8 {/PaintType 2 /PatternType 1 /TilingType 1 /BBox [0 0 8 8] /XStep 8 /YStep 8}
+	bind def
+/KeepColor {currentrgbcolor [/Pattern /DeviceRGB] setcolorspace} bind def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke} 
+>> matrix makepattern
+/Pat1 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke
+	0 4 M 4 8 L 8 4 L 4 0 L 0 4 L stroke}
+>> matrix makepattern
+/Pat2 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 0 8 L
+	8 8 L 8 0 L 0 0 L fill}
+>> matrix makepattern
+/Pat3 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 8 M 8 -4 L
+	0 12 M 12 0 L stroke}
+>> matrix makepattern
+/Pat4 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 0 M 8 12 L
+	0 -4 M 12 8 L stroke}
+>> matrix makepattern
+/Pat5 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 8 M 4 -4 L
+	0 12 M 8 -4 L 4 12 M 10 0 L stroke}
+>> matrix makepattern
+/Pat6 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 0 M 4 12 L
+	0 -4 M 8 12 L 4 -4 M 10 8 L stroke}
+>> matrix makepattern
+/Pat7 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 8 -2 M -4 4 L
+	12 0 M -4 8 L 12 4 M 0 10 L stroke}
+>> matrix makepattern
+/Pat8 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 -2 M 12 4 L
+	-4 0 M 12 8 L -4 4 M 8 10 L stroke}
+>> matrix makepattern
+/Pat9 exch def
+/Pattern1 {PatternBgnd KeepColor Pat1 setpattern} bind def
+/Pattern2 {PatternBgnd KeepColor Pat2 setpattern} bind def
+/Pattern3 {PatternBgnd KeepColor Pat3 setpattern} bind def
+/Pattern4 {PatternBgnd KeepColor Landscape {Pat5} {Pat4} ifelse setpattern} bind def
+/Pattern5 {PatternBgnd KeepColor Landscape {Pat4} {Pat5} ifelse setpattern} bind def
+/Pattern6 {PatternBgnd KeepColor Landscape {Pat9} {Pat6} ifelse setpattern} bind def
+/Pattern7 {PatternBgnd KeepColor Landscape {Pat8} {Pat7} ifelse setpattern} bind def
+} def
+%
+%
+%End of PostScript Level 2 code
+%
+/PatternBgnd {
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+} def
+%
+% Substitute for Level 2 pattern fill codes with
+% grayscale if Level 2 support is not selected.
+%
+/Level1PatternFill {
+/Pattern1 {0.250 Density} bind def
+/Pattern2 {0.500 Density} bind def
+/Pattern3 {0.750 Density} bind def
+/Pattern4 {0.125 Density} bind def
+/Pattern5 {0.375 Density} bind def
+/Pattern6 {0.625 Density} bind def
+/Pattern7 {0.875 Density} bind def
+} def
+%
+% Now test for support of Level 2 code
+%
+Level1 {Level1PatternFill} {Level2PatternFill} ifelse
+%
+/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont
+dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall
+currentdict end definefont pop
+%
+/MFshow {
+   { dup 5 get 3 ge
+     { 5 get 3 eq {gsave} {grestore} ifelse }
+     {dup dup 0 get findfont exch 1 get scalefont setfont
+     [ currentpoint ] exch dup 2 get 0 exch R dup 5 get 2 ne {dup dup 6
+     get exch 4 get {textshow} {stringwidth pop 0 R} ifelse }if dup 5 get 0 eq
+     {dup 3 get {2 get neg 0 exch R pop} {pop aload pop M} ifelse} {dup 5
+     get 1 eq {dup 2 get exch dup 3 get exch 6 get stringwidth pop -2 div
+     dup 0 R} {dup 6 get stringwidth pop -2 div 0 R 6 get
+     textshow 2 index {aload pop M neg 3 -1 roll neg R pop pop} {pop pop pop
+     pop aload pop M} ifelse }ifelse }ifelse }
+     ifelse }
+   forall} def
+/Gswidth {dup type /stringtype eq {stringwidth} {pop (n) stringwidth} ifelse} def
+/MFwidth {0 exch { dup 5 get 3 ge { 5 get 3 eq { 0 } { pop } ifelse }
+ {dup 3 get{dup dup 0 get findfont exch 1 get scalefont setfont
+     6 get Gswidth pop add} {pop} ifelse} ifelse} forall} def
+/MLshow { currentpoint stroke M
+  0 exch R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MRshow { currentpoint stroke M
+  exch dup MFwidth neg 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MCshow { currentpoint stroke M
+  exch dup MFwidth -2 div 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/XYsave    { [( ) 1 2 true false 3 ()] } bind def
+/XYrestore { [( ) 1 2 true false 4 ()] } bind def
+Level1 SuppressPDFMark or 
+{} {
+/SDict 10 dict def
+systemdict /pdfmark known not {
+  userdict /pdfmark systemdict /cleartomark get put
+} if
+SDict begin [
+  /Title (result_10_mini.eps)
+  /Subject (gnuplot plot)
+  /Creator (gnuplot 5.0 patchlevel 1 (Gentoo revision r1))
+  /Author (yentl)
+%  /Producer (gnuplot)
+%  /Keywords ()
+  /CreationDate (Fri Dec  2 10:30:14 2016)
+  /DOCINFO pdfmark
+end
+} ifelse
+end
+%
+% Support for boxed text - Ethan A Merritt May 2005
+%
+/InitTextBox { userdict /TBy2 3 -1 roll put userdict /TBx2 3 -1 roll put
+           userdict /TBy1 3 -1 roll put userdict /TBx1 3 -1 roll put
+	   /Boxing true def } def
+/ExtendTextBox { Boxing
+    { gsave dup false charpath pathbbox
+      dup TBy2 gt {userdict /TBy2 3 -1 roll put} {pop} ifelse
+      dup TBx2 gt {userdict /TBx2 3 -1 roll put} {pop} ifelse
+      dup TBy1 lt {userdict /TBy1 3 -1 roll put} {pop} ifelse
+      dup TBx1 lt {userdict /TBx1 3 -1 roll put} {pop} ifelse
+      grestore } if } def
+/PopTextBox { newpath TBx1 TBxmargin sub TBy1 TBymargin sub M
+               TBx1 TBxmargin sub TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy1 TBymargin sub L closepath } def
+/DrawTextBox { PopTextBox stroke /Boxing false def} def
+/FillTextBox { gsave PopTextBox 1 1 1 setrgbcolor fill grestore /Boxing false def} def
+0 0 0 0 InitTextBox
+/TBxmargin 20 def
+/TBymargin 20 def
+/Boxing false def
+/textshow { ExtendTextBox Gshow } def
+%
+%%EndProlog
+%%Page: 1 1
+gnudict begin
+gsave
+doclip
+50 50 translate
+0.100 0.100 scale
+0 setgray
+newpath
+(Helvetica) findfont 140 scalefont setfont
+BackgroundColor 0 lt 3 1 roll 0 lt exch 0 lt or or not {gsave BackgroundColor C clippath fill grestore} if
+1.000 UL
+LTb
+LCb setrgbcolor
+602 448 M
+63 0 V
+3402 0 R
+-63 0 V
+stroke
+518 448 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+602 793 M
+63 0 V
+3402 0 R
+-63 0 V
+stroke
+518 793 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 2)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+602 1138 M
+63 0 V
+3402 0 R
+-63 0 V
+stroke
+518 1138 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 4)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+602 1483 M
+63 0 V
+3402 0 R
+-63 0 V
+stroke
+518 1483 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 6)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+602 1828 M
+63 0 V
+3402 0 R
+-63 0 V
+stroke
+518 1828 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 8)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+602 2174 M
+63 0 V
+3402 0 R
+-63 0 V
+stroke
+518 2174 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 10)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+602 2519 M
+63 0 V
+3402 0 R
+-63 0 V
+stroke
+518 2519 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 12)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+602 2864 M
+63 0 V
+3402 0 R
+-63 0 V
+stroke
+518 2864 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 14)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+602 3209 M
+63 0 V
+3402 0 R
+-63 0 V
+stroke
+518 3209 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 16)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+602 3554 M
+63 0 V
+3402 0 R
+-63 0 V
+stroke
+518 3554 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 18)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+602 3899 M
+63 0 V
+3402 0 R
+-63 0 V
+stroke
+518 3899 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 20)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+602 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+602 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1097 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+1097 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 5000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1592 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+1592 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 10000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2087 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+2087 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 15000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2582 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+2582 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 20000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3077 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+3077 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 25000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3572 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+3572 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 30000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+4067 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+4067 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 35000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+602 3899 N
+602 448 L
+3465 0 V
+0 3451 V
+-3465 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+LCb setrgbcolor
+112 2173 M
+currentpoint gsave translate -270 rotate 0 0 moveto
+[ [(Helvetica) 140.0 0.0 true true 0 (Simulation execution time \(s\))]
+] -46.7 MCshow
+grestore
+LTb
+LCb setrgbcolor
+2334 98 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Model state \(B\))]
+] -46.7 MCshow
+LTb
+LCb setrgbcolor
+2334 4109 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Influence of omniscient debugging)]
+] -46.7 MCshow
+% Begin plot #1
+4.000 UL
+LTb
+1.00 0.00 0.00 C LCb setrgbcolor
+3038 3766 M
+[ [(Helvetica) 140.0 0.0 true true 0 (With omniscient debugging)]
+] -46.7 MRshow
+4.000 UL
+LTb
+1.00 0.00 0.00 C 3122 3766 M
+399 0 V
+602 616 M
+0 1 V
+0 -2 V
+1 1 V
+1 1 V
+1 2 V
+3 5 V
+7 6 V
+12 14 V
+26 23 V
+50 46 V
+102 94 V
+203 187 V
+405 375 V
+811 740 V
+3846 3559 L
+% End plot #1
+% Begin plot #2
+stroke
+LTb
+0.00 1.00 0.00 C LCb setrgbcolor
+3038 3626 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Without omniscient debugging)]
+] -46.7 MRshow
+4.000 UL
+LTb
+0.00 1.00 0.00 C 3122 3626 M
+399 0 V
+602 589 M
+0 -1 V
+1 2 V
+1 -1 V
+1 -2 V
+3 2 V
+7 1 V
+12 -1 V
+26 -1 V
+50 0 V
+102 -1 V
+203 0 V
+405 0 V
+811 1 V
+1622 1 V
+% End plot #2
+stroke
+2.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+602 3899 N
+602 448 L
+3465 0 V
+0 3451 V
+-3465 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+stroke
+grestore
+end
+showpage
+%%Trailer
+%%DocumentFonts: Helvetica
+%%Pages: 1

+ 10 - 0
examples/result_1a

@@ -0,0 +1,10 @@
+0.0 0.000192809822855 0.00954189300538 0.00834251642227 
+0.001 0.00259781324123 0.00792068243027 0.00494174957275 
+0.002 0.00368644245112 0.0100039243698 0.00850625038147 
+0.003 0.00476660307904 0.0102313160896 0.00817451477051 
+0.004 0.00582733094309 0.0102914214134 0.00838621854782 
+0.005 0.00688034368468 0.00961974859238 0.00697486400604 
+0.006 0.00792588921188 0.00913066864014 0.00939590930939 
+0.007 0.00894739648578 0.0137086987495 0.00869399309159 
+0.008 0.00994443434592 0.0158585906029 0.00912393331528 
+0.009 0.0109028623593 0.0117810964584 0.00858191251755 

+ 847 - 0
examples/result_1a.eps

@@ -0,0 +1,847 @@
+%!PS-Adobe-2.0
+%%Title: result_1a.eps
+%%Creator: gnuplot 5.0 patchlevel 1 (Gentoo revision r1)
+%%CreationDate: Fri Dec  2 10:30:14 2016
+%%DocumentFonts: (atend)
+%%BoundingBox: 50 50 482 482
+%%Orientation: Portrait
+%%Pages: (atend)
+%%EndComments
+%%BeginProlog
+/gnudict 256 dict def
+gnudict begin
+%
+% The following true/false flags may be edited by hand if desired.
+% The unit line width and grayscale image gamma correction may also be changed.
+%
+/Color true def
+/Blacktext false def
+/Solid false def
+/Dashlength 1 def
+/Landscape false def
+/Level1 false def
+/Level3 false def
+/Rounded false def
+/ClipToBoundingBox false def
+/SuppressPDFMark false def
+/TransparentPatterns false def
+/gnulinewidth 5.000 def
+/userlinewidth gnulinewidth def
+/Gamma 1.0 def
+/BackgroundColor {-1.000 -1.000 -1.000} def
+%
+/vshift -46 def
+/dl1 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul sub dup 0 le { pop 0.01 } if } if
+} def
+/dl2 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul add } if
+} def
+/hpt_ 31.5 def
+/vpt_ 31.5 def
+/hpt hpt_ def
+/vpt vpt_ def
+/doclip {
+  ClipToBoundingBox {
+    newpath 50 50 moveto 482 50 lineto 482 482 lineto 50 482 lineto closepath
+    clip
+  } if
+} def
+%
+% Gnuplot Prolog Version 5.0 (Dec 2014)
+%
+%/SuppressPDFMark true def
+%
+/M {moveto} bind def
+/L {lineto} bind def
+/R {rmoveto} bind def
+/V {rlineto} bind def
+/N {newpath moveto} bind def
+/Z {closepath} bind def
+/C {setrgbcolor} bind def
+/f {rlineto fill} bind def
+/g {setgray} bind def
+/Gshow {show} def   % May be redefined later in the file to support UTF-8
+/vpt2 vpt 2 mul def
+/hpt2 hpt 2 mul def
+/Lshow {currentpoint stroke M 0 vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Rshow {currentpoint stroke M dup stringwidth pop neg vshift R
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Cshow {currentpoint stroke M dup stringwidth pop -2 div vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/UP {dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def
+  /hpt2 hpt 2 mul def /vpt2 vpt 2 mul def} def
+/DL {Color {setrgbcolor Solid {pop []} if 0 setdash}
+ {pop pop pop 0 setgray Solid {pop []} if 0 setdash} ifelse} def
+/BL {stroke userlinewidth 2 mul setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/AL {stroke userlinewidth 2 div setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/UL {dup gnulinewidth mul /userlinewidth exch def
+	dup 1 lt {pop 1} if 10 mul /udl exch def} def
+/PL {stroke userlinewidth setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+3.8 setmiterlimit
+% Classic Line colors (version 5.0)
+/LCw {1 1 1} def
+/LCb {0 0 0} def
+/LCa {0 0 0} def
+/LC0 {1 0 0} def
+/LC1 {0 1 0} def
+/LC2 {0 0 1} def
+/LC3 {1 0 1} def
+/LC4 {0 1 1} def
+/LC5 {1 1 0} def
+/LC6 {0 0 0} def
+/LC7 {1 0.3 0} def
+/LC8 {0.5 0.5 0.5} def
+% Default dash patterns (version 5.0)
+/LTw {PL [] 1 setgray} def
+/LTb {BL [] LCb DL} def
+/LTa {AL [1 udl mul 2 udl mul] 0 setdash LCa setrgbcolor} def
+/LT0 {PL [] LC0 DL} def
+/LT1 {PL [2 dl1 3 dl2] LC1 DL} def
+/LT2 {PL [1 dl1 1.5 dl2] LC2 DL} def
+/LT3 {PL [6 dl1 2 dl2 1 dl1 2 dl2] LC3 DL} def
+/LT4 {PL [1 dl1 2 dl2 6 dl1 2 dl2 1 dl1 2 dl2] LC4 DL} def
+/LT5 {PL [4 dl1 2 dl2] LC5 DL} def
+/LT6 {PL [1.5 dl1 1.5 dl2 1.5 dl1 1.5 dl2 1.5 dl1 6 dl2] LC6 DL} def
+/LT7 {PL [3 dl1 3 dl2 1 dl1 3 dl2] LC7 DL} def
+/LT8 {PL [2 dl1 2 dl2 2 dl1 6 dl2] LC8 DL} def
+/SL {[] 0 setdash} def
+/Pnt {stroke [] 0 setdash gsave 1 setlinecap M 0 0 V stroke grestore} def
+/Dia {stroke [] 0 setdash 2 copy vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke
+  Pnt} def
+/Pls {stroke [] 0 setdash vpt sub M 0 vpt2 V
+  currentpoint stroke M
+  hpt neg vpt neg R hpt2 0 V stroke
+ } def
+/Box {stroke [] 0 setdash 2 copy exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke
+  Pnt} def
+/Crs {stroke [] 0 setdash exch hpt sub exch vpt add M
+  hpt2 vpt2 neg V currentpoint stroke M
+  hpt2 neg 0 R hpt2 vpt2 V stroke} def
+/TriU {stroke [] 0 setdash 2 copy vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke
+  Pnt} def
+/Star {2 copy Pls Crs} def
+/BoxF {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath fill} def
+/TriUF {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath fill} def
+/TriD {stroke [] 0 setdash 2 copy vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke
+  Pnt} def
+/TriDF {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath fill} def
+/DiaF {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath fill} def
+/Pent {stroke [] 0 setdash 2 copy gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore Pnt} def
+/PentF {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath fill grestore} def
+/Circle {stroke [] 0 setdash 2 copy
+  hpt 0 360 arc stroke Pnt} def
+/CircleF {stroke [] 0 setdash hpt 0 360 arc fill} def
+/C0 {BL [] 0 setdash 2 copy moveto vpt 90 450 arc} bind def
+/C1 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C2 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C3 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C4 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C5 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc
+	2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc} bind def
+/C6 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C7 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C8 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C9 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 450 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C10 {BL [] 0 setdash 2 copy 2 copy moveto vpt 270 360 arc closepath fill
+	2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C11 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C12 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C13 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C14 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 360 arc closepath fill
+	vpt 0 360 arc} bind def
+/C15 {BL [] 0 setdash 2 copy vpt 0 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/Rec {newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto
+	neg 0 rlineto closepath} bind def
+/Square {dup Rec} bind def
+/Bsquare {vpt sub exch vpt sub exch vpt2 Square} bind def
+/S0 {BL [] 0 setdash 2 copy moveto 0 vpt rlineto BL Bsquare} bind def
+/S1 {BL [] 0 setdash 2 copy vpt Square fill Bsquare} bind def
+/S2 {BL [] 0 setdash 2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S3 {BL [] 0 setdash 2 copy exch vpt sub exch vpt2 vpt Rec fill Bsquare} bind def
+/S4 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S5 {BL [] 0 setdash 2 copy 2 copy vpt Square fill
+	exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S6 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S7 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S8 {BL [] 0 setdash 2 copy vpt sub vpt Square fill Bsquare} bind def
+/S9 {BL [] 0 setdash 2 copy vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S10 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt Square fill
+	Bsquare} bind def
+/S11 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt2 vpt Rec fill
+	Bsquare} bind def
+/S12 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill Bsquare} bind def
+/S13 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S14 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S15 {BL [] 0 setdash 2 copy Bsquare fill Bsquare} bind def
+/D0 {gsave translate 45 rotate 0 0 S0 stroke grestore} bind def
+/D1 {gsave translate 45 rotate 0 0 S1 stroke grestore} bind def
+/D2 {gsave translate 45 rotate 0 0 S2 stroke grestore} bind def
+/D3 {gsave translate 45 rotate 0 0 S3 stroke grestore} bind def
+/D4 {gsave translate 45 rotate 0 0 S4 stroke grestore} bind def
+/D5 {gsave translate 45 rotate 0 0 S5 stroke grestore} bind def
+/D6 {gsave translate 45 rotate 0 0 S6 stroke grestore} bind def
+/D7 {gsave translate 45 rotate 0 0 S7 stroke grestore} bind def
+/D8 {gsave translate 45 rotate 0 0 S8 stroke grestore} bind def
+/D9 {gsave translate 45 rotate 0 0 S9 stroke grestore} bind def
+/D10 {gsave translate 45 rotate 0 0 S10 stroke grestore} bind def
+/D11 {gsave translate 45 rotate 0 0 S11 stroke grestore} bind def
+/D12 {gsave translate 45 rotate 0 0 S12 stroke grestore} bind def
+/D13 {gsave translate 45 rotate 0 0 S13 stroke grestore} bind def
+/D14 {gsave translate 45 rotate 0 0 S14 stroke grestore} bind def
+/D15 {gsave translate 45 rotate 0 0 S15 stroke grestore} bind def
+/DiaE {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke} def
+/BoxE {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke} def
+/TriUE {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke} def
+/TriDE {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke} def
+/PentE {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore} def
+/CircE {stroke [] 0 setdash 
+  hpt 0 360 arc stroke} def
+/Opaque {gsave closepath 1 setgray fill grestore 0 setgray closepath} def
+/DiaW {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V Opaque stroke} def
+/BoxW {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V Opaque stroke} def
+/TriUW {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V Opaque stroke} def
+/TriDW {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V Opaque stroke} def
+/PentW {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  Opaque stroke grestore} def
+/CircW {stroke [] 0 setdash 
+  hpt 0 360 arc Opaque stroke} def
+/BoxFill {gsave Rec 1 setgray fill grestore} def
+/Density {
+  /Fillden exch def
+  currentrgbcolor
+  /ColB exch def /ColG exch def /ColR exch def
+  /ColR ColR Fillden mul Fillden sub 1 add def
+  /ColG ColG Fillden mul Fillden sub 1 add def
+  /ColB ColB Fillden mul Fillden sub 1 add def
+  ColR ColG ColB setrgbcolor} def
+/BoxColFill {gsave Rec PolyFill} def
+/PolyFill {gsave Density fill grestore grestore} def
+/h {rlineto rlineto rlineto gsave closepath fill grestore} bind def
+%
+% PostScript Level 1 Pattern Fill routine for rectangles
+% Usage: x y w h s a XX PatternFill
+%	x,y = lower left corner of box to be filled
+%	w,h = width and height of box
+%	  a = angle in degrees between lines and x-axis
+%	 XX = 0/1 for no/yes cross-hatch
+%
+/PatternFill {gsave /PFa [ 9 2 roll ] def
+  PFa 0 get PFa 2 get 2 div add PFa 1 get PFa 3 get 2 div add translate
+  PFa 2 get -2 div PFa 3 get -2 div PFa 2 get PFa 3 get Rec
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+  clip
+  currentlinewidth 0.5 mul setlinewidth
+  /PFs PFa 2 get dup mul PFa 3 get dup mul add sqrt def
+  0 0 M PFa 5 get rotate PFs -2 div dup translate
+  0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 M 0 PFs V} for
+  0 PFa 6 get ne {
+	0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 2 1 roll M PFs 0 V} for
+ } if
+  stroke grestore} def
+%
+/languagelevel where
+ {pop languagelevel} {1} ifelse
+dup 2 lt
+	{/InterpretLevel1 true def
+	 /InterpretLevel3 false def}
+	{/InterpretLevel1 Level1 def
+	 2 gt
+	    {/InterpretLevel3 Level3 def}
+	    {/InterpretLevel3 false def}
+	 ifelse }
+ ifelse
+%
+% PostScript level 2 pattern fill definitions
+%
+/Level2PatternFill {
+/Tile8x8 {/PaintType 2 /PatternType 1 /TilingType 1 /BBox [0 0 8 8] /XStep 8 /YStep 8}
+	bind def
+/KeepColor {currentrgbcolor [/Pattern /DeviceRGB] setcolorspace} bind def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke} 
+>> matrix makepattern
+/Pat1 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke
+	0 4 M 4 8 L 8 4 L 4 0 L 0 4 L stroke}
+>> matrix makepattern
+/Pat2 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 0 8 L
+	8 8 L 8 0 L 0 0 L fill}
+>> matrix makepattern
+/Pat3 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 8 M 8 -4 L
+	0 12 M 12 0 L stroke}
+>> matrix makepattern
+/Pat4 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 0 M 8 12 L
+	0 -4 M 12 8 L stroke}
+>> matrix makepattern
+/Pat5 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 8 M 4 -4 L
+	0 12 M 8 -4 L 4 12 M 10 0 L stroke}
+>> matrix makepattern
+/Pat6 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 0 M 4 12 L
+	0 -4 M 8 12 L 4 -4 M 10 8 L stroke}
+>> matrix makepattern
+/Pat7 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 8 -2 M -4 4 L
+	12 0 M -4 8 L 12 4 M 0 10 L stroke}
+>> matrix makepattern
+/Pat8 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 -2 M 12 4 L
+	-4 0 M 12 8 L -4 4 M 8 10 L stroke}
+>> matrix makepattern
+/Pat9 exch def
+/Pattern1 {PatternBgnd KeepColor Pat1 setpattern} bind def
+/Pattern2 {PatternBgnd KeepColor Pat2 setpattern} bind def
+/Pattern3 {PatternBgnd KeepColor Pat3 setpattern} bind def
+/Pattern4 {PatternBgnd KeepColor Landscape {Pat5} {Pat4} ifelse setpattern} bind def
+/Pattern5 {PatternBgnd KeepColor Landscape {Pat4} {Pat5} ifelse setpattern} bind def
+/Pattern6 {PatternBgnd KeepColor Landscape {Pat9} {Pat6} ifelse setpattern} bind def
+/Pattern7 {PatternBgnd KeepColor Landscape {Pat8} {Pat7} ifelse setpattern} bind def
+} def
+%
+%
+%End of PostScript Level 2 code
+%
+/PatternBgnd {
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+} def
+%
+% Substitute for Level 2 pattern fill codes with
+% grayscale if Level 2 support is not selected.
+%
+/Level1PatternFill {
+/Pattern1 {0.250 Density} bind def
+/Pattern2 {0.500 Density} bind def
+/Pattern3 {0.750 Density} bind def
+/Pattern4 {0.125 Density} bind def
+/Pattern5 {0.375 Density} bind def
+/Pattern6 {0.625 Density} bind def
+/Pattern7 {0.875 Density} bind def
+} def
+%
+% Now test for support of Level 2 code
+%
+Level1 {Level1PatternFill} {Level2PatternFill} ifelse
+%
+/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont
+dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall
+currentdict end definefont pop
+%
+/MFshow {
+   { dup 5 get 3 ge
+     { 5 get 3 eq {gsave} {grestore} ifelse }
+     {dup dup 0 get findfont exch 1 get scalefont setfont
+     [ currentpoint ] exch dup 2 get 0 exch R dup 5 get 2 ne {dup dup 6
+     get exch 4 get {textshow} {stringwidth pop 0 R} ifelse }if dup 5 get 0 eq
+     {dup 3 get {2 get neg 0 exch R pop} {pop aload pop M} ifelse} {dup 5
+     get 1 eq {dup 2 get exch dup 3 get exch 6 get stringwidth pop -2 div
+     dup 0 R} {dup 6 get stringwidth pop -2 div 0 R 6 get
+     textshow 2 index {aload pop M neg 3 -1 roll neg R pop pop} {pop pop pop
+     pop aload pop M} ifelse }ifelse }ifelse }
+     ifelse }
+   forall} def
+/Gswidth {dup type /stringtype eq {stringwidth} {pop (n) stringwidth} ifelse} def
+/MFwidth {0 exch { dup 5 get 3 ge { 5 get 3 eq { 0 } { pop } ifelse }
+ {dup 3 get{dup dup 0 get findfont exch 1 get scalefont setfont
+     6 get Gswidth pop add} {pop} ifelse} ifelse} forall} def
+/MLshow { currentpoint stroke M
+  0 exch R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MRshow { currentpoint stroke M
+  exch dup MFwidth neg 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MCshow { currentpoint stroke M
+  exch dup MFwidth -2 div 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/XYsave    { [( ) 1 2 true false 3 ()] } bind def
+/XYrestore { [( ) 1 2 true false 4 ()] } bind def
+Level1 SuppressPDFMark or 
+{} {
+/SDict 10 dict def
+systemdict /pdfmark known not {
+  userdict /pdfmark systemdict /cleartomark get put
+} if
+SDict begin [
+  /Title (result_1a.eps)
+  /Subject (gnuplot plot)
+  /Creator (gnuplot 5.0 patchlevel 1 (Gentoo revision r1))
+  /Author (yentl)
+%  /Producer (gnuplot)
+%  /Keywords ()
+  /CreationDate (Fri Dec  2 10:30:14 2016)
+  /DOCINFO pdfmark
+end
+} ifelse
+end
+%
+% Support for boxed text - Ethan A Merritt May 2005
+%
+/InitTextBox { userdict /TBy2 3 -1 roll put userdict /TBx2 3 -1 roll put
+           userdict /TBy1 3 -1 roll put userdict /TBx1 3 -1 roll put
+	   /Boxing true def } def
+/ExtendTextBox { Boxing
+    { gsave dup false charpath pathbbox
+      dup TBy2 gt {userdict /TBy2 3 -1 roll put} {pop} ifelse
+      dup TBx2 gt {userdict /TBx2 3 -1 roll put} {pop} ifelse
+      dup TBy1 lt {userdict /TBy1 3 -1 roll put} {pop} ifelse
+      dup TBx1 lt {userdict /TBx1 3 -1 roll put} {pop} ifelse
+      grestore } if } def
+/PopTextBox { newpath TBx1 TBxmargin sub TBy1 TBymargin sub M
+               TBx1 TBxmargin sub TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy1 TBymargin sub L closepath } def
+/DrawTextBox { PopTextBox stroke /Boxing false def} def
+/FillTextBox { gsave PopTextBox 1 1 1 setrgbcolor fill grestore /Boxing false def} def
+0 0 0 0 InitTextBox
+/TBxmargin 20 def
+/TBymargin 20 def
+/Boxing false def
+/textshow { ExtendTextBox Gshow } def
+%
+%%EndProlog
+%%Page: 1 1
+gnudict begin
+gsave
+doclip
+50 50 translate
+0.100 0.100 scale
+0 setgray
+newpath
+(Helvetica) findfont 140 scalefont setfont
+BackgroundColor 0 lt 3 1 roll 0 lt exch 0 lt or or not {gsave BackgroundColor C clippath fill grestore} if
+1.000 UL
+LTb
+LCb setrgbcolor
+854 448 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 448 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 879 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 879 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.002)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 1311 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 1311 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.004)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 1742 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 1742 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.006)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 2174 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 2174 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.008)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 2605 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 2605 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.01)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 3036 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 3036 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.012)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 3468 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 3468 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.014)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 3899 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 3899 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.016)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+854 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1211 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+1211 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.001)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1568 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+1568 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.002)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1925 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+1925 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.003)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2282 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+2282 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.004)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2639 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+2639 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.005)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2996 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+2996 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.006)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3353 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+3353 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.007)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3710 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+3710 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.008)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+4067 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+4067 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.009)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+854 3899 N
+854 448 L
+3213 0 V
+0 3451 V
+-3213 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+LCb setrgbcolor
+112 2173 M
+currentpoint gsave translate -270 rotate 0 0 moveto
+[ [(Helvetica) 140.0 0.0 true true 0 (Execution time \(s\))]
+] -46.7 MCshow
+grestore
+LTb
+LCb setrgbcolor
+2460 98 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Transition time \(s\))]
+] -46.7 MCshow
+LTb
+LCb setrgbcolor
+2460 4109 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Influence of transition time for copy state saving)]
+] -46.7 MCshow
+% Begin plot #1
+4.000 UL
+LTb
+1.00 0.00 0.00 C LCb setrgbcolor
+2030 3766 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Forward step)]
+] -46.7 MRshow
+4.000 UL
+LTb
+1.00 0.00 0.00 C 2114 3766 M
+399 0 V
+854 490 M
+357 518 V
+357 235 V
+357 233 V
+357 229 V
+357 227 V
+357 226 V
+357 220 V
+357 215 V
+357 207 V
+% End plot #1
+% Begin plot #2
+stroke
+LTb
+0.00 1.00 0.00 C LCb setrgbcolor
+2030 3626 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Random jump)]
+] -46.7 MRshow
+4.000 UL
+LTb
+0.00 1.00 0.00 C 2114 3626 M
+399 0 V
+854 2506 M
+357 -350 V
+357 450 V
+357 49 V
+357 13 V
+357 -145 V
+357 -106 V
+357 988 V
+357 463 V
+357 -879 V
+% End plot #2
+% Begin plot #3
+stroke
+LTb
+LT1
+0.00 0.00 1.00 C LCb setrgbcolor
+2030 3486 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Backward step)]
+] -46.7 MRshow
+4.000 UL
+LTb
+LT1
+0.00 0.00 1.00 C 2114 3486 M
+399 0 V
+854 2247 M
+357 -733 V
+357 769 V
+357 -72 V
+357 46 V
+357 -305 V
+357 523 V
+357 -152 V
+357 93 V
+357 -117 V
+% End plot #3
+stroke
+2.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+854 3899 N
+854 448 L
+3213 0 V
+0 3451 V
+-3213 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+stroke
+grestore
+end
+showpage
+%%Trailer
+%%DocumentFonts: Helvetica
+%%Pages: 1

+ 10 - 0
examples/result_1b

@@ -0,0 +1,10 @@
+0.0 0.000180677999393 0.347425317764 0.187824749947 
+0.001 0.00260211824094 0.313662803173 0.117082309723 
+0.002 0.00369575150965 0.315854239464 0.192000865936 
+0.003 0.00477595338538 0.242237210274 0.288913166523 
+0.004 0.00583319165275 0.387030673027 0.289693009853 
+0.005 0.00687045049744 0.436834359169 0.42284181118 
+0.006 0.00792770872343 0.29181047678 0.12228320837 
+0.007 0.00895442560283 0.113496315479 0.220580494404 
+0.008 0.00997569730118 0.358634603024 0.133556520939 
+0.009 0.0109171829815 0.378147864342 0.186139822006 

+ 814 - 0
examples/result_1b.eps

@@ -0,0 +1,814 @@
+%!PS-Adobe-2.0
+%%Title: result_1b.eps
+%%Creator: gnuplot 5.0 patchlevel 1 (Gentoo revision r1)
+%%CreationDate: Fri Dec  2 10:30:14 2016
+%%DocumentFonts: (atend)
+%%BoundingBox: 50 50 482 482
+%%Orientation: Portrait
+%%Pages: (atend)
+%%EndComments
+%%BeginProlog
+/gnudict 256 dict def
+gnudict begin
+%
+% The following true/false flags may be edited by hand if desired.
+% The unit line width and grayscale image gamma correction may also be changed.
+%
+/Color true def
+/Blacktext false def
+/Solid false def
+/Dashlength 1 def
+/Landscape false def
+/Level1 false def
+/Level3 false def
+/Rounded false def
+/ClipToBoundingBox false def
+/SuppressPDFMark false def
+/TransparentPatterns false def
+/gnulinewidth 5.000 def
+/userlinewidth gnulinewidth def
+/Gamma 1.0 def
+/BackgroundColor {-1.000 -1.000 -1.000} def
+%
+/vshift -46 def
+/dl1 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul sub dup 0 le { pop 0.01 } if } if
+} def
+/dl2 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul add } if
+} def
+/hpt_ 31.5 def
+/vpt_ 31.5 def
+/hpt hpt_ def
+/vpt vpt_ def
+/doclip {
+  ClipToBoundingBox {
+    newpath 50 50 moveto 482 50 lineto 482 482 lineto 50 482 lineto closepath
+    clip
+  } if
+} def
+%
+% Gnuplot Prolog Version 5.0 (Dec 2014)
+%
+%/SuppressPDFMark true def
+%
+/M {moveto} bind def
+/L {lineto} bind def
+/R {rmoveto} bind def
+/V {rlineto} bind def
+/N {newpath moveto} bind def
+/Z {closepath} bind def
+/C {setrgbcolor} bind def
+/f {rlineto fill} bind def
+/g {setgray} bind def
+/Gshow {show} def   % May be redefined later in the file to support UTF-8
+/vpt2 vpt 2 mul def
+/hpt2 hpt 2 mul def
+/Lshow {currentpoint stroke M 0 vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Rshow {currentpoint stroke M dup stringwidth pop neg vshift R
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Cshow {currentpoint stroke M dup stringwidth pop -2 div vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/UP {dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def
+  /hpt2 hpt 2 mul def /vpt2 vpt 2 mul def} def
+/DL {Color {setrgbcolor Solid {pop []} if 0 setdash}
+ {pop pop pop 0 setgray Solid {pop []} if 0 setdash} ifelse} def
+/BL {stroke userlinewidth 2 mul setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/AL {stroke userlinewidth 2 div setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/UL {dup gnulinewidth mul /userlinewidth exch def
+	dup 1 lt {pop 1} if 10 mul /udl exch def} def
+/PL {stroke userlinewidth setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+3.8 setmiterlimit
+% Classic Line colors (version 5.0)
+/LCw {1 1 1} def
+/LCb {0 0 0} def
+/LCa {0 0 0} def
+/LC0 {1 0 0} def
+/LC1 {0 1 0} def
+/LC2 {0 0 1} def
+/LC3 {1 0 1} def
+/LC4 {0 1 1} def
+/LC5 {1 1 0} def
+/LC6 {0 0 0} def
+/LC7 {1 0.3 0} def
+/LC8 {0.5 0.5 0.5} def
+% Default dash patterns (version 5.0)
+/LTw {PL [] 1 setgray} def
+/LTb {BL [] LCb DL} def
+/LTa {AL [1 udl mul 2 udl mul] 0 setdash LCa setrgbcolor} def
+/LT0 {PL [] LC0 DL} def
+/LT1 {PL [2 dl1 3 dl2] LC1 DL} def
+/LT2 {PL [1 dl1 1.5 dl2] LC2 DL} def
+/LT3 {PL [6 dl1 2 dl2 1 dl1 2 dl2] LC3 DL} def
+/LT4 {PL [1 dl1 2 dl2 6 dl1 2 dl2 1 dl1 2 dl2] LC4 DL} def
+/LT5 {PL [4 dl1 2 dl2] LC5 DL} def
+/LT6 {PL [1.5 dl1 1.5 dl2 1.5 dl1 1.5 dl2 1.5 dl1 6 dl2] LC6 DL} def
+/LT7 {PL [3 dl1 3 dl2 1 dl1 3 dl2] LC7 DL} def
+/LT8 {PL [2 dl1 2 dl2 2 dl1 6 dl2] LC8 DL} def
+/SL {[] 0 setdash} def
+/Pnt {stroke [] 0 setdash gsave 1 setlinecap M 0 0 V stroke grestore} def
+/Dia {stroke [] 0 setdash 2 copy vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke
+  Pnt} def
+/Pls {stroke [] 0 setdash vpt sub M 0 vpt2 V
+  currentpoint stroke M
+  hpt neg vpt neg R hpt2 0 V stroke
+ } def
+/Box {stroke [] 0 setdash 2 copy exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke
+  Pnt} def
+/Crs {stroke [] 0 setdash exch hpt sub exch vpt add M
+  hpt2 vpt2 neg V currentpoint stroke M
+  hpt2 neg 0 R hpt2 vpt2 V stroke} def
+/TriU {stroke [] 0 setdash 2 copy vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke
+  Pnt} def
+/Star {2 copy Pls Crs} def
+/BoxF {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath fill} def
+/TriUF {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath fill} def
+/TriD {stroke [] 0 setdash 2 copy vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke
+  Pnt} def
+/TriDF {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath fill} def
+/DiaF {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath fill} def
+/Pent {stroke [] 0 setdash 2 copy gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore Pnt} def
+/PentF {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath fill grestore} def
+/Circle {stroke [] 0 setdash 2 copy
+  hpt 0 360 arc stroke Pnt} def
+/CircleF {stroke [] 0 setdash hpt 0 360 arc fill} def
+/C0 {BL [] 0 setdash 2 copy moveto vpt 90 450 arc} bind def
+/C1 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C2 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C3 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C4 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C5 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc
+	2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc} bind def
+/C6 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C7 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C8 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C9 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 450 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C10 {BL [] 0 setdash 2 copy 2 copy moveto vpt 270 360 arc closepath fill
+	2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C11 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C12 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C13 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C14 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 360 arc closepath fill
+	vpt 0 360 arc} bind def
+/C15 {BL [] 0 setdash 2 copy vpt 0 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/Rec {newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto
+	neg 0 rlineto closepath} bind def
+/Square {dup Rec} bind def
+/Bsquare {vpt sub exch vpt sub exch vpt2 Square} bind def
+/S0 {BL [] 0 setdash 2 copy moveto 0 vpt rlineto BL Bsquare} bind def
+/S1 {BL [] 0 setdash 2 copy vpt Square fill Bsquare} bind def
+/S2 {BL [] 0 setdash 2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S3 {BL [] 0 setdash 2 copy exch vpt sub exch vpt2 vpt Rec fill Bsquare} bind def
+/S4 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S5 {BL [] 0 setdash 2 copy 2 copy vpt Square fill
+	exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S6 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S7 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S8 {BL [] 0 setdash 2 copy vpt sub vpt Square fill Bsquare} bind def
+/S9 {BL [] 0 setdash 2 copy vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S10 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt Square fill
+	Bsquare} bind def
+/S11 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt2 vpt Rec fill
+	Bsquare} bind def
+/S12 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill Bsquare} bind def
+/S13 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S14 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S15 {BL [] 0 setdash 2 copy Bsquare fill Bsquare} bind def
+/D0 {gsave translate 45 rotate 0 0 S0 stroke grestore} bind def
+/D1 {gsave translate 45 rotate 0 0 S1 stroke grestore} bind def
+/D2 {gsave translate 45 rotate 0 0 S2 stroke grestore} bind def
+/D3 {gsave translate 45 rotate 0 0 S3 stroke grestore} bind def
+/D4 {gsave translate 45 rotate 0 0 S4 stroke grestore} bind def
+/D5 {gsave translate 45 rotate 0 0 S5 stroke grestore} bind def
+/D6 {gsave translate 45 rotate 0 0 S6 stroke grestore} bind def
+/D7 {gsave translate 45 rotate 0 0 S7 stroke grestore} bind def
+/D8 {gsave translate 45 rotate 0 0 S8 stroke grestore} bind def
+/D9 {gsave translate 45 rotate 0 0 S9 stroke grestore} bind def
+/D10 {gsave translate 45 rotate 0 0 S10 stroke grestore} bind def
+/D11 {gsave translate 45 rotate 0 0 S11 stroke grestore} bind def
+/D12 {gsave translate 45 rotate 0 0 S12 stroke grestore} bind def
+/D13 {gsave translate 45 rotate 0 0 S13 stroke grestore} bind def
+/D14 {gsave translate 45 rotate 0 0 S14 stroke grestore} bind def
+/D15 {gsave translate 45 rotate 0 0 S15 stroke grestore} bind def
+/DiaE {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke} def
+/BoxE {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke} def
+/TriUE {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke} def
+/TriDE {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke} def
+/PentE {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore} def
+/CircE {stroke [] 0 setdash 
+  hpt 0 360 arc stroke} def
+/Opaque {gsave closepath 1 setgray fill grestore 0 setgray closepath} def
+/DiaW {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V Opaque stroke} def
+/BoxW {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V Opaque stroke} def
+/TriUW {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V Opaque stroke} def
+/TriDW {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V Opaque stroke} def
+/PentW {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  Opaque stroke grestore} def
+/CircW {stroke [] 0 setdash 
+  hpt 0 360 arc Opaque stroke} def
+/BoxFill {gsave Rec 1 setgray fill grestore} def
+/Density {
+  /Fillden exch def
+  currentrgbcolor
+  /ColB exch def /ColG exch def /ColR exch def
+  /ColR ColR Fillden mul Fillden sub 1 add def
+  /ColG ColG Fillden mul Fillden sub 1 add def
+  /ColB ColB Fillden mul Fillden sub 1 add def
+  ColR ColG ColB setrgbcolor} def
+/BoxColFill {gsave Rec PolyFill} def
+/PolyFill {gsave Density fill grestore grestore} def
+/h {rlineto rlineto rlineto gsave closepath fill grestore} bind def
+%
+% PostScript Level 1 Pattern Fill routine for rectangles
+% Usage: x y w h s a XX PatternFill
+%	x,y = lower left corner of box to be filled
+%	w,h = width and height of box
+%	  a = angle in degrees between lines and x-axis
+%	 XX = 0/1 for no/yes cross-hatch
+%
+/PatternFill {gsave /PFa [ 9 2 roll ] def
+  PFa 0 get PFa 2 get 2 div add PFa 1 get PFa 3 get 2 div add translate
+  PFa 2 get -2 div PFa 3 get -2 div PFa 2 get PFa 3 get Rec
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+  clip
+  currentlinewidth 0.5 mul setlinewidth
+  /PFs PFa 2 get dup mul PFa 3 get dup mul add sqrt def
+  0 0 M PFa 5 get rotate PFs -2 div dup translate
+  0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 M 0 PFs V} for
+  0 PFa 6 get ne {
+	0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 2 1 roll M PFs 0 V} for
+ } if
+  stroke grestore} def
+%
+/languagelevel where
+ {pop languagelevel} {1} ifelse
+dup 2 lt
+	{/InterpretLevel1 true def
+	 /InterpretLevel3 false def}
+	{/InterpretLevel1 Level1 def
+	 2 gt
+	    {/InterpretLevel3 Level3 def}
+	    {/InterpretLevel3 false def}
+	 ifelse }
+ ifelse
+%
+% PostScript level 2 pattern fill definitions
+%
+/Level2PatternFill {
+/Tile8x8 {/PaintType 2 /PatternType 1 /TilingType 1 /BBox [0 0 8 8] /XStep 8 /YStep 8}
+	bind def
+/KeepColor {currentrgbcolor [/Pattern /DeviceRGB] setcolorspace} bind def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke} 
+>> matrix makepattern
+/Pat1 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke
+	0 4 M 4 8 L 8 4 L 4 0 L 0 4 L stroke}
+>> matrix makepattern
+/Pat2 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 0 8 L
+	8 8 L 8 0 L 0 0 L fill}
+>> matrix makepattern
+/Pat3 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 8 M 8 -4 L
+	0 12 M 12 0 L stroke}
+>> matrix makepattern
+/Pat4 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 0 M 8 12 L
+	0 -4 M 12 8 L stroke}
+>> matrix makepattern
+/Pat5 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 8 M 4 -4 L
+	0 12 M 8 -4 L 4 12 M 10 0 L stroke}
+>> matrix makepattern
+/Pat6 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 0 M 4 12 L
+	0 -4 M 8 12 L 4 -4 M 10 8 L stroke}
+>> matrix makepattern
+/Pat7 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 8 -2 M -4 4 L
+	12 0 M -4 8 L 12 4 M 0 10 L stroke}
+>> matrix makepattern
+/Pat8 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 -2 M 12 4 L
+	-4 0 M 12 8 L -4 4 M 8 10 L stroke}
+>> matrix makepattern
+/Pat9 exch def
+/Pattern1 {PatternBgnd KeepColor Pat1 setpattern} bind def
+/Pattern2 {PatternBgnd KeepColor Pat2 setpattern} bind def
+/Pattern3 {PatternBgnd KeepColor Pat3 setpattern} bind def
+/Pattern4 {PatternBgnd KeepColor Landscape {Pat5} {Pat4} ifelse setpattern} bind def
+/Pattern5 {PatternBgnd KeepColor Landscape {Pat4} {Pat5} ifelse setpattern} bind def
+/Pattern6 {PatternBgnd KeepColor Landscape {Pat9} {Pat6} ifelse setpattern} bind def
+/Pattern7 {PatternBgnd KeepColor Landscape {Pat8} {Pat7} ifelse setpattern} bind def
+} def
+%
+%
+%End of PostScript Level 2 code
+%
+/PatternBgnd {
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+} def
+%
+% Substitute for Level 2 pattern fill codes with
+% grayscale if Level 2 support is not selected.
+%
+/Level1PatternFill {
+/Pattern1 {0.250 Density} bind def
+/Pattern2 {0.500 Density} bind def
+/Pattern3 {0.750 Density} bind def
+/Pattern4 {0.125 Density} bind def
+/Pattern5 {0.375 Density} bind def
+/Pattern6 {0.625 Density} bind def
+/Pattern7 {0.875 Density} bind def
+} def
+%
+% Now test for support of Level 2 code
+%
+Level1 {Level1PatternFill} {Level2PatternFill} ifelse
+%
+/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont
+dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall
+currentdict end definefont pop
+%
+/MFshow {
+   { dup 5 get 3 ge
+     { 5 get 3 eq {gsave} {grestore} ifelse }
+     {dup dup 0 get findfont exch 1 get scalefont setfont
+     [ currentpoint ] exch dup 2 get 0 exch R dup 5 get 2 ne {dup dup 6
+     get exch 4 get {textshow} {stringwidth pop 0 R} ifelse }if dup 5 get 0 eq
+     {dup 3 get {2 get neg 0 exch R pop} {pop aload pop M} ifelse} {dup 5
+     get 1 eq {dup 2 get exch dup 3 get exch 6 get stringwidth pop -2 div
+     dup 0 R} {dup 6 get stringwidth pop -2 div 0 R 6 get
+     textshow 2 index {aload pop M neg 3 -1 roll neg R pop pop} {pop pop pop
+     pop aload pop M} ifelse }ifelse }ifelse }
+     ifelse }
+   forall} def
+/Gswidth {dup type /stringtype eq {stringwidth} {pop (n) stringwidth} ifelse} def
+/MFwidth {0 exch { dup 5 get 3 ge { 5 get 3 eq { 0 } { pop } ifelse }
+ {dup 3 get{dup dup 0 get findfont exch 1 get scalefont setfont
+     6 get Gswidth pop add} {pop} ifelse} ifelse} forall} def
+/MLshow { currentpoint stroke M
+  0 exch R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MRshow { currentpoint stroke M
+  exch dup MFwidth neg 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MCshow { currentpoint stroke M
+  exch dup MFwidth -2 div 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/XYsave    { [( ) 1 2 true false 3 ()] } bind def
+/XYrestore { [( ) 1 2 true false 4 ()] } bind def
+Level1 SuppressPDFMark or 
+{} {
+/SDict 10 dict def
+systemdict /pdfmark known not {
+  userdict /pdfmark systemdict /cleartomark get put
+} if
+SDict begin [
+  /Title (result_1b.eps)
+  /Subject (gnuplot plot)
+  /Creator (gnuplot 5.0 patchlevel 1 (Gentoo revision r1))
+  /Author (yentl)
+%  /Producer (gnuplot)
+%  /Keywords ()
+  /CreationDate (Fri Dec  2 10:30:14 2016)
+  /DOCINFO pdfmark
+end
+} ifelse
+end
+%
+% Support for boxed text - Ethan A Merritt May 2005
+%
+/InitTextBox { userdict /TBy2 3 -1 roll put userdict /TBx2 3 -1 roll put
+           userdict /TBy1 3 -1 roll put userdict /TBx1 3 -1 roll put
+	   /Boxing true def } def
+/ExtendTextBox { Boxing
+    { gsave dup false charpath pathbbox
+      dup TBy2 gt {userdict /TBy2 3 -1 roll put} {pop} ifelse
+      dup TBx2 gt {userdict /TBx2 3 -1 roll put} {pop} ifelse
+      dup TBy1 lt {userdict /TBy1 3 -1 roll put} {pop} ifelse
+      dup TBx1 lt {userdict /TBx1 3 -1 roll put} {pop} ifelse
+      grestore } if } def
+/PopTextBox { newpath TBx1 TBxmargin sub TBy1 TBymargin sub M
+               TBx1 TBxmargin sub TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy1 TBymargin sub L closepath } def
+/DrawTextBox { PopTextBox stroke /Boxing false def} def
+/FillTextBox { gsave PopTextBox 1 1 1 setrgbcolor fill grestore /Boxing false def} def
+0 0 0 0 InitTextBox
+/TBxmargin 20 def
+/TBymargin 20 def
+/Boxing false def
+/textshow { ExtendTextBox Gshow } def
+%
+%%EndProlog
+%%Page: 1 1
+gnudict begin
+gsave
+doclip
+50 50 translate
+0.100 0.100 scale
+0 setgray
+newpath
+(Helvetica) findfont 140 scalefont setfont
+BackgroundColor 0 lt 3 1 roll 0 lt exch 0 lt or or not {gsave BackgroundColor C clippath fill grestore} if
+1.000 UL
+LTb
+LCb setrgbcolor
+686 448 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 448 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 1138 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 1138 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.1)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 1828 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 1828 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.2)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 2519 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 2519 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.3)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 3209 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 3209 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.4)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 3899 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 3899 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.5)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+686 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1062 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+1062 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.001)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1437 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+1437 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.002)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1813 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+1813 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.003)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2189 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+2189 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.004)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2564 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+2564 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.005)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2940 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+2940 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.006)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3316 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+3316 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.007)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3691 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+3691 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.008)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+4067 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+4067 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.009)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+686 3899 N
+686 448 L
+3381 0 V
+0 3451 V
+-3381 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+LCb setrgbcolor
+112 2173 M
+currentpoint gsave translate -270 rotate 0 0 moveto
+[ [(Helvetica) 140.0 0.0 true true 0 (Execution time \(s\))]
+] -46.7 MCshow
+grestore
+LTb
+LCb setrgbcolor
+2376 98 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Transition time \(s\))]
+] -46.7 MCshow
+LTb
+LCb setrgbcolor
+2376 4109 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Influence of transition time for periodic state saving)]
+] -46.7 MCshow
+% Begin plot #1
+4.000 UL
+LTb
+1.00 0.00 0.00 C LCb setrgbcolor
+1862 3766 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Forward step)]
+] -46.7 MRshow
+4.000 UL
+LTb
+1.00 0.00 0.00 C 1946 3766 M
+399 0 V
+686 449 M
+376 17 V
+375 8 V
+376 7 V
+376 7 V
+375 7 V
+376 8 V
+376 7 V
+375 7 V
+376 6 V
+% End plot #1
+% Begin plot #2
+stroke
+LTb
+0.00 1.00 0.00 C LCb setrgbcolor
+1862 3626 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Random jump)]
+] -46.7 MRshow
+4.000 UL
+LTb
+0.00 1.00 0.00 C 1946 3626 M
+399 0 V
+686 2846 M
+376 -233 V
+375 15 V
+376 -508 V
+376 999 V
+375 344 V
+2940 2462 L
+3316 1231 L
+375 1692 V
+376 135 V
+% End plot #2
+% Begin plot #3
+stroke
+LTb
+LT1
+0.00 0.00 1.00 C LCb setrgbcolor
+1862 3486 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Backward step)]
+] -46.7 MRshow
+4.000 UL
+LTb
+LT1
+0.00 0.00 1.00 C 1946 3486 M
+399 0 V
+686 1744 M
+376 -488 V
+375 517 V
+376 669 V
+376 5 V
+375 919 V
+2940 1292 L
+376 678 V
+375 -600 V
+376 363 V
+% End plot #3
+stroke
+2.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+686 3899 N
+686 448 L
+3381 0 V
+0 3451 V
+-3381 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+stroke
+grestore
+end
+showpage
+%%Trailer
+%%DocumentFonts: Helvetica
+%%Pages: 1

+ 20 - 0
examples/result_2a

@@ -0,0 +1,20 @@
+10 0.00247612365819 0.00569891929626 0.00696206092834 
+20 0.00230309217108 0.0048840045929 0.0189919471741 
+30 0.00224316464148 0.0104629993439 0.0198810100555 
+40 0.0021982090692 0.0138549804688 0.0100939273834 
+50 0.00214465838031 0.0149118900299 0.0050220489502 
+60 0.00214461366474 0.0116879940033 0.0157091617584 
+70 0.00215288354391 0.0127220153809 0.00995206832886 
+80 0.00213687651535 0.0140318870544 0.00415086746216 
+90 0.0021430188417 0.0281460285187 0.00424599647522 
+100 0.00213129240432 0.0229029655457 0.00506901741028 
+110 0.00212107799717 0.0186121463776 0.0188789367676 
+120 0.0021169575996 0.0241730213165 0.0218119621277 
+130 0.00210238631283 0.0278868675232 0.00604581832886 
+140 0.00210436967992 0.0289051532745 0.0219128131866 
+150 0.00209369439883 0.0358431339264 0.0107409954071 
+160 0.00209235247671 0.0238580703735 0.0187830924988 
+170 0.00209195256174 0.0268099308014 0.00648593902588 
+180 0.00208979299731 0.0358419418335 0.00678586959839 
+190 0.00208530720205 0.0260708332062 0.00789785385132 
+200 0.00208608668735 0.0288968086243 0.00808095932007 

+ 20 - 0
examples/result_2a-bis

@@ -0,0 +1,20 @@
+10 0.00255335302629 0.221838951111 0.441825866699 
+20 0.00236973698075 0.100803852081 0.100991010666 
+30 0.00226284396503 0.373555183411 0.211652040482 
+40 0.002219359119 0.172674179077 0.239874124527 
+50 0.00219317676199 0.16991686821 0.303964138031 
+60 0.00217454811102 0.573979854584 0.338911056519 
+70 0.0021495474537 0.338992118835 0.100797891617 
+80 0.00213472613681 0.371994972229 0.0690131187439 
+90 0.00213293500346 0.575094938278 0.440019130707 
+100 0.00212429135213 0.0109341144562 0.303010940552 
+110 0.00210779531556 0.516821861267 0.137888908386 
+120 0.00211161385678 0.270977973938 0.404639005661 
+130 0.00209151040814 0.340162038803 0.102958917618 
+140 0.00209543674458 0.34078001976 0.00394296646118 
+150 0.00209165249388 0.17188000679 0.201961994171 
+160 0.00208447587236 0.170929908752 0.201979875565 
+170 0.00208299344602 0.169950962067 0.203197002411 
+180 0.0020743039057 0.238046884537 0.221855163574 
+190 0.00208532627124 0.506908178329 0.17188501358 
+200 0.0020837071606 0.52202796936 0.302907943726 

+ 864 - 0
examples/result_2a-bis.eps

@@ -0,0 +1,864 @@
+%!PS-Adobe-2.0
+%%Title: result_2a-bis.eps
+%%Creator: gnuplot 5.0 patchlevel 1 (Gentoo revision r1)
+%%CreationDate: Tue Jul 19 11:18:20 2016
+%%DocumentFonts: (atend)
+%%BoundingBox: 50 50 482 626
+%%Orientation: Portrait
+%%Pages: (atend)
+%%EndComments
+%%BeginProlog
+/gnudict 256 dict def
+gnudict begin
+%
+% The following true/false flags may be edited by hand if desired.
+% The unit line width and grayscale image gamma correction may also be changed.
+%
+/Color true def
+/Blacktext false def
+/Solid false def
+/Dashlength 1 def
+/Landscape false def
+/Level1 false def
+/Level3 false def
+/Rounded false def
+/ClipToBoundingBox false def
+/SuppressPDFMark false def
+/TransparentPatterns false def
+/gnulinewidth 5.000 def
+/userlinewidth gnulinewidth def
+/Gamma 1.0 def
+/BackgroundColor {-1.000 -1.000 -1.000} def
+%
+/vshift -46 def
+/dl1 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul sub dup 0 le { pop 0.01 } if } if
+} def
+/dl2 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul add } if
+} def
+/hpt_ 31.5 def
+/vpt_ 31.5 def
+/hpt hpt_ def
+/vpt vpt_ def
+/doclip {
+  ClipToBoundingBox {
+    newpath 50 50 moveto 482 50 lineto 482 626 lineto 50 626 lineto closepath
+    clip
+  } if
+} def
+%
+% Gnuplot Prolog Version 5.0 (Dec 2014)
+%
+%/SuppressPDFMark true def
+%
+/M {moveto} bind def
+/L {lineto} bind def
+/R {rmoveto} bind def
+/V {rlineto} bind def
+/N {newpath moveto} bind def
+/Z {closepath} bind def
+/C {setrgbcolor} bind def
+/f {rlineto fill} bind def
+/g {setgray} bind def
+/Gshow {show} def   % May be redefined later in the file to support UTF-8
+/vpt2 vpt 2 mul def
+/hpt2 hpt 2 mul def
+/Lshow {currentpoint stroke M 0 vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Rshow {currentpoint stroke M dup stringwidth pop neg vshift R
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Cshow {currentpoint stroke M dup stringwidth pop -2 div vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/UP {dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def
+  /hpt2 hpt 2 mul def /vpt2 vpt 2 mul def} def
+/DL {Color {setrgbcolor Solid {pop []} if 0 setdash}
+ {pop pop pop 0 setgray Solid {pop []} if 0 setdash} ifelse} def
+/BL {stroke userlinewidth 2 mul setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/AL {stroke userlinewidth 2 div setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/UL {dup gnulinewidth mul /userlinewidth exch def
+	dup 1 lt {pop 1} if 10 mul /udl exch def} def
+/PL {stroke userlinewidth setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+3.8 setmiterlimit
+% Classic Line colors (version 5.0)
+/LCw {1 1 1} def
+/LCb {0 0 0} def
+/LCa {0 0 0} def
+/LC0 {1 0 0} def
+/LC1 {0 1 0} def
+/LC2 {0 0 1} def
+/LC3 {1 0 1} def
+/LC4 {0 1 1} def
+/LC5 {1 1 0} def
+/LC6 {0 0 0} def
+/LC7 {1 0.3 0} def
+/LC8 {0.5 0.5 0.5} def
+% Default dash patterns (version 5.0)
+/LTw {PL [] 1 setgray} def
+/LTb {BL [] LCb DL} def
+/LTa {AL [1 udl mul 2 udl mul] 0 setdash LCa setrgbcolor} def
+/LT0 {PL [] LC0 DL} def
+/LT1 {PL [2 dl1 3 dl2] LC1 DL} def
+/LT2 {PL [1 dl1 1.5 dl2] LC2 DL} def
+/LT3 {PL [6 dl1 2 dl2 1 dl1 2 dl2] LC3 DL} def
+/LT4 {PL [1 dl1 2 dl2 6 dl1 2 dl2 1 dl1 2 dl2] LC4 DL} def
+/LT5 {PL [4 dl1 2 dl2] LC5 DL} def
+/LT6 {PL [1.5 dl1 1.5 dl2 1.5 dl1 1.5 dl2 1.5 dl1 6 dl2] LC6 DL} def
+/LT7 {PL [3 dl1 3 dl2 1 dl1 3 dl2] LC7 DL} def
+/LT8 {PL [2 dl1 2 dl2 2 dl1 6 dl2] LC8 DL} def
+/SL {[] 0 setdash} def
+/Pnt {stroke [] 0 setdash gsave 1 setlinecap M 0 0 V stroke grestore} def
+/Dia {stroke [] 0 setdash 2 copy vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke
+  Pnt} def
+/Pls {stroke [] 0 setdash vpt sub M 0 vpt2 V
+  currentpoint stroke M
+  hpt neg vpt neg R hpt2 0 V stroke
+ } def
+/Box {stroke [] 0 setdash 2 copy exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke
+  Pnt} def
+/Crs {stroke [] 0 setdash exch hpt sub exch vpt add M
+  hpt2 vpt2 neg V currentpoint stroke M
+  hpt2 neg 0 R hpt2 vpt2 V stroke} def
+/TriU {stroke [] 0 setdash 2 copy vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke
+  Pnt} def
+/Star {2 copy Pls Crs} def
+/BoxF {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath fill} def
+/TriUF {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath fill} def
+/TriD {stroke [] 0 setdash 2 copy vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke
+  Pnt} def
+/TriDF {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath fill} def
+/DiaF {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath fill} def
+/Pent {stroke [] 0 setdash 2 copy gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore Pnt} def
+/PentF {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath fill grestore} def
+/Circle {stroke [] 0 setdash 2 copy
+  hpt 0 360 arc stroke Pnt} def
+/CircleF {stroke [] 0 setdash hpt 0 360 arc fill} def
+/C0 {BL [] 0 setdash 2 copy moveto vpt 90 450 arc} bind def
+/C1 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C2 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C3 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C4 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C5 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc
+	2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc} bind def
+/C6 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C7 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C8 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C9 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 450 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C10 {BL [] 0 setdash 2 copy 2 copy moveto vpt 270 360 arc closepath fill
+	2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C11 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C12 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C13 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C14 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 360 arc closepath fill
+	vpt 0 360 arc} bind def
+/C15 {BL [] 0 setdash 2 copy vpt 0 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/Rec {newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto
+	neg 0 rlineto closepath} bind def
+/Square {dup Rec} bind def
+/Bsquare {vpt sub exch vpt sub exch vpt2 Square} bind def
+/S0 {BL [] 0 setdash 2 copy moveto 0 vpt rlineto BL Bsquare} bind def
+/S1 {BL [] 0 setdash 2 copy vpt Square fill Bsquare} bind def
+/S2 {BL [] 0 setdash 2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S3 {BL [] 0 setdash 2 copy exch vpt sub exch vpt2 vpt Rec fill Bsquare} bind def
+/S4 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S5 {BL [] 0 setdash 2 copy 2 copy vpt Square fill
+	exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S6 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S7 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S8 {BL [] 0 setdash 2 copy vpt sub vpt Square fill Bsquare} bind def
+/S9 {BL [] 0 setdash 2 copy vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S10 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt Square fill
+	Bsquare} bind def
+/S11 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt2 vpt Rec fill
+	Bsquare} bind def
+/S12 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill Bsquare} bind def
+/S13 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S14 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S15 {BL [] 0 setdash 2 copy Bsquare fill Bsquare} bind def
+/D0 {gsave translate 45 rotate 0 0 S0 stroke grestore} bind def
+/D1 {gsave translate 45 rotate 0 0 S1 stroke grestore} bind def
+/D2 {gsave translate 45 rotate 0 0 S2 stroke grestore} bind def
+/D3 {gsave translate 45 rotate 0 0 S3 stroke grestore} bind def
+/D4 {gsave translate 45 rotate 0 0 S4 stroke grestore} bind def
+/D5 {gsave translate 45 rotate 0 0 S5 stroke grestore} bind def
+/D6 {gsave translate 45 rotate 0 0 S6 stroke grestore} bind def
+/D7 {gsave translate 45 rotate 0 0 S7 stroke grestore} bind def
+/D8 {gsave translate 45 rotate 0 0 S8 stroke grestore} bind def
+/D9 {gsave translate 45 rotate 0 0 S9 stroke grestore} bind def
+/D10 {gsave translate 45 rotate 0 0 S10 stroke grestore} bind def
+/D11 {gsave translate 45 rotate 0 0 S11 stroke grestore} bind def
+/D12 {gsave translate 45 rotate 0 0 S12 stroke grestore} bind def
+/D13 {gsave translate 45 rotate 0 0 S13 stroke grestore} bind def
+/D14 {gsave translate 45 rotate 0 0 S14 stroke grestore} bind def
+/D15 {gsave translate 45 rotate 0 0 S15 stroke grestore} bind def
+/DiaE {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke} def
+/BoxE {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke} def
+/TriUE {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke} def
+/TriDE {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke} def
+/PentE {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore} def
+/CircE {stroke [] 0 setdash 
+  hpt 0 360 arc stroke} def
+/Opaque {gsave closepath 1 setgray fill grestore 0 setgray closepath} def
+/DiaW {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V Opaque stroke} def
+/BoxW {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V Opaque stroke} def
+/TriUW {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V Opaque stroke} def
+/TriDW {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V Opaque stroke} def
+/PentW {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  Opaque stroke grestore} def
+/CircW {stroke [] 0 setdash 
+  hpt 0 360 arc Opaque stroke} def
+/BoxFill {gsave Rec 1 setgray fill grestore} def
+/Density {
+  /Fillden exch def
+  currentrgbcolor
+  /ColB exch def /ColG exch def /ColR exch def
+  /ColR ColR Fillden mul Fillden sub 1 add def
+  /ColG ColG Fillden mul Fillden sub 1 add def
+  /ColB ColB Fillden mul Fillden sub 1 add def
+  ColR ColG ColB setrgbcolor} def
+/BoxColFill {gsave Rec PolyFill} def
+/PolyFill {gsave Density fill grestore grestore} def
+/h {rlineto rlineto rlineto gsave closepath fill grestore} bind def
+%
+% PostScript Level 1 Pattern Fill routine for rectangles
+% Usage: x y w h s a XX PatternFill
+%	x,y = lower left corner of box to be filled
+%	w,h = width and height of box
+%	  a = angle in degrees between lines and x-axis
+%	 XX = 0/1 for no/yes cross-hatch
+%
+/PatternFill {gsave /PFa [ 9 2 roll ] def
+  PFa 0 get PFa 2 get 2 div add PFa 1 get PFa 3 get 2 div add translate
+  PFa 2 get -2 div PFa 3 get -2 div PFa 2 get PFa 3 get Rec
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+  clip
+  currentlinewidth 0.5 mul setlinewidth
+  /PFs PFa 2 get dup mul PFa 3 get dup mul add sqrt def
+  0 0 M PFa 5 get rotate PFs -2 div dup translate
+  0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 M 0 PFs V} for
+  0 PFa 6 get ne {
+	0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 2 1 roll M PFs 0 V} for
+ } if
+  stroke grestore} def
+%
+/languagelevel where
+ {pop languagelevel} {1} ifelse
+dup 2 lt
+	{/InterpretLevel1 true def
+	 /InterpretLevel3 false def}
+	{/InterpretLevel1 Level1 def
+	 2 gt
+	    {/InterpretLevel3 Level3 def}
+	    {/InterpretLevel3 false def}
+	 ifelse }
+ ifelse
+%
+% PostScript level 2 pattern fill definitions
+%
+/Level2PatternFill {
+/Tile8x8 {/PaintType 2 /PatternType 1 /TilingType 1 /BBox [0 0 8 8] /XStep 8 /YStep 8}
+	bind def
+/KeepColor {currentrgbcolor [/Pattern /DeviceRGB] setcolorspace} bind def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke} 
+>> matrix makepattern
+/Pat1 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke
+	0 4 M 4 8 L 8 4 L 4 0 L 0 4 L stroke}
+>> matrix makepattern
+/Pat2 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 0 8 L
+	8 8 L 8 0 L 0 0 L fill}
+>> matrix makepattern
+/Pat3 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 8 M 8 -4 L
+	0 12 M 12 0 L stroke}
+>> matrix makepattern
+/Pat4 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 0 M 8 12 L
+	0 -4 M 12 8 L stroke}
+>> matrix makepattern
+/Pat5 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 8 M 4 -4 L
+	0 12 M 8 -4 L 4 12 M 10 0 L stroke}
+>> matrix makepattern
+/Pat6 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 0 M 4 12 L
+	0 -4 M 8 12 L 4 -4 M 10 8 L stroke}
+>> matrix makepattern
+/Pat7 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 8 -2 M -4 4 L
+	12 0 M -4 8 L 12 4 M 0 10 L stroke}
+>> matrix makepattern
+/Pat8 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 -2 M 12 4 L
+	-4 0 M 12 8 L -4 4 M 8 10 L stroke}
+>> matrix makepattern
+/Pat9 exch def
+/Pattern1 {PatternBgnd KeepColor Pat1 setpattern} bind def
+/Pattern2 {PatternBgnd KeepColor Pat2 setpattern} bind def
+/Pattern3 {PatternBgnd KeepColor Pat3 setpattern} bind def
+/Pattern4 {PatternBgnd KeepColor Landscape {Pat5} {Pat4} ifelse setpattern} bind def
+/Pattern5 {PatternBgnd KeepColor Landscape {Pat4} {Pat5} ifelse setpattern} bind def
+/Pattern6 {PatternBgnd KeepColor Landscape {Pat9} {Pat6} ifelse setpattern} bind def
+/Pattern7 {PatternBgnd KeepColor Landscape {Pat8} {Pat7} ifelse setpattern} bind def
+} def
+%
+%
+%End of PostScript Level 2 code
+%
+/PatternBgnd {
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+} def
+%
+% Substitute for Level 2 pattern fill codes with
+% grayscale if Level 2 support is not selected.
+%
+/Level1PatternFill {
+/Pattern1 {0.250 Density} bind def
+/Pattern2 {0.500 Density} bind def
+/Pattern3 {0.750 Density} bind def
+/Pattern4 {0.125 Density} bind def
+/Pattern5 {0.375 Density} bind def
+/Pattern6 {0.625 Density} bind def
+/Pattern7 {0.875 Density} bind def
+} def
+%
+% Now test for support of Level 2 code
+%
+Level1 {Level1PatternFill} {Level2PatternFill} ifelse
+%
+/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont
+dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall
+currentdict end definefont pop
+%
+/MFshow {
+   { dup 5 get 3 ge
+     { 5 get 3 eq {gsave} {grestore} ifelse }
+     {dup dup 0 get findfont exch 1 get scalefont setfont
+     [ currentpoint ] exch dup 2 get 0 exch R dup 5 get 2 ne {dup dup 6
+     get exch 4 get {textshow} {stringwidth pop 0 R} ifelse }if dup 5 get 0 eq
+     {dup 3 get {2 get neg 0 exch R pop} {pop aload pop M} ifelse} {dup 5
+     get 1 eq {dup 2 get exch dup 3 get exch 6 get stringwidth pop -2 div
+     dup 0 R} {dup 6 get stringwidth pop -2 div 0 R 6 get
+     textshow 2 index {aload pop M neg 3 -1 roll neg R pop pop} {pop pop pop
+     pop aload pop M} ifelse }ifelse }ifelse }
+     ifelse }
+   forall} def
+/Gswidth {dup type /stringtype eq {stringwidth} {pop (n) stringwidth} ifelse} def
+/MFwidth {0 exch { dup 5 get 3 ge { 5 get 3 eq { 0 } { pop } ifelse }
+ {dup 3 get{dup dup 0 get findfont exch 1 get scalefont setfont
+     6 get Gswidth pop add} {pop} ifelse} ifelse} forall} def
+/MLshow { currentpoint stroke M
+  0 exch R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MRshow { currentpoint stroke M
+  exch dup MFwidth neg 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MCshow { currentpoint stroke M
+  exch dup MFwidth -2 div 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/XYsave    { [( ) 1 2 true false 3 ()] } bind def
+/XYrestore { [( ) 1 2 true false 4 ()] } bind def
+Level1 SuppressPDFMark or 
+{} {
+/SDict 10 dict def
+systemdict /pdfmark known not {
+  userdict /pdfmark systemdict /cleartomark get put
+} if
+SDict begin [
+  /Title (result_2a-bis.eps)
+  /Subject (gnuplot plot)
+  /Creator (gnuplot 5.0 patchlevel 1 (Gentoo revision r1))
+  /Author (yentl)
+%  /Producer (gnuplot)
+%  /Keywords ()
+  /CreationDate (Tue Jul 19 11:18:20 2016)
+  /DOCINFO pdfmark
+end
+} ifelse
+end
+%
+% Support for boxed text - Ethan A Merritt May 2005
+%
+/InitTextBox { userdict /TBy2 3 -1 roll put userdict /TBx2 3 -1 roll put
+           userdict /TBy1 3 -1 roll put userdict /TBx1 3 -1 roll put
+	   /Boxing true def } def
+/ExtendTextBox { Boxing
+    { gsave dup false charpath pathbbox
+      dup TBy2 gt {userdict /TBy2 3 -1 roll put} {pop} ifelse
+      dup TBx2 gt {userdict /TBx2 3 -1 roll put} {pop} ifelse
+      dup TBy1 lt {userdict /TBy1 3 -1 roll put} {pop} ifelse
+      dup TBx1 lt {userdict /TBx1 3 -1 roll put} {pop} ifelse
+      grestore } if } def
+/PopTextBox { newpath TBx1 TBxmargin sub TBy1 TBymargin sub M
+               TBx1 TBxmargin sub TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy1 TBymargin sub L closepath } def
+/DrawTextBox { PopTextBox stroke /Boxing false def} def
+/FillTextBox { gsave PopTextBox 1 1 1 setrgbcolor fill grestore /Boxing false def} def
+0 0 0 0 InitTextBox
+/TBxmargin 20 def
+/TBymargin 20 def
+/Boxing false def
+/textshow { ExtendTextBox Gshow } def
+%
+%%EndProlog
+%%Page: 1 1
+gnudict begin
+gsave
+doclip
+50 50 translate
+0.100 0.100 scale
+0 setgray
+newpath
+(Helvetica) findfont 140 scalefont setfont
+BackgroundColor 0 lt 3 1 roll 0 lt exch 0 lt or or not {gsave BackgroundColor C clippath fill grestore} if
+1.000 UL
+LTb
+LCb setrgbcolor
+686 448 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 448 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 1263 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 1263 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.1)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 2078 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 2078 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.2)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 2894 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 2894 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.3)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 3709 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 3709 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.4)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 4524 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 4524 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.5)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 5339 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 5339 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.6)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+686 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1024 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+1024 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 20)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1362 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+1362 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 40)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1700 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+1700 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 60)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2038 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+2038 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 80)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2377 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+2377 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 100)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2715 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+2715 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 120)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3053 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+3053 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 140)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3391 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+3391 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 160)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3729 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+3729 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 180)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+4067 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+4067 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 200)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+686 5339 N
+686 448 L
+3381 0 V
+0 4891 V
+-3381 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+LCb setrgbcolor
+112 2893 M
+currentpoint gsave translate -270 rotate 0 0 moveto
+[ [(Helvetica) 140.0 0.0 true true 0 (Execution time \(s\))]
+] -46.7 MCshow
+grestore
+LTb
+LCb setrgbcolor
+2376 98 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Number of models)]
+] -46.7 MCshow
+LTb
+LCb setrgbcolor
+2376 5549 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Influence of number of models for periodic saving)]
+] -46.7 MCshow
+% Begin plot #1
+1.000 UL
+LTb
+0.58 0.00 0.83 C LCb setrgbcolor
+3416 5206 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Forward step)]
+] -46.7 MRshow
+1.000 UL
+LTb
+0.58 0.00 0.83 C 3500 5206 M
+399 0 V
+855 469 M
+169 -2 V
+169 -1 V
+169 0 V
+169 0 V
+169 0 V
+169 0 V
+169 -1 V
+169 0 V
+170 0 V
+169 0 V
+169 0 V
+169 0 V
+169 0 V
+169 0 V
+169 0 V
+169 0 V
+169 0 V
+169 0 V
+169 0 V
+% End plot #1
+% Begin plot #2
+stroke
+LTb
+0.00 0.62 0.45 C LCb setrgbcolor
+3416 5066 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Random jump)]
+] -46.7 MRshow
+1.000 UL
+LTb
+0.00 0.62 0.45 C 3500 5066 M
+399 0 V
+855 2256 M
+169 -986 V
+169 2223 V
+1362 1856 L
+169 -23 V
+169 3294 V
+1869 3211 L
+169 269 V
+169 1656 V
+2377 537 L
+169 4124 V
+2715 2657 L
+169 564 V
+169 5 V
+3222 1849 L
+169 -8 V
+169 -8 V
+169 555 V
+169 2192 V
+169 123 V
+% End plot #2
+% Begin plot #3
+stroke
+LTb
+0.34 0.71 0.91 C LCb setrgbcolor
+3416 4926 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Backward step)]
+] -46.7 MRshow
+1.000 UL
+LTb
+0.34 0.71 0.91 C 3500 4926 M
+399 0 V
+855 4050 M
+1024 1271 L
+169 902 V
+169 230 V
+169 523 V
+169 285 V
+1869 1270 L
+169 -259 V
+169 3024 V
+2377 2918 L
+2546 1572 L
+169 2174 V
+2884 1287 L
+3053 480 L
+169 1614 V
+169 0 V
+169 10 V
+169 152 V
+169 -407 V
+169 1068 V
+% End plot #3
+stroke
+2.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+686 5339 N
+686 448 L
+3381 0 V
+0 4891 V
+-3381 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+stroke
+grestore
+end
+showpage
+%%Trailer
+%%DocumentFonts: Helvetica
+%%Pages: 1

+ 886 - 0
examples/result_2a.eps

@@ -0,0 +1,886 @@
+%!PS-Adobe-2.0
+%%Title: result_2a.eps
+%%Creator: gnuplot 5.0 patchlevel 1 (Gentoo revision r1)
+%%CreationDate: Tue Jul 19 11:18:20 2016
+%%DocumentFonts: (atend)
+%%BoundingBox: 50 50 482 626
+%%Orientation: Portrait
+%%Pages: (atend)
+%%EndComments
+%%BeginProlog
+/gnudict 256 dict def
+gnudict begin
+%
+% The following true/false flags may be edited by hand if desired.
+% The unit line width and grayscale image gamma correction may also be changed.
+%
+/Color true def
+/Blacktext false def
+/Solid false def
+/Dashlength 1 def
+/Landscape false def
+/Level1 false def
+/Level3 false def
+/Rounded false def
+/ClipToBoundingBox false def
+/SuppressPDFMark false def
+/TransparentPatterns false def
+/gnulinewidth 5.000 def
+/userlinewidth gnulinewidth def
+/Gamma 1.0 def
+/BackgroundColor {-1.000 -1.000 -1.000} def
+%
+/vshift -46 def
+/dl1 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul sub dup 0 le { pop 0.01 } if } if
+} def
+/dl2 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul add } if
+} def
+/hpt_ 31.5 def
+/vpt_ 31.5 def
+/hpt hpt_ def
+/vpt vpt_ def
+/doclip {
+  ClipToBoundingBox {
+    newpath 50 50 moveto 482 50 lineto 482 626 lineto 50 626 lineto closepath
+    clip
+  } if
+} def
+%
+% Gnuplot Prolog Version 5.0 (Dec 2014)
+%
+%/SuppressPDFMark true def
+%
+/M {moveto} bind def
+/L {lineto} bind def
+/R {rmoveto} bind def
+/V {rlineto} bind def
+/N {newpath moveto} bind def
+/Z {closepath} bind def
+/C {setrgbcolor} bind def
+/f {rlineto fill} bind def
+/g {setgray} bind def
+/Gshow {show} def   % May be redefined later in the file to support UTF-8
+/vpt2 vpt 2 mul def
+/hpt2 hpt 2 mul def
+/Lshow {currentpoint stroke M 0 vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Rshow {currentpoint stroke M dup stringwidth pop neg vshift R
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Cshow {currentpoint stroke M dup stringwidth pop -2 div vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/UP {dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def
+  /hpt2 hpt 2 mul def /vpt2 vpt 2 mul def} def
+/DL {Color {setrgbcolor Solid {pop []} if 0 setdash}
+ {pop pop pop 0 setgray Solid {pop []} if 0 setdash} ifelse} def
+/BL {stroke userlinewidth 2 mul setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/AL {stroke userlinewidth 2 div setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/UL {dup gnulinewidth mul /userlinewidth exch def
+	dup 1 lt {pop 1} if 10 mul /udl exch def} def
+/PL {stroke userlinewidth setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+3.8 setmiterlimit
+% Classic Line colors (version 5.0)
+/LCw {1 1 1} def
+/LCb {0 0 0} def
+/LCa {0 0 0} def
+/LC0 {1 0 0} def
+/LC1 {0 1 0} def
+/LC2 {0 0 1} def
+/LC3 {1 0 1} def
+/LC4 {0 1 1} def
+/LC5 {1 1 0} def
+/LC6 {0 0 0} def
+/LC7 {1 0.3 0} def
+/LC8 {0.5 0.5 0.5} def
+% Default dash patterns (version 5.0)
+/LTw {PL [] 1 setgray} def
+/LTb {BL [] LCb DL} def
+/LTa {AL [1 udl mul 2 udl mul] 0 setdash LCa setrgbcolor} def
+/LT0 {PL [] LC0 DL} def
+/LT1 {PL [2 dl1 3 dl2] LC1 DL} def
+/LT2 {PL [1 dl1 1.5 dl2] LC2 DL} def
+/LT3 {PL [6 dl1 2 dl2 1 dl1 2 dl2] LC3 DL} def
+/LT4 {PL [1 dl1 2 dl2 6 dl1 2 dl2 1 dl1 2 dl2] LC4 DL} def
+/LT5 {PL [4 dl1 2 dl2] LC5 DL} def
+/LT6 {PL [1.5 dl1 1.5 dl2 1.5 dl1 1.5 dl2 1.5 dl1 6 dl2] LC6 DL} def
+/LT7 {PL [3 dl1 3 dl2 1 dl1 3 dl2] LC7 DL} def
+/LT8 {PL [2 dl1 2 dl2 2 dl1 6 dl2] LC8 DL} def
+/SL {[] 0 setdash} def
+/Pnt {stroke [] 0 setdash gsave 1 setlinecap M 0 0 V stroke grestore} def
+/Dia {stroke [] 0 setdash 2 copy vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke
+  Pnt} def
+/Pls {stroke [] 0 setdash vpt sub M 0 vpt2 V
+  currentpoint stroke M
+  hpt neg vpt neg R hpt2 0 V stroke
+ } def
+/Box {stroke [] 0 setdash 2 copy exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke
+  Pnt} def
+/Crs {stroke [] 0 setdash exch hpt sub exch vpt add M
+  hpt2 vpt2 neg V currentpoint stroke M
+  hpt2 neg 0 R hpt2 vpt2 V stroke} def
+/TriU {stroke [] 0 setdash 2 copy vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke
+  Pnt} def
+/Star {2 copy Pls Crs} def
+/BoxF {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath fill} def
+/TriUF {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath fill} def
+/TriD {stroke [] 0 setdash 2 copy vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke
+  Pnt} def
+/TriDF {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath fill} def
+/DiaF {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath fill} def
+/Pent {stroke [] 0 setdash 2 copy gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore Pnt} def
+/PentF {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath fill grestore} def
+/Circle {stroke [] 0 setdash 2 copy
+  hpt 0 360 arc stroke Pnt} def
+/CircleF {stroke [] 0 setdash hpt 0 360 arc fill} def
+/C0 {BL [] 0 setdash 2 copy moveto vpt 90 450 arc} bind def
+/C1 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C2 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C3 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C4 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C5 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc
+	2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc} bind def
+/C6 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C7 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C8 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C9 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 450 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C10 {BL [] 0 setdash 2 copy 2 copy moveto vpt 270 360 arc closepath fill
+	2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C11 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C12 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C13 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C14 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 360 arc closepath fill
+	vpt 0 360 arc} bind def
+/C15 {BL [] 0 setdash 2 copy vpt 0 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/Rec {newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto
+	neg 0 rlineto closepath} bind def
+/Square {dup Rec} bind def
+/Bsquare {vpt sub exch vpt sub exch vpt2 Square} bind def
+/S0 {BL [] 0 setdash 2 copy moveto 0 vpt rlineto BL Bsquare} bind def
+/S1 {BL [] 0 setdash 2 copy vpt Square fill Bsquare} bind def
+/S2 {BL [] 0 setdash 2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S3 {BL [] 0 setdash 2 copy exch vpt sub exch vpt2 vpt Rec fill Bsquare} bind def
+/S4 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S5 {BL [] 0 setdash 2 copy 2 copy vpt Square fill
+	exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S6 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S7 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S8 {BL [] 0 setdash 2 copy vpt sub vpt Square fill Bsquare} bind def
+/S9 {BL [] 0 setdash 2 copy vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S10 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt Square fill
+	Bsquare} bind def
+/S11 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt2 vpt Rec fill
+	Bsquare} bind def
+/S12 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill Bsquare} bind def
+/S13 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S14 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S15 {BL [] 0 setdash 2 copy Bsquare fill Bsquare} bind def
+/D0 {gsave translate 45 rotate 0 0 S0 stroke grestore} bind def
+/D1 {gsave translate 45 rotate 0 0 S1 stroke grestore} bind def
+/D2 {gsave translate 45 rotate 0 0 S2 stroke grestore} bind def
+/D3 {gsave translate 45 rotate 0 0 S3 stroke grestore} bind def
+/D4 {gsave translate 45 rotate 0 0 S4 stroke grestore} bind def
+/D5 {gsave translate 45 rotate 0 0 S5 stroke grestore} bind def
+/D6 {gsave translate 45 rotate 0 0 S6 stroke grestore} bind def
+/D7 {gsave translate 45 rotate 0 0 S7 stroke grestore} bind def
+/D8 {gsave translate 45 rotate 0 0 S8 stroke grestore} bind def
+/D9 {gsave translate 45 rotate 0 0 S9 stroke grestore} bind def
+/D10 {gsave translate 45 rotate 0 0 S10 stroke grestore} bind def
+/D11 {gsave translate 45 rotate 0 0 S11 stroke grestore} bind def
+/D12 {gsave translate 45 rotate 0 0 S12 stroke grestore} bind def
+/D13 {gsave translate 45 rotate 0 0 S13 stroke grestore} bind def
+/D14 {gsave translate 45 rotate 0 0 S14 stroke grestore} bind def
+/D15 {gsave translate 45 rotate 0 0 S15 stroke grestore} bind def
+/DiaE {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke} def
+/BoxE {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke} def
+/TriUE {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke} def
+/TriDE {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke} def
+/PentE {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore} def
+/CircE {stroke [] 0 setdash 
+  hpt 0 360 arc stroke} def
+/Opaque {gsave closepath 1 setgray fill grestore 0 setgray closepath} def
+/DiaW {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V Opaque stroke} def
+/BoxW {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V Opaque stroke} def
+/TriUW {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V Opaque stroke} def
+/TriDW {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V Opaque stroke} def
+/PentW {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  Opaque stroke grestore} def
+/CircW {stroke [] 0 setdash 
+  hpt 0 360 arc Opaque stroke} def
+/BoxFill {gsave Rec 1 setgray fill grestore} def
+/Density {
+  /Fillden exch def
+  currentrgbcolor
+  /ColB exch def /ColG exch def /ColR exch def
+  /ColR ColR Fillden mul Fillden sub 1 add def
+  /ColG ColG Fillden mul Fillden sub 1 add def
+  /ColB ColB Fillden mul Fillden sub 1 add def
+  ColR ColG ColB setrgbcolor} def
+/BoxColFill {gsave Rec PolyFill} def
+/PolyFill {gsave Density fill grestore grestore} def
+/h {rlineto rlineto rlineto gsave closepath fill grestore} bind def
+%
+% PostScript Level 1 Pattern Fill routine for rectangles
+% Usage: x y w h s a XX PatternFill
+%	x,y = lower left corner of box to be filled
+%	w,h = width and height of box
+%	  a = angle in degrees between lines and x-axis
+%	 XX = 0/1 for no/yes cross-hatch
+%
+/PatternFill {gsave /PFa [ 9 2 roll ] def
+  PFa 0 get PFa 2 get 2 div add PFa 1 get PFa 3 get 2 div add translate
+  PFa 2 get -2 div PFa 3 get -2 div PFa 2 get PFa 3 get Rec
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+  clip
+  currentlinewidth 0.5 mul setlinewidth
+  /PFs PFa 2 get dup mul PFa 3 get dup mul add sqrt def
+  0 0 M PFa 5 get rotate PFs -2 div dup translate
+  0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 M 0 PFs V} for
+  0 PFa 6 get ne {
+	0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 2 1 roll M PFs 0 V} for
+ } if
+  stroke grestore} def
+%
+/languagelevel where
+ {pop languagelevel} {1} ifelse
+dup 2 lt
+	{/InterpretLevel1 true def
+	 /InterpretLevel3 false def}
+	{/InterpretLevel1 Level1 def
+	 2 gt
+	    {/InterpretLevel3 Level3 def}
+	    {/InterpretLevel3 false def}
+	 ifelse }
+ ifelse
+%
+% PostScript level 2 pattern fill definitions
+%
+/Level2PatternFill {
+/Tile8x8 {/PaintType 2 /PatternType 1 /TilingType 1 /BBox [0 0 8 8] /XStep 8 /YStep 8}
+	bind def
+/KeepColor {currentrgbcolor [/Pattern /DeviceRGB] setcolorspace} bind def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke} 
+>> matrix makepattern
+/Pat1 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke
+	0 4 M 4 8 L 8 4 L 4 0 L 0 4 L stroke}
+>> matrix makepattern
+/Pat2 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 0 8 L
+	8 8 L 8 0 L 0 0 L fill}
+>> matrix makepattern
+/Pat3 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 8 M 8 -4 L
+	0 12 M 12 0 L stroke}
+>> matrix makepattern
+/Pat4 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 0 M 8 12 L
+	0 -4 M 12 8 L stroke}
+>> matrix makepattern
+/Pat5 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 8 M 4 -4 L
+	0 12 M 8 -4 L 4 12 M 10 0 L stroke}
+>> matrix makepattern
+/Pat6 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 0 M 4 12 L
+	0 -4 M 8 12 L 4 -4 M 10 8 L stroke}
+>> matrix makepattern
+/Pat7 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 8 -2 M -4 4 L
+	12 0 M -4 8 L 12 4 M 0 10 L stroke}
+>> matrix makepattern
+/Pat8 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 -2 M 12 4 L
+	-4 0 M 12 8 L -4 4 M 8 10 L stroke}
+>> matrix makepattern
+/Pat9 exch def
+/Pattern1 {PatternBgnd KeepColor Pat1 setpattern} bind def
+/Pattern2 {PatternBgnd KeepColor Pat2 setpattern} bind def
+/Pattern3 {PatternBgnd KeepColor Pat3 setpattern} bind def
+/Pattern4 {PatternBgnd KeepColor Landscape {Pat5} {Pat4} ifelse setpattern} bind def
+/Pattern5 {PatternBgnd KeepColor Landscape {Pat4} {Pat5} ifelse setpattern} bind def
+/Pattern6 {PatternBgnd KeepColor Landscape {Pat9} {Pat6} ifelse setpattern} bind def
+/Pattern7 {PatternBgnd KeepColor Landscape {Pat8} {Pat7} ifelse setpattern} bind def
+} def
+%
+%
+%End of PostScript Level 2 code
+%
+/PatternBgnd {
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+} def
+%
+% Substitute for Level 2 pattern fill codes with
+% grayscale if Level 2 support is not selected.
+%
+/Level1PatternFill {
+/Pattern1 {0.250 Density} bind def
+/Pattern2 {0.500 Density} bind def
+/Pattern3 {0.750 Density} bind def
+/Pattern4 {0.125 Density} bind def
+/Pattern5 {0.375 Density} bind def
+/Pattern6 {0.625 Density} bind def
+/Pattern7 {0.875 Density} bind def
+} def
+%
+% Now test for support of Level 2 code
+%
+Level1 {Level1PatternFill} {Level2PatternFill} ifelse
+%
+/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont
+dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall
+currentdict end definefont pop
+%
+/MFshow {
+   { dup 5 get 3 ge
+     { 5 get 3 eq {gsave} {grestore} ifelse }
+     {dup dup 0 get findfont exch 1 get scalefont setfont
+     [ currentpoint ] exch dup 2 get 0 exch R dup 5 get 2 ne {dup dup 6
+     get exch 4 get {textshow} {stringwidth pop 0 R} ifelse }if dup 5 get 0 eq
+     {dup 3 get {2 get neg 0 exch R pop} {pop aload pop M} ifelse} {dup 5
+     get 1 eq {dup 2 get exch dup 3 get exch 6 get stringwidth pop -2 div
+     dup 0 R} {dup 6 get stringwidth pop -2 div 0 R 6 get
+     textshow 2 index {aload pop M neg 3 -1 roll neg R pop pop} {pop pop pop
+     pop aload pop M} ifelse }ifelse }ifelse }
+     ifelse }
+   forall} def
+/Gswidth {dup type /stringtype eq {stringwidth} {pop (n) stringwidth} ifelse} def
+/MFwidth {0 exch { dup 5 get 3 ge { 5 get 3 eq { 0 } { pop } ifelse }
+ {dup 3 get{dup dup 0 get findfont exch 1 get scalefont setfont
+     6 get Gswidth pop add} {pop} ifelse} ifelse} forall} def
+/MLshow { currentpoint stroke M
+  0 exch R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MRshow { currentpoint stroke M
+  exch dup MFwidth neg 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MCshow { currentpoint stroke M
+  exch dup MFwidth -2 div 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/XYsave    { [( ) 1 2 true false 3 ()] } bind def
+/XYrestore { [( ) 1 2 true false 4 ()] } bind def
+Level1 SuppressPDFMark or 
+{} {
+/SDict 10 dict def
+systemdict /pdfmark known not {
+  userdict /pdfmark systemdict /cleartomark get put
+} if
+SDict begin [
+  /Title (result_2a.eps)
+  /Subject (gnuplot plot)
+  /Creator (gnuplot 5.0 patchlevel 1 (Gentoo revision r1))
+  /Author (yentl)
+%  /Producer (gnuplot)
+%  /Keywords ()
+  /CreationDate (Tue Jul 19 11:18:20 2016)
+  /DOCINFO pdfmark
+end
+} ifelse
+end
+%
+% Support for boxed text - Ethan A Merritt May 2005
+%
+/InitTextBox { userdict /TBy2 3 -1 roll put userdict /TBx2 3 -1 roll put
+           userdict /TBy1 3 -1 roll put userdict /TBx1 3 -1 roll put
+	   /Boxing true def } def
+/ExtendTextBox { Boxing
+    { gsave dup false charpath pathbbox
+      dup TBy2 gt {userdict /TBy2 3 -1 roll put} {pop} ifelse
+      dup TBx2 gt {userdict /TBx2 3 -1 roll put} {pop} ifelse
+      dup TBy1 lt {userdict /TBy1 3 -1 roll put} {pop} ifelse
+      dup TBx1 lt {userdict /TBx1 3 -1 roll put} {pop} ifelse
+      grestore } if } def
+/PopTextBox { newpath TBx1 TBxmargin sub TBy1 TBymargin sub M
+               TBx1 TBxmargin sub TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy1 TBymargin sub L closepath } def
+/DrawTextBox { PopTextBox stroke /Boxing false def} def
+/FillTextBox { gsave PopTextBox 1 1 1 setrgbcolor fill grestore /Boxing false def} def
+0 0 0 0 InitTextBox
+/TBxmargin 20 def
+/TBymargin 20 def
+/Boxing false def
+/textshow { ExtendTextBox Gshow } def
+%
+%%EndProlog
+%%Page: 1 1
+gnudict begin
+gsave
+doclip
+50 50 translate
+0.100 0.100 scale
+0 setgray
+newpath
+(Helvetica) findfont 140 scalefont setfont
+BackgroundColor 0 lt 3 1 roll 0 lt exch 0 lt or or not {gsave BackgroundColor C clippath fill grestore} if
+1.000 UL
+LTb
+LCb setrgbcolor
+854 448 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 448 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 1059 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 1059 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.005)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 1671 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 1671 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.01)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 2282 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 2282 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.015)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 2894 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 2894 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.02)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 3505 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 3505 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.025)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 4116 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 4116 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.03)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 4728 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 4728 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.035)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 5339 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 5339 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.04)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+854 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1175 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+1175 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 20)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1497 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+1497 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 40)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1818 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+1818 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 60)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2139 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+2139 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 80)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2461 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+2461 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 100)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2782 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+2782 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 120)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3103 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+3103 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 140)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3424 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+3424 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 160)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3746 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+3746 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 180)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+4067 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+4067 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 200)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+854 5339 N
+854 448 L
+3213 0 V
+0 4891 V
+-3213 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+LCb setrgbcolor
+112 2893 M
+currentpoint gsave translate -270 rotate 0 0 moveto
+[ [(Helvetica) 140.0 0.0 true true 0 (Execution time \(s\))]
+] -46.7 MCshow
+grestore
+LTb
+LCb setrgbcolor
+2460 98 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Number of models)]
+] -46.7 MCshow
+LTb
+LCb setrgbcolor
+2460 5549 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Influence of number of models for incremental saving)]
+] -46.7 MCshow
+% Begin plot #1
+1.000 UL
+LTb
+0.58 0.00 0.83 C LCb setrgbcolor
+3416 5206 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Forward step)]
+] -46.7 MRshow
+1.000 UL
+LTb
+0.58 0.00 0.83 C 3500 5206 M
+399 0 V
+1015 751 M
+160 -21 V
+161 -8 V
+161 -5 V
+160 -7 V
+161 0 V
+161 1 V
+160 -2 V
+161 1 V
+161 -1 V
+160 -2 V
+161 0 V
+160 -2 V
+161 0 V
+161 -1 V
+160 0 V
+161 0 V
+161 0 V
+160 -1 V
+161 0 V
+% End plot #1
+% Begin plot #2
+stroke
+LTb
+0.00 0.62 0.45 C LCb setrgbcolor
+3416 5066 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Random jump)]
+] -46.7 MRshow
+1.000 UL
+LTb
+0.00 0.62 0.45 C 3500 5066 M
+399 0 V
+1015 1145 M
+160 -100 V
+161 682 V
+161 415 V
+160 129 V
+161 -394 V
+161 127 V
+160 160 V
+161 1726 V
+161 -642 V
+160 -524 V
+161 680 V
+160 454 V
+161 124 V
+161 849 V
+3424 3365 L
+161 361 V
+161 1105 V
+3906 3636 L
+161 345 V
+% End plot #2
+% Begin plot #3
+stroke
+LTb
+0.34 0.71 0.91 C LCb setrgbcolor
+3416 4926 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Backward step)]
+] -46.7 MRshow
+1.000 UL
+LTb
+0.34 0.71 0.91 C 3500 4926 M
+399 0 V
+1015 1299 M
+160 1471 V
+161 109 V
+1497 1682 L
+160 -620 V
+161 1307 V
+161 -704 V
+2139 956 L
+161 11 V
+161 101 V
+160 1688 V
+161 359 V
+2942 1187 L
+161 1940 V
+3264 1761 L
+160 984 V
+3585 1241 L
+161 37 V
+160 136 V
+161 22 V
+% End plot #3
+stroke
+2.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+854 5339 N
+854 448 L
+3213 0 V
+0 4891 V
+-3213 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+stroke
+grestore
+end
+showpage
+%%Trailer
+%%DocumentFonts: Helvetica
+%%Pages: 1

+ 10 - 0
examples/result_2b

@@ -0,0 +1,10 @@
+10 28244400.0 20322800.0 
+110 30964000.0 20684400.0 
+210 36674200.0 21269200.0 
+310 40107400.0 21614200.0 
+410 39569400.0 22038200.0 
+510 51641600.0 22674400.0 
+610 49140600.0 22816400.0 
+710 60798800.0 23418400.0 
+810 68241200.0 23754200.0 
+910 69864200.0 24384400.0 

+ 867 - 0
examples/result_2b.eps

@@ -0,0 +1,867 @@
+%!PS-Adobe-2.0
+%%Title: result_2b.eps
+%%Creator: gnuplot 5.0 patchlevel 1 (Gentoo revision r1)
+%%CreationDate: Fri Dec  2 10:30:14 2016
+%%DocumentFonts: (atend)
+%%BoundingBox: 50 50 482 482
+%%Orientation: Portrait
+%%Pages: (atend)
+%%EndComments
+%%BeginProlog
+/gnudict 256 dict def
+gnudict begin
+%
+% The following true/false flags may be edited by hand if desired.
+% The unit line width and grayscale image gamma correction may also be changed.
+%
+/Color true def
+/Blacktext false def
+/Solid false def
+/Dashlength 1 def
+/Landscape false def
+/Level1 false def
+/Level3 false def
+/Rounded false def
+/ClipToBoundingBox false def
+/SuppressPDFMark false def
+/TransparentPatterns false def
+/gnulinewidth 5.000 def
+/userlinewidth gnulinewidth def
+/Gamma 1.0 def
+/BackgroundColor {-1.000 -1.000 -1.000} def
+%
+/vshift -46 def
+/dl1 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul sub dup 0 le { pop 0.01 } if } if
+} def
+/dl2 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul add } if
+} def
+/hpt_ 31.5 def
+/vpt_ 31.5 def
+/hpt hpt_ def
+/vpt vpt_ def
+/doclip {
+  ClipToBoundingBox {
+    newpath 50 50 moveto 482 50 lineto 482 482 lineto 50 482 lineto closepath
+    clip
+  } if
+} def
+%
+% Gnuplot Prolog Version 5.0 (Dec 2014)
+%
+%/SuppressPDFMark true def
+%
+/M {moveto} bind def
+/L {lineto} bind def
+/R {rmoveto} bind def
+/V {rlineto} bind def
+/N {newpath moveto} bind def
+/Z {closepath} bind def
+/C {setrgbcolor} bind def
+/f {rlineto fill} bind def
+/g {setgray} bind def
+/Gshow {show} def   % May be redefined later in the file to support UTF-8
+/vpt2 vpt 2 mul def
+/hpt2 hpt 2 mul def
+/Lshow {currentpoint stroke M 0 vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Rshow {currentpoint stroke M dup stringwidth pop neg vshift R
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Cshow {currentpoint stroke M dup stringwidth pop -2 div vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/UP {dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def
+  /hpt2 hpt 2 mul def /vpt2 vpt 2 mul def} def
+/DL {Color {setrgbcolor Solid {pop []} if 0 setdash}
+ {pop pop pop 0 setgray Solid {pop []} if 0 setdash} ifelse} def
+/BL {stroke userlinewidth 2 mul setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/AL {stroke userlinewidth 2 div setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/UL {dup gnulinewidth mul /userlinewidth exch def
+	dup 1 lt {pop 1} if 10 mul /udl exch def} def
+/PL {stroke userlinewidth setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+3.8 setmiterlimit
+% Classic Line colors (version 5.0)
+/LCw {1 1 1} def
+/LCb {0 0 0} def
+/LCa {0 0 0} def
+/LC0 {1 0 0} def
+/LC1 {0 1 0} def
+/LC2 {0 0 1} def
+/LC3 {1 0 1} def
+/LC4 {0 1 1} def
+/LC5 {1 1 0} def
+/LC6 {0 0 0} def
+/LC7 {1 0.3 0} def
+/LC8 {0.5 0.5 0.5} def
+% Default dash patterns (version 5.0)
+/LTw {PL [] 1 setgray} def
+/LTb {BL [] LCb DL} def
+/LTa {AL [1 udl mul 2 udl mul] 0 setdash LCa setrgbcolor} def
+/LT0 {PL [] LC0 DL} def
+/LT1 {PL [2 dl1 3 dl2] LC1 DL} def
+/LT2 {PL [1 dl1 1.5 dl2] LC2 DL} def
+/LT3 {PL [6 dl1 2 dl2 1 dl1 2 dl2] LC3 DL} def
+/LT4 {PL [1 dl1 2 dl2 6 dl1 2 dl2 1 dl1 2 dl2] LC4 DL} def
+/LT5 {PL [4 dl1 2 dl2] LC5 DL} def
+/LT6 {PL [1.5 dl1 1.5 dl2 1.5 dl1 1.5 dl2 1.5 dl1 6 dl2] LC6 DL} def
+/LT7 {PL [3 dl1 3 dl2 1 dl1 3 dl2] LC7 DL} def
+/LT8 {PL [2 dl1 2 dl2 2 dl1 6 dl2] LC8 DL} def
+/SL {[] 0 setdash} def
+/Pnt {stroke [] 0 setdash gsave 1 setlinecap M 0 0 V stroke grestore} def
+/Dia {stroke [] 0 setdash 2 copy vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke
+  Pnt} def
+/Pls {stroke [] 0 setdash vpt sub M 0 vpt2 V
+  currentpoint stroke M
+  hpt neg vpt neg R hpt2 0 V stroke
+ } def
+/Box {stroke [] 0 setdash 2 copy exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke
+  Pnt} def
+/Crs {stroke [] 0 setdash exch hpt sub exch vpt add M
+  hpt2 vpt2 neg V currentpoint stroke M
+  hpt2 neg 0 R hpt2 vpt2 V stroke} def
+/TriU {stroke [] 0 setdash 2 copy vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke
+  Pnt} def
+/Star {2 copy Pls Crs} def
+/BoxF {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath fill} def
+/TriUF {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath fill} def
+/TriD {stroke [] 0 setdash 2 copy vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke
+  Pnt} def
+/TriDF {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath fill} def
+/DiaF {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath fill} def
+/Pent {stroke [] 0 setdash 2 copy gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore Pnt} def
+/PentF {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath fill grestore} def
+/Circle {stroke [] 0 setdash 2 copy
+  hpt 0 360 arc stroke Pnt} def
+/CircleF {stroke [] 0 setdash hpt 0 360 arc fill} def
+/C0 {BL [] 0 setdash 2 copy moveto vpt 90 450 arc} bind def
+/C1 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C2 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C3 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C4 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C5 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc
+	2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc} bind def
+/C6 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C7 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C8 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C9 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 450 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C10 {BL [] 0 setdash 2 copy 2 copy moveto vpt 270 360 arc closepath fill
+	2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C11 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C12 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C13 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C14 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 360 arc closepath fill
+	vpt 0 360 arc} bind def
+/C15 {BL [] 0 setdash 2 copy vpt 0 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/Rec {newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto
+	neg 0 rlineto closepath} bind def
+/Square {dup Rec} bind def
+/Bsquare {vpt sub exch vpt sub exch vpt2 Square} bind def
+/S0 {BL [] 0 setdash 2 copy moveto 0 vpt rlineto BL Bsquare} bind def
+/S1 {BL [] 0 setdash 2 copy vpt Square fill Bsquare} bind def
+/S2 {BL [] 0 setdash 2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S3 {BL [] 0 setdash 2 copy exch vpt sub exch vpt2 vpt Rec fill Bsquare} bind def
+/S4 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S5 {BL [] 0 setdash 2 copy 2 copy vpt Square fill
+	exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S6 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S7 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S8 {BL [] 0 setdash 2 copy vpt sub vpt Square fill Bsquare} bind def
+/S9 {BL [] 0 setdash 2 copy vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S10 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt Square fill
+	Bsquare} bind def
+/S11 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt2 vpt Rec fill
+	Bsquare} bind def
+/S12 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill Bsquare} bind def
+/S13 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S14 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S15 {BL [] 0 setdash 2 copy Bsquare fill Bsquare} bind def
+/D0 {gsave translate 45 rotate 0 0 S0 stroke grestore} bind def
+/D1 {gsave translate 45 rotate 0 0 S1 stroke grestore} bind def
+/D2 {gsave translate 45 rotate 0 0 S2 stroke grestore} bind def
+/D3 {gsave translate 45 rotate 0 0 S3 stroke grestore} bind def
+/D4 {gsave translate 45 rotate 0 0 S4 stroke grestore} bind def
+/D5 {gsave translate 45 rotate 0 0 S5 stroke grestore} bind def
+/D6 {gsave translate 45 rotate 0 0 S6 stroke grestore} bind def
+/D7 {gsave translate 45 rotate 0 0 S7 stroke grestore} bind def
+/D8 {gsave translate 45 rotate 0 0 S8 stroke grestore} bind def
+/D9 {gsave translate 45 rotate 0 0 S9 stroke grestore} bind def
+/D10 {gsave translate 45 rotate 0 0 S10 stroke grestore} bind def
+/D11 {gsave translate 45 rotate 0 0 S11 stroke grestore} bind def
+/D12 {gsave translate 45 rotate 0 0 S12 stroke grestore} bind def
+/D13 {gsave translate 45 rotate 0 0 S13 stroke grestore} bind def
+/D14 {gsave translate 45 rotate 0 0 S14 stroke grestore} bind def
+/D15 {gsave translate 45 rotate 0 0 S15 stroke grestore} bind def
+/DiaE {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke} def
+/BoxE {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke} def
+/TriUE {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke} def
+/TriDE {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke} def
+/PentE {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore} def
+/CircE {stroke [] 0 setdash 
+  hpt 0 360 arc stroke} def
+/Opaque {gsave closepath 1 setgray fill grestore 0 setgray closepath} def
+/DiaW {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V Opaque stroke} def
+/BoxW {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V Opaque stroke} def
+/TriUW {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V Opaque stroke} def
+/TriDW {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V Opaque stroke} def
+/PentW {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  Opaque stroke grestore} def
+/CircW {stroke [] 0 setdash 
+  hpt 0 360 arc Opaque stroke} def
+/BoxFill {gsave Rec 1 setgray fill grestore} def
+/Density {
+  /Fillden exch def
+  currentrgbcolor
+  /ColB exch def /ColG exch def /ColR exch def
+  /ColR ColR Fillden mul Fillden sub 1 add def
+  /ColG ColG Fillden mul Fillden sub 1 add def
+  /ColB ColB Fillden mul Fillden sub 1 add def
+  ColR ColG ColB setrgbcolor} def
+/BoxColFill {gsave Rec PolyFill} def
+/PolyFill {gsave Density fill grestore grestore} def
+/h {rlineto rlineto rlineto gsave closepath fill grestore} bind def
+%
+% PostScript Level 1 Pattern Fill routine for rectangles
+% Usage: x y w h s a XX PatternFill
+%	x,y = lower left corner of box to be filled
+%	w,h = width and height of box
+%	  a = angle in degrees between lines and x-axis
+%	 XX = 0/1 for no/yes cross-hatch
+%
+/PatternFill {gsave /PFa [ 9 2 roll ] def
+  PFa 0 get PFa 2 get 2 div add PFa 1 get PFa 3 get 2 div add translate
+  PFa 2 get -2 div PFa 3 get -2 div PFa 2 get PFa 3 get Rec
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+  clip
+  currentlinewidth 0.5 mul setlinewidth
+  /PFs PFa 2 get dup mul PFa 3 get dup mul add sqrt def
+  0 0 M PFa 5 get rotate PFs -2 div dup translate
+  0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 M 0 PFs V} for
+  0 PFa 6 get ne {
+	0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 2 1 roll M PFs 0 V} for
+ } if
+  stroke grestore} def
+%
+/languagelevel where
+ {pop languagelevel} {1} ifelse
+dup 2 lt
+	{/InterpretLevel1 true def
+	 /InterpretLevel3 false def}
+	{/InterpretLevel1 Level1 def
+	 2 gt
+	    {/InterpretLevel3 Level3 def}
+	    {/InterpretLevel3 false def}
+	 ifelse }
+ ifelse
+%
+% PostScript level 2 pattern fill definitions
+%
+/Level2PatternFill {
+/Tile8x8 {/PaintType 2 /PatternType 1 /TilingType 1 /BBox [0 0 8 8] /XStep 8 /YStep 8}
+	bind def
+/KeepColor {currentrgbcolor [/Pattern /DeviceRGB] setcolorspace} bind def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke} 
+>> matrix makepattern
+/Pat1 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke
+	0 4 M 4 8 L 8 4 L 4 0 L 0 4 L stroke}
+>> matrix makepattern
+/Pat2 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 0 8 L
+	8 8 L 8 0 L 0 0 L fill}
+>> matrix makepattern
+/Pat3 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 8 M 8 -4 L
+	0 12 M 12 0 L stroke}
+>> matrix makepattern
+/Pat4 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 0 M 8 12 L
+	0 -4 M 12 8 L stroke}
+>> matrix makepattern
+/Pat5 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 8 M 4 -4 L
+	0 12 M 8 -4 L 4 12 M 10 0 L stroke}
+>> matrix makepattern
+/Pat6 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 0 M 4 12 L
+	0 -4 M 8 12 L 4 -4 M 10 8 L stroke}
+>> matrix makepattern
+/Pat7 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 8 -2 M -4 4 L
+	12 0 M -4 8 L 12 4 M 0 10 L stroke}
+>> matrix makepattern
+/Pat8 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 -2 M 12 4 L
+	-4 0 M 12 8 L -4 4 M 8 10 L stroke}
+>> matrix makepattern
+/Pat9 exch def
+/Pattern1 {PatternBgnd KeepColor Pat1 setpattern} bind def
+/Pattern2 {PatternBgnd KeepColor Pat2 setpattern} bind def
+/Pattern3 {PatternBgnd KeepColor Pat3 setpattern} bind def
+/Pattern4 {PatternBgnd KeepColor Landscape {Pat5} {Pat4} ifelse setpattern} bind def
+/Pattern5 {PatternBgnd KeepColor Landscape {Pat4} {Pat5} ifelse setpattern} bind def
+/Pattern6 {PatternBgnd KeepColor Landscape {Pat9} {Pat6} ifelse setpattern} bind def
+/Pattern7 {PatternBgnd KeepColor Landscape {Pat8} {Pat7} ifelse setpattern} bind def
+} def
+%
+%
+%End of PostScript Level 2 code
+%
+/PatternBgnd {
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+} def
+%
+% Substitute for Level 2 pattern fill codes with
+% grayscale if Level 2 support is not selected.
+%
+/Level1PatternFill {
+/Pattern1 {0.250 Density} bind def
+/Pattern2 {0.500 Density} bind def
+/Pattern3 {0.750 Density} bind def
+/Pattern4 {0.125 Density} bind def
+/Pattern5 {0.375 Density} bind def
+/Pattern6 {0.625 Density} bind def
+/Pattern7 {0.875 Density} bind def
+} def
+%
+% Now test for support of Level 2 code
+%
+Level1 {Level1PatternFill} {Level2PatternFill} ifelse
+%
+/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont
+dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall
+currentdict end definefont pop
+%
+/MFshow {
+   { dup 5 get 3 ge
+     { 5 get 3 eq {gsave} {grestore} ifelse }
+     {dup dup 0 get findfont exch 1 get scalefont setfont
+     [ currentpoint ] exch dup 2 get 0 exch R dup 5 get 2 ne {dup dup 6
+     get exch 4 get {textshow} {stringwidth pop 0 R} ifelse }if dup 5 get 0 eq
+     {dup 3 get {2 get neg 0 exch R pop} {pop aload pop M} ifelse} {dup 5
+     get 1 eq {dup 2 get exch dup 3 get exch 6 get stringwidth pop -2 div
+     dup 0 R} {dup 6 get stringwidth pop -2 div 0 R 6 get
+     textshow 2 index {aload pop M neg 3 -1 roll neg R pop pop} {pop pop pop
+     pop aload pop M} ifelse }ifelse }ifelse }
+     ifelse }
+   forall} def
+/Gswidth {dup type /stringtype eq {stringwidth} {pop (n) stringwidth} ifelse} def
+/MFwidth {0 exch { dup 5 get 3 ge { 5 get 3 eq { 0 } { pop } ifelse }
+ {dup 3 get{dup dup 0 get findfont exch 1 get scalefont setfont
+     6 get Gswidth pop add} {pop} ifelse} ifelse} forall} def
+/MLshow { currentpoint stroke M
+  0 exch R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MRshow { currentpoint stroke M
+  exch dup MFwidth neg 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MCshow { currentpoint stroke M
+  exch dup MFwidth -2 div 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/XYsave    { [( ) 1 2 true false 3 ()] } bind def
+/XYrestore { [( ) 1 2 true false 4 ()] } bind def
+Level1 SuppressPDFMark or 
+{} {
+/SDict 10 dict def
+systemdict /pdfmark known not {
+  userdict /pdfmark systemdict /cleartomark get put
+} if
+SDict begin [
+  /Title (result_2b.eps)
+  /Subject (gnuplot plot)
+  /Creator (gnuplot 5.0 patchlevel 1 (Gentoo revision r1))
+  /Author (yentl)
+%  /Producer (gnuplot)
+%  /Keywords ()
+  /CreationDate (Fri Dec  2 10:30:14 2016)
+  /DOCINFO pdfmark
+end
+} ifelse
+end
+%
+% Support for boxed text - Ethan A Merritt May 2005
+%
+/InitTextBox { userdict /TBy2 3 -1 roll put userdict /TBx2 3 -1 roll put
+           userdict /TBy1 3 -1 roll put userdict /TBx1 3 -1 roll put
+	   /Boxing true def } def
+/ExtendTextBox { Boxing
+    { gsave dup false charpath pathbbox
+      dup TBy2 gt {userdict /TBy2 3 -1 roll put} {pop} ifelse
+      dup TBx2 gt {userdict /TBx2 3 -1 roll put} {pop} ifelse
+      dup TBy1 lt {userdict /TBy1 3 -1 roll put} {pop} ifelse
+      dup TBx1 lt {userdict /TBx1 3 -1 roll put} {pop} ifelse
+      grestore } if } def
+/PopTextBox { newpath TBx1 TBxmargin sub TBy1 TBymargin sub M
+               TBx1 TBxmargin sub TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy1 TBymargin sub L closepath } def
+/DrawTextBox { PopTextBox stroke /Boxing false def} def
+/FillTextBox { gsave PopTextBox 1 1 1 setrgbcolor fill grestore /Boxing false def} def
+0 0 0 0 InitTextBox
+/TBxmargin 20 def
+/TBymargin 20 def
+/Boxing false def
+/textshow { ExtendTextBox Gshow } def
+%
+%%EndProlog
+%%Page: 1 1
+gnudict begin
+gsave
+doclip
+50 50 translate
+0.100 0.100 scale
+0 setgray
+newpath
+(Helvetica) findfont 140 scalefont setfont
+BackgroundColor 0 lt 3 1 roll 0 lt exch 0 lt or or not {gsave BackgroundColor C clippath fill grestore} if
+1.000 UL
+LTb
+LCb setrgbcolor
+854 448 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 448 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 15000)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 762 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 762 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 20000)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 1075 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 1075 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 25000)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 1389 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 1389 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 30000)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 1703 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 1703 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 35000)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 2017 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 2017 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 40000)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 2330 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 2330 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 45000)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 2644 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 2644 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 50000)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 2958 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 2958 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 55000)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 3272 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 3272 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 60000)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 3585 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 3585 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 65000)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 3899 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 3899 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 70000)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+854 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1175 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+1175 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 100)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1497 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+1497 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 200)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1818 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+1818 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 300)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2139 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+2139 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 400)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2461 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+2461 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 500)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2782 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+2782 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 600)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3103 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+3103 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 700)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3424 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+3424 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 800)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3746 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+3746 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 900)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+4067 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+4067 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 1000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+854 3899 N
+854 448 L
+3213 0 V
+0 3451 V
+-3213 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+LCb setrgbcolor
+112 2173 M
+currentpoint gsave translate -270 rotate 0 0 moveto
+[ [(Helvetica) 140.0 0.0 true true 0 (Main memory used \(KB\))]
+] -46.7 MCshow
+grestore
+LTb
+LCb setrgbcolor
+2460 98 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Number of models)]
+] -46.7 MCshow
+LTb
+LCb setrgbcolor
+2460 4109 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Influence of number of models on memory)]
+] -46.7 MCshow
+% Begin plot #1
+4.000 UL
+LTb
+1.00 0.00 0.00 C LCb setrgbcolor
+1610 3766 M
+[ [(Helvetica) 140.0 0.0 true true 0 (copy)]
+] -46.7 MRshow
+4.000 UL
+LTb
+1.00 0.00 0.00 C 1694 3766 M
+399 0 V
+886 1237 M
+321 167 V
+322 350 V
+321 210 V
+321 -33 V
+322 740 V
+321 -153 V
+321 714 V
+322 456 V
+321 100 V
+% End plot #1
+% Begin plot #2
+stroke
+LTb
+0.00 1.00 0.00 C LCb setrgbcolor
+1610 3626 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Periodic)]
+] -46.7 MRshow
+4.000 UL
+LTb
+0.00 1.00 0.00 C 1694 3626 M
+399 0 V
+886 752 M
+321 22 V
+322 36 V
+321 21 V
+321 26 V
+322 39 V
+321 9 V
+321 37 V
+322 20 V
+321 39 V
+% End plot #2
+stroke
+2.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+854 3899 N
+854 448 L
+3213 0 V
+0 3451 V
+-3213 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+stroke
+grestore
+end
+showpage
+%%Trailer
+%%DocumentFonts: Helvetica
+%%Pages: 1

+ 16 - 0
examples/result_3

@@ -0,0 +1,16 @@
+1 20868800.0 20300400.0 
+2 20846000.0 20318800.0 
+4 20883800.0 20326400.0 
+8 20773600.0 20284000.0 
+16 20838000.0 20375000.0 
+32 21171000.0 20323400.0 
+64 21402600.0 20305800.0 
+128 21877200.0 20324000.0 
+256 22448200.0 20329400.0 
+512 24579200.0 20555000.0 
+1024 27836200.0 20551600.0 
+2048 36140800.0 21122200.0 
+4096 45081000.0 22027000.0 
+8192 78566200.0 24613400.0 
+16384 124407800.0 27717200.0 
+32768 251972800.0 37777400.0 

+ 777 - 0
examples/result_3.eps

@@ -0,0 +1,777 @@
+%!PS-Adobe-2.0
+%%Title: result_3.eps
+%%Creator: gnuplot 5.0 patchlevel 1 (Gentoo revision r1)
+%%CreationDate: Fri Dec  2 10:30:14 2016
+%%DocumentFonts: (atend)
+%%BoundingBox: 50 50 482 482
+%%Orientation: Portrait
+%%Pages: (atend)
+%%EndComments
+%%BeginProlog
+/gnudict 256 dict def
+gnudict begin
+%
+% The following true/false flags may be edited by hand if desired.
+% The unit line width and grayscale image gamma correction may also be changed.
+%
+/Color true def
+/Blacktext false def
+/Solid false def
+/Dashlength 1 def
+/Landscape false def
+/Level1 false def
+/Level3 false def
+/Rounded false def
+/ClipToBoundingBox false def
+/SuppressPDFMark false def
+/TransparentPatterns false def
+/gnulinewidth 5.000 def
+/userlinewidth gnulinewidth def
+/Gamma 1.0 def
+/BackgroundColor {-1.000 -1.000 -1.000} def
+%
+/vshift -46 def
+/dl1 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul sub dup 0 le { pop 0.01 } if } if
+} def
+/dl2 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul add } if
+} def
+/hpt_ 31.5 def
+/vpt_ 31.5 def
+/hpt hpt_ def
+/vpt vpt_ def
+/doclip {
+  ClipToBoundingBox {
+    newpath 50 50 moveto 482 50 lineto 482 482 lineto 50 482 lineto closepath
+    clip
+  } if
+} def
+%
+% Gnuplot Prolog Version 5.0 (Dec 2014)
+%
+%/SuppressPDFMark true def
+%
+/M {moveto} bind def
+/L {lineto} bind def
+/R {rmoveto} bind def
+/V {rlineto} bind def
+/N {newpath moveto} bind def
+/Z {closepath} bind def
+/C {setrgbcolor} bind def
+/f {rlineto fill} bind def
+/g {setgray} bind def
+/Gshow {show} def   % May be redefined later in the file to support UTF-8
+/vpt2 vpt 2 mul def
+/hpt2 hpt 2 mul def
+/Lshow {currentpoint stroke M 0 vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Rshow {currentpoint stroke M dup stringwidth pop neg vshift R
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Cshow {currentpoint stroke M dup stringwidth pop -2 div vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/UP {dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def
+  /hpt2 hpt 2 mul def /vpt2 vpt 2 mul def} def
+/DL {Color {setrgbcolor Solid {pop []} if 0 setdash}
+ {pop pop pop 0 setgray Solid {pop []} if 0 setdash} ifelse} def
+/BL {stroke userlinewidth 2 mul setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/AL {stroke userlinewidth 2 div setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/UL {dup gnulinewidth mul /userlinewidth exch def
+	dup 1 lt {pop 1} if 10 mul /udl exch def} def
+/PL {stroke userlinewidth setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+3.8 setmiterlimit
+% Classic Line colors (version 5.0)
+/LCw {1 1 1} def
+/LCb {0 0 0} def
+/LCa {0 0 0} def
+/LC0 {1 0 0} def
+/LC1 {0 1 0} def
+/LC2 {0 0 1} def
+/LC3 {1 0 1} def
+/LC4 {0 1 1} def
+/LC5 {1 1 0} def
+/LC6 {0 0 0} def
+/LC7 {1 0.3 0} def
+/LC8 {0.5 0.5 0.5} def
+% Default dash patterns (version 5.0)
+/LTw {PL [] 1 setgray} def
+/LTb {BL [] LCb DL} def
+/LTa {AL [1 udl mul 2 udl mul] 0 setdash LCa setrgbcolor} def
+/LT0 {PL [] LC0 DL} def
+/LT1 {PL [2 dl1 3 dl2] LC1 DL} def
+/LT2 {PL [1 dl1 1.5 dl2] LC2 DL} def
+/LT3 {PL [6 dl1 2 dl2 1 dl1 2 dl2] LC3 DL} def
+/LT4 {PL [1 dl1 2 dl2 6 dl1 2 dl2 1 dl1 2 dl2] LC4 DL} def
+/LT5 {PL [4 dl1 2 dl2] LC5 DL} def
+/LT6 {PL [1.5 dl1 1.5 dl2 1.5 dl1 1.5 dl2 1.5 dl1 6 dl2] LC6 DL} def
+/LT7 {PL [3 dl1 3 dl2 1 dl1 3 dl2] LC7 DL} def
+/LT8 {PL [2 dl1 2 dl2 2 dl1 6 dl2] LC8 DL} def
+/SL {[] 0 setdash} def
+/Pnt {stroke [] 0 setdash gsave 1 setlinecap M 0 0 V stroke grestore} def
+/Dia {stroke [] 0 setdash 2 copy vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke
+  Pnt} def
+/Pls {stroke [] 0 setdash vpt sub M 0 vpt2 V
+  currentpoint stroke M
+  hpt neg vpt neg R hpt2 0 V stroke
+ } def
+/Box {stroke [] 0 setdash 2 copy exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke
+  Pnt} def
+/Crs {stroke [] 0 setdash exch hpt sub exch vpt add M
+  hpt2 vpt2 neg V currentpoint stroke M
+  hpt2 neg 0 R hpt2 vpt2 V stroke} def
+/TriU {stroke [] 0 setdash 2 copy vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke
+  Pnt} def
+/Star {2 copy Pls Crs} def
+/BoxF {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath fill} def
+/TriUF {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath fill} def
+/TriD {stroke [] 0 setdash 2 copy vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke
+  Pnt} def
+/TriDF {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath fill} def
+/DiaF {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath fill} def
+/Pent {stroke [] 0 setdash 2 copy gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore Pnt} def
+/PentF {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath fill grestore} def
+/Circle {stroke [] 0 setdash 2 copy
+  hpt 0 360 arc stroke Pnt} def
+/CircleF {stroke [] 0 setdash hpt 0 360 arc fill} def
+/C0 {BL [] 0 setdash 2 copy moveto vpt 90 450 arc} bind def
+/C1 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C2 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C3 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C4 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C5 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc
+	2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc} bind def
+/C6 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C7 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C8 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C9 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 450 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C10 {BL [] 0 setdash 2 copy 2 copy moveto vpt 270 360 arc closepath fill
+	2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C11 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C12 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C13 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C14 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 360 arc closepath fill
+	vpt 0 360 arc} bind def
+/C15 {BL [] 0 setdash 2 copy vpt 0 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/Rec {newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto
+	neg 0 rlineto closepath} bind def
+/Square {dup Rec} bind def
+/Bsquare {vpt sub exch vpt sub exch vpt2 Square} bind def
+/S0 {BL [] 0 setdash 2 copy moveto 0 vpt rlineto BL Bsquare} bind def
+/S1 {BL [] 0 setdash 2 copy vpt Square fill Bsquare} bind def
+/S2 {BL [] 0 setdash 2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S3 {BL [] 0 setdash 2 copy exch vpt sub exch vpt2 vpt Rec fill Bsquare} bind def
+/S4 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S5 {BL [] 0 setdash 2 copy 2 copy vpt Square fill
+	exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S6 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S7 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S8 {BL [] 0 setdash 2 copy vpt sub vpt Square fill Bsquare} bind def
+/S9 {BL [] 0 setdash 2 copy vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S10 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt Square fill
+	Bsquare} bind def
+/S11 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt2 vpt Rec fill
+	Bsquare} bind def
+/S12 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill Bsquare} bind def
+/S13 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S14 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S15 {BL [] 0 setdash 2 copy Bsquare fill Bsquare} bind def
+/D0 {gsave translate 45 rotate 0 0 S0 stroke grestore} bind def
+/D1 {gsave translate 45 rotate 0 0 S1 stroke grestore} bind def
+/D2 {gsave translate 45 rotate 0 0 S2 stroke grestore} bind def
+/D3 {gsave translate 45 rotate 0 0 S3 stroke grestore} bind def
+/D4 {gsave translate 45 rotate 0 0 S4 stroke grestore} bind def
+/D5 {gsave translate 45 rotate 0 0 S5 stroke grestore} bind def
+/D6 {gsave translate 45 rotate 0 0 S6 stroke grestore} bind def
+/D7 {gsave translate 45 rotate 0 0 S7 stroke grestore} bind def
+/D8 {gsave translate 45 rotate 0 0 S8 stroke grestore} bind def
+/D9 {gsave translate 45 rotate 0 0 S9 stroke grestore} bind def
+/D10 {gsave translate 45 rotate 0 0 S10 stroke grestore} bind def
+/D11 {gsave translate 45 rotate 0 0 S11 stroke grestore} bind def
+/D12 {gsave translate 45 rotate 0 0 S12 stroke grestore} bind def
+/D13 {gsave translate 45 rotate 0 0 S13 stroke grestore} bind def
+/D14 {gsave translate 45 rotate 0 0 S14 stroke grestore} bind def
+/D15 {gsave translate 45 rotate 0 0 S15 stroke grestore} bind def
+/DiaE {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke} def
+/BoxE {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke} def
+/TriUE {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke} def
+/TriDE {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke} def
+/PentE {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore} def
+/CircE {stroke [] 0 setdash 
+  hpt 0 360 arc stroke} def
+/Opaque {gsave closepath 1 setgray fill grestore 0 setgray closepath} def
+/DiaW {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V Opaque stroke} def
+/BoxW {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V Opaque stroke} def
+/TriUW {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V Opaque stroke} def
+/TriDW {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V Opaque stroke} def
+/PentW {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  Opaque stroke grestore} def
+/CircW {stroke [] 0 setdash 
+  hpt 0 360 arc Opaque stroke} def
+/BoxFill {gsave Rec 1 setgray fill grestore} def
+/Density {
+  /Fillden exch def
+  currentrgbcolor
+  /ColB exch def /ColG exch def /ColR exch def
+  /ColR ColR Fillden mul Fillden sub 1 add def
+  /ColG ColG Fillden mul Fillden sub 1 add def
+  /ColB ColB Fillden mul Fillden sub 1 add def
+  ColR ColG ColB setrgbcolor} def
+/BoxColFill {gsave Rec PolyFill} def
+/PolyFill {gsave Density fill grestore grestore} def
+/h {rlineto rlineto rlineto gsave closepath fill grestore} bind def
+%
+% PostScript Level 1 Pattern Fill routine for rectangles
+% Usage: x y w h s a XX PatternFill
+%	x,y = lower left corner of box to be filled
+%	w,h = width and height of box
+%	  a = angle in degrees between lines and x-axis
+%	 XX = 0/1 for no/yes cross-hatch
+%
+/PatternFill {gsave /PFa [ 9 2 roll ] def
+  PFa 0 get PFa 2 get 2 div add PFa 1 get PFa 3 get 2 div add translate
+  PFa 2 get -2 div PFa 3 get -2 div PFa 2 get PFa 3 get Rec
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+  clip
+  currentlinewidth 0.5 mul setlinewidth
+  /PFs PFa 2 get dup mul PFa 3 get dup mul add sqrt def
+  0 0 M PFa 5 get rotate PFs -2 div dup translate
+  0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 M 0 PFs V} for
+  0 PFa 6 get ne {
+	0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 2 1 roll M PFs 0 V} for
+ } if
+  stroke grestore} def
+%
+/languagelevel where
+ {pop languagelevel} {1} ifelse
+dup 2 lt
+	{/InterpretLevel1 true def
+	 /InterpretLevel3 false def}
+	{/InterpretLevel1 Level1 def
+	 2 gt
+	    {/InterpretLevel3 Level3 def}
+	    {/InterpretLevel3 false def}
+	 ifelse }
+ ifelse
+%
+% PostScript level 2 pattern fill definitions
+%
+/Level2PatternFill {
+/Tile8x8 {/PaintType 2 /PatternType 1 /TilingType 1 /BBox [0 0 8 8] /XStep 8 /YStep 8}
+	bind def
+/KeepColor {currentrgbcolor [/Pattern /DeviceRGB] setcolorspace} bind def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke} 
+>> matrix makepattern
+/Pat1 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke
+	0 4 M 4 8 L 8 4 L 4 0 L 0 4 L stroke}
+>> matrix makepattern
+/Pat2 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 0 8 L
+	8 8 L 8 0 L 0 0 L fill}
+>> matrix makepattern
+/Pat3 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 8 M 8 -4 L
+	0 12 M 12 0 L stroke}
+>> matrix makepattern
+/Pat4 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 0 M 8 12 L
+	0 -4 M 12 8 L stroke}
+>> matrix makepattern
+/Pat5 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 8 M 4 -4 L
+	0 12 M 8 -4 L 4 12 M 10 0 L stroke}
+>> matrix makepattern
+/Pat6 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 0 M 4 12 L
+	0 -4 M 8 12 L 4 -4 M 10 8 L stroke}
+>> matrix makepattern
+/Pat7 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 8 -2 M -4 4 L
+	12 0 M -4 8 L 12 4 M 0 10 L stroke}
+>> matrix makepattern
+/Pat8 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 -2 M 12 4 L
+	-4 0 M 12 8 L -4 4 M 8 10 L stroke}
+>> matrix makepattern
+/Pat9 exch def
+/Pattern1 {PatternBgnd KeepColor Pat1 setpattern} bind def
+/Pattern2 {PatternBgnd KeepColor Pat2 setpattern} bind def
+/Pattern3 {PatternBgnd KeepColor Pat3 setpattern} bind def
+/Pattern4 {PatternBgnd KeepColor Landscape {Pat5} {Pat4} ifelse setpattern} bind def
+/Pattern5 {PatternBgnd KeepColor Landscape {Pat4} {Pat5} ifelse setpattern} bind def
+/Pattern6 {PatternBgnd KeepColor Landscape {Pat9} {Pat6} ifelse setpattern} bind def
+/Pattern7 {PatternBgnd KeepColor Landscape {Pat8} {Pat7} ifelse setpattern} bind def
+} def
+%
+%
+%End of PostScript Level 2 code
+%
+/PatternBgnd {
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+} def
+%
+% Substitute for Level 2 pattern fill codes with
+% grayscale if Level 2 support is not selected.
+%
+/Level1PatternFill {
+/Pattern1 {0.250 Density} bind def
+/Pattern2 {0.500 Density} bind def
+/Pattern3 {0.750 Density} bind def
+/Pattern4 {0.125 Density} bind def
+/Pattern5 {0.375 Density} bind def
+/Pattern6 {0.625 Density} bind def
+/Pattern7 {0.875 Density} bind def
+} def
+%
+% Now test for support of Level 2 code
+%
+Level1 {Level1PatternFill} {Level2PatternFill} ifelse
+%
+/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont
+dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall
+currentdict end definefont pop
+%
+/MFshow {
+   { dup 5 get 3 ge
+     { 5 get 3 eq {gsave} {grestore} ifelse }
+     {dup dup 0 get findfont exch 1 get scalefont setfont
+     [ currentpoint ] exch dup 2 get 0 exch R dup 5 get 2 ne {dup dup 6
+     get exch 4 get {textshow} {stringwidth pop 0 R} ifelse }if dup 5 get 0 eq
+     {dup 3 get {2 get neg 0 exch R pop} {pop aload pop M} ifelse} {dup 5
+     get 1 eq {dup 2 get exch dup 3 get exch 6 get stringwidth pop -2 div
+     dup 0 R} {dup 6 get stringwidth pop -2 div 0 R 6 get
+     textshow 2 index {aload pop M neg 3 -1 roll neg R pop pop} {pop pop pop
+     pop aload pop M} ifelse }ifelse }ifelse }
+     ifelse }
+   forall} def
+/Gswidth {dup type /stringtype eq {stringwidth} {pop (n) stringwidth} ifelse} def
+/MFwidth {0 exch { dup 5 get 3 ge { 5 get 3 eq { 0 } { pop } ifelse }
+ {dup 3 get{dup dup 0 get findfont exch 1 get scalefont setfont
+     6 get Gswidth pop add} {pop} ifelse} ifelse} forall} def
+/MLshow { currentpoint stroke M
+  0 exch R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MRshow { currentpoint stroke M
+  exch dup MFwidth neg 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MCshow { currentpoint stroke M
+  exch dup MFwidth -2 div 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/XYsave    { [( ) 1 2 true false 3 ()] } bind def
+/XYrestore { [( ) 1 2 true false 4 ()] } bind def
+Level1 SuppressPDFMark or 
+{} {
+/SDict 10 dict def
+systemdict /pdfmark known not {
+  userdict /pdfmark systemdict /cleartomark get put
+} if
+SDict begin [
+  /Title (result_3.eps)
+  /Subject (gnuplot plot)
+  /Creator (gnuplot 5.0 patchlevel 1 (Gentoo revision r1))
+  /Author (yentl)
+%  /Producer (gnuplot)
+%  /Keywords ()
+  /CreationDate (Fri Dec  2 10:30:14 2016)
+  /DOCINFO pdfmark
+end
+} ifelse
+end
+%
+% Support for boxed text - Ethan A Merritt May 2005
+%
+/InitTextBox { userdict /TBy2 3 -1 roll put userdict /TBx2 3 -1 roll put
+           userdict /TBy1 3 -1 roll put userdict /TBx1 3 -1 roll put
+	   /Boxing true def } def
+/ExtendTextBox { Boxing
+    { gsave dup false charpath pathbbox
+      dup TBy2 gt {userdict /TBy2 3 -1 roll put} {pop} ifelse
+      dup TBx2 gt {userdict /TBx2 3 -1 roll put} {pop} ifelse
+      dup TBy1 lt {userdict /TBy1 3 -1 roll put} {pop} ifelse
+      dup TBx1 lt {userdict /TBx1 3 -1 roll put} {pop} ifelse
+      grestore } if } def
+/PopTextBox { newpath TBx1 TBxmargin sub TBy1 TBymargin sub M
+               TBx1 TBxmargin sub TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy1 TBymargin sub L closepath } def
+/DrawTextBox { PopTextBox stroke /Boxing false def} def
+/FillTextBox { gsave PopTextBox 1 1 1 setrgbcolor fill grestore /Boxing false def} def
+0 0 0 0 InitTextBox
+/TBxmargin 20 def
+/TBymargin 20 def
+/Boxing false def
+/textshow { ExtendTextBox Gshow } def
+%
+%%EndProlog
+%%Page: 1 1
+gnudict begin
+gsave
+doclip
+50 50 translate
+0.100 0.100 scale
+0 setgray
+newpath
+(Helvetica) findfont 140 scalefont setfont
+BackgroundColor 0 lt 3 1 roll 0 lt exch 0 lt or or not {gsave BackgroundColor C clippath fill grestore} if
+1.000 UL
+LTb
+LCb setrgbcolor
+938 448 M
+63 0 V
+3066 0 R
+-63 0 V
+stroke
+854 448 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+938 1138 M
+63 0 V
+3066 0 R
+-63 0 V
+stroke
+854 1138 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 50000)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+938 1828 M
+63 0 V
+3066 0 R
+-63 0 V
+stroke
+854 1828 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 100000)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+938 2519 M
+63 0 V
+3066 0 R
+-63 0 V
+stroke
+854 2519 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 150000)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+938 3209 M
+63 0 V
+3066 0 R
+-63 0 V
+stroke
+854 3209 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 200000)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+938 3899 M
+63 0 V
+3066 0 R
+-63 0 V
+stroke
+854 3899 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 250000)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+938 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+938 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1385 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+1385 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 5000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1832 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+1832 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 10000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2279 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+2279 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 15000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2726 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+2726 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 20000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3173 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+3173 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 25000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3620 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+3620 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 30000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+4067 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+4067 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 35000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+938 3899 N
+938 448 L
+3129 0 V
+0 3451 V
+-3129 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+LCb setrgbcolor
+112 2173 M
+currentpoint gsave translate -270 rotate 0 0 moveto
+[ [(Helvetica) 140.0 0.0 true true 0 (Main memory usage \(KB\))]
+] -46.7 MCshow
+grestore
+LTb
+LCb setrgbcolor
+2502 98 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Model state \(B\))]
+] -46.7 MCshow
+LTb
+LCb setrgbcolor
+2502 4109 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Influence of state size on memory)]
+] -46.7 MCshow
+% Begin plot #1
+4.000 UL
+LTb
+1.00 0.00 0.00 C LCb setrgbcolor
+1694 3766 M
+[ [(Helvetica) 140.0 0.0 true true 0 (copy)]
+] -46.7 MRshow
+4.000 UL
+LTb
+1.00 0.00 0.00 C 1778 3766 M
+399 0 V
+938 729 M
+0 1 V
+1 -2 V
+0 1 V
+2 4 V
+3 4 V
+5 6 V
+12 8 V
+23 28 V
+46 44 V
+91 112 V
+183 121 V
+366 451 V
+733 618 V
+3867 3845 L
+% End plot #1
+% Begin plot #2
+stroke
+LTb
+0.00 1.00 0.00 C LCb setrgbcolor
+1694 3626 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Periodic)]
+] -46.7 MRshow
+4.000 UL
+LTb
+0.00 1.00 0.00 C 1778 3626 M
+399 0 V
+938 722 M
+1 -1 V
+0 2 V
+2 -1 V
+3 0 V
+5 0 V
+12 0 V
+23 3 V
+46 0 V
+91 8 V
+183 12 V
+366 35 V
+733 42 V
+3867 957 L
+% End plot #2
+stroke
+2.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+938 3899 N
+938 448 L
+3129 0 V
+0 3451 V
+-3129 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+stroke
+grestore
+end
+showpage
+%%Trailer
+%%DocumentFonts: Helvetica
+%%Pages: 1

+ 992 - 0
examples/result_4.eps

@@ -0,0 +1,992 @@
+%!PS-Adobe-2.0
+%%Title: result_4.eps
+%%Creator: gnuplot 5.0 patchlevel 1 (Gentoo revision r1)
+%%CreationDate: Fri Dec  2 10:30:14 2016
+%%DocumentFonts: (atend)
+%%BoundingBox: 50 50 482 482
+%%Orientation: Portrait
+%%Pages: (atend)
+%%EndComments
+%%BeginProlog
+/gnudict 256 dict def
+gnudict begin
+%
+% The following true/false flags may be edited by hand if desired.
+% The unit line width and grayscale image gamma correction may also be changed.
+%
+/Color true def
+/Blacktext false def
+/Solid false def
+/Dashlength 1 def
+/Landscape false def
+/Level1 false def
+/Level3 false def
+/Rounded false def
+/ClipToBoundingBox false def
+/SuppressPDFMark false def
+/TransparentPatterns false def
+/gnulinewidth 5.000 def
+/userlinewidth gnulinewidth def
+/Gamma 1.0 def
+/BackgroundColor {-1.000 -1.000 -1.000} def
+%
+/vshift -46 def
+/dl1 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul sub dup 0 le { pop 0.01 } if } if
+} def
+/dl2 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul add } if
+} def
+/hpt_ 31.5 def
+/vpt_ 31.5 def
+/hpt hpt_ def
+/vpt vpt_ def
+/doclip {
+  ClipToBoundingBox {
+    newpath 50 50 moveto 482 50 lineto 482 482 lineto 50 482 lineto closepath
+    clip
+  } if
+} def
+%
+% Gnuplot Prolog Version 5.0 (Dec 2014)
+%
+%/SuppressPDFMark true def
+%
+/M {moveto} bind def
+/L {lineto} bind def
+/R {rmoveto} bind def
+/V {rlineto} bind def
+/N {newpath moveto} bind def
+/Z {closepath} bind def
+/C {setrgbcolor} bind def
+/f {rlineto fill} bind def
+/g {setgray} bind def
+/Gshow {show} def   % May be redefined later in the file to support UTF-8
+/vpt2 vpt 2 mul def
+/hpt2 hpt 2 mul def
+/Lshow {currentpoint stroke M 0 vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Rshow {currentpoint stroke M dup stringwidth pop neg vshift R
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Cshow {currentpoint stroke M dup stringwidth pop -2 div vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/UP {dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def
+  /hpt2 hpt 2 mul def /vpt2 vpt 2 mul def} def
+/DL {Color {setrgbcolor Solid {pop []} if 0 setdash}
+ {pop pop pop 0 setgray Solid {pop []} if 0 setdash} ifelse} def
+/BL {stroke userlinewidth 2 mul setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/AL {stroke userlinewidth 2 div setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/UL {dup gnulinewidth mul /userlinewidth exch def
+	dup 1 lt {pop 1} if 10 mul /udl exch def} def
+/PL {stroke userlinewidth setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+3.8 setmiterlimit
+% Classic Line colors (version 5.0)
+/LCw {1 1 1} def
+/LCb {0 0 0} def
+/LCa {0 0 0} def
+/LC0 {1 0 0} def
+/LC1 {0 1 0} def
+/LC2 {0 0 1} def
+/LC3 {1 0 1} def
+/LC4 {0 1 1} def
+/LC5 {1 1 0} def
+/LC6 {0 0 0} def
+/LC7 {1 0.3 0} def
+/LC8 {0.5 0.5 0.5} def
+% Default dash patterns (version 5.0)
+/LTw {PL [] 1 setgray} def
+/LTb {BL [] LCb DL} def
+/LTa {AL [1 udl mul 2 udl mul] 0 setdash LCa setrgbcolor} def
+/LT0 {PL [] LC0 DL} def
+/LT1 {PL [2 dl1 3 dl2] LC1 DL} def
+/LT2 {PL [1 dl1 1.5 dl2] LC2 DL} def
+/LT3 {PL [6 dl1 2 dl2 1 dl1 2 dl2] LC3 DL} def
+/LT4 {PL [1 dl1 2 dl2 6 dl1 2 dl2 1 dl1 2 dl2] LC4 DL} def
+/LT5 {PL [4 dl1 2 dl2] LC5 DL} def
+/LT6 {PL [1.5 dl1 1.5 dl2 1.5 dl1 1.5 dl2 1.5 dl1 6 dl2] LC6 DL} def
+/LT7 {PL [3 dl1 3 dl2 1 dl1 3 dl2] LC7 DL} def
+/LT8 {PL [2 dl1 2 dl2 2 dl1 6 dl2] LC8 DL} def
+/SL {[] 0 setdash} def
+/Pnt {stroke [] 0 setdash gsave 1 setlinecap M 0 0 V stroke grestore} def
+/Dia {stroke [] 0 setdash 2 copy vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke
+  Pnt} def
+/Pls {stroke [] 0 setdash vpt sub M 0 vpt2 V
+  currentpoint stroke M
+  hpt neg vpt neg R hpt2 0 V stroke
+ } def
+/Box {stroke [] 0 setdash 2 copy exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke
+  Pnt} def
+/Crs {stroke [] 0 setdash exch hpt sub exch vpt add M
+  hpt2 vpt2 neg V currentpoint stroke M
+  hpt2 neg 0 R hpt2 vpt2 V stroke} def
+/TriU {stroke [] 0 setdash 2 copy vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke
+  Pnt} def
+/Star {2 copy Pls Crs} def
+/BoxF {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath fill} def
+/TriUF {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath fill} def
+/TriD {stroke [] 0 setdash 2 copy vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke
+  Pnt} def
+/TriDF {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath fill} def
+/DiaF {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath fill} def
+/Pent {stroke [] 0 setdash 2 copy gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore Pnt} def
+/PentF {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath fill grestore} def
+/Circle {stroke [] 0 setdash 2 copy
+  hpt 0 360 arc stroke Pnt} def
+/CircleF {stroke [] 0 setdash hpt 0 360 arc fill} def
+/C0 {BL [] 0 setdash 2 copy moveto vpt 90 450 arc} bind def
+/C1 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C2 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C3 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C4 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C5 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc
+	2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc} bind def
+/C6 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C7 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C8 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C9 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 450 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C10 {BL [] 0 setdash 2 copy 2 copy moveto vpt 270 360 arc closepath fill
+	2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C11 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C12 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C13 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C14 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 360 arc closepath fill
+	vpt 0 360 arc} bind def
+/C15 {BL [] 0 setdash 2 copy vpt 0 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/Rec {newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto
+	neg 0 rlineto closepath} bind def
+/Square {dup Rec} bind def
+/Bsquare {vpt sub exch vpt sub exch vpt2 Square} bind def
+/S0 {BL [] 0 setdash 2 copy moveto 0 vpt rlineto BL Bsquare} bind def
+/S1 {BL [] 0 setdash 2 copy vpt Square fill Bsquare} bind def
+/S2 {BL [] 0 setdash 2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S3 {BL [] 0 setdash 2 copy exch vpt sub exch vpt2 vpt Rec fill Bsquare} bind def
+/S4 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S5 {BL [] 0 setdash 2 copy 2 copy vpt Square fill
+	exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S6 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S7 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S8 {BL [] 0 setdash 2 copy vpt sub vpt Square fill Bsquare} bind def
+/S9 {BL [] 0 setdash 2 copy vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S10 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt Square fill
+	Bsquare} bind def
+/S11 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt2 vpt Rec fill
+	Bsquare} bind def
+/S12 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill Bsquare} bind def
+/S13 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S14 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S15 {BL [] 0 setdash 2 copy Bsquare fill Bsquare} bind def
+/D0 {gsave translate 45 rotate 0 0 S0 stroke grestore} bind def
+/D1 {gsave translate 45 rotate 0 0 S1 stroke grestore} bind def
+/D2 {gsave translate 45 rotate 0 0 S2 stroke grestore} bind def
+/D3 {gsave translate 45 rotate 0 0 S3 stroke grestore} bind def
+/D4 {gsave translate 45 rotate 0 0 S4 stroke grestore} bind def
+/D5 {gsave translate 45 rotate 0 0 S5 stroke grestore} bind def
+/D6 {gsave translate 45 rotate 0 0 S6 stroke grestore} bind def
+/D7 {gsave translate 45 rotate 0 0 S7 stroke grestore} bind def
+/D8 {gsave translate 45 rotate 0 0 S8 stroke grestore} bind def
+/D9 {gsave translate 45 rotate 0 0 S9 stroke grestore} bind def
+/D10 {gsave translate 45 rotate 0 0 S10 stroke grestore} bind def
+/D11 {gsave translate 45 rotate 0 0 S11 stroke grestore} bind def
+/D12 {gsave translate 45 rotate 0 0 S12 stroke grestore} bind def
+/D13 {gsave translate 45 rotate 0 0 S13 stroke grestore} bind def
+/D14 {gsave translate 45 rotate 0 0 S14 stroke grestore} bind def
+/D15 {gsave translate 45 rotate 0 0 S15 stroke grestore} bind def
+/DiaE {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke} def
+/BoxE {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke} def
+/TriUE {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke} def
+/TriDE {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke} def
+/PentE {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore} def
+/CircE {stroke [] 0 setdash 
+  hpt 0 360 arc stroke} def
+/Opaque {gsave closepath 1 setgray fill grestore 0 setgray closepath} def
+/DiaW {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V Opaque stroke} def
+/BoxW {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V Opaque stroke} def
+/TriUW {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V Opaque stroke} def
+/TriDW {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V Opaque stroke} def
+/PentW {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  Opaque stroke grestore} def
+/CircW {stroke [] 0 setdash 
+  hpt 0 360 arc Opaque stroke} def
+/BoxFill {gsave Rec 1 setgray fill grestore} def
+/Density {
+  /Fillden exch def
+  currentrgbcolor
+  /ColB exch def /ColG exch def /ColR exch def
+  /ColR ColR Fillden mul Fillden sub 1 add def
+  /ColG ColG Fillden mul Fillden sub 1 add def
+  /ColB ColB Fillden mul Fillden sub 1 add def
+  ColR ColG ColB setrgbcolor} def
+/BoxColFill {gsave Rec PolyFill} def
+/PolyFill {gsave Density fill grestore grestore} def
+/h {rlineto rlineto rlineto gsave closepath fill grestore} bind def
+%
+% PostScript Level 1 Pattern Fill routine for rectangles
+% Usage: x y w h s a XX PatternFill
+%	x,y = lower left corner of box to be filled
+%	w,h = width and height of box
+%	  a = angle in degrees between lines and x-axis
+%	 XX = 0/1 for no/yes cross-hatch
+%
+/PatternFill {gsave /PFa [ 9 2 roll ] def
+  PFa 0 get PFa 2 get 2 div add PFa 1 get PFa 3 get 2 div add translate
+  PFa 2 get -2 div PFa 3 get -2 div PFa 2 get PFa 3 get Rec
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+  clip
+  currentlinewidth 0.5 mul setlinewidth
+  /PFs PFa 2 get dup mul PFa 3 get dup mul add sqrt def
+  0 0 M PFa 5 get rotate PFs -2 div dup translate
+  0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 M 0 PFs V} for
+  0 PFa 6 get ne {
+	0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 2 1 roll M PFs 0 V} for
+ } if
+  stroke grestore} def
+%
+/languagelevel where
+ {pop languagelevel} {1} ifelse
+dup 2 lt
+	{/InterpretLevel1 true def
+	 /InterpretLevel3 false def}
+	{/InterpretLevel1 Level1 def
+	 2 gt
+	    {/InterpretLevel3 Level3 def}
+	    {/InterpretLevel3 false def}
+	 ifelse }
+ ifelse
+%
+% PostScript level 2 pattern fill definitions
+%
+/Level2PatternFill {
+/Tile8x8 {/PaintType 2 /PatternType 1 /TilingType 1 /BBox [0 0 8 8] /XStep 8 /YStep 8}
+	bind def
+/KeepColor {currentrgbcolor [/Pattern /DeviceRGB] setcolorspace} bind def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke} 
+>> matrix makepattern
+/Pat1 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke
+	0 4 M 4 8 L 8 4 L 4 0 L 0 4 L stroke}
+>> matrix makepattern
+/Pat2 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 0 8 L
+	8 8 L 8 0 L 0 0 L fill}
+>> matrix makepattern
+/Pat3 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 8 M 8 -4 L
+	0 12 M 12 0 L stroke}
+>> matrix makepattern
+/Pat4 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 0 M 8 12 L
+	0 -4 M 12 8 L stroke}
+>> matrix makepattern
+/Pat5 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 8 M 4 -4 L
+	0 12 M 8 -4 L 4 12 M 10 0 L stroke}
+>> matrix makepattern
+/Pat6 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 0 M 4 12 L
+	0 -4 M 8 12 L 4 -4 M 10 8 L stroke}
+>> matrix makepattern
+/Pat7 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 8 -2 M -4 4 L
+	12 0 M -4 8 L 12 4 M 0 10 L stroke}
+>> matrix makepattern
+/Pat8 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 -2 M 12 4 L
+	-4 0 M 12 8 L -4 4 M 8 10 L stroke}
+>> matrix makepattern
+/Pat9 exch def
+/Pattern1 {PatternBgnd KeepColor Pat1 setpattern} bind def
+/Pattern2 {PatternBgnd KeepColor Pat2 setpattern} bind def
+/Pattern3 {PatternBgnd KeepColor Pat3 setpattern} bind def
+/Pattern4 {PatternBgnd KeepColor Landscape {Pat5} {Pat4} ifelse setpattern} bind def
+/Pattern5 {PatternBgnd KeepColor Landscape {Pat4} {Pat5} ifelse setpattern} bind def
+/Pattern6 {PatternBgnd KeepColor Landscape {Pat9} {Pat6} ifelse setpattern} bind def
+/Pattern7 {PatternBgnd KeepColor Landscape {Pat8} {Pat7} ifelse setpattern} bind def
+} def
+%
+%
+%End of PostScript Level 2 code
+%
+/PatternBgnd {
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+} def
+%
+% Substitute for Level 2 pattern fill codes with
+% grayscale if Level 2 support is not selected.
+%
+/Level1PatternFill {
+/Pattern1 {0.250 Density} bind def
+/Pattern2 {0.500 Density} bind def
+/Pattern3 {0.750 Density} bind def
+/Pattern4 {0.125 Density} bind def
+/Pattern5 {0.375 Density} bind def
+/Pattern6 {0.625 Density} bind def
+/Pattern7 {0.875 Density} bind def
+} def
+%
+% Now test for support of Level 2 code
+%
+Level1 {Level1PatternFill} {Level2PatternFill} ifelse
+%
+/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont
+dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall
+currentdict end definefont pop
+%
+/MFshow {
+   { dup 5 get 3 ge
+     { 5 get 3 eq {gsave} {grestore} ifelse }
+     {dup dup 0 get findfont exch 1 get scalefont setfont
+     [ currentpoint ] exch dup 2 get 0 exch R dup 5 get 2 ne {dup dup 6
+     get exch 4 get {textshow} {stringwidth pop 0 R} ifelse }if dup 5 get 0 eq
+     {dup 3 get {2 get neg 0 exch R pop} {pop aload pop M} ifelse} {dup 5
+     get 1 eq {dup 2 get exch dup 3 get exch 6 get stringwidth pop -2 div
+     dup 0 R} {dup 6 get stringwidth pop -2 div 0 R 6 get
+     textshow 2 index {aload pop M neg 3 -1 roll neg R pop pop} {pop pop pop
+     pop aload pop M} ifelse }ifelse }ifelse }
+     ifelse }
+   forall} def
+/Gswidth {dup type /stringtype eq {stringwidth} {pop (n) stringwidth} ifelse} def
+/MFwidth {0 exch { dup 5 get 3 ge { 5 get 3 eq { 0 } { pop } ifelse }
+ {dup 3 get{dup dup 0 get findfont exch 1 get scalefont setfont
+     6 get Gswidth pop add} {pop} ifelse} ifelse} forall} def
+/MLshow { currentpoint stroke M
+  0 exch R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MRshow { currentpoint stroke M
+  exch dup MFwidth neg 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MCshow { currentpoint stroke M
+  exch dup MFwidth -2 div 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/XYsave    { [( ) 1 2 true false 3 ()] } bind def
+/XYrestore { [( ) 1 2 true false 4 ()] } bind def
+Level1 SuppressPDFMark or 
+{} {
+/SDict 10 dict def
+systemdict /pdfmark known not {
+  userdict /pdfmark systemdict /cleartomark get put
+} if
+SDict begin [
+  /Title (result_4.eps)
+  /Subject (gnuplot plot)
+  /Creator (gnuplot 5.0 patchlevel 1 (Gentoo revision r1))
+  /Author (yentl)
+%  /Producer (gnuplot)
+%  /Keywords ()
+  /CreationDate (Fri Dec  2 10:30:14 2016)
+  /DOCINFO pdfmark
+end
+} ifelse
+end
+%
+% Support for boxed text - Ethan A Merritt May 2005
+%
+/InitTextBox { userdict /TBy2 3 -1 roll put userdict /TBx2 3 -1 roll put
+           userdict /TBy1 3 -1 roll put userdict /TBx1 3 -1 roll put
+	   /Boxing true def } def
+/ExtendTextBox { Boxing
+    { gsave dup false charpath pathbbox
+      dup TBy2 gt {userdict /TBy2 3 -1 roll put} {pop} ifelse
+      dup TBx2 gt {userdict /TBx2 3 -1 roll put} {pop} ifelse
+      dup TBy1 lt {userdict /TBy1 3 -1 roll put} {pop} ifelse
+      dup TBx1 lt {userdict /TBx1 3 -1 roll put} {pop} ifelse
+      grestore } if } def
+/PopTextBox { newpath TBx1 TBxmargin sub TBy1 TBymargin sub M
+               TBx1 TBxmargin sub TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy1 TBymargin sub L closepath } def
+/DrawTextBox { PopTextBox stroke /Boxing false def} def
+/FillTextBox { gsave PopTextBox 1 1 1 setrgbcolor fill grestore /Boxing false def} def
+0 0 0 0 InitTextBox
+/TBxmargin 20 def
+/TBymargin 20 def
+/Boxing false def
+/textshow { ExtendTextBox Gshow } def
+%
+%%EndProlog
+%%Page: 1 1
+gnudict begin
+gsave
+doclip
+50 50 translate
+0.100 0.100 scale
+0 setgray
+newpath
+(Helvetica) findfont 140 scalefont setfont
+BackgroundColor 0 lt 3 1 roll 0 lt exch 0 lt or or not {gsave BackgroundColor C clippath fill grestore} if
+1.000 UL
+LTb
+LCb setrgbcolor
+686 448 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 448 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 1023 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 1023 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.1)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 1598 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 1598 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.2)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 2174 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 2174 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.3)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 2749 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 2749 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.4)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 3324 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 3324 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.5)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 3899 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 3899 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.6)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+686 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1024 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+1024 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 10)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1362 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+1362 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 20)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1700 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+1700 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 30)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2038 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+2038 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 40)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2377 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+2377 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 50)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2715 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+2715 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 60)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3053 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+3053 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 70)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3391 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+3391 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 80)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3729 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+3729 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 90)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+4067 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+4067 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 100)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+686 3899 N
+686 448 L
+3381 0 V
+0 3451 V
+-3381 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+LCb setrgbcolor
+112 2173 M
+currentpoint gsave translate -270 rotate 0 0 moveto
+[ [(Helvetica) 140.0 0.0 true true 0 (Latency \(s\))]
+] -46.7 MCshow
+grestore
+LTb
+LCb setrgbcolor
+2376 98 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Jump destination time)]
+] -46.7 MCshow
+LTb
+LCb setrgbcolor
+2376 4109 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Jumping to specific points in time)]
+] -46.7 MCshow
+% Begin plot #1
+4.000 UL
+LTb
+1.00 0.00 0.00 C LCb setrgbcolor
+3416 3766 M
+[ [(Helvetica) 140.0 0.0 true true 0 (copy)]
+] -46.7 MRshow
+4.000 UL
+LTb
+1.00 0.00 0.00 C 3500 3766 M
+399 0 V
+4033 494 M
+-34 7 V
+-33 4 V
+-34 -12 V
+-34 -4 V
+-34 0 V
+-34 7 V
+-33 -7 V
+-34 12 V
+-34 -11 V
+-34 -4 V
+-34 1 V
+-34 -7 V
+-33 15 V
+-34 6 V
+-34 -4 V
+-34 31 V
+-34 0 V
+-33 -20 V
+-34 -5 V
+-34 -22 V
+-34 28 V
+-34 -11 V
+-33 -7 V
+-34 13 V
+-34 0 V
+-34 -9 V
+-34 -2 V
+-33 6 V
+-34 -5 V
+-34 8 V
+-34 15 V
+-34 -2 V
+-34 -7 V
+-33 -16 V
+-34 3 V
+-34 -1 V
+-34 10 V
+-34 2 V
+-33 -16 V
+-34 1 V
+-34 6 V
+-34 -3 V
+-34 1 V
+-33 14 V
+-34 -6 V
+-34 2 V
+-34 -10 V
+-34 17 V
+-33 -17 V
+-34 -7 V
+-34 2 V
+-34 -1 V
+-34 13 V
+-34 -2 V
+-33 -6 V
+-34 4 V
+-34 2 V
+-34 -15 V
+-34 17 V
+-33 2 V
+-34 -4 V
+-34 -6 V
+-34 4 V
+-34 1 V
+-33 16 V
+-34 -1 V
+-34 -12 V
+-34 23 V
+-34 -24 V
+-34 -1 V
+-33 -15 V
+-34 31 V
+-34 -18 V
+-34 -7 V
+-34 23 V
+-33 3 V
+-34 8 V
+-34 -15 V
+-34 -5 V
+-34 -25 V
+-33 44 V
+-34 -33 V
+-34 11 V
+-34 12 V
+-34 -23 V
+-33 -2 V
+-34 29 V
+-34 -23 V
+-34 17 V
+-34 11 V
+956 495 L
+-33 26 V
+889 500 L
+-34 3 V
+-34 -4 V
+787 488 L
+-33 6 V
+-34 -1 V
+-34 18 V
+% End plot #1
+% Begin plot #2
+stroke
+LTb
+0.00 1.00 0.00 C LCb setrgbcolor
+3416 3626 M
+[ [(Helvetica) 140.0 0.0 true true 0 (periodic)]
+] -46.7 MRshow
+4.000 UL
+LTb
+0.00 1.00 0.00 C 3500 3626 M
+399 0 V
+4033 1475 M
+-34 -99 V
+-33 -73 V
+-34 -145 V
+-34 -88 V
+-34 -52 V
+-34 -53 V
+-33 -72 V
+-34 -37 V
+-34 -75 V
+3695 560 L
+-34 -84 V
+-34 939 V
+-33 -137 V
+-34 -49 V
+-34 -96 V
+-34 -57 V
+3458 971 L
+-33 -8 V
+-34 -13 V
+3357 728 L
+-34 -48 V
+3289 576 L
+-33 -74 V
+-34 2746 V
+-34 -44 V
+-34 56 V
+-34 -139 V
+-33 -55 V
+-34 5 V
+-34 -208 V
+-34 -105 V
+-34 -99 V
+-34 45 V
+-33 -6 V
+-34 -271 V
+-34 -25 V
+-34 -64 V
+-34 -8 V
+-33 -95 V
+-34 -216 V
+-34 9 V
+-34 -36 V
+-34 -118 V
+-33 -91 V
+-34 -78 V
+-34 -56 V
+-34 -48 V
+-34 17 V
+-33 -112 V
+-34 -74 V
+-34 -59 V
+-34 -207 V
+-34 -101 V
+-34 18 V
+2174 983 L
+-34 -86 V
+-34 -53 V
+-34 -94 V
+-34 -64 V
+2005 492 L
+-34 2834 V
+-34 44 V
+-34 -58 V
+-34 -61 V
+-33 -112 V
+-34 -14 V
+-34 -265 V
+-34 -56 V
+-34 -59 V
+-34 -29 V
+-33 -123 V
+-34 45 V
+-34 -19 V
+-34 -19 V
+-34 -205 V
+-33 -167 V
+-34 -213 V
+-34 33 V
+-34 55 V
+-34 -226 V
+-33 88 V
+-34 -114 V
+-34 -78 V
+-34 -82 V
+-34 -112 V
+-33 -82 V
+-34 -46 V
+-34 -4 V
+-34 -25 V
+990 1166 L
+-34 -92 V
+923 985 L
+-34 -5 V
+855 864 L
+821 838 L
+787 762 L
+754 618 L
+720 542 L
+686 509 L
+% End plot #2
+stroke
+2.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+686 3899 N
+686 448 L
+3381 0 V
+0 3451 V
+-3381 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+stroke
+grestore
+end
+showpage
+%%Trailer
+%%DocumentFonts: Helvetica
+%%Pages: 1

+ 100 - 0
examples/result_4a

@@ -0,0 +1,100 @@
+99 0.00807018280029
+98 0.00923209190369
+97 0.00994606018066
+96 0.00784101486206
+95 0.00717670917511
+94 0.00706884860992
+93 0.00833628177643
+92 0.0071702003479
+91 0.00916652679443
+90 0.00722255706787
+89 0.00657951831818
+88 0.00685949325562
+87 0.00561740398407
+86 0.00813982486725
+85 0.0091374874115
+84 0.00854620933533
+83 0.0139896392822
+82 0.0138880729675
+81 0.010381603241
+80 0.00963037014008
+79 0.00580670833588
+78 0.0106555700302
+77 0.0087119102478
+76 0.00741271972656
+75 0.00979597568512
+74 0.00974447727203
+73 0.00822448730469
+72 0.00790984630585
+71 0.0088907957077
+70 0.00800907611847
+69 0.00943901538849
+68 0.0120308160782
+67 0.0116786956787
+66 0.010422205925
+65 0.00767407417297
+64 0.00824861526489
+63 0.00807468891144
+62 0.00972790718079
+61 0.0100048065186
+60 0.00726447105408
+59 0.00740630626678
+58 0.00855135917664
+57 0.00804660320282
+56 0.00814094543457
+55 0.0105469226837
+54 0.00955581665039
+53 0.00996587276459
+52 0.00813815593719
+51 0.0111654281616
+50 0.00809619426727
+49 0.0069509267807
+48 0.0072897195816
+47 0.00707137584686
+46 0.00940017700195
+45 0.00896739959717
+44 0.00797951221466
+43 0.00872349739075
+42 0.00905923843384
+41 0.00641107559204
+40 0.00947308540344
+39 0.00977742671967
+38 0.00908467769623
+37 0.00803987979889
+36 0.00876801013947
+35 0.00880410671234
+34 0.0115906000137
+33 0.0114108085632
+32 0.00937049388885
+31 0.0133528470993
+30 0.0092845916748
+29 0.00903210639954
+28 0.00647535324097
+27 0.0117668151855
+26 0.00864713191986
+25 0.00751249790192
+24 0.0115209102631
+23 0.0120535612106
+22 0.0134263038635
+21 0.0107324123383
+20 0.00990953445435
+19 0.00559964179993
+18 0.0132171392441
+17 0.00739736557007
+16 0.00936965942383
+15 0.0114476442337
+14 0.00740866661072
+13 0.00706849098206
+12 0.0122534275055
+11 0.00813252925873
+10 0.0110965013504
+9 0.013111782074
+8 0.00819580554962
+7 0.0126975297928
+6 0.0090758562088
+5 0.00948281288147
+4 0.00886862277985
+3 0.00693056583405
+2 0.0079656124115
+1 0.0077921628952
+0 0.0110217094421

+ 100 - 0
examples/result_4b

@@ -0,0 +1,100 @@
+99 0.178556084633
+98 0.161297655106
+97 0.148643064499
+96 0.123448228836
+95 0.108087539673
+94 0.0991831064224
+93 0.0898884773254
+92 0.0773097276688
+91 0.0708530902863
+90 0.0578243255615
+89 0.0194981098175
+88 0.00492107868195
+87 0.168108606339
+86 0.144368863106
+85 0.135796236992
+84 0.119089984894
+83 0.109251213074
+82 0.0910040855408
+81 0.0895184755325
+80 0.0872821569443
+79 0.0486232757568
+78 0.0402568101883
+77 0.0222248077393
+76 0.00945444107056
+75 0.486737465858
+74 0.479189586639
+73 0.488912582397
+72 0.464715504646
+71 0.455212426186
+70 0.456048798561
+69 0.419809317589
+68 0.401602172852
+67 0.38445482254
+66 0.392276358604
+65 0.391186714172
+64 0.344101381302
+63 0.339760041237
+62 0.328636169434
+61 0.32728869915
+60 0.310741519928
+59 0.273110294342
+58 0.274738526344
+57 0.26851682663
+56 0.24795627594
+55 0.232072710991
+54 0.218622469902
+53 0.208796215057
+52 0.200396323204
+51 0.203503918648
+50 0.184005737305
+49 0.171029520035
+48 0.160833501816
+47 0.124838232994
+46 0.107358956337
+45 0.110323190689
+44 0.0929322957993
+43 0.0780694961548
+42 0.0688237190247
+41 0.0525889873505
+40 0.0413108110428
+39 0.00756831169128
+38 0.500421667099
+37 0.508100485802
+36 0.497992396355
+35 0.48740298748
+34 0.46794219017
+33 0.46547164917
+32 0.419306492805
+31 0.409541082382
+30 0.399446201324
+29 0.394249820709
+28 0.372902822495
+27 0.380831742287
+26 0.377446961403
+25 0.374167585373
+24 0.338581252098
+23 0.309480714798
+22 0.272519373894
+21 0.278162884712
+20 0.287661981583
+19 0.248466706276
+18 0.263784956932
+17 0.243936491013
+16 0.230413651466
+15 0.216117787361
+14 0.19663476944
+13 0.182380795479
+12 0.174401926994
+11 0.173692250252
+10 0.169372797012
+9 0.124862122536
+8 0.108840441704
+7 0.0933245182037
+6 0.0924233436584
+5 0.0722931861877
+4 0.0678470134735
+3 0.054577589035
+2 0.0296260356903
+1 0.0162930727005
+0 0.0106116056442

File diff suppressed because it is too large
+ 1000 - 0
examples/result_5a


File diff suppressed because it is too large
+ 2832 - 0
examples/result_5a.eps


File diff suppressed because it is too large
+ 1000 - 0
examples/result_5b


File diff suppressed because it is too large
+ 2843 - 0
examples/result_5b.eps


+ 10 - 0
examples/result_6

@@ -0,0 +1,10 @@
+0.1 0.00244787207763 0.0710091590881 0.0389080047607 
+1.1 0.00249246413754 0.0688621997833 0.272018909454 
+2.1 0.00249603850173 0.343945980072 0.880016088486 
+3.1 0.00246469832845 1.42701888084 0.00577998161316 
+4.1 0.00252163786704 0.606753110886 1.2235751152 
+5.1 0.0025110800593 4.68594408035 4.14892506599 
+6.1 0.00251000589936 4.45400094986 2.80100798607 
+7.1 0.00237752730127 4.55200910568 1.85699892044 
+8.1 0.00250974412393 4.75707101822 1.38499903679 
+9.1 0.00253995614848 4.75693297386 0.403884887695 

+ 878 - 0
examples/result_6.eps

@@ -0,0 +1,878 @@
+%!PS-Adobe-2.0
+%%Title: result_6.eps
+%%Creator: gnuplot 5.0 patchlevel 1 (Gentoo revision r1)
+%%CreationDate: Tue Jul 19 11:18:20 2016
+%%DocumentFonts: (atend)
+%%BoundingBox: 50 50 482 626
+%%Orientation: Portrait
+%%Pages: (atend)
+%%EndComments
+%%BeginProlog
+/gnudict 256 dict def
+gnudict begin
+%
+% The following true/false flags may be edited by hand if desired.
+% The unit line width and grayscale image gamma correction may also be changed.
+%
+/Color true def
+/Blacktext false def
+/Solid false def
+/Dashlength 1 def
+/Landscape false def
+/Level1 false def
+/Level3 false def
+/Rounded false def
+/ClipToBoundingBox false def
+/SuppressPDFMark false def
+/TransparentPatterns false def
+/gnulinewidth 5.000 def
+/userlinewidth gnulinewidth def
+/Gamma 1.0 def
+/BackgroundColor {-1.000 -1.000 -1.000} def
+%
+/vshift -46 def
+/dl1 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul sub dup 0 le { pop 0.01 } if } if
+} def
+/dl2 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul add } if
+} def
+/hpt_ 31.5 def
+/vpt_ 31.5 def
+/hpt hpt_ def
+/vpt vpt_ def
+/doclip {
+  ClipToBoundingBox {
+    newpath 50 50 moveto 482 50 lineto 482 626 lineto 50 626 lineto closepath
+    clip
+  } if
+} def
+%
+% Gnuplot Prolog Version 5.0 (Dec 2014)
+%
+%/SuppressPDFMark true def
+%
+/M {moveto} bind def
+/L {lineto} bind def
+/R {rmoveto} bind def
+/V {rlineto} bind def
+/N {newpath moveto} bind def
+/Z {closepath} bind def
+/C {setrgbcolor} bind def
+/f {rlineto fill} bind def
+/g {setgray} bind def
+/Gshow {show} def   % May be redefined later in the file to support UTF-8
+/vpt2 vpt 2 mul def
+/hpt2 hpt 2 mul def
+/Lshow {currentpoint stroke M 0 vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Rshow {currentpoint stroke M dup stringwidth pop neg vshift R
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Cshow {currentpoint stroke M dup stringwidth pop -2 div vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/UP {dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def
+  /hpt2 hpt 2 mul def /vpt2 vpt 2 mul def} def
+/DL {Color {setrgbcolor Solid {pop []} if 0 setdash}
+ {pop pop pop 0 setgray Solid {pop []} if 0 setdash} ifelse} def
+/BL {stroke userlinewidth 2 mul setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/AL {stroke userlinewidth 2 div setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/UL {dup gnulinewidth mul /userlinewidth exch def
+	dup 1 lt {pop 1} if 10 mul /udl exch def} def
+/PL {stroke userlinewidth setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+3.8 setmiterlimit
+% Classic Line colors (version 5.0)
+/LCw {1 1 1} def
+/LCb {0 0 0} def
+/LCa {0 0 0} def
+/LC0 {1 0 0} def
+/LC1 {0 1 0} def
+/LC2 {0 0 1} def
+/LC3 {1 0 1} def
+/LC4 {0 1 1} def
+/LC5 {1 1 0} def
+/LC6 {0 0 0} def
+/LC7 {1 0.3 0} def
+/LC8 {0.5 0.5 0.5} def
+% Default dash patterns (version 5.0)
+/LTw {PL [] 1 setgray} def
+/LTb {BL [] LCb DL} def
+/LTa {AL [1 udl mul 2 udl mul] 0 setdash LCa setrgbcolor} def
+/LT0 {PL [] LC0 DL} def
+/LT1 {PL [2 dl1 3 dl2] LC1 DL} def
+/LT2 {PL [1 dl1 1.5 dl2] LC2 DL} def
+/LT3 {PL [6 dl1 2 dl2 1 dl1 2 dl2] LC3 DL} def
+/LT4 {PL [1 dl1 2 dl2 6 dl1 2 dl2 1 dl1 2 dl2] LC4 DL} def
+/LT5 {PL [4 dl1 2 dl2] LC5 DL} def
+/LT6 {PL [1.5 dl1 1.5 dl2 1.5 dl1 1.5 dl2 1.5 dl1 6 dl2] LC6 DL} def
+/LT7 {PL [3 dl1 3 dl2 1 dl1 3 dl2] LC7 DL} def
+/LT8 {PL [2 dl1 2 dl2 2 dl1 6 dl2] LC8 DL} def
+/SL {[] 0 setdash} def
+/Pnt {stroke [] 0 setdash gsave 1 setlinecap M 0 0 V stroke grestore} def
+/Dia {stroke [] 0 setdash 2 copy vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke
+  Pnt} def
+/Pls {stroke [] 0 setdash vpt sub M 0 vpt2 V
+  currentpoint stroke M
+  hpt neg vpt neg R hpt2 0 V stroke
+ } def
+/Box {stroke [] 0 setdash 2 copy exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke
+  Pnt} def
+/Crs {stroke [] 0 setdash exch hpt sub exch vpt add M
+  hpt2 vpt2 neg V currentpoint stroke M
+  hpt2 neg 0 R hpt2 vpt2 V stroke} def
+/TriU {stroke [] 0 setdash 2 copy vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke
+  Pnt} def
+/Star {2 copy Pls Crs} def
+/BoxF {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath fill} def
+/TriUF {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath fill} def
+/TriD {stroke [] 0 setdash 2 copy vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke
+  Pnt} def
+/TriDF {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath fill} def
+/DiaF {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath fill} def
+/Pent {stroke [] 0 setdash 2 copy gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore Pnt} def
+/PentF {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath fill grestore} def
+/Circle {stroke [] 0 setdash 2 copy
+  hpt 0 360 arc stroke Pnt} def
+/CircleF {stroke [] 0 setdash hpt 0 360 arc fill} def
+/C0 {BL [] 0 setdash 2 copy moveto vpt 90 450 arc} bind def
+/C1 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C2 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C3 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C4 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C5 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc
+	2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc} bind def
+/C6 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C7 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C8 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C9 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 450 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C10 {BL [] 0 setdash 2 copy 2 copy moveto vpt 270 360 arc closepath fill
+	2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C11 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C12 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C13 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C14 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 360 arc closepath fill
+	vpt 0 360 arc} bind def
+/C15 {BL [] 0 setdash 2 copy vpt 0 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/Rec {newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto
+	neg 0 rlineto closepath} bind def
+/Square {dup Rec} bind def
+/Bsquare {vpt sub exch vpt sub exch vpt2 Square} bind def
+/S0 {BL [] 0 setdash 2 copy moveto 0 vpt rlineto BL Bsquare} bind def
+/S1 {BL [] 0 setdash 2 copy vpt Square fill Bsquare} bind def
+/S2 {BL [] 0 setdash 2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S3 {BL [] 0 setdash 2 copy exch vpt sub exch vpt2 vpt Rec fill Bsquare} bind def
+/S4 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S5 {BL [] 0 setdash 2 copy 2 copy vpt Square fill
+	exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S6 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S7 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S8 {BL [] 0 setdash 2 copy vpt sub vpt Square fill Bsquare} bind def
+/S9 {BL [] 0 setdash 2 copy vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S10 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt Square fill
+	Bsquare} bind def
+/S11 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt2 vpt Rec fill
+	Bsquare} bind def
+/S12 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill Bsquare} bind def
+/S13 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S14 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S15 {BL [] 0 setdash 2 copy Bsquare fill Bsquare} bind def
+/D0 {gsave translate 45 rotate 0 0 S0 stroke grestore} bind def
+/D1 {gsave translate 45 rotate 0 0 S1 stroke grestore} bind def
+/D2 {gsave translate 45 rotate 0 0 S2 stroke grestore} bind def
+/D3 {gsave translate 45 rotate 0 0 S3 stroke grestore} bind def
+/D4 {gsave translate 45 rotate 0 0 S4 stroke grestore} bind def
+/D5 {gsave translate 45 rotate 0 0 S5 stroke grestore} bind def
+/D6 {gsave translate 45 rotate 0 0 S6 stroke grestore} bind def
+/D7 {gsave translate 45 rotate 0 0 S7 stroke grestore} bind def
+/D8 {gsave translate 45 rotate 0 0 S8 stroke grestore} bind def
+/D9 {gsave translate 45 rotate 0 0 S9 stroke grestore} bind def
+/D10 {gsave translate 45 rotate 0 0 S10 stroke grestore} bind def
+/D11 {gsave translate 45 rotate 0 0 S11 stroke grestore} bind def
+/D12 {gsave translate 45 rotate 0 0 S12 stroke grestore} bind def
+/D13 {gsave translate 45 rotate 0 0 S13 stroke grestore} bind def
+/D14 {gsave translate 45 rotate 0 0 S14 stroke grestore} bind def
+/D15 {gsave translate 45 rotate 0 0 S15 stroke grestore} bind def
+/DiaE {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke} def
+/BoxE {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke} def
+/TriUE {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke} def
+/TriDE {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke} def
+/PentE {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore} def
+/CircE {stroke [] 0 setdash 
+  hpt 0 360 arc stroke} def
+/Opaque {gsave closepath 1 setgray fill grestore 0 setgray closepath} def
+/DiaW {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V Opaque stroke} def
+/BoxW {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V Opaque stroke} def
+/TriUW {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V Opaque stroke} def
+/TriDW {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V Opaque stroke} def
+/PentW {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  Opaque stroke grestore} def
+/CircW {stroke [] 0 setdash 
+  hpt 0 360 arc Opaque stroke} def
+/BoxFill {gsave Rec 1 setgray fill grestore} def
+/Density {
+  /Fillden exch def
+  currentrgbcolor
+  /ColB exch def /ColG exch def /ColR exch def
+  /ColR ColR Fillden mul Fillden sub 1 add def
+  /ColG ColG Fillden mul Fillden sub 1 add def
+  /ColB ColB Fillden mul Fillden sub 1 add def
+  ColR ColG ColB setrgbcolor} def
+/BoxColFill {gsave Rec PolyFill} def
+/PolyFill {gsave Density fill grestore grestore} def
+/h {rlineto rlineto rlineto gsave closepath fill grestore} bind def
+%
+% PostScript Level 1 Pattern Fill routine for rectangles
+% Usage: x y w h s a XX PatternFill
+%	x,y = lower left corner of box to be filled
+%	w,h = width and height of box
+%	  a = angle in degrees between lines and x-axis
+%	 XX = 0/1 for no/yes cross-hatch
+%
+/PatternFill {gsave /PFa [ 9 2 roll ] def
+  PFa 0 get PFa 2 get 2 div add PFa 1 get PFa 3 get 2 div add translate
+  PFa 2 get -2 div PFa 3 get -2 div PFa 2 get PFa 3 get Rec
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+  clip
+  currentlinewidth 0.5 mul setlinewidth
+  /PFs PFa 2 get dup mul PFa 3 get dup mul add sqrt def
+  0 0 M PFa 5 get rotate PFs -2 div dup translate
+  0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 M 0 PFs V} for
+  0 PFa 6 get ne {
+	0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 2 1 roll M PFs 0 V} for
+ } if
+  stroke grestore} def
+%
+/languagelevel where
+ {pop languagelevel} {1} ifelse
+dup 2 lt
+	{/InterpretLevel1 true def
+	 /InterpretLevel3 false def}
+	{/InterpretLevel1 Level1 def
+	 2 gt
+	    {/InterpretLevel3 Level3 def}
+	    {/InterpretLevel3 false def}
+	 ifelse }
+ ifelse
+%
+% PostScript level 2 pattern fill definitions
+%
+/Level2PatternFill {
+/Tile8x8 {/PaintType 2 /PatternType 1 /TilingType 1 /BBox [0 0 8 8] /XStep 8 /YStep 8}
+	bind def
+/KeepColor {currentrgbcolor [/Pattern /DeviceRGB] setcolorspace} bind def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke} 
+>> matrix makepattern
+/Pat1 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke
+	0 4 M 4 8 L 8 4 L 4 0 L 0 4 L stroke}
+>> matrix makepattern
+/Pat2 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 0 8 L
+	8 8 L 8 0 L 0 0 L fill}
+>> matrix makepattern
+/Pat3 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 8 M 8 -4 L
+	0 12 M 12 0 L stroke}
+>> matrix makepattern
+/Pat4 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 0 M 8 12 L
+	0 -4 M 12 8 L stroke}
+>> matrix makepattern
+/Pat5 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 8 M 4 -4 L
+	0 12 M 8 -4 L 4 12 M 10 0 L stroke}
+>> matrix makepattern
+/Pat6 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 0 M 4 12 L
+	0 -4 M 8 12 L 4 -4 M 10 8 L stroke}
+>> matrix makepattern
+/Pat7 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 8 -2 M -4 4 L
+	12 0 M -4 8 L 12 4 M 0 10 L stroke}
+>> matrix makepattern
+/Pat8 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 -2 M 12 4 L
+	-4 0 M 12 8 L -4 4 M 8 10 L stroke}
+>> matrix makepattern
+/Pat9 exch def
+/Pattern1 {PatternBgnd KeepColor Pat1 setpattern} bind def
+/Pattern2 {PatternBgnd KeepColor Pat2 setpattern} bind def
+/Pattern3 {PatternBgnd KeepColor Pat3 setpattern} bind def
+/Pattern4 {PatternBgnd KeepColor Landscape {Pat5} {Pat4} ifelse setpattern} bind def
+/Pattern5 {PatternBgnd KeepColor Landscape {Pat4} {Pat5} ifelse setpattern} bind def
+/Pattern6 {PatternBgnd KeepColor Landscape {Pat9} {Pat6} ifelse setpattern} bind def
+/Pattern7 {PatternBgnd KeepColor Landscape {Pat8} {Pat7} ifelse setpattern} bind def
+} def
+%
+%
+%End of PostScript Level 2 code
+%
+/PatternBgnd {
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+} def
+%
+% Substitute for Level 2 pattern fill codes with
+% grayscale if Level 2 support is not selected.
+%
+/Level1PatternFill {
+/Pattern1 {0.250 Density} bind def
+/Pattern2 {0.500 Density} bind def
+/Pattern3 {0.750 Density} bind def
+/Pattern4 {0.125 Density} bind def
+/Pattern5 {0.375 Density} bind def
+/Pattern6 {0.625 Density} bind def
+/Pattern7 {0.875 Density} bind def
+} def
+%
+% Now test for support of Level 2 code
+%
+Level1 {Level1PatternFill} {Level2PatternFill} ifelse
+%
+/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont
+dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall
+currentdict end definefont pop
+%
+/MFshow {
+   { dup 5 get 3 ge
+     { 5 get 3 eq {gsave} {grestore} ifelse }
+     {dup dup 0 get findfont exch 1 get scalefont setfont
+     [ currentpoint ] exch dup 2 get 0 exch R dup 5 get 2 ne {dup dup 6
+     get exch 4 get {textshow} {stringwidth pop 0 R} ifelse }if dup 5 get 0 eq
+     {dup 3 get {2 get neg 0 exch R pop} {pop aload pop M} ifelse} {dup 5
+     get 1 eq {dup 2 get exch dup 3 get exch 6 get stringwidth pop -2 div
+     dup 0 R} {dup 6 get stringwidth pop -2 div 0 R 6 get
+     textshow 2 index {aload pop M neg 3 -1 roll neg R pop pop} {pop pop pop
+     pop aload pop M} ifelse }ifelse }ifelse }
+     ifelse }
+   forall} def
+/Gswidth {dup type /stringtype eq {stringwidth} {pop (n) stringwidth} ifelse} def
+/MFwidth {0 exch { dup 5 get 3 ge { 5 get 3 eq { 0 } { pop } ifelse }
+ {dup 3 get{dup dup 0 get findfont exch 1 get scalefont setfont
+     6 get Gswidth pop add} {pop} ifelse} ifelse} forall} def
+/MLshow { currentpoint stroke M
+  0 exch R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MRshow { currentpoint stroke M
+  exch dup MFwidth neg 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MCshow { currentpoint stroke M
+  exch dup MFwidth -2 div 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/XYsave    { [( ) 1 2 true false 3 ()] } bind def
+/XYrestore { [( ) 1 2 true false 4 ()] } bind def
+Level1 SuppressPDFMark or 
+{} {
+/SDict 10 dict def
+systemdict /pdfmark known not {
+  userdict /pdfmark systemdict /cleartomark get put
+} if
+SDict begin [
+  /Title (result_6.eps)
+  /Subject (gnuplot plot)
+  /Creator (gnuplot 5.0 patchlevel 1 (Gentoo revision r1))
+  /Author (yentl)
+%  /Producer (gnuplot)
+%  /Keywords ()
+  /CreationDate (Tue Jul 19 11:18:20 2016)
+  /DOCINFO pdfmark
+end
+} ifelse
+end
+%
+% Support for boxed text - Ethan A Merritt May 2005
+%
+/InitTextBox { userdict /TBy2 3 -1 roll put userdict /TBx2 3 -1 roll put
+           userdict /TBy1 3 -1 roll put userdict /TBx1 3 -1 roll put
+	   /Boxing true def } def
+/ExtendTextBox { Boxing
+    { gsave dup false charpath pathbbox
+      dup TBy2 gt {userdict /TBy2 3 -1 roll put} {pop} ifelse
+      dup TBx2 gt {userdict /TBx2 3 -1 roll put} {pop} ifelse
+      dup TBy1 lt {userdict /TBy1 3 -1 roll put} {pop} ifelse
+      dup TBx1 lt {userdict /TBx1 3 -1 roll put} {pop} ifelse
+      grestore } if } def
+/PopTextBox { newpath TBx1 TBxmargin sub TBy1 TBymargin sub M
+               TBx1 TBxmargin sub TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy1 TBymargin sub L closepath } def
+/DrawTextBox { PopTextBox stroke /Boxing false def} def
+/FillTextBox { gsave PopTextBox 1 1 1 setrgbcolor fill grestore /Boxing false def} def
+0 0 0 0 InitTextBox
+/TBxmargin 20 def
+/TBymargin 20 def
+/Boxing false def
+/textshow { ExtendTextBox Gshow } def
+%
+%%EndProlog
+%%Page: 1 1
+gnudict begin
+gsave
+doclip
+50 50 translate
+0.100 0.100 scale
+0 setgray
+newpath
+(Helvetica) findfont 140 scalefont setfont
+BackgroundColor 0 lt 3 1 roll 0 lt exch 0 lt or or not {gsave BackgroundColor C clippath fill grestore} if
+1.000 UL
+LTb
+LCb setrgbcolor
+686 448 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 448 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 937 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 937 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.5)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 1426 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 1426 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 1)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 1915 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 1915 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 1.5)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 2404 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 2404 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 2)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 2894 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 2894 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 2.5)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 3383 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 3383 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 3)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 3872 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 3872 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 3.5)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 4361 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 4361 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 4)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 4850 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 4850 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 4.5)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 5339 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 5339 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 5)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+686 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1024 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+1024 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 1)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1362 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+1362 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 2)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1700 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+1700 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 3)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2038 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+2038 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 4)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2377 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+2377 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 5)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2715 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+2715 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 6)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3053 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+3053 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 7)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3391 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+3391 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 8)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3729 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+3729 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 9)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+4067 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+4067 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 10)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+686 5339 N
+686 448 L
+3381 0 V
+0 4891 V
+-3381 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+LCb setrgbcolor
+112 2893 M
+currentpoint gsave translate -270 rotate 0 0 moveto
+[ [(Helvetica) 140.0 0.0 true true 0 (Execution time \(s\))]
+] -46.7 MCshow
+grestore
+LTb
+LCb setrgbcolor
+2376 98 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Maximum delay \(s\))]
+] -46.7 MCshow
+LTb
+LCb setrgbcolor
+2376 5549 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Influence of maximum delay for periodic saving)]
+] -46.7 MCshow
+% Begin plot #1
+1.000 UL
+LTb
+0.58 0.00 0.83 C LCb setrgbcolor
+3416 5206 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Forward step)]
+] -46.7 MRshow
+1.000 UL
+LTb
+0.58 0.00 0.83 C 3500 5206 M
+399 0 V
+720 450 M
+338 0 V
+338 0 V
+338 0 V
+338 0 V
+338 0 V
+338 0 V
+339 0 V
+338 0 V
+338 0 V
+% End plot #1
+% Begin plot #2
+stroke
+LTb
+0.00 0.62 0.45 C LCb setrgbcolor
+3416 5066 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Random jump)]
+] -46.7 MRshow
+1.000 UL
+LTb
+0.00 0.62 0.45 C 3500 5066 M
+399 0 V
+720 517 M
+338 -2 V
+338 269 V
+338 1060 V
+338 -802 V
+338 3990 V
+338 -227 V
+339 96 V
+338 200 V
+338 0 V
+% End plot #2
+% Begin plot #3
+stroke
+LTb
+0.34 0.71 0.91 C LCb setrgbcolor
+3416 4926 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Backward step)]
+] -46.7 MRshow
+1.000 UL
+LTb
+0.34 0.71 0.91 C 3500 4926 M
+399 0 V
+720 486 M
+338 228 V
+338 595 V
+1734 454 L
+338 1191 V
+338 2861 V
+2748 3188 L
+339 -923 V
+338 -462 V
+3763 843 L
+% End plot #3
+stroke
+2.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+686 5339 N
+686 448 L
+3381 0 V
+0 4891 V
+-3381 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+stroke
+grestore
+end
+showpage
+%%Trailer
+%%DocumentFonts: Helvetica
+%%Pages: 1

+ 20 - 0
examples/result_7a

@@ -0,0 +1,20 @@
+1024 0.0024942183903 0.0199348926544 0.0045211315155 
+11264 0.00250319405848 0.0188848972321 0.0100829601288 
+21504 0.00260916377799 0.00577998161316 0.00517296791077 
+31744 0.00242020339731 0.00687003135681 0.00996494293213 
+41984 0.0024643153016 0.00987195968628 0.00493907928467 
+52224 0.00248762633356 0.00992298126221 0.00502586364746 
+62464 0.002467218954 0.00327181816101 0.0108959674835 
+72704 0.00245529068614 0.0109128952026 0.0119659900665 
+82944 0.00260018121762 0.00609517097473 0.00494003295898 
+93184 0.00262797031974 0.0100049972534 0.0100040435791 
+103424 0.00257697592966 0.0060920715332 0.00494694709778 
+113664 0.00260511934119 0.010048866272 0.00517106056213 
+123904 0.00254802836596 0.0124599933624 0.00381708145142 
+134144 0.002611578149 0.00645899772644 0.00504207611084 
+144384 0.00263204015552 0.00510311126709 0.00998592376709 
+154624 0.0026131592675 0.0189361572266 0.00722599029541 
+164864 0.00259412528361 0.0068781375885 0.00995206832886 
+175104 0.00257527381501 0.00592494010925 0.00467705726624 
+185344 0.00257252568351 0.011953830719 0.00683307647705 
+195584 0.00257739775696 0.00525903701782 0.00427603721619 

+ 897 - 0
examples/result_7a.eps

@@ -0,0 +1,897 @@
+%!PS-Adobe-2.0
+%%Title: result_7a.eps
+%%Creator: gnuplot 5.0 patchlevel 1 (Gentoo revision r1)
+%%CreationDate: Tue Jul 19 11:18:20 2016
+%%DocumentFonts: (atend)
+%%BoundingBox: 50 50 482 626
+%%Orientation: Portrait
+%%Pages: (atend)
+%%EndComments
+%%BeginProlog
+/gnudict 256 dict def
+gnudict begin
+%
+% The following true/false flags may be edited by hand if desired.
+% The unit line width and grayscale image gamma correction may also be changed.
+%
+/Color true def
+/Blacktext false def
+/Solid false def
+/Dashlength 1 def
+/Landscape false def
+/Level1 false def
+/Level3 false def
+/Rounded false def
+/ClipToBoundingBox false def
+/SuppressPDFMark false def
+/TransparentPatterns false def
+/gnulinewidth 5.000 def
+/userlinewidth gnulinewidth def
+/Gamma 1.0 def
+/BackgroundColor {-1.000 -1.000 -1.000} def
+%
+/vshift -46 def
+/dl1 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul sub dup 0 le { pop 0.01 } if } if
+} def
+/dl2 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul add } if
+} def
+/hpt_ 31.5 def
+/vpt_ 31.5 def
+/hpt hpt_ def
+/vpt vpt_ def
+/doclip {
+  ClipToBoundingBox {
+    newpath 50 50 moveto 482 50 lineto 482 626 lineto 50 626 lineto closepath
+    clip
+  } if
+} def
+%
+% Gnuplot Prolog Version 5.0 (Dec 2014)
+%
+%/SuppressPDFMark true def
+%
+/M {moveto} bind def
+/L {lineto} bind def
+/R {rmoveto} bind def
+/V {rlineto} bind def
+/N {newpath moveto} bind def
+/Z {closepath} bind def
+/C {setrgbcolor} bind def
+/f {rlineto fill} bind def
+/g {setgray} bind def
+/Gshow {show} def   % May be redefined later in the file to support UTF-8
+/vpt2 vpt 2 mul def
+/hpt2 hpt 2 mul def
+/Lshow {currentpoint stroke M 0 vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Rshow {currentpoint stroke M dup stringwidth pop neg vshift R
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Cshow {currentpoint stroke M dup stringwidth pop -2 div vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/UP {dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def
+  /hpt2 hpt 2 mul def /vpt2 vpt 2 mul def} def
+/DL {Color {setrgbcolor Solid {pop []} if 0 setdash}
+ {pop pop pop 0 setgray Solid {pop []} if 0 setdash} ifelse} def
+/BL {stroke userlinewidth 2 mul setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/AL {stroke userlinewidth 2 div setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/UL {dup gnulinewidth mul /userlinewidth exch def
+	dup 1 lt {pop 1} if 10 mul /udl exch def} def
+/PL {stroke userlinewidth setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+3.8 setmiterlimit
+% Classic Line colors (version 5.0)
+/LCw {1 1 1} def
+/LCb {0 0 0} def
+/LCa {0 0 0} def
+/LC0 {1 0 0} def
+/LC1 {0 1 0} def
+/LC2 {0 0 1} def
+/LC3 {1 0 1} def
+/LC4 {0 1 1} def
+/LC5 {1 1 0} def
+/LC6 {0 0 0} def
+/LC7 {1 0.3 0} def
+/LC8 {0.5 0.5 0.5} def
+% Default dash patterns (version 5.0)
+/LTw {PL [] 1 setgray} def
+/LTb {BL [] LCb DL} def
+/LTa {AL [1 udl mul 2 udl mul] 0 setdash LCa setrgbcolor} def
+/LT0 {PL [] LC0 DL} def
+/LT1 {PL [2 dl1 3 dl2] LC1 DL} def
+/LT2 {PL [1 dl1 1.5 dl2] LC2 DL} def
+/LT3 {PL [6 dl1 2 dl2 1 dl1 2 dl2] LC3 DL} def
+/LT4 {PL [1 dl1 2 dl2 6 dl1 2 dl2 1 dl1 2 dl2] LC4 DL} def
+/LT5 {PL [4 dl1 2 dl2] LC5 DL} def
+/LT6 {PL [1.5 dl1 1.5 dl2 1.5 dl1 1.5 dl2 1.5 dl1 6 dl2] LC6 DL} def
+/LT7 {PL [3 dl1 3 dl2 1 dl1 3 dl2] LC7 DL} def
+/LT8 {PL [2 dl1 2 dl2 2 dl1 6 dl2] LC8 DL} def
+/SL {[] 0 setdash} def
+/Pnt {stroke [] 0 setdash gsave 1 setlinecap M 0 0 V stroke grestore} def
+/Dia {stroke [] 0 setdash 2 copy vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke
+  Pnt} def
+/Pls {stroke [] 0 setdash vpt sub M 0 vpt2 V
+  currentpoint stroke M
+  hpt neg vpt neg R hpt2 0 V stroke
+ } def
+/Box {stroke [] 0 setdash 2 copy exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke
+  Pnt} def
+/Crs {stroke [] 0 setdash exch hpt sub exch vpt add M
+  hpt2 vpt2 neg V currentpoint stroke M
+  hpt2 neg 0 R hpt2 vpt2 V stroke} def
+/TriU {stroke [] 0 setdash 2 copy vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke
+  Pnt} def
+/Star {2 copy Pls Crs} def
+/BoxF {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath fill} def
+/TriUF {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath fill} def
+/TriD {stroke [] 0 setdash 2 copy vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke
+  Pnt} def
+/TriDF {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath fill} def
+/DiaF {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath fill} def
+/Pent {stroke [] 0 setdash 2 copy gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore Pnt} def
+/PentF {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath fill grestore} def
+/Circle {stroke [] 0 setdash 2 copy
+  hpt 0 360 arc stroke Pnt} def
+/CircleF {stroke [] 0 setdash hpt 0 360 arc fill} def
+/C0 {BL [] 0 setdash 2 copy moveto vpt 90 450 arc} bind def
+/C1 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C2 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C3 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C4 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C5 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc
+	2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc} bind def
+/C6 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C7 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C8 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C9 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 450 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C10 {BL [] 0 setdash 2 copy 2 copy moveto vpt 270 360 arc closepath fill
+	2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C11 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C12 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C13 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C14 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 360 arc closepath fill
+	vpt 0 360 arc} bind def
+/C15 {BL [] 0 setdash 2 copy vpt 0 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/Rec {newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto
+	neg 0 rlineto closepath} bind def
+/Square {dup Rec} bind def
+/Bsquare {vpt sub exch vpt sub exch vpt2 Square} bind def
+/S0 {BL [] 0 setdash 2 copy moveto 0 vpt rlineto BL Bsquare} bind def
+/S1 {BL [] 0 setdash 2 copy vpt Square fill Bsquare} bind def
+/S2 {BL [] 0 setdash 2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S3 {BL [] 0 setdash 2 copy exch vpt sub exch vpt2 vpt Rec fill Bsquare} bind def
+/S4 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S5 {BL [] 0 setdash 2 copy 2 copy vpt Square fill
+	exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S6 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S7 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S8 {BL [] 0 setdash 2 copy vpt sub vpt Square fill Bsquare} bind def
+/S9 {BL [] 0 setdash 2 copy vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S10 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt Square fill
+	Bsquare} bind def
+/S11 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt2 vpt Rec fill
+	Bsquare} bind def
+/S12 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill Bsquare} bind def
+/S13 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S14 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S15 {BL [] 0 setdash 2 copy Bsquare fill Bsquare} bind def
+/D0 {gsave translate 45 rotate 0 0 S0 stroke grestore} bind def
+/D1 {gsave translate 45 rotate 0 0 S1 stroke grestore} bind def
+/D2 {gsave translate 45 rotate 0 0 S2 stroke grestore} bind def
+/D3 {gsave translate 45 rotate 0 0 S3 stroke grestore} bind def
+/D4 {gsave translate 45 rotate 0 0 S4 stroke grestore} bind def
+/D5 {gsave translate 45 rotate 0 0 S5 stroke grestore} bind def
+/D6 {gsave translate 45 rotate 0 0 S6 stroke grestore} bind def
+/D7 {gsave translate 45 rotate 0 0 S7 stroke grestore} bind def
+/D8 {gsave translate 45 rotate 0 0 S8 stroke grestore} bind def
+/D9 {gsave translate 45 rotate 0 0 S9 stroke grestore} bind def
+/D10 {gsave translate 45 rotate 0 0 S10 stroke grestore} bind def
+/D11 {gsave translate 45 rotate 0 0 S11 stroke grestore} bind def
+/D12 {gsave translate 45 rotate 0 0 S12 stroke grestore} bind def
+/D13 {gsave translate 45 rotate 0 0 S13 stroke grestore} bind def
+/D14 {gsave translate 45 rotate 0 0 S14 stroke grestore} bind def
+/D15 {gsave translate 45 rotate 0 0 S15 stroke grestore} bind def
+/DiaE {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke} def
+/BoxE {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke} def
+/TriUE {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke} def
+/TriDE {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke} def
+/PentE {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore} def
+/CircE {stroke [] 0 setdash 
+  hpt 0 360 arc stroke} def
+/Opaque {gsave closepath 1 setgray fill grestore 0 setgray closepath} def
+/DiaW {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V Opaque stroke} def
+/BoxW {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V Opaque stroke} def
+/TriUW {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V Opaque stroke} def
+/TriDW {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V Opaque stroke} def
+/PentW {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  Opaque stroke grestore} def
+/CircW {stroke [] 0 setdash 
+  hpt 0 360 arc Opaque stroke} def
+/BoxFill {gsave Rec 1 setgray fill grestore} def
+/Density {
+  /Fillden exch def
+  currentrgbcolor
+  /ColB exch def /ColG exch def /ColR exch def
+  /ColR ColR Fillden mul Fillden sub 1 add def
+  /ColG ColG Fillden mul Fillden sub 1 add def
+  /ColB ColB Fillden mul Fillden sub 1 add def
+  ColR ColG ColB setrgbcolor} def
+/BoxColFill {gsave Rec PolyFill} def
+/PolyFill {gsave Density fill grestore grestore} def
+/h {rlineto rlineto rlineto gsave closepath fill grestore} bind def
+%
+% PostScript Level 1 Pattern Fill routine for rectangles
+% Usage: x y w h s a XX PatternFill
+%	x,y = lower left corner of box to be filled
+%	w,h = width and height of box
+%	  a = angle in degrees between lines and x-axis
+%	 XX = 0/1 for no/yes cross-hatch
+%
+/PatternFill {gsave /PFa [ 9 2 roll ] def
+  PFa 0 get PFa 2 get 2 div add PFa 1 get PFa 3 get 2 div add translate
+  PFa 2 get -2 div PFa 3 get -2 div PFa 2 get PFa 3 get Rec
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+  clip
+  currentlinewidth 0.5 mul setlinewidth
+  /PFs PFa 2 get dup mul PFa 3 get dup mul add sqrt def
+  0 0 M PFa 5 get rotate PFs -2 div dup translate
+  0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 M 0 PFs V} for
+  0 PFa 6 get ne {
+	0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 2 1 roll M PFs 0 V} for
+ } if
+  stroke grestore} def
+%
+/languagelevel where
+ {pop languagelevel} {1} ifelse
+dup 2 lt
+	{/InterpretLevel1 true def
+	 /InterpretLevel3 false def}
+	{/InterpretLevel1 Level1 def
+	 2 gt
+	    {/InterpretLevel3 Level3 def}
+	    {/InterpretLevel3 false def}
+	 ifelse }
+ ifelse
+%
+% PostScript level 2 pattern fill definitions
+%
+/Level2PatternFill {
+/Tile8x8 {/PaintType 2 /PatternType 1 /TilingType 1 /BBox [0 0 8 8] /XStep 8 /YStep 8}
+	bind def
+/KeepColor {currentrgbcolor [/Pattern /DeviceRGB] setcolorspace} bind def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke} 
+>> matrix makepattern
+/Pat1 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke
+	0 4 M 4 8 L 8 4 L 4 0 L 0 4 L stroke}
+>> matrix makepattern
+/Pat2 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 0 8 L
+	8 8 L 8 0 L 0 0 L fill}
+>> matrix makepattern
+/Pat3 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 8 M 8 -4 L
+	0 12 M 12 0 L stroke}
+>> matrix makepattern
+/Pat4 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 0 M 8 12 L
+	0 -4 M 12 8 L stroke}
+>> matrix makepattern
+/Pat5 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 8 M 4 -4 L
+	0 12 M 8 -4 L 4 12 M 10 0 L stroke}
+>> matrix makepattern
+/Pat6 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 0 M 4 12 L
+	0 -4 M 8 12 L 4 -4 M 10 8 L stroke}
+>> matrix makepattern
+/Pat7 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 8 -2 M -4 4 L
+	12 0 M -4 8 L 12 4 M 0 10 L stroke}
+>> matrix makepattern
+/Pat8 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 -2 M 12 4 L
+	-4 0 M 12 8 L -4 4 M 8 10 L stroke}
+>> matrix makepattern
+/Pat9 exch def
+/Pattern1 {PatternBgnd KeepColor Pat1 setpattern} bind def
+/Pattern2 {PatternBgnd KeepColor Pat2 setpattern} bind def
+/Pattern3 {PatternBgnd KeepColor Pat3 setpattern} bind def
+/Pattern4 {PatternBgnd KeepColor Landscape {Pat5} {Pat4} ifelse setpattern} bind def
+/Pattern5 {PatternBgnd KeepColor Landscape {Pat4} {Pat5} ifelse setpattern} bind def
+/Pattern6 {PatternBgnd KeepColor Landscape {Pat9} {Pat6} ifelse setpattern} bind def
+/Pattern7 {PatternBgnd KeepColor Landscape {Pat8} {Pat7} ifelse setpattern} bind def
+} def
+%
+%
+%End of PostScript Level 2 code
+%
+/PatternBgnd {
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+} def
+%
+% Substitute for Level 2 pattern fill codes with
+% grayscale if Level 2 support is not selected.
+%
+/Level1PatternFill {
+/Pattern1 {0.250 Density} bind def
+/Pattern2 {0.500 Density} bind def
+/Pattern3 {0.750 Density} bind def
+/Pattern4 {0.125 Density} bind def
+/Pattern5 {0.375 Density} bind def
+/Pattern6 {0.625 Density} bind def
+/Pattern7 {0.875 Density} bind def
+} def
+%
+% Now test for support of Level 2 code
+%
+Level1 {Level1PatternFill} {Level2PatternFill} ifelse
+%
+/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont
+dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall
+currentdict end definefont pop
+%
+/MFshow {
+   { dup 5 get 3 ge
+     { 5 get 3 eq {gsave} {grestore} ifelse }
+     {dup dup 0 get findfont exch 1 get scalefont setfont
+     [ currentpoint ] exch dup 2 get 0 exch R dup 5 get 2 ne {dup dup 6
+     get exch 4 get {textshow} {stringwidth pop 0 R} ifelse }if dup 5 get 0 eq
+     {dup 3 get {2 get neg 0 exch R pop} {pop aload pop M} ifelse} {dup 5
+     get 1 eq {dup 2 get exch dup 3 get exch 6 get stringwidth pop -2 div
+     dup 0 R} {dup 6 get stringwidth pop -2 div 0 R 6 get
+     textshow 2 index {aload pop M neg 3 -1 roll neg R pop pop} {pop pop pop
+     pop aload pop M} ifelse }ifelse }ifelse }
+     ifelse }
+   forall} def
+/Gswidth {dup type /stringtype eq {stringwidth} {pop (n) stringwidth} ifelse} def
+/MFwidth {0 exch { dup 5 get 3 ge { 5 get 3 eq { 0 } { pop } ifelse }
+ {dup 3 get{dup dup 0 get findfont exch 1 get scalefont setfont
+     6 get Gswidth pop add} {pop} ifelse} ifelse} forall} def
+/MLshow { currentpoint stroke M
+  0 exch R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MRshow { currentpoint stroke M
+  exch dup MFwidth neg 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MCshow { currentpoint stroke M
+  exch dup MFwidth -2 div 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/XYsave    { [( ) 1 2 true false 3 ()] } bind def
+/XYrestore { [( ) 1 2 true false 4 ()] } bind def
+Level1 SuppressPDFMark or 
+{} {
+/SDict 10 dict def
+systemdict /pdfmark known not {
+  userdict /pdfmark systemdict /cleartomark get put
+} if
+SDict begin [
+  /Title (result_7a.eps)
+  /Subject (gnuplot plot)
+  /Creator (gnuplot 5.0 patchlevel 1 (Gentoo revision r1))
+  /Author (yentl)
+%  /Producer (gnuplot)
+%  /Keywords ()
+  /CreationDate (Tue Jul 19 11:18:20 2016)
+  /DOCINFO pdfmark
+end
+} ifelse
+end
+%
+% Support for boxed text - Ethan A Merritt May 2005
+%
+/InitTextBox { userdict /TBy2 3 -1 roll put userdict /TBx2 3 -1 roll put
+           userdict /TBy1 3 -1 roll put userdict /TBx1 3 -1 roll put
+	   /Boxing true def } def
+/ExtendTextBox { Boxing
+    { gsave dup false charpath pathbbox
+      dup TBy2 gt {userdict /TBy2 3 -1 roll put} {pop} ifelse
+      dup TBx2 gt {userdict /TBx2 3 -1 roll put} {pop} ifelse
+      dup TBy1 lt {userdict /TBy1 3 -1 roll put} {pop} ifelse
+      dup TBx1 lt {userdict /TBx1 3 -1 roll put} {pop} ifelse
+      grestore } if } def
+/PopTextBox { newpath TBx1 TBxmargin sub TBy1 TBymargin sub M
+               TBx1 TBxmargin sub TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy1 TBymargin sub L closepath } def
+/DrawTextBox { PopTextBox stroke /Boxing false def} def
+/FillTextBox { gsave PopTextBox 1 1 1 setrgbcolor fill grestore /Boxing false def} def
+0 0 0 0 InitTextBox
+/TBxmargin 20 def
+/TBymargin 20 def
+/Boxing false def
+/textshow { ExtendTextBox Gshow } def
+%
+%%EndProlog
+%%Page: 1 1
+gnudict begin
+gsave
+doclip
+50 50 translate
+0.100 0.100 scale
+0 setgray
+newpath
+(Helvetica) findfont 140 scalefont setfont
+BackgroundColor 0 lt 3 1 roll 0 lt exch 0 lt or or not {gsave BackgroundColor C clippath fill grestore} if
+1.000 UL
+LTb
+LCb setrgbcolor
+854 448 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 448 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.002)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 991 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 991 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.004)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 1535 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 1535 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.006)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 2078 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 2078 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.008)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 2622 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 2622 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.01)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 3165 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 3165 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.012)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 3709 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 3709 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.014)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 4252 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 4252 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.016)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 4796 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 4796 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.018)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 5339 M
+63 0 V
+3150 0 R
+-63 0 V
+stroke
+770 5339 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.02)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+854 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+854 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1175 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+1175 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 20000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1497 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+1497 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 40000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1818 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+1818 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 60000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2139 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+2139 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 80000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2461 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+2461 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 100000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2782 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+2782 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 120000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3103 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+3103 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 140000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3424 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+3424 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 160000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3746 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+3746 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 180000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+4067 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+4067 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 200000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+854 5339 N
+854 448 L
+3213 0 V
+0 4891 V
+-3213 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+LCb setrgbcolor
+112 2893 M
+currentpoint gsave translate -270 rotate 0 0 moveto
+[ [(Helvetica) 140.0 0.0 true true 0 (Execution time \(s\))]
+] -46.7 MCshow
+grestore
+LTb
+LCb setrgbcolor
+2460 98 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Maximum memory \(B\))]
+] -46.7 MCshow
+LTb
+LCb setrgbcolor
+2460 5549 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Influence of maximum memory consumption for incremental saving)]
+] -46.7 MCshow
+% Begin plot #1
+1.000 UL
+LTb
+0.58 0.00 0.83 C LCb setrgbcolor
+3416 5206 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Forward step)]
+] -46.7 MRshow
+1.000 UL
+LTb
+0.58 0.00 0.83 C 3500 5206 M
+399 0 V
+870 582 M
+165 3 V
+164 29 V
+165 -52 V
+164 12 V
+165 6 V
+164 -5 V
+165 -3 V
+164 39 V
+165 8 V
+165 -14 V
+164 7 V
+165 -15 V
+164 17 V
+165 6 V
+164 -5 V
+165 -6 V
+164 -5 V
+165 0 V
+164 1 V
+% End plot #1
+% Begin plot #2
+stroke
+LTb
+0.00 0.62 0.45 C LCb setrgbcolor
+3416 5066 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Random jump)]
+] -46.7 MRshow
+1.000 UL
+LTb
+0.00 0.62 0.45 C 3500 5066 M
+399 0 V
+870 5321 M
+165 -285 V
+1199 1475 L
+165 296 V
+164 816 V
+165 14 V
+1857 794 L
+165 2076 V
+2186 1561 L
+165 1062 V
+2516 1560 L
+164 1075 V
+165 655 V
+3009 1660 L
+165 -369 V
+164 3759 V
+3503 1773 L
+164 -259 V
+165 1639 V
+3996 1334 L
+% End plot #2
+% Begin plot #3
+stroke
+LTb
+0.34 0.71 0.91 C LCb setrgbcolor
+3416 4926 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Backward step)]
+] -46.7 MRshow
+1.000 UL
+LTb
+0.34 0.71 0.91 C 3500 4926 M
+399 0 V
+870 1133 M
+165 1511 V
+1199 1310 L
+165 1302 V
+1528 1247 L
+165 23 V
+164 1595 V
+165 291 V
+2186 1247 L
+165 1376 V
+2516 1249 L
+164 61 V
+2845 942 L
+164 333 V
+165 1343 V
+164 -750 V
+165 741 V
+3667 1175 L
+165 586 V
+164 -695 V
+% End plot #3
+stroke
+2.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+854 5339 N
+854 448 L
+3213 0 V
+0 4891 V
+-3213 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+stroke
+grestore
+end
+showpage
+%%Trailer
+%%DocumentFonts: Helvetica
+%%Pages: 1

+ 20 - 0
examples/result_7b

@@ -0,0 +1,20 @@
+1024 0.00252311802778 0.173013925552 0.374843835831 
+11264 0.00250207222759 0.170908927917 0.303967952728 
+21504 0.00253608886639 0.240961074829 0.306150913239 
+31744 0.00255238652485 0.203099966049 0.440869092941 
+41984 0.00255627435586 0.202069997787 0.473991155624 
+52224 0.00254469944017 0.237884044647 0.403933048248 
+62464 0.00252038010693 0.271582126617 0.442936897278 
+72704 0.00251998527402 0.170077085495 0.374884128571 
+82944 0.00251062951456 0.201925992966 0.237990140915 
+93184 0.00253958001382 0.574855089188 0.371874094009 
+103424 0.00254000911621 0.171000003815 0.371937036514 
+113664 0.00254736965167 0.221903085709 0.304061174393 
+123904 0.00254803372655 0.237975120544 0.410693883896 
+134144 0.00256299806611 0.203082799911 0.304851055145 
+144384 0.00249831400796 0.171096086502 0.424970149994 
+154624 0.00254035544855 0.272098064423 0.441952943802 
+164864 0.002498425304 0.207034111023 0.341925144196 
+175104 0.00249170159375 0.119989871979 0.373005867004 
+185344 0.00252036587584 0.0198788642883 0.30407500267 
+195584 0.00253704547627 0.139905929565 0.373299837112 

+ 864 - 0
examples/result_7b.eps

@@ -0,0 +1,864 @@
+%!PS-Adobe-2.0
+%%Title: result_7b.eps
+%%Creator: gnuplot 5.0 patchlevel 1 (Gentoo revision r1)
+%%CreationDate: Tue Jul 19 11:18:20 2016
+%%DocumentFonts: (atend)
+%%BoundingBox: 50 50 482 626
+%%Orientation: Portrait
+%%Pages: (atend)
+%%EndComments
+%%BeginProlog
+/gnudict 256 dict def
+gnudict begin
+%
+% The following true/false flags may be edited by hand if desired.
+% The unit line width and grayscale image gamma correction may also be changed.
+%
+/Color true def
+/Blacktext false def
+/Solid false def
+/Dashlength 1 def
+/Landscape false def
+/Level1 false def
+/Level3 false def
+/Rounded false def
+/ClipToBoundingBox false def
+/SuppressPDFMark false def
+/TransparentPatterns false def
+/gnulinewidth 5.000 def
+/userlinewidth gnulinewidth def
+/Gamma 1.0 def
+/BackgroundColor {-1.000 -1.000 -1.000} def
+%
+/vshift -46 def
+/dl1 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul sub dup 0 le { pop 0.01 } if } if
+} def
+/dl2 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul add } if
+} def
+/hpt_ 31.5 def
+/vpt_ 31.5 def
+/hpt hpt_ def
+/vpt vpt_ def
+/doclip {
+  ClipToBoundingBox {
+    newpath 50 50 moveto 482 50 lineto 482 626 lineto 50 626 lineto closepath
+    clip
+  } if
+} def
+%
+% Gnuplot Prolog Version 5.0 (Dec 2014)
+%
+%/SuppressPDFMark true def
+%
+/M {moveto} bind def
+/L {lineto} bind def
+/R {rmoveto} bind def
+/V {rlineto} bind def
+/N {newpath moveto} bind def
+/Z {closepath} bind def
+/C {setrgbcolor} bind def
+/f {rlineto fill} bind def
+/g {setgray} bind def
+/Gshow {show} def   % May be redefined later in the file to support UTF-8
+/vpt2 vpt 2 mul def
+/hpt2 hpt 2 mul def
+/Lshow {currentpoint stroke M 0 vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Rshow {currentpoint stroke M dup stringwidth pop neg vshift R
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Cshow {currentpoint stroke M dup stringwidth pop -2 div vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/UP {dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def
+  /hpt2 hpt 2 mul def /vpt2 vpt 2 mul def} def
+/DL {Color {setrgbcolor Solid {pop []} if 0 setdash}
+ {pop pop pop 0 setgray Solid {pop []} if 0 setdash} ifelse} def
+/BL {stroke userlinewidth 2 mul setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/AL {stroke userlinewidth 2 div setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/UL {dup gnulinewidth mul /userlinewidth exch def
+	dup 1 lt {pop 1} if 10 mul /udl exch def} def
+/PL {stroke userlinewidth setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+3.8 setmiterlimit
+% Classic Line colors (version 5.0)
+/LCw {1 1 1} def
+/LCb {0 0 0} def
+/LCa {0 0 0} def
+/LC0 {1 0 0} def
+/LC1 {0 1 0} def
+/LC2 {0 0 1} def
+/LC3 {1 0 1} def
+/LC4 {0 1 1} def
+/LC5 {1 1 0} def
+/LC6 {0 0 0} def
+/LC7 {1 0.3 0} def
+/LC8 {0.5 0.5 0.5} def
+% Default dash patterns (version 5.0)
+/LTw {PL [] 1 setgray} def
+/LTb {BL [] LCb DL} def
+/LTa {AL [1 udl mul 2 udl mul] 0 setdash LCa setrgbcolor} def
+/LT0 {PL [] LC0 DL} def
+/LT1 {PL [2 dl1 3 dl2] LC1 DL} def
+/LT2 {PL [1 dl1 1.5 dl2] LC2 DL} def
+/LT3 {PL [6 dl1 2 dl2 1 dl1 2 dl2] LC3 DL} def
+/LT4 {PL [1 dl1 2 dl2 6 dl1 2 dl2 1 dl1 2 dl2] LC4 DL} def
+/LT5 {PL [4 dl1 2 dl2] LC5 DL} def
+/LT6 {PL [1.5 dl1 1.5 dl2 1.5 dl1 1.5 dl2 1.5 dl1 6 dl2] LC6 DL} def
+/LT7 {PL [3 dl1 3 dl2 1 dl1 3 dl2] LC7 DL} def
+/LT8 {PL [2 dl1 2 dl2 2 dl1 6 dl2] LC8 DL} def
+/SL {[] 0 setdash} def
+/Pnt {stroke [] 0 setdash gsave 1 setlinecap M 0 0 V stroke grestore} def
+/Dia {stroke [] 0 setdash 2 copy vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke
+  Pnt} def
+/Pls {stroke [] 0 setdash vpt sub M 0 vpt2 V
+  currentpoint stroke M
+  hpt neg vpt neg R hpt2 0 V stroke
+ } def
+/Box {stroke [] 0 setdash 2 copy exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke
+  Pnt} def
+/Crs {stroke [] 0 setdash exch hpt sub exch vpt add M
+  hpt2 vpt2 neg V currentpoint stroke M
+  hpt2 neg 0 R hpt2 vpt2 V stroke} def
+/TriU {stroke [] 0 setdash 2 copy vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke
+  Pnt} def
+/Star {2 copy Pls Crs} def
+/BoxF {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath fill} def
+/TriUF {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath fill} def
+/TriD {stroke [] 0 setdash 2 copy vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke
+  Pnt} def
+/TriDF {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath fill} def
+/DiaF {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath fill} def
+/Pent {stroke [] 0 setdash 2 copy gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore Pnt} def
+/PentF {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath fill grestore} def
+/Circle {stroke [] 0 setdash 2 copy
+  hpt 0 360 arc stroke Pnt} def
+/CircleF {stroke [] 0 setdash hpt 0 360 arc fill} def
+/C0 {BL [] 0 setdash 2 copy moveto vpt 90 450 arc} bind def
+/C1 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C2 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C3 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C4 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C5 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc
+	2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc} bind def
+/C6 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C7 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C8 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C9 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 450 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C10 {BL [] 0 setdash 2 copy 2 copy moveto vpt 270 360 arc closepath fill
+	2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C11 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C12 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C13 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C14 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 360 arc closepath fill
+	vpt 0 360 arc} bind def
+/C15 {BL [] 0 setdash 2 copy vpt 0 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/Rec {newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto
+	neg 0 rlineto closepath} bind def
+/Square {dup Rec} bind def
+/Bsquare {vpt sub exch vpt sub exch vpt2 Square} bind def
+/S0 {BL [] 0 setdash 2 copy moveto 0 vpt rlineto BL Bsquare} bind def
+/S1 {BL [] 0 setdash 2 copy vpt Square fill Bsquare} bind def
+/S2 {BL [] 0 setdash 2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S3 {BL [] 0 setdash 2 copy exch vpt sub exch vpt2 vpt Rec fill Bsquare} bind def
+/S4 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S5 {BL [] 0 setdash 2 copy 2 copy vpt Square fill
+	exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S6 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S7 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S8 {BL [] 0 setdash 2 copy vpt sub vpt Square fill Bsquare} bind def
+/S9 {BL [] 0 setdash 2 copy vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S10 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt Square fill
+	Bsquare} bind def
+/S11 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt2 vpt Rec fill
+	Bsquare} bind def
+/S12 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill Bsquare} bind def
+/S13 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S14 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S15 {BL [] 0 setdash 2 copy Bsquare fill Bsquare} bind def
+/D0 {gsave translate 45 rotate 0 0 S0 stroke grestore} bind def
+/D1 {gsave translate 45 rotate 0 0 S1 stroke grestore} bind def
+/D2 {gsave translate 45 rotate 0 0 S2 stroke grestore} bind def
+/D3 {gsave translate 45 rotate 0 0 S3 stroke grestore} bind def
+/D4 {gsave translate 45 rotate 0 0 S4 stroke grestore} bind def
+/D5 {gsave translate 45 rotate 0 0 S5 stroke grestore} bind def
+/D6 {gsave translate 45 rotate 0 0 S6 stroke grestore} bind def
+/D7 {gsave translate 45 rotate 0 0 S7 stroke grestore} bind def
+/D8 {gsave translate 45 rotate 0 0 S8 stroke grestore} bind def
+/D9 {gsave translate 45 rotate 0 0 S9 stroke grestore} bind def
+/D10 {gsave translate 45 rotate 0 0 S10 stroke grestore} bind def
+/D11 {gsave translate 45 rotate 0 0 S11 stroke grestore} bind def
+/D12 {gsave translate 45 rotate 0 0 S12 stroke grestore} bind def
+/D13 {gsave translate 45 rotate 0 0 S13 stroke grestore} bind def
+/D14 {gsave translate 45 rotate 0 0 S14 stroke grestore} bind def
+/D15 {gsave translate 45 rotate 0 0 S15 stroke grestore} bind def
+/DiaE {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke} def
+/BoxE {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke} def
+/TriUE {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke} def
+/TriDE {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke} def
+/PentE {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore} def
+/CircE {stroke [] 0 setdash 
+  hpt 0 360 arc stroke} def
+/Opaque {gsave closepath 1 setgray fill grestore 0 setgray closepath} def
+/DiaW {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V Opaque stroke} def
+/BoxW {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V Opaque stroke} def
+/TriUW {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V Opaque stroke} def
+/TriDW {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V Opaque stroke} def
+/PentW {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  Opaque stroke grestore} def
+/CircW {stroke [] 0 setdash 
+  hpt 0 360 arc Opaque stroke} def
+/BoxFill {gsave Rec 1 setgray fill grestore} def
+/Density {
+  /Fillden exch def
+  currentrgbcolor
+  /ColB exch def /ColG exch def /ColR exch def
+  /ColR ColR Fillden mul Fillden sub 1 add def
+  /ColG ColG Fillden mul Fillden sub 1 add def
+  /ColB ColB Fillden mul Fillden sub 1 add def
+  ColR ColG ColB setrgbcolor} def
+/BoxColFill {gsave Rec PolyFill} def
+/PolyFill {gsave Density fill grestore grestore} def
+/h {rlineto rlineto rlineto gsave closepath fill grestore} bind def
+%
+% PostScript Level 1 Pattern Fill routine for rectangles
+% Usage: x y w h s a XX PatternFill
+%	x,y = lower left corner of box to be filled
+%	w,h = width and height of box
+%	  a = angle in degrees between lines and x-axis
+%	 XX = 0/1 for no/yes cross-hatch
+%
+/PatternFill {gsave /PFa [ 9 2 roll ] def
+  PFa 0 get PFa 2 get 2 div add PFa 1 get PFa 3 get 2 div add translate
+  PFa 2 get -2 div PFa 3 get -2 div PFa 2 get PFa 3 get Rec
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+  clip
+  currentlinewidth 0.5 mul setlinewidth
+  /PFs PFa 2 get dup mul PFa 3 get dup mul add sqrt def
+  0 0 M PFa 5 get rotate PFs -2 div dup translate
+  0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 M 0 PFs V} for
+  0 PFa 6 get ne {
+	0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 2 1 roll M PFs 0 V} for
+ } if
+  stroke grestore} def
+%
+/languagelevel where
+ {pop languagelevel} {1} ifelse
+dup 2 lt
+	{/InterpretLevel1 true def
+	 /InterpretLevel3 false def}
+	{/InterpretLevel1 Level1 def
+	 2 gt
+	    {/InterpretLevel3 Level3 def}
+	    {/InterpretLevel3 false def}
+	 ifelse }
+ ifelse
+%
+% PostScript level 2 pattern fill definitions
+%
+/Level2PatternFill {
+/Tile8x8 {/PaintType 2 /PatternType 1 /TilingType 1 /BBox [0 0 8 8] /XStep 8 /YStep 8}
+	bind def
+/KeepColor {currentrgbcolor [/Pattern /DeviceRGB] setcolorspace} bind def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke} 
+>> matrix makepattern
+/Pat1 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke
+	0 4 M 4 8 L 8 4 L 4 0 L 0 4 L stroke}
+>> matrix makepattern
+/Pat2 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 0 8 L
+	8 8 L 8 0 L 0 0 L fill}
+>> matrix makepattern
+/Pat3 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 8 M 8 -4 L
+	0 12 M 12 0 L stroke}
+>> matrix makepattern
+/Pat4 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 0 M 8 12 L
+	0 -4 M 12 8 L stroke}
+>> matrix makepattern
+/Pat5 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 8 M 4 -4 L
+	0 12 M 8 -4 L 4 12 M 10 0 L stroke}
+>> matrix makepattern
+/Pat6 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 0 M 4 12 L
+	0 -4 M 8 12 L 4 -4 M 10 8 L stroke}
+>> matrix makepattern
+/Pat7 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 8 -2 M -4 4 L
+	12 0 M -4 8 L 12 4 M 0 10 L stroke}
+>> matrix makepattern
+/Pat8 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 -2 M 12 4 L
+	-4 0 M 12 8 L -4 4 M 8 10 L stroke}
+>> matrix makepattern
+/Pat9 exch def
+/Pattern1 {PatternBgnd KeepColor Pat1 setpattern} bind def
+/Pattern2 {PatternBgnd KeepColor Pat2 setpattern} bind def
+/Pattern3 {PatternBgnd KeepColor Pat3 setpattern} bind def
+/Pattern4 {PatternBgnd KeepColor Landscape {Pat5} {Pat4} ifelse setpattern} bind def
+/Pattern5 {PatternBgnd KeepColor Landscape {Pat4} {Pat5} ifelse setpattern} bind def
+/Pattern6 {PatternBgnd KeepColor Landscape {Pat9} {Pat6} ifelse setpattern} bind def
+/Pattern7 {PatternBgnd KeepColor Landscape {Pat8} {Pat7} ifelse setpattern} bind def
+} def
+%
+%
+%End of PostScript Level 2 code
+%
+/PatternBgnd {
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+} def
+%
+% Substitute for Level 2 pattern fill codes with
+% grayscale if Level 2 support is not selected.
+%
+/Level1PatternFill {
+/Pattern1 {0.250 Density} bind def
+/Pattern2 {0.500 Density} bind def
+/Pattern3 {0.750 Density} bind def
+/Pattern4 {0.125 Density} bind def
+/Pattern5 {0.375 Density} bind def
+/Pattern6 {0.625 Density} bind def
+/Pattern7 {0.875 Density} bind def
+} def
+%
+% Now test for support of Level 2 code
+%
+Level1 {Level1PatternFill} {Level2PatternFill} ifelse
+%
+/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont
+dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall
+currentdict end definefont pop
+%
+/MFshow {
+   { dup 5 get 3 ge
+     { 5 get 3 eq {gsave} {grestore} ifelse }
+     {dup dup 0 get findfont exch 1 get scalefont setfont
+     [ currentpoint ] exch dup 2 get 0 exch R dup 5 get 2 ne {dup dup 6
+     get exch 4 get {textshow} {stringwidth pop 0 R} ifelse }if dup 5 get 0 eq
+     {dup 3 get {2 get neg 0 exch R pop} {pop aload pop M} ifelse} {dup 5
+     get 1 eq {dup 2 get exch dup 3 get exch 6 get stringwidth pop -2 div
+     dup 0 R} {dup 6 get stringwidth pop -2 div 0 R 6 get
+     textshow 2 index {aload pop M neg 3 -1 roll neg R pop pop} {pop pop pop
+     pop aload pop M} ifelse }ifelse }ifelse }
+     ifelse }
+   forall} def
+/Gswidth {dup type /stringtype eq {stringwidth} {pop (n) stringwidth} ifelse} def
+/MFwidth {0 exch { dup 5 get 3 ge { 5 get 3 eq { 0 } { pop } ifelse }
+ {dup 3 get{dup dup 0 get findfont exch 1 get scalefont setfont
+     6 get Gswidth pop add} {pop} ifelse} ifelse} forall} def
+/MLshow { currentpoint stroke M
+  0 exch R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MRshow { currentpoint stroke M
+  exch dup MFwidth neg 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MCshow { currentpoint stroke M
+  exch dup MFwidth -2 div 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/XYsave    { [( ) 1 2 true false 3 ()] } bind def
+/XYrestore { [( ) 1 2 true false 4 ()] } bind def
+Level1 SuppressPDFMark or 
+{} {
+/SDict 10 dict def
+systemdict /pdfmark known not {
+  userdict /pdfmark systemdict /cleartomark get put
+} if
+SDict begin [
+  /Title (result_7b.eps)
+  /Subject (gnuplot plot)
+  /Creator (gnuplot 5.0 patchlevel 1 (Gentoo revision r1))
+  /Author (yentl)
+%  /Producer (gnuplot)
+%  /Keywords ()
+  /CreationDate (Tue Jul 19 11:18:20 2016)
+  /DOCINFO pdfmark
+end
+} ifelse
+end
+%
+% Support for boxed text - Ethan A Merritt May 2005
+%
+/InitTextBox { userdict /TBy2 3 -1 roll put userdict /TBx2 3 -1 roll put
+           userdict /TBy1 3 -1 roll put userdict /TBx1 3 -1 roll put
+	   /Boxing true def } def
+/ExtendTextBox { Boxing
+    { gsave dup false charpath pathbbox
+      dup TBy2 gt {userdict /TBy2 3 -1 roll put} {pop} ifelse
+      dup TBx2 gt {userdict /TBx2 3 -1 roll put} {pop} ifelse
+      dup TBy1 lt {userdict /TBy1 3 -1 roll put} {pop} ifelse
+      dup TBx1 lt {userdict /TBx1 3 -1 roll put} {pop} ifelse
+      grestore } if } def
+/PopTextBox { newpath TBx1 TBxmargin sub TBy1 TBymargin sub M
+               TBx1 TBxmargin sub TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy1 TBymargin sub L closepath } def
+/DrawTextBox { PopTextBox stroke /Boxing false def} def
+/FillTextBox { gsave PopTextBox 1 1 1 setrgbcolor fill grestore /Boxing false def} def
+0 0 0 0 InitTextBox
+/TBxmargin 20 def
+/TBymargin 20 def
+/Boxing false def
+/textshow { ExtendTextBox Gshow } def
+%
+%%EndProlog
+%%Page: 1 1
+gnudict begin
+gsave
+doclip
+50 50 translate
+0.100 0.100 scale
+0 setgray
+newpath
+(Helvetica) findfont 140 scalefont setfont
+BackgroundColor 0 lt 3 1 roll 0 lt exch 0 lt or or not {gsave BackgroundColor C clippath fill grestore} if
+1.000 UL
+LTb
+LCb setrgbcolor
+686 448 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 448 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 1263 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 1263 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.1)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 2078 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 2078 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.2)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 2894 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 2894 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.3)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 3709 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 3709 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.4)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 4524 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 4524 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.5)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 5339 M
+63 0 V
+3318 0 R
+-63 0 V
+stroke
+602 5339 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.6)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+686 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+686 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1024 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+1024 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 20000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1362 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+1362 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 40000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1700 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+1700 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 60000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2038 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+2038 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 80000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2377 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+2377 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 100000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2715 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+2715 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 120000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3053 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+3053 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 140000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3391 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+3391 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 160000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3729 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+3729 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 180000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+4067 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+4067 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 200000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+686 5339 N
+686 448 L
+3381 0 V
+0 4891 V
+-3381 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+LCb setrgbcolor
+112 2893 M
+currentpoint gsave translate -270 rotate 0 0 moveto
+[ [(Helvetica) 140.0 0.0 true true 0 (Execution time \(s\))]
+] -46.7 MCshow
+grestore
+LTb
+LCb setrgbcolor
+2376 98 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Maximum memory \(B\))]
+] -46.7 MCshow
+LTb
+LCb setrgbcolor
+2376 5549 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Influence of maximum memory consumption for periodic saving)]
+] -46.7 MCshow
+% Begin plot #1
+1.000 UL
+LTb
+0.58 0.00 0.83 C LCb setrgbcolor
+3416 5206 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Forward step)]
+] -46.7 MRshow
+1.000 UL
+LTb
+0.58 0.00 0.83 C 3500 5206 M
+399 0 V
+703 469 M
+173 -1 V
+174 1 V
+173 0 V
+173 0 V
+173 0 V
+173 0 V
+173 0 V
+173 -1 V
+173 1 V
+173 0 V
+173 0 V
+174 0 V
+173 0 V
+173 -1 V
+173 1 V
+173 -1 V
+173 0 V
+173 1 V
+173 0 V
+% End plot #1
+% Begin plot #2
+stroke
+LTb
+0.00 0.62 0.45 C LCb setrgbcolor
+3416 5066 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Random jump)]
+] -46.7 MRshow
+1.000 UL
+LTb
+0.00 0.62 0.45 C 3500 5066 M
+399 0 V
+703 1858 M
+173 -17 V
+174 571 V
+173 -308 V
+173 -9 V
+173 292 V
+173 275 V
+173 -828 V
+173 260 V
+173 3040 V
+2434 1842 L
+173 415 V
+174 131 V
+173 -285 V
+173 -260 V
+173 823 V
+173 -530 V
+173 -710 V
+3819 610 L
+173 978 V
+% End plot #2
+% Begin plot #3
+stroke
+LTb
+0.34 0.71 0.91 C LCb setrgbcolor
+3416 4926 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Backward step)]
+] -46.7 MRshow
+1.000 UL
+LTb
+0.34 0.71 0.91 C 3500 4926 M
+399 0 V
+703 3504 M
+876 2926 L
+174 18 V
+173 1098 V
+173 270 V
+173 -571 V
+173 318 V
+173 -555 V
+2088 2388 L
+173 1091 V
+173 1 V
+173 -553 V
+174 869 V
+173 -863 V
+173 979 V
+173 139 V
+173 -816 V
+173 254 V
+173 -562 V
+173 564 V
+% End plot #3
+stroke
+2.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+686 5339 N
+686 448 L
+3381 0 V
+0 4891 V
+-3381 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+stroke
+grestore
+end
+showpage
+%%Trailer
+%%DocumentFonts: Helvetica
+%%Pages: 1

+ 16 - 0
examples/result_8

@@ -0,0 +1,16 @@
+1 0.000190672131626 0.00018698216378 
+2 0.000187699270198 0.00017847376028 
+4 0.000190634543687 0.000184673058144 
+8 0.000194187912237 0.000181852494879 
+16 0.000194255174866 0.000183256682032 
+32 0.000197555957566 0.000178120854836 
+64 0.000191786240715 0.000186372460594 
+128 0.000194594902196 0.000182080702813 
+256 0.000193333121643 0.000178636651989 
+512 0.000201019663882 0.000181787465829 
+1024 0.000212588995631 0.000177151896458 
+2048 0.000228057964455 0.000178761668583 
+4096 0.000266502290262 0.000183973756541 
+8192 0.000347277719918 0.000180663975709 
+16384 0.000497702612866 0.000183907929784 
+32768 0.000800363129161 0.000180132894495 

+ 812 - 0
examples/result_8.eps

@@ -0,0 +1,812 @@
+%!PS-Adobe-2.0
+%%Title: result_8.eps
+%%Creator: gnuplot 5.0 patchlevel 1 (Gentoo revision r1)
+%%CreationDate: Tue Jul 19 11:18:20 2016
+%%DocumentFonts: (atend)
+%%BoundingBox: 50 50 482 626
+%%Orientation: Portrait
+%%Pages: (atend)
+%%EndComments
+%%BeginProlog
+/gnudict 256 dict def
+gnudict begin
+%
+% The following true/false flags may be edited by hand if desired.
+% The unit line width and grayscale image gamma correction may also be changed.
+%
+/Color true def
+/Blacktext false def
+/Solid false def
+/Dashlength 1 def
+/Landscape false def
+/Level1 false def
+/Level3 false def
+/Rounded false def
+/ClipToBoundingBox false def
+/SuppressPDFMark false def
+/TransparentPatterns false def
+/gnulinewidth 5.000 def
+/userlinewidth gnulinewidth def
+/Gamma 1.0 def
+/BackgroundColor {-1.000 -1.000 -1.000} def
+%
+/vshift -46 def
+/dl1 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul sub dup 0 le { pop 0.01 } if } if
+} def
+/dl2 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul add } if
+} def
+/hpt_ 31.5 def
+/vpt_ 31.5 def
+/hpt hpt_ def
+/vpt vpt_ def
+/doclip {
+  ClipToBoundingBox {
+    newpath 50 50 moveto 482 50 lineto 482 626 lineto 50 626 lineto closepath
+    clip
+  } if
+} def
+%
+% Gnuplot Prolog Version 5.0 (Dec 2014)
+%
+%/SuppressPDFMark true def
+%
+/M {moveto} bind def
+/L {lineto} bind def
+/R {rmoveto} bind def
+/V {rlineto} bind def
+/N {newpath moveto} bind def
+/Z {closepath} bind def
+/C {setrgbcolor} bind def
+/f {rlineto fill} bind def
+/g {setgray} bind def
+/Gshow {show} def   % May be redefined later in the file to support UTF-8
+/vpt2 vpt 2 mul def
+/hpt2 hpt 2 mul def
+/Lshow {currentpoint stroke M 0 vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Rshow {currentpoint stroke M dup stringwidth pop neg vshift R
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Cshow {currentpoint stroke M dup stringwidth pop -2 div vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/UP {dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def
+  /hpt2 hpt 2 mul def /vpt2 vpt 2 mul def} def
+/DL {Color {setrgbcolor Solid {pop []} if 0 setdash}
+ {pop pop pop 0 setgray Solid {pop []} if 0 setdash} ifelse} def
+/BL {stroke userlinewidth 2 mul setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/AL {stroke userlinewidth 2 div setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/UL {dup gnulinewidth mul /userlinewidth exch def
+	dup 1 lt {pop 1} if 10 mul /udl exch def} def
+/PL {stroke userlinewidth setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+3.8 setmiterlimit
+% Classic Line colors (version 5.0)
+/LCw {1 1 1} def
+/LCb {0 0 0} def
+/LCa {0 0 0} def
+/LC0 {1 0 0} def
+/LC1 {0 1 0} def
+/LC2 {0 0 1} def
+/LC3 {1 0 1} def
+/LC4 {0 1 1} def
+/LC5 {1 1 0} def
+/LC6 {0 0 0} def
+/LC7 {1 0.3 0} def
+/LC8 {0.5 0.5 0.5} def
+% Default dash patterns (version 5.0)
+/LTw {PL [] 1 setgray} def
+/LTb {BL [] LCb DL} def
+/LTa {AL [1 udl mul 2 udl mul] 0 setdash LCa setrgbcolor} def
+/LT0 {PL [] LC0 DL} def
+/LT1 {PL [2 dl1 3 dl2] LC1 DL} def
+/LT2 {PL [1 dl1 1.5 dl2] LC2 DL} def
+/LT3 {PL [6 dl1 2 dl2 1 dl1 2 dl2] LC3 DL} def
+/LT4 {PL [1 dl1 2 dl2 6 dl1 2 dl2 1 dl1 2 dl2] LC4 DL} def
+/LT5 {PL [4 dl1 2 dl2] LC5 DL} def
+/LT6 {PL [1.5 dl1 1.5 dl2 1.5 dl1 1.5 dl2 1.5 dl1 6 dl2] LC6 DL} def
+/LT7 {PL [3 dl1 3 dl2 1 dl1 3 dl2] LC7 DL} def
+/LT8 {PL [2 dl1 2 dl2 2 dl1 6 dl2] LC8 DL} def
+/SL {[] 0 setdash} def
+/Pnt {stroke [] 0 setdash gsave 1 setlinecap M 0 0 V stroke grestore} def
+/Dia {stroke [] 0 setdash 2 copy vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke
+  Pnt} def
+/Pls {stroke [] 0 setdash vpt sub M 0 vpt2 V
+  currentpoint stroke M
+  hpt neg vpt neg R hpt2 0 V stroke
+ } def
+/Box {stroke [] 0 setdash 2 copy exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke
+  Pnt} def
+/Crs {stroke [] 0 setdash exch hpt sub exch vpt add M
+  hpt2 vpt2 neg V currentpoint stroke M
+  hpt2 neg 0 R hpt2 vpt2 V stroke} def
+/TriU {stroke [] 0 setdash 2 copy vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke
+  Pnt} def
+/Star {2 copy Pls Crs} def
+/BoxF {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath fill} def
+/TriUF {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath fill} def
+/TriD {stroke [] 0 setdash 2 copy vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke
+  Pnt} def
+/TriDF {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath fill} def
+/DiaF {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath fill} def
+/Pent {stroke [] 0 setdash 2 copy gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore Pnt} def
+/PentF {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath fill grestore} def
+/Circle {stroke [] 0 setdash 2 copy
+  hpt 0 360 arc stroke Pnt} def
+/CircleF {stroke [] 0 setdash hpt 0 360 arc fill} def
+/C0 {BL [] 0 setdash 2 copy moveto vpt 90 450 arc} bind def
+/C1 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C2 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C3 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C4 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C5 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc
+	2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc} bind def
+/C6 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C7 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C8 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C9 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 450 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C10 {BL [] 0 setdash 2 copy 2 copy moveto vpt 270 360 arc closepath fill
+	2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C11 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C12 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C13 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C14 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 360 arc closepath fill
+	vpt 0 360 arc} bind def
+/C15 {BL [] 0 setdash 2 copy vpt 0 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/Rec {newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto
+	neg 0 rlineto closepath} bind def
+/Square {dup Rec} bind def
+/Bsquare {vpt sub exch vpt sub exch vpt2 Square} bind def
+/S0 {BL [] 0 setdash 2 copy moveto 0 vpt rlineto BL Bsquare} bind def
+/S1 {BL [] 0 setdash 2 copy vpt Square fill Bsquare} bind def
+/S2 {BL [] 0 setdash 2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S3 {BL [] 0 setdash 2 copy exch vpt sub exch vpt2 vpt Rec fill Bsquare} bind def
+/S4 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S5 {BL [] 0 setdash 2 copy 2 copy vpt Square fill
+	exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S6 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S7 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S8 {BL [] 0 setdash 2 copy vpt sub vpt Square fill Bsquare} bind def
+/S9 {BL [] 0 setdash 2 copy vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S10 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt Square fill
+	Bsquare} bind def
+/S11 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt2 vpt Rec fill
+	Bsquare} bind def
+/S12 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill Bsquare} bind def
+/S13 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S14 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S15 {BL [] 0 setdash 2 copy Bsquare fill Bsquare} bind def
+/D0 {gsave translate 45 rotate 0 0 S0 stroke grestore} bind def
+/D1 {gsave translate 45 rotate 0 0 S1 stroke grestore} bind def
+/D2 {gsave translate 45 rotate 0 0 S2 stroke grestore} bind def
+/D3 {gsave translate 45 rotate 0 0 S3 stroke grestore} bind def
+/D4 {gsave translate 45 rotate 0 0 S4 stroke grestore} bind def
+/D5 {gsave translate 45 rotate 0 0 S5 stroke grestore} bind def
+/D6 {gsave translate 45 rotate 0 0 S6 stroke grestore} bind def
+/D7 {gsave translate 45 rotate 0 0 S7 stroke grestore} bind def
+/D8 {gsave translate 45 rotate 0 0 S8 stroke grestore} bind def
+/D9 {gsave translate 45 rotate 0 0 S9 stroke grestore} bind def
+/D10 {gsave translate 45 rotate 0 0 S10 stroke grestore} bind def
+/D11 {gsave translate 45 rotate 0 0 S11 stroke grestore} bind def
+/D12 {gsave translate 45 rotate 0 0 S12 stroke grestore} bind def
+/D13 {gsave translate 45 rotate 0 0 S13 stroke grestore} bind def
+/D14 {gsave translate 45 rotate 0 0 S14 stroke grestore} bind def
+/D15 {gsave translate 45 rotate 0 0 S15 stroke grestore} bind def
+/DiaE {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke} def
+/BoxE {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke} def
+/TriUE {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke} def
+/TriDE {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke} def
+/PentE {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore} def
+/CircE {stroke [] 0 setdash 
+  hpt 0 360 arc stroke} def
+/Opaque {gsave closepath 1 setgray fill grestore 0 setgray closepath} def
+/DiaW {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V Opaque stroke} def
+/BoxW {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V Opaque stroke} def
+/TriUW {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V Opaque stroke} def
+/TriDW {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V Opaque stroke} def
+/PentW {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  Opaque stroke grestore} def
+/CircW {stroke [] 0 setdash 
+  hpt 0 360 arc Opaque stroke} def
+/BoxFill {gsave Rec 1 setgray fill grestore} def
+/Density {
+  /Fillden exch def
+  currentrgbcolor
+  /ColB exch def /ColG exch def /ColR exch def
+  /ColR ColR Fillden mul Fillden sub 1 add def
+  /ColG ColG Fillden mul Fillden sub 1 add def
+  /ColB ColB Fillden mul Fillden sub 1 add def
+  ColR ColG ColB setrgbcolor} def
+/BoxColFill {gsave Rec PolyFill} def
+/PolyFill {gsave Density fill grestore grestore} def
+/h {rlineto rlineto rlineto gsave closepath fill grestore} bind def
+%
+% PostScript Level 1 Pattern Fill routine for rectangles
+% Usage: x y w h s a XX PatternFill
+%	x,y = lower left corner of box to be filled
+%	w,h = width and height of box
+%	  a = angle in degrees between lines and x-axis
+%	 XX = 0/1 for no/yes cross-hatch
+%
+/PatternFill {gsave /PFa [ 9 2 roll ] def
+  PFa 0 get PFa 2 get 2 div add PFa 1 get PFa 3 get 2 div add translate
+  PFa 2 get -2 div PFa 3 get -2 div PFa 2 get PFa 3 get Rec
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+  clip
+  currentlinewidth 0.5 mul setlinewidth
+  /PFs PFa 2 get dup mul PFa 3 get dup mul add sqrt def
+  0 0 M PFa 5 get rotate PFs -2 div dup translate
+  0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 M 0 PFs V} for
+  0 PFa 6 get ne {
+	0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 2 1 roll M PFs 0 V} for
+ } if
+  stroke grestore} def
+%
+/languagelevel where
+ {pop languagelevel} {1} ifelse
+dup 2 lt
+	{/InterpretLevel1 true def
+	 /InterpretLevel3 false def}
+	{/InterpretLevel1 Level1 def
+	 2 gt
+	    {/InterpretLevel3 Level3 def}
+	    {/InterpretLevel3 false def}
+	 ifelse }
+ ifelse
+%
+% PostScript level 2 pattern fill definitions
+%
+/Level2PatternFill {
+/Tile8x8 {/PaintType 2 /PatternType 1 /TilingType 1 /BBox [0 0 8 8] /XStep 8 /YStep 8}
+	bind def
+/KeepColor {currentrgbcolor [/Pattern /DeviceRGB] setcolorspace} bind def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke} 
+>> matrix makepattern
+/Pat1 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke
+	0 4 M 4 8 L 8 4 L 4 0 L 0 4 L stroke}
+>> matrix makepattern
+/Pat2 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 0 8 L
+	8 8 L 8 0 L 0 0 L fill}
+>> matrix makepattern
+/Pat3 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 8 M 8 -4 L
+	0 12 M 12 0 L stroke}
+>> matrix makepattern
+/Pat4 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 0 M 8 12 L
+	0 -4 M 12 8 L stroke}
+>> matrix makepattern
+/Pat5 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 8 M 4 -4 L
+	0 12 M 8 -4 L 4 12 M 10 0 L stroke}
+>> matrix makepattern
+/Pat6 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 0 M 4 12 L
+	0 -4 M 8 12 L 4 -4 M 10 8 L stroke}
+>> matrix makepattern
+/Pat7 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 8 -2 M -4 4 L
+	12 0 M -4 8 L 12 4 M 0 10 L stroke}
+>> matrix makepattern
+/Pat8 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 -2 M 12 4 L
+	-4 0 M 12 8 L -4 4 M 8 10 L stroke}
+>> matrix makepattern
+/Pat9 exch def
+/Pattern1 {PatternBgnd KeepColor Pat1 setpattern} bind def
+/Pattern2 {PatternBgnd KeepColor Pat2 setpattern} bind def
+/Pattern3 {PatternBgnd KeepColor Pat3 setpattern} bind def
+/Pattern4 {PatternBgnd KeepColor Landscape {Pat5} {Pat4} ifelse setpattern} bind def
+/Pattern5 {PatternBgnd KeepColor Landscape {Pat4} {Pat5} ifelse setpattern} bind def
+/Pattern6 {PatternBgnd KeepColor Landscape {Pat9} {Pat6} ifelse setpattern} bind def
+/Pattern7 {PatternBgnd KeepColor Landscape {Pat8} {Pat7} ifelse setpattern} bind def
+} def
+%
+%
+%End of PostScript Level 2 code
+%
+/PatternBgnd {
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+} def
+%
+% Substitute for Level 2 pattern fill codes with
+% grayscale if Level 2 support is not selected.
+%
+/Level1PatternFill {
+/Pattern1 {0.250 Density} bind def
+/Pattern2 {0.500 Density} bind def
+/Pattern3 {0.750 Density} bind def
+/Pattern4 {0.125 Density} bind def
+/Pattern5 {0.375 Density} bind def
+/Pattern6 {0.625 Density} bind def
+/Pattern7 {0.875 Density} bind def
+} def
+%
+% Now test for support of Level 2 code
+%
+Level1 {Level1PatternFill} {Level2PatternFill} ifelse
+%
+/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont
+dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall
+currentdict end definefont pop
+%
+/MFshow {
+   { dup 5 get 3 ge
+     { 5 get 3 eq {gsave} {grestore} ifelse }
+     {dup dup 0 get findfont exch 1 get scalefont setfont
+     [ currentpoint ] exch dup 2 get 0 exch R dup 5 get 2 ne {dup dup 6
+     get exch 4 get {textshow} {stringwidth pop 0 R} ifelse }if dup 5 get 0 eq
+     {dup 3 get {2 get neg 0 exch R pop} {pop aload pop M} ifelse} {dup 5
+     get 1 eq {dup 2 get exch dup 3 get exch 6 get stringwidth pop -2 div
+     dup 0 R} {dup 6 get stringwidth pop -2 div 0 R 6 get
+     textshow 2 index {aload pop M neg 3 -1 roll neg R pop pop} {pop pop pop
+     pop aload pop M} ifelse }ifelse }ifelse }
+     ifelse }
+   forall} def
+/Gswidth {dup type /stringtype eq {stringwidth} {pop (n) stringwidth} ifelse} def
+/MFwidth {0 exch { dup 5 get 3 ge { 5 get 3 eq { 0 } { pop } ifelse }
+ {dup 3 get{dup dup 0 get findfont exch 1 get scalefont setfont
+     6 get Gswidth pop add} {pop} ifelse} ifelse} forall} def
+/MLshow { currentpoint stroke M
+  0 exch R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MRshow { currentpoint stroke M
+  exch dup MFwidth neg 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MCshow { currentpoint stroke M
+  exch dup MFwidth -2 div 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/XYsave    { [( ) 1 2 true false 3 ()] } bind def
+/XYrestore { [( ) 1 2 true false 4 ()] } bind def
+Level1 SuppressPDFMark or 
+{} {
+/SDict 10 dict def
+systemdict /pdfmark known not {
+  userdict /pdfmark systemdict /cleartomark get put
+} if
+SDict begin [
+  /Title (result_8.eps)
+  /Subject (gnuplot plot)
+  /Creator (gnuplot 5.0 patchlevel 1 (Gentoo revision r1))
+  /Author (yentl)
+%  /Producer (gnuplot)
+%  /Keywords ()
+  /CreationDate (Tue Jul 19 11:18:20 2016)
+  /DOCINFO pdfmark
+end
+} ifelse
+end
+%
+% Support for boxed text - Ethan A Merritt May 2005
+%
+/InitTextBox { userdict /TBy2 3 -1 roll put userdict /TBx2 3 -1 roll put
+           userdict /TBy1 3 -1 roll put userdict /TBx1 3 -1 roll put
+	   /Boxing true def } def
+/ExtendTextBox { Boxing
+    { gsave dup false charpath pathbbox
+      dup TBy2 gt {userdict /TBy2 3 -1 roll put} {pop} ifelse
+      dup TBx2 gt {userdict /TBx2 3 -1 roll put} {pop} ifelse
+      dup TBy1 lt {userdict /TBy1 3 -1 roll put} {pop} ifelse
+      dup TBx1 lt {userdict /TBx1 3 -1 roll put} {pop} ifelse
+      grestore } if } def
+/PopTextBox { newpath TBx1 TBxmargin sub TBy1 TBymargin sub M
+               TBx1 TBxmargin sub TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy1 TBymargin sub L closepath } def
+/DrawTextBox { PopTextBox stroke /Boxing false def} def
+/FillTextBox { gsave PopTextBox 1 1 1 setrgbcolor fill grestore /Boxing false def} def
+0 0 0 0 InitTextBox
+/TBxmargin 20 def
+/TBymargin 20 def
+/Boxing false def
+/textshow { ExtendTextBox Gshow } def
+%
+%%EndProlog
+%%Page: 1 1
+gnudict begin
+gsave
+doclip
+50 50 translate
+0.100 0.100 scale
+0 setgray
+newpath
+(Helvetica) findfont 140 scalefont setfont
+BackgroundColor 0 lt 3 1 roll 0 lt exch 0 lt or or not {gsave BackgroundColor C clippath fill grestore} if
+1.000 UL
+LTb
+LCb setrgbcolor
+938 448 M
+63 0 V
+3066 0 R
+-63 0 V
+stroke
+854 448 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.0001)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+938 1059 M
+63 0 V
+3066 0 R
+-63 0 V
+stroke
+854 1059 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.0002)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+938 1671 M
+63 0 V
+3066 0 R
+-63 0 V
+stroke
+854 1671 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.0003)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+938 2282 M
+63 0 V
+3066 0 R
+-63 0 V
+stroke
+854 2282 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.0004)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+938 2894 M
+63 0 V
+3066 0 R
+-63 0 V
+stroke
+854 2894 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.0005)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+938 3505 M
+63 0 V
+3066 0 R
+-63 0 V
+stroke
+854 3505 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.0006)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+938 4116 M
+63 0 V
+3066 0 R
+-63 0 V
+stroke
+854 4116 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.0007)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+938 4728 M
+63 0 V
+3066 0 R
+-63 0 V
+stroke
+854 4728 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.0008)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+938 5339 M
+63 0 V
+3066 0 R
+-63 0 V
+stroke
+854 5339 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.0009)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+938 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+938 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1385 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+1385 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 5000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1832 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+1832 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 10000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2279 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+2279 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 15000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2726 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+2726 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 20000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3173 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+3173 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 25000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3620 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+3620 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 30000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+4067 448 M
+0 63 V
+0 4828 R
+0 -63 V
+stroke
+4067 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 35000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+938 5339 N
+938 448 L
+3129 0 V
+0 4891 V
+-3129 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+LCb setrgbcolor
+112 2893 M
+currentpoint gsave translate -270 rotate 0 0 moveto
+[ [(Helvetica) 140.0 0.0 true true 0 (Execution time \(s\))]
+] -46.7 MCshow
+grestore
+LTb
+LCb setrgbcolor
+2502 98 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Model state \(B\))]
+] -46.7 MCshow
+LTb
+LCb setrgbcolor
+2502 5549 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Influence of state size on forward stepping)]
+] -46.7 MCshow
+% Begin plot #1
+1.000 UL
+LTb
+0.58 0.00 0.83 C LCb setrgbcolor
+3416 5206 M
+[ [(Helvetica) 140.0 0.0 true true 0 (incremental)]
+] -46.7 MRshow
+1.000 UL
+LTb
+0.58 0.00 0.83 C 3500 5206 M
+399 0 V
+938 1002 M
+0 -18 V
+0 18 V
+1 22 V
+2 20 V
+3 -35 V
+5 17 V
+12 -7 V
+23 47 V
+46 70 V
+91 95 V
+183 235 V
+366 494 V
+733 919 V
+3867 4730 L
+% End plot #1
+% Begin plot #2
+stroke
+LTb
+0.00 0.62 0.45 C LCb setrgbcolor
+3416 5066 M
+[ [(Helvetica) 140.0 0.0 true true 0 (periodic)]
+] -46.7 MRshow
+1.000 UL
+LTb
+0.00 0.62 0.45 C 3500 5066 M
+399 0 V
+938 980 M
+0 -52 V
+0 38 V
+1 -18 V
+0 9 V
+2 -31 V
+3 50 V
+5 -26 V
+12 -21 V
+23 19 V
+46 -28 V
+91 10 V
+183 31 V
+366 -20 V
+733 20 V
+3867 938 L
+% End plot #2
+stroke
+2.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+938 5339 N
+938 448 L
+3129 0 V
+0 4891 V
+-3129 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+stroke
+grestore
+end
+showpage
+%%Trailer
+%%DocumentFonts: Helvetica
+%%Pages: 1

+ 10 - 0
examples/result_9

@@ -0,0 +1,10 @@
+10 0.0387123942375 0.0799214482307 
+110 0.0539743542671 0.0901644229889 
+210 0.0688293814659 0.0933729290962 
+310 0.081147480011 0.0925981879235 
+410 0.0956897974014 0.103880059719 
+510 0.108364677429 0.0918560862541 
+610 0.118905699253 0.0970425128937 
+710 0.137597382069 0.12126095295 
+810 0.160588383675 0.11870610714 
+910 0.174916958809 0.126384329796 

+ 834 - 0
examples/result_9.eps

@@ -0,0 +1,834 @@
+%!PS-Adobe-2.0
+%%Title: result_9.eps
+%%Creator: gnuplot 5.0 patchlevel 1 (Gentoo revision r1)
+%%CreationDate: Fri Dec  2 10:30:14 2016
+%%DocumentFonts: (atend)
+%%BoundingBox: 50 50 482 482
+%%Orientation: Portrait
+%%Pages: (atend)
+%%EndComments
+%%BeginProlog
+/gnudict 256 dict def
+gnudict begin
+%
+% The following true/false flags may be edited by hand if desired.
+% The unit line width and grayscale image gamma correction may also be changed.
+%
+/Color true def
+/Blacktext false def
+/Solid false def
+/Dashlength 1 def
+/Landscape false def
+/Level1 false def
+/Level3 false def
+/Rounded false def
+/ClipToBoundingBox false def
+/SuppressPDFMark false def
+/TransparentPatterns false def
+/gnulinewidth 5.000 def
+/userlinewidth gnulinewidth def
+/Gamma 1.0 def
+/BackgroundColor {-1.000 -1.000 -1.000} def
+%
+/vshift -46 def
+/dl1 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul sub dup 0 le { pop 0.01 } if } if
+} def
+/dl2 {
+  10.0 Dashlength userlinewidth gnulinewidth div mul mul mul
+  Rounded { currentlinewidth 0.75 mul add } if
+} def
+/hpt_ 31.5 def
+/vpt_ 31.5 def
+/hpt hpt_ def
+/vpt vpt_ def
+/doclip {
+  ClipToBoundingBox {
+    newpath 50 50 moveto 482 50 lineto 482 482 lineto 50 482 lineto closepath
+    clip
+  } if
+} def
+%
+% Gnuplot Prolog Version 5.0 (Dec 2014)
+%
+%/SuppressPDFMark true def
+%
+/M {moveto} bind def
+/L {lineto} bind def
+/R {rmoveto} bind def
+/V {rlineto} bind def
+/N {newpath moveto} bind def
+/Z {closepath} bind def
+/C {setrgbcolor} bind def
+/f {rlineto fill} bind def
+/g {setgray} bind def
+/Gshow {show} def   % May be redefined later in the file to support UTF-8
+/vpt2 vpt 2 mul def
+/hpt2 hpt 2 mul def
+/Lshow {currentpoint stroke M 0 vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Rshow {currentpoint stroke M dup stringwidth pop neg vshift R
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/Cshow {currentpoint stroke M dup stringwidth pop -2 div vshift R 
+	Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def
+/UP {dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def
+  /hpt2 hpt 2 mul def /vpt2 vpt 2 mul def} def
+/DL {Color {setrgbcolor Solid {pop []} if 0 setdash}
+ {pop pop pop 0 setgray Solid {pop []} if 0 setdash} ifelse} def
+/BL {stroke userlinewidth 2 mul setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/AL {stroke userlinewidth 2 div setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+/UL {dup gnulinewidth mul /userlinewidth exch def
+	dup 1 lt {pop 1} if 10 mul /udl exch def} def
+/PL {stroke userlinewidth setlinewidth
+	Rounded {1 setlinejoin 1 setlinecap} if} def
+3.8 setmiterlimit
+% Classic Line colors (version 5.0)
+/LCw {1 1 1} def
+/LCb {0 0 0} def
+/LCa {0 0 0} def
+/LC0 {1 0 0} def
+/LC1 {0 1 0} def
+/LC2 {0 0 1} def
+/LC3 {1 0 1} def
+/LC4 {0 1 1} def
+/LC5 {1 1 0} def
+/LC6 {0 0 0} def
+/LC7 {1 0.3 0} def
+/LC8 {0.5 0.5 0.5} def
+% Default dash patterns (version 5.0)
+/LTw {PL [] 1 setgray} def
+/LTb {BL [] LCb DL} def
+/LTa {AL [1 udl mul 2 udl mul] 0 setdash LCa setrgbcolor} def
+/LT0 {PL [] LC0 DL} def
+/LT1 {PL [2 dl1 3 dl2] LC1 DL} def
+/LT2 {PL [1 dl1 1.5 dl2] LC2 DL} def
+/LT3 {PL [6 dl1 2 dl2 1 dl1 2 dl2] LC3 DL} def
+/LT4 {PL [1 dl1 2 dl2 6 dl1 2 dl2 1 dl1 2 dl2] LC4 DL} def
+/LT5 {PL [4 dl1 2 dl2] LC5 DL} def
+/LT6 {PL [1.5 dl1 1.5 dl2 1.5 dl1 1.5 dl2 1.5 dl1 6 dl2] LC6 DL} def
+/LT7 {PL [3 dl1 3 dl2 1 dl1 3 dl2] LC7 DL} def
+/LT8 {PL [2 dl1 2 dl2 2 dl1 6 dl2] LC8 DL} def
+/SL {[] 0 setdash} def
+/Pnt {stroke [] 0 setdash gsave 1 setlinecap M 0 0 V stroke grestore} def
+/Dia {stroke [] 0 setdash 2 copy vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke
+  Pnt} def
+/Pls {stroke [] 0 setdash vpt sub M 0 vpt2 V
+  currentpoint stroke M
+  hpt neg vpt neg R hpt2 0 V stroke
+ } def
+/Box {stroke [] 0 setdash 2 copy exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke
+  Pnt} def
+/Crs {stroke [] 0 setdash exch hpt sub exch vpt add M
+  hpt2 vpt2 neg V currentpoint stroke M
+  hpt2 neg 0 R hpt2 vpt2 V stroke} def
+/TriU {stroke [] 0 setdash 2 copy vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke
+  Pnt} def
+/Star {2 copy Pls Crs} def
+/BoxF {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath fill} def
+/TriUF {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath fill} def
+/TriD {stroke [] 0 setdash 2 copy vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke
+  Pnt} def
+/TriDF {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath fill} def
+/DiaF {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath fill} def
+/Pent {stroke [] 0 setdash 2 copy gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore Pnt} def
+/PentF {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath fill grestore} def
+/Circle {stroke [] 0 setdash 2 copy
+  hpt 0 360 arc stroke Pnt} def
+/CircleF {stroke [] 0 setdash hpt 0 360 arc fill} def
+/C0 {BL [] 0 setdash 2 copy moveto vpt 90 450 arc} bind def
+/C1 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C2 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C3 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C4 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C5 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc
+	2 copy moveto
+	2 copy vpt 180 270 arc closepath fill
+	vpt 0 360 arc} bind def
+/C6 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C7 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 270 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C8 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C9 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 270 450 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C10 {BL [] 0 setdash 2 copy 2 copy moveto vpt 270 360 arc closepath fill
+	2 copy moveto
+	2 copy vpt 90 180 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C11 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 180 arc closepath fill
+	2 copy moveto
+	2 copy vpt 270 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C12 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C13 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 0 90 arc closepath fill
+	2 copy moveto
+	2 copy vpt 180 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/C14 {BL [] 0 setdash 2 copy moveto
+	2 copy vpt 90 360 arc closepath fill
+	vpt 0 360 arc} bind def
+/C15 {BL [] 0 setdash 2 copy vpt 0 360 arc closepath fill
+	vpt 0 360 arc closepath} bind def
+/Rec {newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto
+	neg 0 rlineto closepath} bind def
+/Square {dup Rec} bind def
+/Bsquare {vpt sub exch vpt sub exch vpt2 Square} bind def
+/S0 {BL [] 0 setdash 2 copy moveto 0 vpt rlineto BL Bsquare} bind def
+/S1 {BL [] 0 setdash 2 copy vpt Square fill Bsquare} bind def
+/S2 {BL [] 0 setdash 2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S3 {BL [] 0 setdash 2 copy exch vpt sub exch vpt2 vpt Rec fill Bsquare} bind def
+/S4 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S5 {BL [] 0 setdash 2 copy 2 copy vpt Square fill
+	exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S6 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S7 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S8 {BL [] 0 setdash 2 copy vpt sub vpt Square fill Bsquare} bind def
+/S9 {BL [] 0 setdash 2 copy vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S10 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt Square fill
+	Bsquare} bind def
+/S11 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt2 vpt Rec fill
+	Bsquare} bind def
+/S12 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill Bsquare} bind def
+/S13 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy vpt Square fill Bsquare} bind def
+/S14 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+	2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S15 {BL [] 0 setdash 2 copy Bsquare fill Bsquare} bind def
+/D0 {gsave translate 45 rotate 0 0 S0 stroke grestore} bind def
+/D1 {gsave translate 45 rotate 0 0 S1 stroke grestore} bind def
+/D2 {gsave translate 45 rotate 0 0 S2 stroke grestore} bind def
+/D3 {gsave translate 45 rotate 0 0 S3 stroke grestore} bind def
+/D4 {gsave translate 45 rotate 0 0 S4 stroke grestore} bind def
+/D5 {gsave translate 45 rotate 0 0 S5 stroke grestore} bind def
+/D6 {gsave translate 45 rotate 0 0 S6 stroke grestore} bind def
+/D7 {gsave translate 45 rotate 0 0 S7 stroke grestore} bind def
+/D8 {gsave translate 45 rotate 0 0 S8 stroke grestore} bind def
+/D9 {gsave translate 45 rotate 0 0 S9 stroke grestore} bind def
+/D10 {gsave translate 45 rotate 0 0 S10 stroke grestore} bind def
+/D11 {gsave translate 45 rotate 0 0 S11 stroke grestore} bind def
+/D12 {gsave translate 45 rotate 0 0 S12 stroke grestore} bind def
+/D13 {gsave translate 45 rotate 0 0 S13 stroke grestore} bind def
+/D14 {gsave translate 45 rotate 0 0 S14 stroke grestore} bind def
+/D15 {gsave translate 45 rotate 0 0 S15 stroke grestore} bind def
+/DiaE {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V closepath stroke} def
+/BoxE {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V closepath stroke} def
+/TriUE {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V closepath stroke} def
+/TriDE {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V closepath stroke} def
+/PentE {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  closepath stroke grestore} def
+/CircE {stroke [] 0 setdash 
+  hpt 0 360 arc stroke} def
+/Opaque {gsave closepath 1 setgray fill grestore 0 setgray closepath} def
+/DiaW {stroke [] 0 setdash vpt add M
+  hpt neg vpt neg V hpt vpt neg V
+  hpt vpt V hpt neg vpt V Opaque stroke} def
+/BoxW {stroke [] 0 setdash exch hpt sub exch vpt add M
+  0 vpt2 neg V hpt2 0 V 0 vpt2 V
+  hpt2 neg 0 V Opaque stroke} def
+/TriUW {stroke [] 0 setdash vpt 1.12 mul add M
+  hpt neg vpt -1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt 1.62 mul V Opaque stroke} def
+/TriDW {stroke [] 0 setdash vpt 1.12 mul sub M
+  hpt neg vpt 1.62 mul V
+  hpt 2 mul 0 V
+  hpt neg vpt -1.62 mul V Opaque stroke} def
+/PentW {stroke [] 0 setdash gsave
+  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+  Opaque stroke grestore} def
+/CircW {stroke [] 0 setdash 
+  hpt 0 360 arc Opaque stroke} def
+/BoxFill {gsave Rec 1 setgray fill grestore} def
+/Density {
+  /Fillden exch def
+  currentrgbcolor
+  /ColB exch def /ColG exch def /ColR exch def
+  /ColR ColR Fillden mul Fillden sub 1 add def
+  /ColG ColG Fillden mul Fillden sub 1 add def
+  /ColB ColB Fillden mul Fillden sub 1 add def
+  ColR ColG ColB setrgbcolor} def
+/BoxColFill {gsave Rec PolyFill} def
+/PolyFill {gsave Density fill grestore grestore} def
+/h {rlineto rlineto rlineto gsave closepath fill grestore} bind def
+%
+% PostScript Level 1 Pattern Fill routine for rectangles
+% Usage: x y w h s a XX PatternFill
+%	x,y = lower left corner of box to be filled
+%	w,h = width and height of box
+%	  a = angle in degrees between lines and x-axis
+%	 XX = 0/1 for no/yes cross-hatch
+%
+/PatternFill {gsave /PFa [ 9 2 roll ] def
+  PFa 0 get PFa 2 get 2 div add PFa 1 get PFa 3 get 2 div add translate
+  PFa 2 get -2 div PFa 3 get -2 div PFa 2 get PFa 3 get Rec
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+  clip
+  currentlinewidth 0.5 mul setlinewidth
+  /PFs PFa 2 get dup mul PFa 3 get dup mul add sqrt def
+  0 0 M PFa 5 get rotate PFs -2 div dup translate
+  0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 M 0 PFs V} for
+  0 PFa 6 get ne {
+	0 1 PFs PFa 4 get div 1 add floor cvi
+	{PFa 4 get mul 0 2 1 roll M PFs 0 V} for
+ } if
+  stroke grestore} def
+%
+/languagelevel where
+ {pop languagelevel} {1} ifelse
+dup 2 lt
+	{/InterpretLevel1 true def
+	 /InterpretLevel3 false def}
+	{/InterpretLevel1 Level1 def
+	 2 gt
+	    {/InterpretLevel3 Level3 def}
+	    {/InterpretLevel3 false def}
+	 ifelse }
+ ifelse
+%
+% PostScript level 2 pattern fill definitions
+%
+/Level2PatternFill {
+/Tile8x8 {/PaintType 2 /PatternType 1 /TilingType 1 /BBox [0 0 8 8] /XStep 8 /YStep 8}
+	bind def
+/KeepColor {currentrgbcolor [/Pattern /DeviceRGB] setcolorspace} bind def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke} 
+>> matrix makepattern
+/Pat1 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke
+	0 4 M 4 8 L 8 4 L 4 0 L 0 4 L stroke}
+>> matrix makepattern
+/Pat2 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 0 8 L
+	8 8 L 8 0 L 0 0 L fill}
+>> matrix makepattern
+/Pat3 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 8 M 8 -4 L
+	0 12 M 12 0 L stroke}
+>> matrix makepattern
+/Pat4 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 0 M 8 12 L
+	0 -4 M 12 8 L stroke}
+>> matrix makepattern
+/Pat5 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 8 M 4 -4 L
+	0 12 M 8 -4 L 4 12 M 10 0 L stroke}
+>> matrix makepattern
+/Pat6 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 0 M 4 12 L
+	0 -4 M 8 12 L 4 -4 M 10 8 L stroke}
+>> matrix makepattern
+/Pat7 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 8 -2 M -4 4 L
+	12 0 M -4 8 L 12 4 M 0 10 L stroke}
+>> matrix makepattern
+/Pat8 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 -2 M 12 4 L
+	-4 0 M 12 8 L -4 4 M 8 10 L stroke}
+>> matrix makepattern
+/Pat9 exch def
+/Pattern1 {PatternBgnd KeepColor Pat1 setpattern} bind def
+/Pattern2 {PatternBgnd KeepColor Pat2 setpattern} bind def
+/Pattern3 {PatternBgnd KeepColor Pat3 setpattern} bind def
+/Pattern4 {PatternBgnd KeepColor Landscape {Pat5} {Pat4} ifelse setpattern} bind def
+/Pattern5 {PatternBgnd KeepColor Landscape {Pat4} {Pat5} ifelse setpattern} bind def
+/Pattern6 {PatternBgnd KeepColor Landscape {Pat9} {Pat6} ifelse setpattern} bind def
+/Pattern7 {PatternBgnd KeepColor Landscape {Pat8} {Pat7} ifelse setpattern} bind def
+} def
+%
+%
+%End of PostScript Level 2 code
+%
+/PatternBgnd {
+  TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+} def
+%
+% Substitute for Level 2 pattern fill codes with
+% grayscale if Level 2 support is not selected.
+%
+/Level1PatternFill {
+/Pattern1 {0.250 Density} bind def
+/Pattern2 {0.500 Density} bind def
+/Pattern3 {0.750 Density} bind def
+/Pattern4 {0.125 Density} bind def
+/Pattern5 {0.375 Density} bind def
+/Pattern6 {0.625 Density} bind def
+/Pattern7 {0.875 Density} bind def
+} def
+%
+% Now test for support of Level 2 code
+%
+Level1 {Level1PatternFill} {Level2PatternFill} ifelse
+%
+/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont
+dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall
+currentdict end definefont pop
+%
+/MFshow {
+   { dup 5 get 3 ge
+     { 5 get 3 eq {gsave} {grestore} ifelse }
+     {dup dup 0 get findfont exch 1 get scalefont setfont
+     [ currentpoint ] exch dup 2 get 0 exch R dup 5 get 2 ne {dup dup 6
+     get exch 4 get {textshow} {stringwidth pop 0 R} ifelse }if dup 5 get 0 eq
+     {dup 3 get {2 get neg 0 exch R pop} {pop aload pop M} ifelse} {dup 5
+     get 1 eq {dup 2 get exch dup 3 get exch 6 get stringwidth pop -2 div
+     dup 0 R} {dup 6 get stringwidth pop -2 div 0 R 6 get
+     textshow 2 index {aload pop M neg 3 -1 roll neg R pop pop} {pop pop pop
+     pop aload pop M} ifelse }ifelse }ifelse }
+     ifelse }
+   forall} def
+/Gswidth {dup type /stringtype eq {stringwidth} {pop (n) stringwidth} ifelse} def
+/MFwidth {0 exch { dup 5 get 3 ge { 5 get 3 eq { 0 } { pop } ifelse }
+ {dup 3 get{dup dup 0 get findfont exch 1 get scalefont setfont
+     6 get Gswidth pop add} {pop} ifelse} ifelse} forall} def
+/MLshow { currentpoint stroke M
+  0 exch R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MRshow { currentpoint stroke M
+  exch dup MFwidth neg 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/MCshow { currentpoint stroke M
+  exch dup MFwidth -2 div 3 -1 roll R
+  Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def
+/XYsave    { [( ) 1 2 true false 3 ()] } bind def
+/XYrestore { [( ) 1 2 true false 4 ()] } bind def
+Level1 SuppressPDFMark or 
+{} {
+/SDict 10 dict def
+systemdict /pdfmark known not {
+  userdict /pdfmark systemdict /cleartomark get put
+} if
+SDict begin [
+  /Title (result_9.eps)
+  /Subject (gnuplot plot)
+  /Creator (gnuplot 5.0 patchlevel 1 (Gentoo revision r1))
+  /Author (yentl)
+%  /Producer (gnuplot)
+%  /Keywords ()
+  /CreationDate (Fri Dec  2 10:30:14 2016)
+  /DOCINFO pdfmark
+end
+} ifelse
+end
+%
+% Support for boxed text - Ethan A Merritt May 2005
+%
+/InitTextBox { userdict /TBy2 3 -1 roll put userdict /TBx2 3 -1 roll put
+           userdict /TBy1 3 -1 roll put userdict /TBx1 3 -1 roll put
+	   /Boxing true def } def
+/ExtendTextBox { Boxing
+    { gsave dup false charpath pathbbox
+      dup TBy2 gt {userdict /TBy2 3 -1 roll put} {pop} ifelse
+      dup TBx2 gt {userdict /TBx2 3 -1 roll put} {pop} ifelse
+      dup TBy1 lt {userdict /TBy1 3 -1 roll put} {pop} ifelse
+      dup TBx1 lt {userdict /TBx1 3 -1 roll put} {pop} ifelse
+      grestore } if } def
+/PopTextBox { newpath TBx1 TBxmargin sub TBy1 TBymargin sub M
+               TBx1 TBxmargin sub TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy2 TBymargin add L
+	       TBx2 TBxmargin add TBy1 TBymargin sub L closepath } def
+/DrawTextBox { PopTextBox stroke /Boxing false def} def
+/FillTextBox { gsave PopTextBox 1 1 1 setrgbcolor fill grestore /Boxing false def} def
+0 0 0 0 InitTextBox
+/TBxmargin 20 def
+/TBymargin 20 def
+/Boxing false def
+/textshow { ExtendTextBox Gshow } def
+%
+%%EndProlog
+%%Page: 1 1
+gnudict begin
+gsave
+doclip
+50 50 translate
+0.100 0.100 scale
+0 setgray
+newpath
+(Helvetica) findfont 140 scalefont setfont
+BackgroundColor 0 lt 3 1 roll 0 lt exch 0 lt or or not {gsave BackgroundColor C clippath fill grestore} if
+1.000 UL
+LTb
+LCb setrgbcolor
+770 448 M
+63 0 V
+3234 0 R
+-63 0 V
+stroke
+686 448 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.02)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+770 879 M
+63 0 V
+3234 0 R
+-63 0 V
+stroke
+686 879 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.04)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+770 1311 M
+63 0 V
+3234 0 R
+-63 0 V
+stroke
+686 1311 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.06)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+770 1742 M
+63 0 V
+3234 0 R
+-63 0 V
+stroke
+686 1742 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.08)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+770 2174 M
+63 0 V
+3234 0 R
+-63 0 V
+stroke
+686 2174 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.1)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+770 2605 M
+63 0 V
+3234 0 R
+-63 0 V
+stroke
+686 2605 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.12)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+770 3036 M
+63 0 V
+3234 0 R
+-63 0 V
+stroke
+686 3036 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.14)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+770 3468 M
+63 0 V
+3234 0 R
+-63 0 V
+stroke
+686 3468 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.16)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+770 3899 M
+63 0 V
+3234 0 R
+-63 0 V
+stroke
+686 3899 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0.18)]
+] -46.7 MRshow
+1.000 UL
+LTb
+LCb setrgbcolor
+770 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+770 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 0)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1100 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+1100 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 100)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1429 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+1429 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 200)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1759 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+1759 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 300)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2089 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+2089 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 400)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2419 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+2419 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 500)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+2748 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+2748 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 600)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3078 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+3078 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 700)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3408 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+3408 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 800)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+3737 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+3737 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 900)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+4067 448 M
+0 63 V
+0 3388 R
+0 -63 V
+stroke
+4067 308 M
+[ [(Helvetica) 140.0 0.0 true true 0 ( 1000)]
+] -46.7 MCshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+770 3899 N
+770 448 L
+3297 0 V
+0 3451 V
+-3297 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+LCb setrgbcolor
+112 2173 M
+currentpoint gsave translate -270 rotate 0 0 moveto
+[ [(Helvetica) 140.0 0.0 true true 0 (Execution time \(s\))]
+] -46.7 MCshow
+grestore
+LTb
+LCb setrgbcolor
+2418 98 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Number of models)]
+] -46.7 MCshow
+LTb
+LCb setrgbcolor
+2418 4109 M
+[ [(Helvetica) 140.0 0.0 true true 0 (Jump time comparison)]
+] -46.7 MCshow
+% Begin plot #1
+4.000 UL
+LTb
+1.00 0.00 0.00 C LCb setrgbcolor
+1526 3766 M
+[ [(Helvetica) 140.0 0.0 true true 0 (copy)]
+] -46.7 MRshow
+4.000 UL
+LTb
+1.00 0.00 0.00 C 1610 3766 M
+399 0 V
+803 852 M
+330 329 V
+329 320 V
+330 266 V
+330 314 V
+329 273 V
+330 227 V
+330 403 V
+330 496 V
+329 309 V
+% End plot #1
+% Begin plot #2
+stroke
+LTb
+0.00 1.00 0.00 C LCb setrgbcolor
+1526 3626 M
+[ [(Helvetica) 140.0 0.0 true true 0 (periodic)]
+] -46.7 MRshow
+4.000 UL
+LTb
+0.00 1.00 0.00 C 1610 3626 M
+399 0 V
+803 1740 M
+330 221 V
+329 70 V
+330 -17 V
+330 243 V
+329 -259 V
+330 112 V
+330 522 V
+330 -55 V
+329 166 V
+% End plot #2
+stroke
+2.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+770 3899 N
+770 448 L
+3297 0 V
+0 3451 V
+-3297 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+stroke
+grestore
+end
+showpage
+%%Trailer
+%%DocumentFonts: Helvetica
+%%Pages: 1

+ 6 - 0
examples/run_client.sh

@@ -0,0 +1,6 @@
+#!/bin/bash
+set -e
+cd ../src
+python python_sccd_compiler/sccdc.py -p threads sccd.xml
+cd ../examples
+python client.py

+ 227 - 0
examples/run_experiments.py

@@ -0,0 +1,227 @@
+import subprocess
+import sys
+# params format:
+#   0 max seconds to jump
+#   1 max memory to use
+#   2 number of models
+#   3 bytes in state
+#   4 computation in transition
+
+MAX_MEM = 2**32
+REPS = 20
+
+if len(sys.argv) == 1:
+    args = ["1a", "1b", "2b", "3", "4a", "4b", "5a", "5b", "9", "10"]
+else:
+    args = sys.argv[1:]
+
+def to_str(lst):
+    return [str(i) for i in lst]
+
+def progress_print(data):
+    print data,
+    open_file.write("%s " % data)
+    sys.stdout.flush()
+
+def progress_print_newline():
+    print("")
+    open_file.write("\n")
+    sys.stdout.flush()
+
+def call(command, params, no_cast=False):
+    if no_cast:
+        return subprocess.check_output(["python", "%s.py" % command] + to_str(params))
+    else:
+        v = []
+        for i in range(REPS):
+            v.append(float(subprocess.check_output(["python", "%s.py" % command] + to_str(params)).split()[0]))
+        return sum(v)/len(v)
+
+if "1a" in args:
+    open_file = open("result_1a", "w")
+    print("")
+    print("(1a) time in function of transition time (INC)")
+    for i in range(0, 10):
+        f = i/1000.0
+        progress_print(f)
+        progress_print(call("experiment_time_forward", [0, MAX_MEM, 10, 128, f]))
+        progress_print(call("experiment_time_jump", [0, MAX_MEM, 10, 128, f]))
+        progress_print(call("experiment_time_backwards", [0, MAX_MEM, 10, 128, f]))
+        progress_print_newline()
+    open_file.close()
+
+if "1b" in args:
+    open_file = open("result_1b", "w")
+    print("")
+    print("(1b) time in function of transition time (FULL)")
+    for i in range(0, 10):
+        f = i/1000.0
+        progress_print(f)
+        progress_print(call("experiment_time_forward", [0.5, MAX_MEM, 10, 128, f]))
+        progress_print(call("experiment_time_jump", [0.5, MAX_MEM, 10, 128, f]))
+        progress_print(call("experiment_time_backwards", [0.5, MAX_MEM, 10, 128, f]))
+        progress_print_newline()
+    open_file.close()
+
+if "2a" in args:
+    open_file = open("result_2a", "w")
+    print("")
+    print("(2a) time in function of number of models (INC)")
+    for i in range(10, 210, 10):
+        f = i
+        progress_print(f)
+        progress_print(call("experiment_time_forward", [0, MAX_MEM, f, 10000/f, 0.001]))
+        progress_print(call("experiment_time_jump", [0, MAX_MEM, f, 10000/f, 0.001]))
+        progress_print(call("experiment_time_backwards", [0, MAX_MEM, f, 10000/f, 0.001]))
+        progress_print_newline()
+    open_file.close()
+
+if "2a-bis" in args:
+    open_file = open("result_2a-bis", "w")
+    print("")
+    print("(2a-bis) time in function of number of models (FULL)")
+    for i in range(10, 210, 10):
+        f = i
+        progress_print(f)
+        progress_print(call("experiment_time_forward", [0.5, MAX_MEM, f, 10000/f, 0.001]))
+        progress_print(call("experiment_time_jump", [0.5, MAX_MEM, f, 10000/f, 0.001]))
+        progress_print(call("experiment_time_backwards", [0.5, MAX_MEM, f, 10000/f, 0.001]))
+        progress_print_newline()
+    open_file.close()
+
+if "2b" in args:
+    print("")
+    print("(2b) mem in function of number of models")
+    open_file = open("result_2b", "w")
+    for i in range(10, 1000, 100):
+        f = i
+        progress_print(f)
+        progress_print(call("experiment_mem_forward", [0, MAX_MEM, f, 10000/f, 0]))
+        progress_print(call("experiment_mem_forward", [0.5, MAX_MEM, f, 10000/f, 0]))
+        progress_print_newline()
+    open_file.close()
+
+if "3" in args:
+    open_file = open("result_3", "w")
+    print("")
+    print("(3) mem in function of model state size")
+    for i in range(0, 16):
+        f = 2**i
+        progress_print(f)
+        progress_print(call("experiment_mem_forward", [0, MAX_MEM, 10, f, 0.001]))
+        progress_print(call("experiment_mem_forward", [0.5, MAX_MEM, 10, f, 0.001]))
+        progress_print_newline()
+    open_file.close()
+
+if "4a" in args:
+    open_file = open("result_4a", "w")
+    print("")
+    print("(4a) jumping to specific points in time (INC)")
+    v = call("experiment_time_fakejump", [0, MAX_MEM, 20, 100, 0.0001], no_cast=True)
+    print(v)
+    open_file.write(v)
+    open_file.close()
+
+if "4b" in args:
+    open_file = open("result_4b", "w")
+    print("")
+    print("(4b) jumping to specific points in time (FULL)")
+    v = call("experiment_time_fakejump", [0.5, MAX_MEM, 20, 100, 0.0001], no_cast=True)
+    open_file.write(v)
+    print(v)
+    open_file.close()
+
+if "5a" in args:
+    open_file = open("result_5a", "w")
+    print("")
+    print("(5a) mem and disk in function of running simulation (INC)")
+    v = call("experiment_memdisk_periodical", [0, 100000, 10, 10240, 0], no_cast=True)
+    print(v)
+    open_file.write(v)
+    open_file.close()
+
+if "5b" in args:
+    open_file = open("result_5b", "w")
+    print("")
+    print("(5b) mem and disk in function of running simulation (FULL)")
+    v = call("experiment_memdisk_periodical", [0.2, 100000, 10, 10240, 0], no_cast=True)
+    print(v)
+    open_file.write(v)
+    open_file.close()
+
+if "6" in args:
+    open_file = open("result_6", "w")
+    print("")
+    print("(6) time in function of max delay")
+    for i in range(1, 100, 10):
+        f = i/10.0
+        progress_print(str(f))
+        progress_print(call("experiment_time_forward", [f, MAX_MEM, 10, 128, 0.001]))
+        progress_print(call("experiment_time_jump", [f, MAX_MEM, 10, 128, 0.001]))
+        progress_print(call("experiment_time_backwards", [f, MAX_MEM, 10, 128, 0.001]))
+        progress_print_newline()
+    open_file.close()
+
+if "7a" in args:
+    open_file = open("result_7a", "w")
+    print("")
+    print("(7a) time in function of max memory (INC)")
+    for i in range(1, 200, 10):
+        f = i * 1024
+        progress_print(f)
+        progress_print(call("experiment_time_forward", [0, f, 10, 128, 0.001]))
+        progress_print(call("experiment_time_jump", [0, f, 10, 128, 0.001]))
+        progress_print(call("experiment_time_backwards", [0, f, 10, 128, 0.001]))
+        progress_print_newline()
+    open_file.close()
+
+if "7b" in args:
+    open_file = open("result_7b", "w")
+    print("")
+    print("(7b) time in function of max memory (FULL)")
+    for i in range(1, 200, 10):
+        f = i * 1024
+        progress_print(f)
+        progress_print(call("experiment_time_forward", [0.5, f, 10, 128, 0.001]))
+        progress_print(call("experiment_time_jump", [0.5, f, 10, 128, 0.001]))
+        progress_print(call("experiment_time_backwards", [0.5, f, 10, 128, 0.001]))
+        progress_print_newline()
+    open_file.close()
+
+if "8" in args:
+    open_file = open("result_8", "w")
+    print("")
+    print("(8) time in function of state size")
+    for i in range(0, 16):
+        f = 2**i
+        progress_print(f)
+        progress_print(call("experiment_time_forward", [0, MAX_MEM, 10, f, 0]))
+        progress_print(call("experiment_time_forward", [0.5, MAX_MEM, 10, f, 0]))
+        progress_print_newline()
+    open_file.close()
+
+if "9" in args:
+    open_file = open("result_9", "w")
+    print("")
+    print("(9) time in function of number of models")
+    for i in range(10, 1000, 100):
+        f = i
+        progress_print(f)
+        progress_print(call("experiment_time_jump", [0, MAX_MEM, f, 1000000/f, 0]))
+        progress_print(call("experiment_time_jump", [0.1, MAX_MEM, f, 1000000/f, 0]))
+        progress_print_newline()
+    open_file.close()
+
+if "10" in args:
+    open_file = open("result_10", "w")
+    print("")
+    print("(10) influence of omniscient debugging")
+    for i in range(0, 16):
+        f = 2**i
+        progress_print(f)
+        progress_print(call("experiment_time_total", [0, MAX_MEM, 100, f, 0]))
+        progress_print(call("experiment_time_total", [0.1, MAX_MEM, 100, f, 0]))
+        progress_print(call("experiment_time_total", [0.5, MAX_MEM, 100, f, 0]))
+        progress_print(call("experiment_time_total", [9999999, MAX_MEM, 100, f, 0]))
+        progress_print_newline()
+    open_file.close()

+ 6 - 0
run_benchmarks.sh

@@ -0,0 +1,6 @@
+#!/bin/bash
+cd examples
+python run_experiments.py
+gnuplot plot
+
+echo "Results are now stored in the examples/ folder and plots have been generated."

+ 536 - 0
src/DEVS.py

@@ -0,0 +1,536 @@
+# -*- coding: Latin-1 -*-
+"""
+Classes and tools for DEVS model specification
+"""
+
+from devsexception import DEVSException
+
+class BaseDEVS(object):
+    """
+    Abstract base class for AtomicDEVS and CoupledDEVS classes.
+  
+    This class provides basic DEVS attributes and query/set methods.
+    """
+    def __init__(self, name):
+        """
+        Constructor
+
+        :param name: the name of the DEVS model
+        """
+    
+        # Prevent any attempt to instantiate this abstract class
+        if self.__class__ == BaseDEVS:
+            raise DEVSException ("Cannot instantiate abstract class '%s' ... " 
+                                 % (self.__class__.__name__))
+
+        # The parent of the current model
+        self.parent = None
+        # The local name of the model
+        self.name = name
+        self.IPorts  = []  
+        self.OPorts   = []
+        self.ports = []
+
+        # Initialise the times
+        self.timeLast = (0.0, 0)
+        self.timeNext = (0.0, 1)
+
+        self.location = None
+    
+        # Variables used for optimisations
+        self.myInput = {}  
+        self.myOutput = {}
+
+        # The state queue, used for time warp
+        self.oldStates = []
+        # List of all memoized states, only useful in distributed simulation 
+        #   with memoization enabled
+        self.memo = []
+
+    def modelTransition(self, state):
+        """
+        DEFAULT function for Dynamic Structure DEVS, always returning False (thus indicating that no structural change is needed)
+
+        :param state: a dict that can be used to save some kind of state, this object is maintained by the kernel and will be passed each time
+        :returns: bool -- whether or not a structural change is necessary
+        """
+        return False
+
+    def addPort(self, name, isInput):
+        """
+        Utility function to create a new port and add it everywhere where it is necessary
+
+        :param name: the name of the port
+        :param isInput: whether or not this is an input port
+        """
+        name = name if name is not None else "port%s" % len(self.ports)
+        port = Port(isInput=isInput, name=name) 
+        if isInput:
+            self.IPorts.append(port)
+        else:
+            self.OPorts.append(port)
+        port.port_id = len(self.ports)
+        self.ports.append(port)
+        port.hostDEVS = self
+        return port
+      
+    def addInPort(self, name=None):
+        """
+        Add an input port to the DEVS model.
+        
+        addInPort is the only proper way to add input ports to a DEVS model. 
+        As for the CoupledDEVS.addSubModel method, calls
+        to addInPort and addOutPort can appear in any DEVS'
+        descriptive class constructor, or the methods can be used with an
+        instantiated object.
+    
+        The methods add a reference to the new port in the DEVS' IPorts 
+        attributes and set the port's hostDEVS attribute. The modeler
+        should typically save the returned reference somewhere.
+
+        :param name: the name of the port. A unique ID will be generated in case None is passed
+        :returns: port -- the generated port
+        """
+        return self.addPort(name, True)
+      
+    def addOutPort(self, name=None):
+        """Add an output port to the DEVS model.
+
+        addOutPort is the only proper way to
+        add output ports to DEVS. As for the CoupledDEVS.addSubModel method, calls
+        to addInPort and addOutPort can appear in any DEVS'
+        descriptive class constructor, or the methods can be used with an
+        instantiated object.
+    
+        The methods add a reference to the new port in the DEVS'
+        OPorts attributes and set the port's hostDEVS attribute. The modeler
+        should typically save the returned reference somewhere.
+
+        :param name: the name of the port. A unique ID will be generated in case None is passed
+        :returns: port -- the generated port
+        """
+        return self.addPort(name, False)
+    
+    def getModelName(self):
+        """
+        Get the local model name
+
+        :returns: string -- the name of the model
+        """
+        return str(self.name)
+
+    def getModelFullName(self):
+        """
+        Get the full model name, including the path from the root
+
+        :returns: string -- the fully qualified name of the model
+        """
+        return self.fullName
+
+class AtomicDEVS(BaseDEVS):
+    """
+    Abstract base class for all atomic-DEVS descriptive classes.
+    """
+  
+    def __init__(self, name=None):
+        """
+        Constructor for an AtomicDEVS model
+
+        :param name: name of the model, can be None to have an automatically generated name
+        """
+        # Prevent any attempt to instantiate this abstract class
+        if self.__class__ == AtomicDEVS:
+            raise DEVSException("Cannot instantiate abstract class '%s' ... " 
+                                % (self.__class__.__name__))
+
+        # The minimal constructor shall first call the superclass
+        # (i.e., BaseDEVS) constructor.
+        BaseDEVS.__init__(self, name)
+    
+        self.elapsed = 0.0 
+        self.state = None
+
+    def extTransition(self, inputs):
+        """
+        DEFAULT External Transition Function.
+  
+        Accesses state and elapsed attributes, as well as inputs
+        through the passed dictionary. Returns the new state.
+
+        .. note:: Should only write to the *state* attribute.
+
+        :param inputs: dictionary containing all ports and their corresponding outputs
+        :returns: state -- the new state of the model
+        """
+        return self.state
+    
+    def intTransition(self):
+        """
+        DEFAULT Internal Transition Function.
+ 
+        .. note:: Should only write to the *state* attribute.
+
+        :returns: state -- the new state of the model
+
+        .. versionchanged:: 2.1 The *elapsed* attribute is no longer guaranteed to be correct as this isn't required by the DEVS formalism.
+
+        """
+        return self.state
+
+    def confTransition(self, inputs):
+        """
+        DEFAULT Confluent Transition Function.
+  
+        Accesses state and elapsed attributes, as well as inputs
+        through the passed dictionary. Returns the new state.
+
+        .. note:: Should only write to the *state* attribute.
+
+        :param inputs: dictionary containing all ports and their corresponding outputs
+        :returns: state -- the new state of the model
+        """
+        self.state = self.intTransition()
+        self.state = self.extTransition(inputs)
+        return self.state
+  
+    def outputFnc(self):
+        """
+        DEFAULT Output Function.
+  
+        Accesses only state attribute. Returns the output on the different ports as a dictionary.
+
+        .. note:: Should **not** write to any attribute.
+
+        :returns: dictionary containing output ports as keys and lists of output on that port as value
+
+        .. versionchanged:: 2.1 The *elapsed* attribute is no longer guaranteed to be correct as this isn't required by the DEVS formalism.
+
+        """
+        return {}
+  
+    def timeAdvance(self):
+        """
+        DEFAULT Time Advance Function.
+    
+        .. note:: Should ideally be deterministic, though this is not mandatory for simulation.
+
+        :returns: the time advance of the model
+
+        .. versionchanged:: 2.1 The *elapsed* attribute is no longer guaranteed to be correct as this isn't required by the DEVS formalism.
+
+        """
+        # By default, return infinity 
+        return float('inf')
+
+    def finalize(self, name, model_counter, model_ids, locations, selectHierarchy):
+        """
+        Finalize the model hierarchy by doing all pre-simulation configuration
+
+        .. note:: Parameters *model_ids* and *locations* are updated by reference.
+
+        :param name: the name of the hierarchy above
+        :param model_counter: the model ID counter
+        :param model_ids: a list with all model_ids and their model
+        :param locations: dictionary of locations and where every model runs
+        :param selectHierarchy: hierarchy to perform selections in Classic DEVS
+
+        :returns: int -- the new model ID counter
+        """
+        # Give a name
+        self.fullName = name + str(self.getModelName())
+
+        # Give a unique ID to the model itself
+        self.model_id = model_counter
+        self.selectHierarchy = selectHierarchy + [self]
+
+        # Add the element to its designated place in the model_ids list
+        model_ids.append(self)
+
+        # Do a quick check, since this is vital to correct operation
+        if model_ids[self.model_id] != self:
+            raise DEVSException("Something went wrong while initializing models: IDs don't match")
+
+        locations[self.location].append(self.model_id)
+
+        # Return the unique ID counter, incremented so it stays unique
+        return model_counter + 1
+
+class CoupledDEVS(BaseDEVS):
+    """
+    Abstract base class for all coupled-DEVS descriptive classes.
+    """
+  
+    def __init__(self, name=None):
+        """
+        Constructor.
+
+        :param name: the name of the coupled model, can be None for an automatically generated name
+        """
+        # Prevent any attempt to instantiate this abstract class
+        if self.__class__ == CoupledDEVS:
+            raise DEVSException("Cannot instantiate abstract class '%s' ... " 
+                                % (self.__class__.__name__))
+        # The minimal constructor shall first call the superclass
+        # (i.e., BaseDEVS) constructor.
+        BaseDEVS.__init__(self, name)
+    
+        # All components of this coupled model (the submodels)
+        self.componentSet = []
+
+    def finalize(self, name, model_counter, model_ids, locations, selectHierarchy):
+        """
+        Finalize the model hierarchy by doing all pre-simulation configuration
+
+        .. note:: Parameters *model_ids* and *locations* are updated by reference.
+
+        :param name: the name of the hierarchy above
+        :param model_counter: the model ID counter
+        :param model_ids: a list with all model_ids and their model
+        :param locations: dictionary of locations and where every model runs
+        :param selectHierarchy: hierarchy to perform selections in Classic DEVS
+
+        :returns: int -- the new model ID counter
+        """
+        # Set name, even though it will never be requested
+        self.fullName = name + str(self.getModelName())
+        for i in self.componentSet:
+            model_counter = i.finalize(self.fullName + ".", model_counter, 
+                    model_ids, locations, selectHierarchy + [self])
+        return model_counter
+
+    def addSubModel(self, model, location = None):
+        """
+        Adds a specified model to the current coupled model as its child. This
+        is the function that must be used to make distributed simulation
+        possible.
+
+        :param model: the model to be added as a child
+        :param location: the location at which the child must run
+        :returns: model -- the model that was created as a child
+
+        .. versionchanged:: 2.1.3
+           model can no longer be a string, this was previously a lot more efficient in partial distribution, though this functionality was removed together with the partial distribution functionality.
+        """
+        model.parent = self
+        if location is not None:
+            location = int(location)
+        model.location = location if location is not None else self.location
+        if model.location is not None and isinstance(model, CoupledDEVS):
+            # Set the location of all children
+            for i in model.componentSet:
+                i.setLocation(model.location)
+        self.componentSet.append(model)        
+        if hasattr(self, "fullName"):
+            # Full Name is only created when starting the simulation, so we are currently in a running simulation
+            # Dynamic Structure change
+            self.server.getSelfProxy().dsScheduleModel(model)
+        return model
+
+    def connectPorts(self, p1, p2, z = None):
+        """
+        Connects two ports together. The coupling is to begin at p1 and
+        to end at p2.
+
+        :param p1: the port at the start of the new connection
+        :param p2: the port at the end of the new connection
+        :param z: the translation function for the events
+                  either input-to-input, output-to-input or output-to-output.
+        """
+        # For a coupling to be valid, two requirements must be met:
+        # 1- at least one of the DEVS the ports belong to is a child of the
+        #    coupled-DEVS (i.e., self), while the other is either the
+        #    coupled-DEVS itself or another of its children. The DEVS'
+        #    'parenthood relationship' uniquely determine the type of coupling;
+        # 2- the types of the ports are consistent with the 'parenthood' of the
+        #    associated DEVS. This validates the coupling determined above.
+
+        # Internal Coupling:
+        if ((p1.hostDEVS.parent == self and p2.hostDEVS.parent == self) and
+                (p1.type() == 'OUTPORT' and p2.type() == 'INPORT')):
+            if p1.hostDEVS is p2.hostDEVS:
+                raise DEVSException(("In coupled model '%s', connecting ports" +
+                                    " '%s' and '%s' belong to the same model" +
+                                    " '%s'. " +
+                                    " Direct feedback coupling not allowed") % (
+                                    self.getModelFullName(),
+                                    p1.getPortFullName(),
+                                    p2.getPortFullName(),
+                                    p1.hostDEVS.getModelFullName()))
+            else:
+                p1.outLine.append(p2)
+                p2.inLine.append(p1)
+        
+        # External input couplings:
+        elif ((p1.hostDEVS == self and p2.hostDEVS.parent == self) and
+              (p1.type() == p2.type() == 'INPORT')):
+            p1.outLine.append(p2)
+            p2.inLine.append(p1)
+   
+        # Eternal output couplings:
+        elif ((p1.hostDEVS.parent == self and p2.hostDEVS == self) and
+              (p1.type() == p2.type() == 'OUTPORT')):
+            p1.outLine.append(p2)
+            p2.inLine.append(p1)
+
+        # Other cases (illegal coupling):
+        else:
+            raise DEVSException(("Illegal coupling in coupled model '%s' " +
+                                "between ports '%s' and '%s'") % (
+                                self.getModelName(), p1.getPortName(), 
+                                p2.getPortName()))
+
+        p1.zFunctions[p2] = z
+        if hasattr(self, "server"):
+            self.server.getSelfProxy().dsUndoDirectConnect()
+
+class RootDEVS(BaseDEVS):
+    """
+    The artificial RootDEVS model is the only 'coupled' model in the simulation after direct connection is performed.
+    """
+    def __init__(self, components, models, schedulerType):
+        """
+        Basic constructor.
+
+        :param components: the atomic DEVS models that are the cildren, only those that are ran locally should be mentioned
+        :param models: all models that have to be passed to the scheduler, thus all models, even non-local ones
+        :param schedulerType: type of scheduler to use (string representation)
+        """
+        BaseDEVS.__init__(self, "ROOT model")
+        self.componentSet = components
+        self.timeNext = (float('inf'), 1)
+        self.local_model_ids = set()
+        for i in self.componentSet:
+            self.local_model_ids.add(i.model_id)
+        self.models = models
+        self.schedulerType = schedulerType
+        self.directConnected = True
+
+    def directConnect(self):
+        """
+        Perform direct connection on the models again
+        """
+        directConnect(self.models, True)
+
+    def setTimeNext(self):
+        """
+        Reset the timeNext
+        """
+        try:
+            self.timeNext = self.scheduler.readFirst()
+        except IndexError:
+            # No element found in the scheduler, so put it to INFINITY
+            self.timeNext = (float('inf'), 1)
+
+class Port(object):
+    """
+    Class for DEVS model ports (both input and output). This class provides basic port attributes and query methods.
+    """
+    def __init__(self, isInput, name=None):
+        """
+        Constructor. Creates an input port if isInput evaluates to True, and
+        an output port otherwise.
+
+        :param isInput: whether or not this is an input port
+        :param name: the name of the port. If None is provided, a unique ID is generated
+        """
+        self.inLine = [] 
+        self.outLine = []
+        self.hostDEVS = None 
+        self.msgcount = 0
+   
+        # The name of the port
+        self.name = name
+        self.isInput = isInput
+        self.zFunctions = {}
+
+    def getPortName(self):
+        """
+        Returns the name of the port
+
+        :returns: local name of the port
+        """
+        return self.name
+
+    def getPortFullName(self):
+        """
+        Returns the complete name of the port
+
+        :returns: fully qualified name of the port
+        """
+        return "%s.%s" % (self.hostDEVS.getModelFullName(), self.getPortName())
+
+    def type(self):
+        """
+        Returns the 'type' of the object
+
+        :returns: either 'INPORT' or 'OUTPORT'
+        """
+        if self.isInput:
+            return 'INPORT'
+        else:
+            return 'OUTPORT'
+
+def appendZ(first_z, new_z):
+    if first_z is None:
+        return new_z
+    elif new_z is None:
+        return first_z
+    else:
+        return lambda x: new_z(first_z(x))
+
+def directConnect(componentSet, local):
+    """
+    Perform direct connection on this CoupledDEVS model
+
+    :param componentSet: the iterable to direct connect
+    :param local: whether or not simulation is local; if it is, dynamic structure code will be prepared
+    :returns: the direct connected componentSet
+    """
+    newlist = []
+    for i in componentSet:
+        if isinstance(i, CoupledDEVS):
+            componentSet.extend(i.componentSet)
+        else:
+            # Found an atomic model
+            newlist.append(i)
+    componentSet = newlist
+
+    # All and only all atomic models are now direct children of this model
+    for i in componentSet:
+        # Remap the output ports
+        for outport in i.OPorts:
+            # The new contents of the line
+            outport.routingOutLine = []
+            worklist = [(p, outport.zFunctions.get(p, None)) for p in outport.outLine]
+            for outline, z in worklist:
+                # If it is a coupled model, we must expand this model
+                if isinstance(outline.hostDEVS, CoupledDEVS):
+                    for inline in outline.outLine:
+                        # Add it to the current iterating list, so we can just continue
+                        worklist.append((inline, appendZ(z, outline.zFunctions[inline])))
+                        # If it is a Coupled model, we should just continue 
+                        # expanding it and not add it to the finished line
+                        if not isinstance(inline.hostDEVS, CoupledDEVS):
+                            outport.routingOutLine.append((inline, appendZ(z, outline.zFunctions[inline])))
+                else:
+                    for ol, z in outport.routingOutLine:
+                        if ol == outline:
+                            break
+                    else:
+                        # Add to the new line if it isn't already there
+                        # Note that it isn't really mandatory to check for this, 
+                        # it is a lot cleaner to do so.
+                        # This will greatly increase the complexity of the connector though
+                        outport.routingOutLine.append((outline, z))
+        # Remap the input ports: identical to the output ports, only in the reverse direction
+        for inport in i.IPorts:
+            inport.routingInLine = []
+            for inline in inport.inLine:
+                if isinstance(inline.hostDEVS, CoupledDEVS):
+                    for outline in inline.inLine:
+                        inport.inLine.append(outline)
+                        if not isinstance(outline.hostDEVS, CoupledDEVS):
+                            inport.routingInLine.append(outline)
+                elif inline not in inport.routingInLine:
+                    inport.routingInLine.append(inline)
+    return componentSet

+ 17 - 0
src/devsexception.py

@@ -0,0 +1,17 @@
+class DEVSException(Exception):
+    """
+    DEVS specific exceptions
+    """
+    def __init__(self, message="not specified in source"):
+        """
+        Constructor
+
+        :param message: error message to print
+        """
+        Exception.__init__(self, message)
+
+    def __str__(self):
+        """
+        String representation of the exception
+        """
+        return "DEVS Exception: " + str(self.message)

+ 1 - 0
src/infinity.py

@@ -0,0 +1 @@
+INFINITY = float('inf')

+ 0 - 0
src/python_runtime/__init__.py


+ 9 - 0
src/python_runtime/accurate_time.py

@@ -0,0 +1,9 @@
+import time as t
+import os
+
+if os.name == 'posix':
+	def time():
+		return t.time()
+elif os.name == 'nt':
+	def time():
+		return t.clock()

+ 58 - 0
src/python_runtime/event_queue.py

@@ -0,0 +1,58 @@
+from infinity import INFINITY
+
+class EventQueue(object):
+    class EventQueueEntry(object):        
+        def __init__(self, event_list, time_offset) :
+            self.event_list = event_list
+            self.time_offset = time_offset
+        
+        def decreaseTime(self, offset) :
+            self.time_offset -= offset;   
+        
+        def getEvents(self) :
+            return self.event_list
+        
+        def getTime (self) :
+            return self.time_offset
+
+    def __init__(self):
+        self.event_list = []
+
+    def add(self, event_list, time_offset) :
+        entry = EventQueue.EventQueueEntry(event_list, time_offset);
+        #We maintain a sorted stable list
+        insert_index = 0;
+        index = len(self.event_list)-1
+        while (index >= 0) :
+            if (self.event_list[index].getTime() <= time_offset) :
+                insert_index = index + 1;
+                break;
+            index -= 1
+        self.event_list.insert(insert_index, entry)
+    
+    def decreaseTime(self, offset) :
+        for event in self.event_list :
+            event.decreaseTime(offset)
+    
+    def isEmpty(self) :
+        return len(self.event_list) == 0
+    
+    def getEarliestTime(self) :
+        """Returns the earliest time. INFINITY if no events are present."""
+        if self.isEmpty() :
+            return INFINITY
+        else :
+            return self.event_list[0].getTime()
+    
+    def popDueEvents(self) :
+        result = []
+        if (self.isEmpty() or self.event_list[0].getTime() > 0.0) :
+            #There are no events, or the earliest event isn't due, so we can already return an emtpy result
+            return result
+
+        index = 0;
+        while (index < len(self.event_list) and self.event_list[index].getTime() <= 0.0) :
+            result.append(self.event_list[index].getEvents()) #Add all events that are due (offset less than 0) to the result
+            index += 1
+        self.event_list = self.event_list[len(result):]
+        return result;

+ 3 - 0
src/python_runtime/infinity.py

@@ -0,0 +1,3 @@
+# Instantiate singleton:        
+INFINITY = float('inf')
+

+ 1 - 0
src/python_runtime/libs/__init__.py

@@ -0,0 +1 @@
+

+ 59 - 0
src/python_runtime/libs/drawing.py

@@ -0,0 +1,59 @@
+"""
+ *REALLY* Small framework for creating/manipulating/deleting Tkinter Canvas elements.
+ 
+ NOTE: keep this synced with svg.js
+ 
+ Author: Raphael Mannadiar
+ Date: 2014/08/21
+"""
+
+from utils import utils
+
+
+class drawing:
+    class canvas_wrapper:
+        def __init__(self, element):
+            self.element = element
+            self.width = int(element.cget("width"))
+            self.height = int(element.cget("height"))
+
+        def add_circle(self, x, y, r, style):
+            new_element_id = self.element.create_oval(x-r, y-r, x+r, y+r, **style)
+            return drawing.ui_element_wrapper(self, new_element_id, x, y)
+
+        def add_rectangle(self, x, y, w, h, style):
+            new_element_id = self.element.create_rectangle(x-w/2.0, y-h/2.0, x+w/2.0, y+h/2.0, **style)
+            return drawing.ui_element_wrapper(self, new_element_id, x, y)
+
+        def remove_element(self, element):
+            self.element.delete(element.element_id)
+
+
+    class ui_element_wrapper:
+        def __init__(self, canvas_wrapper, element_id, x, y):
+            self.canvas_wrapper = canvas_wrapper
+            self.element_id = element_id
+            self.a = 0
+            self.x = x
+            self.y = y
+
+        def set_position(self, x, y):
+            self.move(x-self.x, y-self.y)
+
+        def get_position(self):
+            return utils._bunch(x=self.x, y=self.y)
+
+        def move(self, dx, dy):
+            self.x += dx
+            self.y += dy
+            self.canvas_wrapper.element.move(self.element_id, dx, dy)
+
+        def set_rotation(self, a):
+            raise Exception("Not implemented yet")
+
+        def rotate(self, a):
+            raise Exception("Not implemented yet")
+
+        def set_color(self, color):
+            self.canvas_wrapper.element.itemconfig(self.element_id, fill=color)
+

+ 107 - 0
src/python_runtime/libs/ui.py

@@ -0,0 +1,107 @@
+"""
+ *REALLY* Small framework for creating/manipulating/deleting gui elements in Tkinter.
+ 
+ NOTE: keep this synced with ui.js
+ 
+ Author: Raphael Mannadiar
+ Date: 2014/08/21
+"""
+
+import Tkinter as tk
+from python_runtime.statecharts_core import Event
+from drawing import drawing
+from utils import utils
+
+
+class ui:
+	window = None
+	__nextWindowId = 0
+
+	EVENTS = utils._bunch(
+		KEY_PRESS = 			'<Key>',
+		MOUSE_CLICK = 			'<Button>',
+		MOUSE_MOVE = 			'<Motion>',
+		MOUSE_PRESS =			'<ButtonPress>',
+		MOUSE_RELEASE =		'<ButtonRelease>',
+		MOUSE_RIGHT_CLICK =	'<Button-3>',
+		WINDOW_CLOSE = 		'WM_DELETE_WINDOW');
+
+	MOUSE_BUTTONS = utils._bunch(
+		LEFT		= 1,
+		MIDDLE	= 2,
+		RIGHT		= 3);
+
+	KEYCODES	= utils._bunch(
+		DELETE	= 46);
+
+	@staticmethod
+	def append_button(_window,text):
+		button = tk.Button(_window, text=text)
+		button.pack()
+		return ui.wrap_element(button)
+
+
+	@staticmethod
+	def append_canvas(_window,width,height,style):
+		canvas = tk.Canvas(_window,width=width,height=height)
+		canvas.config(**style)
+		canvas.pack()
+		return drawing.canvas_wrapper(canvas)
+
+
+	@staticmethod
+	def bind_event(source,event,controller,raise_name,port="ui",time_offset=0.0):
+
+		def __handle_event(ev=None):
+			if event == ui.EVENTS.KEY_PRESS :
+				controller.addInput(Event(raise_name, port, [ev.keycode,source]),time_offset)
+
+			elif event == ui.EVENTS.MOUSE_CLICK or \
+				  event == ui.EVENTS.MOUSE_MOVE or \
+				  event == ui.EVENTS.MOUSE_PRESS or \
+				  event == ui.EVENTS.MOUSE_RELEASE or \
+		  		  event == ui.EVENTS.MOUSE_RIGHT_CLICK :
+				controller.addInput(Event(raise_name, port, [ev.x, ev.y, ev.num]),time_offset)
+
+			elif event == ui.EVENTS.WINDOW_CLOSE :
+				controller.addInput(Event(raise_name, port, [source]),time_offset)
+
+			else :
+				raise Exception('Unsupported event');
+	
+		if event == ui.EVENTS.WINDOW_CLOSE :
+			source.protocol(event, __handle_event)
+
+		elif issubclass(drawing.ui_element_wrapper,source.__class__) :
+			source.canvas_wrapper.element.tag_bind(source.element_id, event, __handle_event)
+
+		else :
+			source.bind(event, __handle_event)
+
+
+	@staticmethod
+	def close_window(_window):
+		_window.destroy()
+
+
+	@staticmethod
+	def log(value):
+		print(value)
+
+
+	@staticmethod
+	def new_window(width,height):
+		_window = tk.Toplevel(ui.window)
+		_window.geometry(str(width)+"x"+str(height)+"+300+300")
+		return _window
+
+
+	@staticmethod
+	def println(value,target):
+		raise Exception('Not implemented yet');
+
+
+	@staticmethod
+	def wrap_element(element):
+		return utils._bunch(element=element)
+

+ 19 - 0
src/python_runtime/libs/utils.py

@@ -0,0 +1,19 @@
+import random
+
+class utils:
+
+	@staticmethod
+	def random():
+		return random.random()
+
+
+	"""
+		provide "." access to dictionaries
+
+		example: d = {'a':1}
+			before: d['a'] => 1, d.a => error
+			after:  d['a'] = d.a
+	"""
+	class _bunch:
+  		def __init__(self, **kwds):
+ 			self.__dict__.update(kwds)

+ 22 - 0
src/python_runtime/nextafter.py

@@ -0,0 +1,22 @@
+import imp
+
+try:
+	# if module 'numpy' exists, use it
+	found = imp.find_module('numpy')
+	nextafter = imp.load_module('numpy', *found).nextafter
+
+except ImportError:
+	import math
+	# this ad-hoc implementation won't always give the exact same result as the C implementation used by numpy, but it's good enough for our purposes
+	def nextafter(x, y):
+		m,e = math.frexp(x)
+		exp = e - 53
+		if exp < -1022 or m == 0.0:
+			exp = -1022
+		epsilon = math.ldexp(1.0, exp)
+		if y > x:
+			return x + epsilon
+		elif y < x:
+			return x - epsilon
+		else:
+			return x

+ 941 - 0
src/python_runtime/statecharts_core.py

@@ -0,0 +1,941 @@
+import abc
+import re
+from accurate_time import time
+import threading
+import traceback
+import math
+from nextafter import nextafter
+from infinity import INFINITY
+from event_queue import EventQueue
+from Queue import Queue, Empty
+
+class RuntimeException(Exception):
+	def __init__(self, message):
+		self.message = message
+	def __str__(self):
+		return repr(self.message)
+
+class AssociationException(RuntimeException):
+	pass
+
+class AssociationReferenceException(RuntimeException):
+	pass
+
+class ParameterException(RuntimeException):
+	pass
+
+class InputException(RuntimeException):
+	pass
+
+class Association(object):
+	#wrapper object for one association relation
+	def __init__(self, to_class, min_card, max_card):
+		self.to_class = to_class
+		self.min_card = min_card
+		self.max_card = max_card
+		self.instances = {}  # maps index (as string) to instance
+		self.instances_to_ids = {}
+		self.size = 0
+		self.next_id = 0
+		
+
+	def allowedToAdd(self):
+		return self.max_card == -1 or self.size < self.max_card
+		
+	def allowedToRemove(self):
+		return self.min_card == -1 or self.size > self.min_card
+		
+	def addInstance(self, instance):
+		if self.allowedToAdd() :
+			new_id = self.next_id
+			self.next_id += 1
+			self.instances[new_id] = instance
+			self.instances_to_ids[instance] = new_id
+			self.size += 1
+			return new_id
+		else :
+			raise AssociationException("Not allowed to add the instance to the association.")
+		
+	def removeInstance(self, instance):
+		if self.allowedToRemove() :
+			del self.instances[self.instances_to_ids[instance]]
+			del self.instances_to_ids[instance]
+			self.size -= 1
+		else :
+			raise AssociationException("Not allowed to remove the instance from the association.")
+		
+	def getInstance(self, index):
+		try :
+			return self.instances[index]
+		except IndexError :
+			raise AssociationException("Invalid index for fetching instance(s) from association.")
+
+"""class InstanceWrapper(object):
+	#wrapper object for an instance and its relevant information needed in the object manager
+	def __init__(self, instance, associations):
+		self.instance = instance
+		self.associations = {}
+		for association in associations :
+			self.associations[association.getName()] = association  
+		
+	def getAssociation(self, name):
+		try :
+			return self.associations[name]
+		except KeyError :
+			raise AssociationReferenceException("Unknown association %s." % name)
+	
+	def getInstance(self):
+		return self.instance"""
+
+class ObjectManagerBase(object):
+	__metaclass__  = abc.ABCMeta
+	
+	def __init__(self, controller):
+		self.controller = controller
+		self.events = EventQueue()
+		self.instances = set() #a dictionary that maps RuntimeClassBase to InstanceWrapper
+		
+	def addEvent(self, event, time_offset = 0.0):
+		self.events.add(event, time_offset)
+		
+	# Broadcast an event to all instances
+	def broadcast(self, new_event):
+		for i in self.instances:
+			i.addEvent(new_event)
+		
+	def getWaitTime(self):  
+		#first get waiting time of the object manager's events
+		smallest_time = self.events.getEarliestTime()
+		#check all the instances
+		for instance in self.instances:
+			smallest_time = min(smallest_time, instance.getEarliestEventTime())
+		return smallest_time
+	
+	def stepAll(self, delta):
+		self.step(delta)
+		for i in self.instances:
+			i.step(delta)
+
+	def step(self, delta):
+		self.events.decreaseTime(delta)
+		for event in self.events.popDueEvents() :
+			self.handleEvent(event)
+			   
+	def start(self):
+		for i in self.instances:
+			i.start()		  
+			   
+	def handleEvent(self, e):   
+		if e.getName() == "narrow_cast" :
+			self.handleNarrowCastEvent(e.getParameters())
+			
+		elif e.getName() == "broad_cast" :
+			self.handleBroadCastEvent(e.getParameters())
+			
+		elif e.getName() == "create_instance" :
+			self.handleCreateEvent(e.getParameters())
+			
+		elif e.getName() == "associate_instance" :
+			self.handleAssociateEvent(e.getParameters())
+			
+		elif e.getName() == "start_instance" :
+			self.handleStartInstanceEvent(e.getParameters())
+			
+		elif e.getName() == "delete_instance" :
+			self.handleDeleteInstanceEvent(e.getParameters())
+			
+	def processAssociationReference(self, input_string):
+		if len(input_string) == 0 :
+			raise AssociationReferenceException("Empty association reference.")
+		regex_pattern = re.compile("^([a-zA-Z_]\w*)(?:\[(\d+)\])?$")
+		path_string =  input_string.split("/")
+		result = []
+		for piece in path_string :
+			match = regex_pattern.match(piece)
+			if match :
+				name = match.group(1)
+				index = match.group(2)
+				if index is None :
+					index = -1
+				result.append((name,int(index)))
+			else :
+				raise AssociationReferenceException("Invalid entry in association reference. Input string: " + input_string)
+		return result
+	
+	def handleStartInstanceEvent(self, parameters):
+		if len(parameters) != 2 :
+			raise ParameterException ("The start instance event needs 2 parameters.")  
+		else :
+			source = parameters[0]
+			traversal_list = self.processAssociationReference(parameters[1])
+			for i in self.getInstances(source, traversal_list) :
+				i["instance"].start()
+			source.addEvent(Event("instance_started", parameters = [parameters[1]]))
+		
+	def handleBroadCastEvent(self, parameters):
+		if len(parameters) != 1 :
+			raise ParameterException ("The broadcast event needs 1 parameter.")
+		self.broadcast(parameters[0])
+
+	def handleCreateEvent(self, parameters):
+		if len(parameters) < 2 :
+			raise ParameterException ("The create event needs at least 2 parameters.")
+
+		source = parameters[0]
+		association_name = parameters[1]
+		
+		association = source.associations[association_name]
+		#association = self.instances_map[source].getAssociation(association_name)
+		if association.allowedToAdd() :
+			''' allow subclasses to be instantiated '''
+			class_name = association.to_class if len(parameters) == 2 else parameters[2]
+			new_instance = self.createInstance(class_name, parameters[3:])
+			if not new_instance:
+				raise ParameterException("Creating instance: no such class: " + class_name)
+			#index = association.addInstance(new_instance)
+			try:
+				index = association.addInstance(new_instance)
+			except AssociationException as exception:
+				raise RuntimeException("Error adding instance to association '" + association_name + "': " + str(exception))
+			p = new_instance.associations.get("parent")
+			if p:
+				p.addInstance(source)
+			source.addEvent(Event("instance_created", None, [association_name+"["+str(index)+"]"]))
+		else :
+			source.addEvent(Event("instance_creation_error", None, [association_name]))
+
+	def handleDeleteInstanceEvent(self, parameters):
+		if len(parameters) < 2 :
+			raise ParameterException ("The delete event needs at least 2 parameters.")
+		else :
+			source = parameters[0]
+			association_name = parameters[1]
+			traversal_list = self.processAssociationReference(association_name)
+			instances = self.getInstances(source, traversal_list)
+			#association = self.instances_map[source].getAssociation(traversal_list[0][0])
+			association = source.associations[traversal_list[0][0]]
+			for i in instances:
+				try:
+					association.removeInstance(i["instance"])
+					self.instances.discard(i["instance"])
+				except AssociationException as exception:
+					raise RuntimeException("Error removing instance from association '" + association_name + "': " + str(exception))
+				i["instance"].stop()
+				#if hasattr(i.instance, 'user_defined_destructor'):
+				i["instance"].user_defined_destructor()
+			source.addEvent(Event("instance_deleted", parameters = [parameters[1]]))
+				
+	def handleAssociateEvent(self, parameters):
+		if len(parameters) != 3 :
+			raise ParameterException ("The associate_instance event needs 3 parameters.")
+		else :
+			source = parameters[0]
+			to_copy_list = self.getInstances(source,self.processAssociationReference(parameters[1]))
+			if len(to_copy_list) != 1 :
+				raise AssociationReferenceException ("Invalid source association reference.")
+			wrapped_to_copy_instance = to_copy_list[0]["instance"]
+			dest_list = self.processAssociationReference(parameters[2])
+			if len(dest_list) == 0 :
+				raise AssociationReferenceException ("Invalid destination association reference.")
+			last = dest_list.pop()
+			if last[1] != -1 :
+				raise AssociationReferenceException ("Last association name in association reference should not be accompanied by an index.")
+				
+			for i in self.getInstances(source, dest_list) :
+				i["instance"].associations[last[0]].addInstance(wrapped_to_copy_instance)
+		
+	def handleNarrowCastEvent(self, parameters):
+		if len(parameters) != 3 :
+			raise ParameterException ("The associate_instance event needs 3 parameters.")
+		source = parameters[0]
+		traversal_list = self.processAssociationReference(parameters[1])
+		cast_event = parameters[2]
+		for i in self.getInstances(source, traversal_list) :
+			i["instance"].addEvent(cast_event)
+		
+	def getInstances(self, source, traversal_list):
+		currents = [{
+			"instance" : source,
+			"ref" : None,
+			"assoc_name" : None,
+			"assoc_index" : None
+		}]
+		#currents = [source]
+		for (name, index) in traversal_list :
+			nexts = []
+			for current in currents :
+				association = current["instance"].associations[name]
+				if (index >= 0 ) :
+					nexts.append({
+						"instance" : association.instances[index],
+						"ref" : current["instance"],
+						"assoc_name" : name,
+						"assoc_index" : index
+					})
+				elif (index == -1) :
+					for i in association.instances:
+						nexts.append({
+							"instance" : association.instances[i],
+							"ref" : current["instance"],
+							"assoc_name" : name,
+							"assoc_index" : index
+						})
+					#nexts.extend( association.instances.values() )
+				else :
+					raise AssociationReferenceException("Incorrect index in association reference.")
+			currents = nexts
+		return currents
+			
+	@abc.abstractmethod
+	def instantiate(self, class_name, construct_params):
+		pass
+		
+	def createInstance(self, to_class, construct_params = []):
+		instance = self.instantiate(to_class, construct_params)
+		self.instances.add(instance)
+		return instance
+	
+class Event(object):
+	def __init__(self, event_name, port = "", parameters = []):
+		self.name = event_name
+		self.parameters = parameters
+		self.port = port
+
+	def getName(self):
+		return self.name
+
+	def getPort(self):
+		return self.port
+
+	def getParameters(self):
+		return self.parameters
+	
+	def __repr__(self):
+		representation = "(event name : " + str(self.name) + "; port : " + str(self.port)
+		if self.parameters :
+			representation += "; parameters : " + str(self.parameters)
+		representation += ")"
+		return representation
+	
+class OutputListener(object):
+	def __init__(self, port_names):
+		self.port_names = port_names
+		self.queue = Queue()
+
+	def add(self, event):
+		if len(self.port_names) == 0 or event.getPort() in self.port_names :
+			self.queue.put_nowait(event)
+			
+	""" Tries for timeout seconds to fetch an event, returns None if failed.
+		0 as timeout means no waiting (blocking), returns None if queue is empty.
+		-1 as timeout means blocking until an event can be fetched. """
+	def fetch(self, timeout = 0):
+		if timeout < 0:
+			timeout = INFINITY
+		while timeout >= 0:
+			try:
+				# wait in chunks of 100ms because we
+				# can't receive (keyboard)interrupts while waiting
+				return self.queue.get(True, 0.1 if timeout > 0.1 else timeout)
+			except Empty:
+				timeout -= 0.1
+		return None
+
+class InputPortEntry(object):
+	def __init__(self, virtual_name, instance):
+		self.virtual_name = virtual_name
+		self.instance = instance
+		
+class ControllerBase(object):
+
+	def __init__(self, object_manager):
+		self.object_manager = object_manager
+
+		self.private_port_counter = 0
+
+		# Keep track of input ports
+		self.input_ports = {}
+		self.input_queue = EventQueue()
+
+		# Keep track of output ports
+		self.output_ports = []
+		self.output_listeners = []
+
+		# Let statechart run one last time before stopping
+		self.done = False
+			
+	def addInputPort(self, virtual_name, instance = None):
+		if instance == None :
+			port_name = virtual_name
+		else:
+			port_name = "private_" + str(self.private_port_counter) + "_" + virtual_name
+			self.private_port_counter += 1
+		self.input_ports[port_name] = InputPortEntry(virtual_name, instance)
+		return port_name
+		
+	def addOutputPort(self, port_name):
+		self.output_ports.append(port_name)
+
+	def broadcast(self, new_event):
+		self.object_manager.broadcast(new_event)
+		
+	def start(self):
+		self.object_manager.start()
+	
+	def stop(self):
+		pass
+
+	def addInput(self, input_event_list, time_offset = 0.0):
+		if not isinstance(input_event_list, list):
+			input_event_list = [input_event_list]
+
+		for e in input_event_list:
+			if e.getName() == ""  :
+				raise InputException("Input event can't have an empty name.")
+		
+			if e.getPort() not in self.input_ports :
+				raise InputException("Input port mismatch, no such port: " + e.getPort() + ".")	 
+
+		self.input_queue.add(input_event_list, time_offset)
+
+	def getWaitTime(self):
+		return min(self.object_manager.getWaitTime(), self.input_queue.getEarliestTime())
+
+	def handleInput(self, delta):
+		self.input_queue.decreaseTime(delta)
+		for events in self.input_queue.popDueEvents():
+			for e in events:
+				input_port = self.input_ports[e.getPort()]
+				e.port = input_port.virtual_name
+				target_instance = input_port.instance
+				if target_instance == None:
+					self.broadcast(e)
+				else:
+					target_instance.addEvent(e)
+
+	def outputEvent(self, event):
+		for listener in self.output_listeners :
+			listener.add(event)
+
+	def addOutputListener(self, ports):
+		listener = OutputListener(ports)
+		self.output_listeners.append(listener)
+		return listener
+
+	def addMyOwnOutputListener(self, listener):
+		self.output_listeners.append(listener)
+
+	# deprecated, to add multiple events, use addInput instead
+	def addEventList(self, event_list):
+		for (event, time_offset) in event_list :
+			self.addInput(event, time_offset)
+			
+	def getObjectManager(self):
+		return self.object_manager
+		
+class GameLoopControllerBase(ControllerBase):
+	def __init__(self, object_manager):
+		ControllerBase.__init__(self, object_manager)
+		
+	def update(self, delta):
+		self.handleInput(delta)
+		self.object_manager.stepAll(delta)
+
+class EventLoop:
+	# parameters:
+	#  schedule - a callback scheduling another callback in the event loop
+	#      this callback should take 2 parameters: (callback, timeout) and return an ID
+	#  clear - a callback that clears a scheduled callback
+	#      this callback should take an ID that was returned by 'schedule'
+	def __init__(self, schedule, clear):
+		self.schedule_callback = schedule
+		self.clear_callback = clear
+		self.scheduled_id = None
+		self.last_time = None
+		self.next_wakeup = None
+		self.last_print = 0.0
+
+	def getScheduledTimeout(self):
+		if self.last_time and self.next_wakeup:
+			return self.next_wakeup - self.last_time
+		else:
+			return INFINITY
+
+	# schedule relative to last_time
+	#
+	# argument 'wait_time' is the amount of virtual (simulated) time to wait
+	#
+	# NOTE: if the next wakeup (in simulated time) is in the past, the timeout is '0',
+	# but because scheduling '0' timeouts hurts performance, we don't schedule anything
+	# and return False instead
+	def schedule(self, f, wait_time):
+		if self.scheduled_id:
+			# if the following error occurs, it is probably due to a flaw in the logic of EventLoopControllerBase
+			raise RuntimeException("EventLoop class intended to maintain at most 1 scheduled callback.")
+
+		if wait_time == INFINITY:
+			self.last_time = None
+			self.next_wakeup = None
+			is_scheduled = True
+		else:
+			now = time()
+			if not self.last_time:
+				self.last_time = now
+			self.next_wakeup = self.last_time + wait_time
+			# self.last_time is a very large value, and wait_time can be very small, so 
+			if self.next_wakeup - self.last_time < wait_time:
+				# due to floating point imprecision, it is possible for a nonzero wait-time to advance simulated time not enough to pop the next event, potentially even causing the model to hang, so we always take the ceil of the exact result of the addition self.last_time + wait_time.
+				self.next_wakeup = nextafter(self.next_wakeup, INFINITY)
+			remaining = max(self.next_wakeup - now, 0.0)
+			is_scheduled, self.scheduled_id = self.schedule_callback(f, remaining)
+		return is_scheduled
+
+	def clear(self):
+		if self.scheduled_id:
+			self.clear_callback(self.scheduled_id)
+			self.scheduled_id = None
+
+	def nextDelta(self):
+		now = time()
+		if self.next_wakeup:
+			simulated_now = self.next_wakeup
+		else:
+			simulated_now = now
+		if now - self.last_print > 1.0:
+			behind_schedule = now - simulated_now
+			if behind_schedule > 0.1:
+				print "Warning: running %.f ms behind schedule" % (behind_schedule*1000.0)
+				self.last_print = now
+		if self.last_time:
+			delta = simulated_now - self.last_time
+		else:
+			delta = 0.0
+		self.last_time = simulated_now
+		self.next_wakeup = None
+		return delta
+
+	# returns elapsed time since delta
+	def elapsed(self):
+		if self.last_time:
+			return time() - self.last_time
+		else:
+			return 0.0
+
+class EventLoopControllerBase(ControllerBase):
+	def __init__(self, object_manager, event_loop, finished_callback = None):
+		ControllerBase.__init__(self, object_manager)
+		self.event_loop = event_loop
+		self.finished_callback = finished_callback
+
+	def addInput(self, input_event, time_offset = 0.0):
+		elapsed = self.event_loop.elapsed()
+		controller_timeout = time_offset + elapsed
+		ControllerBase.addInput(self, input_event, controller_timeout)
+		if controller_timeout < self.event_loop.getScheduledTimeout():
+			# added event's timeout is sooner than existing timeout -> re-schedule
+			self.event_loop.clear()
+			if not self.event_loop.schedule(self.run, controller_timeout):
+				self.run()
+
+	def start(self):
+		ControllerBase.start(self)
+		self.run()
+
+	def stop(self):
+		self.event_loop.clear()
+		ControllerBase.stop(self)
+
+	def run(self):
+		while True:
+			# clear existing timeout
+			self.event_loop.clear()
+			# calculate last time since simulation
+			delta = self.event_loop.nextDelta()
+			# simulate
+			self.handleInput(delta)
+			self.object_manager.stepAll(delta)
+			# schedule next timeout
+			wait_time = self.getWaitTime()
+			scheduled = self.event_loop.schedule(self.run, wait_time)
+			if wait_time == INFINITY:
+				if self.finished_callback:
+					self.finished_callback()
+			if scheduled:
+				break
+		
+class ThreadsControllerBase(ControllerBase):
+	def __init__(self, object_manager, keep_running):
+		ControllerBase.__init__(self, object_manager)
+		self.keep_running = keep_running
+		self.input_condition = threading.Condition()
+		self.stop_thread = False
+		self.thread = threading.Thread(target=self.run)
+		
+	def handleInput(self, delta):
+		with self.input_condition:
+		    ControllerBase.handleInput(self, delta)
+		
+	def start(self):
+		self.thread.start()
+		
+	def stop(self):
+		with self.input_condition:
+		    self.stop_thread = True
+		    self.input_condition.notifyAll()
+
+	def getWaitTime(self):
+		"""Compute time untill earliest next event"""
+		with self.input_condition:
+		    wait_time = ControllerBase.getWaitTime(self)
+
+		if wait_time == INFINITY :
+			if self.done :
+				self.done = False
+			else :
+				self.done = True
+				return 0.0
+		return wait_time
+
+	def handleWaiting(self):
+		with self.input_condition:
+		    wait_time = self.getWaitTime()
+		    if(wait_time <= 0.0):
+			    return
+		    
+		    if wait_time == INFINITY :
+			    if self.keep_running :
+				    self.input_condition.wait() #Wait for a signals
+			    else :
+				    self.stop_thread = True
+		    
+		    elif wait_time != 0.0 :
+			    reduced_wait_time = wait_time - (time() - self.last_recorded_time)
+			    if reduced_wait_time > 0.0 :
+				    self.input_condition.wait(reduced_wait_time)    
+
+	def run(self):
+		self.last_recorded_time  = time()
+		super(ThreadsControllerBase, self).start()
+		last_iteration_time = 0.0
+		
+		while True:
+			with self.input_condition:
+			    self.handleInput(last_iteration_time)
+			#Compute the new state based on internal events
+			self.object_manager.stepAll(last_iteration_time)
+			
+			self.handleWaiting()
+			
+			with self.input_condition:
+			    if self.stop_thread : 
+				    break
+			
+			previous_recorded_time = self.last_recorded_time
+			self.last_recorded_time = time()
+			last_iteration_time = self.last_recorded_time - previous_recorded_time
+		
+	def join(self):
+		self.thread.join()
+
+	def addInput(self, input_event, time_offset = 0.0):
+		with self.input_condition:
+		    super(ThreadsControllerBase, self).addInput(input_event, time_offset)
+		    self.input_condition.notifyAll()
+
+	def addEventList(self, event_list):
+		with self.input_condition:
+		    super(ThreadsControllerBase, self).addEventList(event_list)
+
+class StatechartSemantics:
+	# Big Step Maximality
+	TakeOne = 0
+	TakeMany = 1
+	# Concurrency - not implemented yet
+	Single = 0
+	Many = 1
+	# Preemption - not implemented yet
+	NonPreemptive = 0
+	Preemptive = 1
+	# Internal Event Lifeline
+	Queue = 0
+	NextSmallStep = 1
+	NextComboStep = 2
+	# Input Event Lifeline
+	Whole = 0
+	FirstSmallStep = 1
+	FirstComboStep = 2
+	# Priority
+	SourceParent = 0
+	SourceChild = 1
+	# TODO: add Memory Protocol options
+	
+	def __init__(self):
+		# default semantics:
+		self.big_step_maximality = self.TakeMany
+		self.concurrency = self.Single
+		self.internal_event_lifeline = self.Queue
+		#self.input_event_lifeline = self.FirstComboStep
+		self.input_event_lifeline = self.FirstSmallStep
+		self.priority = self.SourceParent
+
+class RuntimeClassBase(object):
+	__metaclass__  = abc.ABCMeta
+	
+	def __init__(self, controller):
+		self.active = False
+		self.is_stable = True
+		self.events = EventQueue()
+
+		self.controller = controller
+
+		self.timers = None
+		self.inports = {}
+
+		self.semantics = StatechartSemantics()
+
+	def start(self):
+		self.current_state = {}
+		self.history_state = {}
+		self.timers = {}
+
+		self.big_step = BigStepState()
+		self.combo_step = ComboStepState()
+		self.small_step = SmallStepState()
+
+		self.active = True
+		self.is_stable = False
+
+		self.initializeStatechart()
+		self.processBigStepOutput()
+	
+	def stop(self):
+		self.active = False
+		
+	def addEvent(self, event_list, time_offset = 0.0):
+		if not isinstance(event_list, list):
+			event_list = [event_list]
+		self.events.add(event_list, time_offset)
+		
+	def getEarliestEventTime(self) :
+		if not self.active:
+			return INFINITY
+		if not self.is_stable:
+			return 0.0
+		if self.timers:
+			return min(self.events.getEarliestTime(), min(self.timers.itervalues()))
+		return self.events.getEarliestTime()
+
+	def processBigStepOutput(self):
+		for e in self.big_step.getOutputEvents():
+			self.controller.outputEvent(e)
+		for e in self.big_step.getOutputEventsOM():
+			self.controller.object_manager.addEvent(e)
+
+	def step(self, delta):
+		if not self.active :
+			return
+		
+		# decrease event queue time
+		self.events.decreaseTime(delta)
+
+		# decrease timers time
+		next_timers = {}
+		for (key,value) in self.timers.iteritems() :
+			time = value - delta
+			if time <= 0.0 :
+				self.addEvent( Event("_" + str(key) + "after"), time)
+			else :
+				next_timers[key] = time
+		self.timers = next_timers
+
+		# execute big step(s)
+		due = self.events.popDueEvents()
+		if not due and not self.is_stable:
+			due = [[]]
+		for input_events in due:
+			# perform 1 big step per slot in 'due'
+			self.is_stable = not self.bigStep(input_events)
+			self.processBigStepOutput()
+
+	def inState(self, nodes):
+		for c in self.current_state.itervalues():
+			new_nodes = []
+			for n in nodes:
+				if not (n in c):
+					new_nodes.append(n)
+			nodes = new_nodes
+			if len(nodes) == 0:
+				return True
+		return False
+
+	def bigStep(self, input_events):
+		#print "new big step"
+		self.big_step.next(input_events)
+		self.small_step.reset()
+		self.combo_step.reset()
+		while self.comboStep():
+			self.big_step.setStepped()
+			if self.semantics.big_step_maximality == StatechartSemantics.TakeOne:
+				break # Take One -> only one combo step allowed
+		return self.big_step.hasStepped()
+
+	def comboStep(self):
+		#print "new combo step"
+		self.combo_step.next()
+		while self.smallStep():
+			self.combo_step.setStepped()
+		return self.combo_step.hasStepped()
+
+	def smallStep(self):
+		if self.small_step.hasStepped():
+			self.small_step.next()
+		self.generateCandidates()
+		if self.small_step.hasCandidates():
+			#print "new small step, have " + str(len(self.small_step.getCandidates())) + " candidates"
+			if self.semantics.concurrency == StatechartSemantics.Single:
+				transition, parameters = self.small_step.getCandidates()[0] # execute first of candidates
+				transition(parameters)
+			elif self.semantics.concurrency == StatechartSemantics.Many:
+				pass # TODO: implement
+			self.small_step.setStepped()
+		return self.small_step.hasStepped()
+
+	def getEnabledEvents(self):
+		result = self.small_step.getCurrentEvents() + self.combo_step.getCurrentEvents()
+		if self.semantics.input_event_lifeline == StatechartSemantics.Whole or (
+			not self.big_step.hasStepped() and
+				(self.semantics.input_event_lifeline == StatechartSemantics.FirstComboStep or (
+				not self.combo_step.hasStepped() and
+					self.semantics.input_event_lifeline == StatechartSemantics.FirstSmallStep))):
+			result += self.big_step.getInputEvents()
+		return result
+
+	def raiseInternalEvent(self, event):
+		if self.semantics.internal_event_lifeline == StatechartSemantics.NextSmallStep:
+			self.small_step.addNextEvent(event)
+		elif self.semantics.internal_event_lifeline == StatechartSemantics.NextComboStep:
+			self.combo_step.addNextEvent(event)
+		elif self.semantics.internal_event_lifeline == StatechartSemantics.Queue:
+			self.events.add([event], 0.0)
+
+	@abc.abstractmethod
+	def initializeStatechart(self):
+		pass
+
+	@abc.abstractmethod
+	def generateCandidates(self):
+		pass
+
+
+class BigStepState(object):
+	def __init__(self):
+		self.input_events = [] # input events received from environment before beginning of big step (e.g. from object manager, from input port)
+		self.output_events_port = [] # output events to be sent to output port after big step ends.
+		self.output_events_om = [] # output events to be sent to object manager after big step ends.
+		self.has_stepped = True
+
+	def next(self, input_events):
+		self.input_events = input_events
+		self.output_events_port = []
+		self.output_events_om = []
+		self.has_stepped = False
+
+	def getInputEvents(self):
+		return self.input_events
+
+	def getOutputEvents(self):
+		return self.output_events_port
+
+	def getOutputEventsOM(self):
+		return self.output_events_om
+
+	def outputEvent(self, event):
+		self.output_events_port.append(event)
+
+	def outputEventOM(self, event):
+		self.output_events_om.append(event)
+
+	def setStepped(self):
+		self.has_stepped = True
+
+	def hasStepped(self):
+		return self.has_stepped
+
+
+class ComboStepState(object):
+	def __init__(self):
+		self.current_events = [] # set of enabled events during combo step
+		self.next_events = [] # internal events that were raised during combo step
+		self.changed = [] # set of all or-states that were the arena of a triggered transition during big step.
+		self.has_stepped = True
+
+	def reset(self):
+		self.current_events = []
+		self.next_events = []
+
+	def next(self):
+		self.current_events = self.next_events
+		self.next_events = []
+		self.changed = []
+		self.has_stepped = False
+
+	def addNextEvent(self, event):
+		self.next_events.append(event)
+
+	def getCurrentEvents(self):
+		return self.current_events
+
+	def setArenaChanged(self, arena):
+		self.changed.append(arena)
+
+	def isArenaChanged(self, arena):
+		return (arena in self.changed)
+
+	def isStable(self):
+		return (len(self.changed) == 0)
+
+	def setStepped(self):
+		self.has_stepped = True
+
+	def hasStepped(self):
+		return self.has_stepped
+
+
+class SmallStepState(object):
+	def __init__(self):
+		self.current_events = [] # set of enabled events during small step
+		self.next_events = [] # events to become 'current' in the next small step
+		self.candidates = [] # document-ordered(!) list of transitions that can potentially be executed concurrently, or preempt each other, depending on concurrency semantics. If no concurrency is used and there are multiple candidates, the first one is chosen. Source states of candidates are *always* orthogonal to each other.
+		self.has_stepped = True
+
+	def reset(self):
+		self.current_events = []
+		self.next_events = []
+
+	def next(self):
+		self.current_events = self.next_events # raised events from previous small step
+		self.next_events = []
+		self.candidates = []
+		self.has_stepped = False
+
+	def addNextEvent(self, event):
+		self.next_events.append(event)
+
+	def getCurrentEvents(self):
+		return self.current_events
+
+	def addCandidate(self, t, p):
+		self.candidates.append((t, p))
+
+	def getCandidates(self):
+		return self.candidates
+
+	def hasCandidates(self):
+		return len(self.candidates) > 0
+
+	def setStepped(self):
+		self.has_stepped = True
+
+	def hasStepped(self):
+		return self.has_stepped
+

+ 21 - 0
src/python_runtime/tkinter_eventloop.py

@@ -0,0 +1,21 @@
+from statecharts_core import EventLoop
+import math
+
+class TkEventLoop(EventLoop):
+	def __init__(self, tk):
+	
+		tk.sccd_force_update = False
+
+		# bind scheduler callback
+		def schedule(callback, timeout):
+			if timeout == 0:
+			# tk considers updating the window an 'idle' task, only to be done if no events are scheduled for a while. But this has the downside of the interface becoming completely unresponsive while the model is performing steps with no gaps in between. Thus we insert an 'update_idletasks()' to obtain "javascript event loop"-like behavior.
+				if tk.sccd_force_update:
+					tk.update_idletasks()
+					tk.sccd_force_update = False
+				else:
+					return (False, None) # don't schedule 0-timeout, it's more performant to just keep running
+			return (True, tk.after(int(math.ceil(timeout*1000.0)), callback))
+
+		EventLoop.__init__(self, schedule, tk.after_cancel)
+

+ 0 - 0
src/python_sccd_compiler/__init__.py


+ 14 - 0
src/python_sccd_compiler/compiler_exceptions.py

@@ -0,0 +1,14 @@
+class CompilerException(Exception):
+	def __init__(self, message):
+		self.message = message
+	def __str__(self):
+		return repr(self.message)
+	
+class TransitionException(CompilerException):
+	pass
+
+class UnprocessedException(CompilerException):
+	pass
+
+class CodeBlockException(CompilerException):
+	pass

+ 911 - 0
src/python_sccd_compiler/generic_generator.py

@@ -0,0 +1,911 @@
+# Generic Generator by Joeri Exelmans
+#
+# Visits SCCD-domain constructs (see sccd_constructs.py) and converts them
+# to a generic language AST (see generic_language_constructs.py), that can
+# then be visited by a target language writer.
+
+import traceback
+
+import time
+from utils import Enum, Logger
+
+from visitor import Visitor
+from sccd_constructs import FormalParameter
+from stateful_writer import StatefulWriter
+import generic_language_constructs as GLC
+
+Platforms = Enum("Threads","GameLoop","EventLoop") 
+
+class GenericGenerator(Visitor):
+	
+	def __init__(self, platform):
+		self.platform = platform
+		self.writer = StatefulWriter()
+
+	def generic_visit(self, node):
+		Logger.showWarning("GenericGenerator has no visit method for node of type '" + str(type(node)) + "'.")
+
+	def get(self):
+		return self.writer.get()
+
+	def visit_ClassDiagram(self, class_diagram):
+		header = ("Generated by Statechart compiler by Glenn De Jonghe and Joeri Exelmans\n"
+		          "\n"
+		          "Date:   " + time.asctime() + "\n")
+		if class_diagram.name or class_diagram.author or class_diagram.description:
+			header += "\n"
+		if class_diagram.author:
+			header += "Model author: " + class_diagram.author + "\n"
+		if class_diagram.name:
+			header += "Model name:   " + class_diagram.name + "\n"
+		if class_diagram.description.strip():
+			header += "Model description:\n"
+			header += class_diagram.description.strip()
+
+		self.writer.addMultiLineComment(header)
+		self.writer.addVSpace()
+		self.writer.addInclude(([GLC.RuntimeModuleIdentifier(), "statecharts_core"]))
+		if class_diagram.top.strip():
+			self.writer.addRawCode(class_diagram.top)
+		self.writer.addVSpace()
+
+		self.writer.beginPackage(class_diagram.name)
+		
+		#visit children
+		for c in class_diagram.classes :
+			c.accept(self)
+		 
+		self.writer.beginClass("ObjectManager", ["ObjectManagerBase"])
+
+		self.writer.beginConstructor()
+		self.writer.addFormalParameter("controller")
+		self.writer.beginMethodBody()
+		self.writer.beginSuperClassConstructorCall("ObjectManagerBase")
+		self.writer.addActualParameter("controller")
+		self.writer.endSuperClassConstructorCall()
+		self.writer.endMethodBody()
+		self.writer.endConstructor()
+
+		self.writer.beginMethod("instantiate")
+		self.writer.addFormalParameter("class_name")
+		self.writer.addFormalParameter("construct_params")
+		self.writer.beginMethodBody()
+		for index,c in enumerate(class_diagram.classes):
+			self.writer.beginElseIf(GLC.EqualsExpression("class_name", GLC.String(c.name)))
+			if c.isAbstract():
+				# cannot instantiate abstract class
+				self.writer.add(GLC.ThrowExceptionStatement(GLC.String("Cannot instantiate abstract class \"" + c.name + "\" with unimplemented methods \"" + "\", \"".join(c.abstract_method_names) + "\".")))
+			else:
+				new_expr = GLC.NewExpression(c.name, [GLC.SelfProperty("controller")])
+				param_count = 0
+				for p in c.constructors[0].parameters:
+					new_expr.getActualParameters().add(GLC.ArrayIndexedExpression("construct_params", str(param_count)))
+					param_count += 1
+				self.writer.addAssignment(
+					GLC.LocalVariableDeclaration("instance"),
+					new_expr)
+				self.writer.addAssignment(
+					GLC.Property("instance", "associations"),
+					GLC.MapExpression())
+				for a in c.associations:
+					a.accept(self)
+			self.writer.endElseIf()
+		self.writer.add(GLC.ReturnStatement("instance"))
+		self.writer.endMethodBody()
+		self.writer.endMethod()
+		self.writer.endClass() # ObjectManager
+
+		if self.platform == Platforms.Threads:
+			controller_sub_class = "ThreadsControllerBase"
+		if self.platform == Platforms.EventLoop :
+			controller_sub_class = "EventLoopControllerBase"
+		elif self.platform == Platforms.GameLoop :
+			controller_sub_class = "GameLoopControllerBase"
+
+		self.writer.beginClass("Controller", [controller_sub_class])
+		self.writer.beginConstructor()
+		for p in class_diagram.default_class.constructors[0].parameters:
+			p.accept(self)
+		if self.platform == Platforms.EventLoop:
+			self.writer.addFormalParameter("event_loop_callbacks")
+			self.writer.addFormalParameter("finished_callback", GLC.NoneExpression())
+		elif self.platform == Platforms.Threads:
+			self.writer.addFormalParameter("keep_running", GLC.TrueExpression())
+		self.writer.beginMethodBody()
+		self.writer.beginSuperClassConstructorCall(controller_sub_class)
+		self.writer.addActualParameter(GLC.NewExpression("ObjectManager", [GLC.SelfExpression()]))
+		if self.platform == Platforms.EventLoop:
+			self.writer.addActualParameter("event_loop_callbacks")
+			self.writer.addActualParameter("finished_callback")
+		elif self.platform == Platforms.Threads:
+			self.writer.addActualParameter("keep_running")
+		self.writer.endSuperClassConstructorCall()
+		for i in class_diagram.inports:
+			self.writer.add(GLC.FunctionCall(GLC.SelfProperty("addInputPort"), [GLC.String(i)]))
+		for o in class_diagram.outports:
+			self.writer.add(GLC.FunctionCall(GLC.SelfProperty("addOutputPort"), [GLC.String(o)]))
+		actual_parameters = [p.getIdent() for p in class_diagram.default_class.constructors[0].parameters]
+		self.writer.add(GLC.FunctionCall(GLC.Property(GLC.SelfProperty("object_manager"), "createInstance"), [GLC.String(class_diagram.default_class.name), GLC.ArrayExpression(actual_parameters)]))
+		self.writer.endMethodBody()
+		self.writer.endConstructor()
+		self.writer.endClass() # Controller
+
+		# Visit test node if there is one
+		if class_diagram.test:
+			class_diagram.test.accept(self)
+
+		self.writer.endPackage()
+
+	def visit_DiagramTest(self, test):
+		# helper class
+		self.writer.beginClass("InputEvent")
+		self.writer.beginConstructor()
+		self.writer.addFormalParameter("name")
+		self.writer.addFormalParameter("port")
+		self.writer.addFormalParameter("parameters")
+		self.writer.addFormalParameter("time_offset")
+		self.writer.beginMethodBody()
+		self.writer.addAssignment(GLC.SelfProperty("name"), "name")
+		self.writer.addAssignment(GLC.SelfProperty("port"), "port")
+		self.writer.addAssignment(GLC.SelfProperty("parameters"), "parameters")
+		self.writer.addAssignment(GLC.SelfProperty("time_offset"), "time_offset")
+		self.writer.endMethodBody()
+		self.writer.endConstructor()
+		self.writer.endClass()
+		self.writer.beginClass("Test")
+		if test.input:
+			test.input.accept(self)
+		else:
+			self.writer.addStaticAttribute("input_events", GLC.ArrayExpression())
+		if test.expected:
+			test.expected.accept(self)
+		else:
+			self.writer.addStaticAttribute("expected_events", GLC.ArrayExpression())
+		self.writer.endClass()
+
+	def visit_DiagramTestInput(self, test_input):
+		# write array of input events
+		self.writer.startRecordingExpression()
+		self.writer.beginArray()
+		for e in test_input.input_events:
+			e.accept(self)
+		self.writer.endArray()
+		array_expr = self.writer.stopRecordingExpression()
+		self.writer.addStaticAttribute("input_events", array_expr)
+
+	def visit_DiagramTestInputEvent(self, event):
+		self.writer.add(GLC.NewExpression("InputEvent", [GLC.String(event.name), GLC.String(event.port), GLC.ArrayExpression(event.parameters), event.time]))
+
+	def visit_DiagramTestExpected(self, test_expected):
+		# write array of slots containing expected events
+		self.writer.startRecordingExpression()
+		self.writer.beginArray()
+		for s in test_expected.slots:
+			s.accept(self)
+		self.writer.endArray()
+		array_expr = self.writer.stopRecordingExpression()
+		self.writer.addStaticAttribute("expected_events", array_expr)
+
+	def visit_DiagramTestExpectedSlot(self, slot):
+		# write slot
+		self.writer.beginArray()
+		for e in slot.expected_events:
+			e.accept(self)
+		self.writer.endArray()
+
+	def visit_DiagramTestEvent(self, event):
+		self.writer.add(GLC.NewExpression("Event", [GLC.String(event.name), GLC.String(event.port), GLC.ArrayExpression(event.parameters)]))
+
+	def visit_Class(self, class_node):
+		"""
+		Generate code for Class construct
+		"""
+
+		super_classes = []
+		if not class_node.super_class_objs:
+			# if none of the class' super classes is defined in the diagram,
+			# we have to inherit RuntimeClassBase
+			if class_node.statechart:
+				# only inherit RuntimeClassBase if class has a statechart
+				super_classes.append("RuntimeClassBase")
+		if class_node.super_classes:
+			for super_class in class_node.super_classes:
+				super_classes.append(super_class)
+
+		self.writer.beginClass(class_node.name, super_classes)
+
+		#visit constructor
+		for i in class_node.constructors :
+			i.accept(self)
+
+		self.writer.beginMethod("user_defined_constructor")
+		for p in class_node.constructors[0].getParams():
+			p.accept(self)
+		self.writer.beginMethodBody()
+		for super_class in class_node.super_classes:
+			# begin call
+			if super_class in class_node.super_class_objs:
+				self.writer.beginSuperClassMethodCall(super_class, "user_defined_constructor")
+			else:
+				self.writer.beginSuperClassConstructorCall(super_class)
+			# write actual parameters
+			if super_class in class_node.constructors[0].super_class_parameters:
+				for p in class_node.constructors[0].super_class_parameters[super_class]:
+					self.writer.addActualParameter(p)
+			# end call
+			if super_class in class_node.super_class_objs:
+				self.writer.endSuperClassMethodCall()
+			else:
+				self.writer.endSuperClassConstructorCall()
+		self.writer.addRawCode(class_node.constructors[0].body)
+		self.writer.endMethodBody()
+		self.writer.endMethod()
+
+
+		#visit children
+		for i in class_node.destructors :
+			i.accept(self)
+		for i in class_node.methods :
+			i.accept(self)
+
+		if class_node.statechart:
+			self.writer.beginMethod("initializeStatechart")
+			self.writer.beginMethodBody()
+
+			for c in class_node.statechart.composites :
+				self.writer.addAssignment(GLC.MapIndexedExpression(GLC.SelfProperty("current_state"), GLC.SelfProperty(c.full_name)), GLC.ArrayExpression())
+
+			if class_node.statechart.histories:
+				self.writer.addVSpace()
+				for node in class_node.statechart.combined_history_parents:
+					self.writer.addAssignment(GLC.MapIndexedExpression(GLC.SelfProperty("history_state"), GLC.SelfProperty(node.full_name)), GLC.ArrayExpression())
+
+			self.writer.addVSpace()
+			self.writer.addComment("Enter default state")	
+			for default_node in class_node.statechart.root.defaults:
+				if default_node.is_composite:
+					self.writer.add(GLC.FunctionCall(GLC.SelfProperty("enterDefault_"+default_node.full_name)))
+				elif default_node.is_basic:
+					self.writer.add(GLC.FunctionCall(GLC.SelfProperty("enter_"+default_node.full_name)))
+			self.writer.endMethodBody()
+			self.writer.endMethod()
+
+			class_node.statechart.accept(self)
+
+		self.writer.endClass()
+
+
+	def visit_FormalParameter(self, formal_parameter):
+		self.writer.addFormalParameter(formal_parameter.getIdent(), formal_parameter.getDefault())
+		
+	def visit_Constructor(self, constructor):
+		self.writer.beginConstructor()
+		if constructor.parent_class.statechart:
+			self.writer.addFormalParameter("controller")
+		for p in constructor.getParams():
+			self.writer.addFormalParameter(p.getIdent(), p.getDefault())
+		self.writer.beginMethodBody() # constructor body
+
+		if constructor.parent_class.statechart:
+			self.writer.beginSuperClassConstructorCall("RuntimeClassBase")
+			self.writer.addActualParameter("controller")
+			self.writer.endSuperClassConstructorCall()
+
+			self.writer.addVSpace()
+
+			if constructor.parent_class.statechart.big_step_maximality == "take_one":
+				self.writer.addAssignment(GLC.Property(GLC.SelfProperty("semantics"), "big_step_maximality"), GLC.Property("StatechartSemantics", "TakeOne"))
+			elif constructor.parent_class.statechart.big_step_maximality == "take_many":
+				self.writer.addAssignment(GLC.Property(GLC.SelfProperty("semantics"), "big_step_maximality"), GLC.Property("StatechartSemantics", "TakeMany"))
+
+			if constructor.parent_class.statechart.internal_event_lifeline == "queue":
+				self.writer.addAssignment(GLC.Property(GLC.SelfProperty("semantics"), "internal_event_lifeline"), GLC.Property("StatechartSemantics", "Queue"))
+			elif constructor.parent_class.statechart.internal_event_lifeline == "next_small_step":
+				self.writer.addAssignment(GLC.Property(GLC.SelfProperty("semantics"), "internal_event_lifeline"), GLC.Property("StatechartSemantics", "NextSmallStep"))
+			elif constructor.parent_class.statechart.internal_event_lifeline == "next_combo_step":
+				self.writer.addAssignment(GLC.Property(GLC.SelfProperty("semantics"), "internal_event_lifeline"), GLC.Property("StatechartSemantics", "NextComboStep"))
+
+			if constructor.parent_class.statechart.input_event_lifeline == "first_small_step":
+				self.writer.addAssignment(GLC.Property(GLC.SelfProperty("semantics"), "input_event_lifeline"), GLC.Property("StatechartSemantics", "FirstSmallStep"))
+			elif constructor.parent_class.statechart.input_event_lifeline == "first_combo_step":
+				self.writer.addAssignment(GLC.Property(GLC.SelfProperty("semantics"), "input_event_lifeline"), GLC.Property("StatechartSemantics", "FirstComboStep"))
+			elif constructor.parent_class.statechart.input_event_lifeline == "whole":
+				self.writer.addAssignment(GLC.Property(GLC.SelfProperty("semantics"), "input_event_lifeline"), GLC.Property("StatechartSemantics", "Whole"))
+
+			if constructor.parent_class.statechart.priority == "source_parent":
+				self.writer.addAssignment(GLC.Property(GLC.SelfProperty("semantics"), "priority"), GLC.Property("StatechartSemantics", "SourceParent"))
+			elif constructor.parent_class.statechart.priority == "source_child":
+				self.writer.addAssignment(GLC.Property(GLC.SelfProperty("semantics"), "priority"), GLC.Property("StatechartSemantics", "SourceChild"))
+
+
+			if constructor.parent_class.statechart.concurrency == "single":
+				self.writer.addAssignment(GLC.Property(GLC.SelfProperty("semantics"), "concurrency"), GLC.Property("StatechartSemantics", "Single"))
+			elif constructor.parent_class.statechart.concurrency == "many":
+				self.writer.addAssignment(GLC.Property(GLC.SelfProperty("semantics"), "concurrency"), GLC.Property("StatechartSemantics", "Many"))
+
+		for p in constructor.parent_class.inports:
+			self.writer.addAssignment(
+				GLC.MapIndexedExpression(GLC.SelfProperty("inports"), GLC.String(p)),
+				GLC.FunctionCall(GLC.Property("controller", "addInputPort"), [GLC.String(p), GLC.SelfExpression()]))
+
+		if constructor.parent_class.attributes:
+			self.writer.addVSpace()
+			self.writer.addComment("User defined attributes")
+			for attribute in constructor.parent_class.attributes:
+				if attribute.init_value is None :
+					self.writer.addAssignment(GLC.SelfProperty(attribute.name), GLC.NoneExpression())
+				else :
+					self.writer.addAssignment(GLC.SelfProperty(attribute.name), attribute.init_value)
+
+		self.writer.addVSpace()
+		self.writer.addComment("Call user defined constructor")
+		self.writer.beginSuperClassMethodCall(constructor.parent_class.name, "user_defined_constructor")
+		for p in constructor.getParams():
+			# we can't do p.accept(self) here because 'p' is a FormalParameter
+			# and we want to write it as an actual parameter
+			self.writer.addActualParameter(p.getIdent())
+		self.writer.endSuperClassMethodCall()
+		self.writer.endMethodBody()
+		self.writer.endConstructor()
+
+	def visit_Destructor(self, destructor):
+		self.writer.beginMethod("user_defined_destructor")
+		self.writer.beginMethodBody()
+		if destructor.body.strip():
+			self.writer.addRawCode(destructor.body)
+		if destructor.parent_class.super_classes:
+			self.writer.addComment("Call super class destructors")
+			for super_class in destructor.parent_class.super_classes:
+				# begin call
+				if super_class in destructor.parent_class.super_class_objs:
+					self.writer.beginSuperClassMethodCall(super_class, "user_defined_destructor")
+					self.writer.endSuperClassMethodCall()
+				else:
+					self.writer.beginSuperClassDestructorCall(super_class)
+					self.writer.endSuperClassDestructorCall()
+					pass
+
+				#self.writer.beginSuperClassMethodCall(super_class, "user_defined_destructor")
+				#self.writer.endSuperClassMethodCall()
+		self.writer.endMethodBody()
+		self.writer.endMethod()
+		
+	def visit_Method(self, method):
+		self.writer.addVSpace()
+		self.writer.beginMethod(method.name, "User defined method")
+		for p in method.parameters:
+			p.accept(self)
+		self.writer.beginMethodBody()
+		self.writer.addRawCode(method.body)
+		self.writer.endMethodBody()
+		self.writer.endMethod()
+		
+	def visit_Association(self, association):
+		self.writer.addAssignment(
+			GLC.MapIndexedExpression(
+				GLC.Property("instance", "associations"),
+				GLC.String(association.name)),
+			GLC.NewExpression("Association", [GLC.String(association.to_class), str(association.min), str(association.max)]))
+
+	#helper method
+	def writeTransitionsRecursively(self, current_node):
+		valid_children = []
+		for child in current_node.children :
+			if child.is_composite or child.is_basic :
+				valid_children.append(child)
+
+		has_candidates_children = (len(valid_children) > 0)
+		has_candidates_current = (len(current_node.transitions) > 0)
+
+		if has_candidates_children:
+			self.writer.beginMethod("generateCandidatesChildren_" + current_node.full_name)
+			self.writer.beginMethodBody()
+			if current_node.is_parallel_state:
+				self.writer.addAssignment(
+					GLC.LocalVariableDeclaration("branch_done"),
+					GLC.FalseExpression())
+				for child in valid_children :
+					self.writer.addAssignment(
+						"branch_done",
+						GLC.OrExpression(
+							GLC.FunctionCall(GLC.SelfProperty("generateCandidates_" + child.full_name)),
+							"branch_done"))
+				self.writer.add(GLC.ReturnStatement("branch_done"))
+			elif current_node.is_composite:
+				for i, child in enumerate(valid_children) :
+					self.writer.beginElseIf(GLC.EqualsExpression(
+						GLC.ArrayIndexedExpression(
+							GLC.MapIndexedExpression(
+								GLC.SelfProperty("current_state"),
+								GLC.SelfProperty(current_node.full_name)),
+							"0"),
+						GLC.SelfProperty(child.full_name)))
+					self.writer.add(GLC.ReturnStatement(GLC.FunctionCall(GLC.SelfProperty("generateCandidates_"+child.full_name))))
+					self.writer.endElseIf()
+				self.writer.add(GLC.ReturnStatement(GLC.FalseExpression()))
+			self.writer.endMethodBody()
+			self.writer.endMethod()
+
+		if has_candidates_current:
+			self.writer.beginMethod("generateCandidatesCurrent_" + current_node.full_name)
+			self.writer.beginMethodBody()
+			self.writeFromTransitions(current_node)
+			self.writer.add(GLC.ReturnStatement(GLC.FalseExpression()))
+			self.writer.endMethodBody()
+			self.writer.endMethod()
+
+		self.writer.beginMethod("generateCandidates_" + current_node.full_name)
+		self.writer.beginMethodBody()
+
+		if not has_candidates_children and not has_candidates_current:
+			self.writer.add(GLC.ReturnStatement(GLC.FalseExpression()))
+		else:
+			self.writer.beginIf(
+				GLC.NotExpression(GLC.FunctionCall(
+					GLC.Property(GLC.SelfProperty("combo_step"), "isArenaChanged"),
+					[GLC.SelfProperty(current_node.full_name)])))
+
+			if has_candidates_children and has_candidates_current:
+				self.writer.addAssignment(
+					GLC.LocalVariableDeclaration("branch_done"),
+					GLC.FalseExpression())
+
+			if not has_candidates_children and has_candidates_current:
+				self.writer.add(GLC.ReturnStatement(GLC.FunctionCall(GLC.SelfProperty("generateCandidatesCurrent_" + current_node.full_name))))
+			elif not has_candidates_current and has_candidates_children:
+				self.writer.add(GLC.ReturnStatement(GLC.FunctionCall(GLC.SelfProperty("generateCandidatesChildren_" + current_node.full_name))))
+			else:
+				self.writer.beginElseIf(GLC.EqualsExpression(
+					GLC.Property(GLC.SelfProperty("semantics"), "priority"),
+					GLC.Property("StatechartSemantics", "SourceParent")))
+				if has_candidates_current:
+					self.writer.addAssignment("branch_done", GLC.FunctionCall(GLC.SelfProperty("generateCandidatesCurrent_" + current_node.full_name)))
+				if has_candidates_children:
+					self.writer.beginIf(GLC.NotExpression("branch_done"))
+					self.writer.addAssignment("branch_done", GLC.FunctionCall(GLC.SelfProperty("generateCandidatesChildren_" + current_node.full_name)))
+					self.writer.endIf()
+				self.writer.endElseIf()
+				self.writer.beginElseIf(GLC.EqualsExpression(
+					GLC.Property(GLC.SelfProperty("semantics"), "priority"),
+					GLC.Property("StatechartSemantics", "SourceChild")))
+				if has_candidates_children:
+					self.writer.addAssignment("branch_done", GLC.FunctionCall(GLC.SelfProperty("generateCandidatesChildren_" + current_node.full_name)))
+				if has_candidates_current:
+					self.writer.beginIf(GLC.NotExpression("branch_done"))
+					self.writer.addAssignment("branch_done", GLC.FunctionCall(GLC.SelfProperty("generateCandidatesCurrent_" + current_node.full_name)))
+					self.writer.endIf()
+				self.writer.endElseIf()
+
+			if has_candidates_children and has_candidates_current:
+				self.writer.add(GLC.ReturnStatement("branch_done"))
+			self.writer.endIf()
+			self.writer.beginElse()
+			self.writer.add(GLC.ReturnStatement(GLC.TrueExpression()))
+			self.writer.endElse()
+
+		self.writer.endMethodBody()
+		self.writer.endMethod()
+
+		for index, transition in enumerate(current_node.transitions, start=1):
+			self.writeTransitionAction(transition, index)
+		
+		for child in valid_children :
+			self.writeTransitionsRecursively(child)
+				
+	#helper method
+	def writeFromTransitions(self, current_node): 
+		# get all transition out of this state
+		out_transitions = current_node.transitions
+		if len(out_transitions) == 0 :
+			return
+		
+		for index, transition in enumerate(out_transitions, start=1):
+			self.writeTransitionCondition(transition, index)
+		
+	def visit_FormalEventParameter(self, formal_event_parameter):
+		self.writer.add(formal_event_parameter.name)
+		
+	def writeFormalEventParameters(self, transition):
+		parameters = transition.getTrigger().getParameters()
+		if(len(parameters) > 0) :
+			for index, parameter in enumerate(parameters):
+				self.writer.startRecordingExpression()
+				parameter.accept(self)
+				parameter_expr = self.writer.stopRecordingExpression()
+				self.writer.addAssignment(
+					GLC.LocalVariableDeclaration(parameter_expr),
+					GLC.ArrayIndexedExpression("parameters", str(index)))
+		
+		
+	def writeTransitionAction(self, transition, index):
+		self.writer.beginMethod("transition_" + transition.parent_node.full_name + "_" + str(index))
+		self.writer.addFormalParameter("parameters")
+		self.writer.beginMethodBody()
+
+		# handle parameters to actually use them
+		self.writeFormalEventParameters(transition)
+		
+		exits = transition.getExitNodes()
+		
+		# write exit actions
+		if not exits[-1].is_basic:
+			self.writer.add(GLC.FunctionCall(GLC.SelfProperty("exit_"+exits[-1].full_name)))
+		else:
+			for node in exits:
+				if node.is_basic:
+					self.writer.add(GLC.FunctionCall(GLC.SelfProperty("exit_"+node.full_name)))
+					
+		# write trigger actions
+		transition.getAction().accept(self)
+
+		# add arena of transition to list of 'changed' states,
+		# this may prevent other transitions whose arenas overlap to be taken
+		self.writer.add(
+			GLC.FunctionCall(
+				GLC.Property(GLC.SelfProperty("combo_step"), "setArenaChanged"),
+				[GLC.SelfProperty(transition.arena.full_name)]))
+
+		# write enter actions
+		for (entering_node, is_ending_node) in transition.getEnterNodes() : 
+			if is_ending_node :
+				if entering_node.is_composite:
+					self.writer.add(GLC.FunctionCall(GLC.SelfProperty("enterDefault_" + entering_node.full_name)))
+				elif entering_node.is_history:
+					if (entering_node.is_history_deep) :
+						self.writer.add(GLC.FunctionCall(GLC.SelfProperty("enterHistoryDeep_" + entering_node.parent.full_name)))
+					else :
+						self.writer.add(GLC.FunctionCall(GLC.SelfProperty("enterHistoryShallow_" + entering_node.parent.full_name)))
+				else:
+					self.writer.add(GLC.FunctionCall(GLC.SelfProperty("enter_" + entering_node.full_name)))
+			else :
+				if entering_node.is_composite:
+					self.writer.add(GLC.FunctionCall(GLC.SelfProperty("enter_" + entering_node.full_name)))
+
+		self.writer.endMethodBody()
+		self.writer.endMethod()
+						
+	def writeTransitionCondition(self, transition, index):
+		trigger = transition.getTrigger()
+
+		self.writer.addAssignment(
+			GLC.LocalVariableDeclaration("enabled_events"),
+			GLC.FunctionCall(GLC.SelfProperty("getEnabledEvents")))
+
+		if not trigger.isUC():
+			self.writer.beginForLoopIterateArray("enabled_events", "e")
+			condition = GLC.EqualsExpression(
+				GLC.Property(GLC.ForLoopCurrentElement("enabled_events", "e"), "name"),
+					GLC.String(trigger.getEvent()))
+			if trigger.getPort() != "":
+				condition = GLC.AndExpression(
+					condition,
+					GLC.EqualsExpression(
+						GLC.Property(GLC.ForLoopCurrentElement("enabled_events", "e"), "port"),
+						GLC.String(trigger.getPort())))
+			self.writer.beginIf(condition)
+		# evaluate guard
+		if transition.hasGuard() :
+			# handle parameters for guard evaluation
+			if not transition.getTrigger().isUC():
+				self.writer.addAssignment(GLC.LocalVariableDeclaration("parameters"), GLC.Property(GLC.ForLoopCurrentElement("enabled_events", "e"), "parameters"))
+				self.writeFormalEventParameters(transition)
+			self.writer.startRecordingExpression()
+			transition.getGuard().accept(self) # --> visit_Expression
+			expr = self.writer.stopRecordingExpression()
+			self.writer.beginIf(expr)
+
+		if trigger.isUC():
+			params_expr = GLC.ArrayExpression()
+		else:
+			params_expr = GLC.Property(GLC.ForLoopCurrentElement("enabled_events", "e"), "parameters")
+		self.writer.add(GLC.FunctionCall(GLC.Property(GLC.SelfProperty("small_step"), "addCandidate"), [GLC.SelfProperty("transition_" + transition.parent_node.full_name + "_" + str(index)), params_expr]))
+
+		self.writer.add(GLC.ReturnStatement(GLC.TrueExpression()))
+
+		if transition.hasGuard() :
+			self.writer.endIf()
+		if not trigger.isUC() :
+			self.writer.endIf()
+			self.writer.endForLoopIterateArray()
+	
+	def visit_EnterAction(self, enter_method):
+		parent_node = enter_method.parent_node
+		self.writer.beginMethod("enter_" + parent_node.full_name)
+		self.writer.beginMethodBody()
+
+		# take care of any AFTER events
+		for transition in parent_node.transitions :
+			trigger = transition.getTrigger()
+			if trigger.isAfter() :
+				self.writer.startRecordingExpression()
+				trigger.after.accept(self)
+				after = self.writer.stopRecordingExpression()
+				
+				self.writer.addAssignment(
+					GLC.MapIndexedExpression(GLC.SelfProperty("timers"), str(trigger.getAfterIndex())),
+					after)
+
+		if enter_method.action:
+			enter_method.action.accept(self)
+		self.writer.add(
+			GLC.ArrayPushBack(
+					GLC.MapIndexedExpression(
+						GLC.SelfProperty("current_state"),
+						GLC.SelfProperty(parent_node.parent.full_name)),
+					GLC.SelfProperty(parent_node.full_name)))
+		self.writer.endMethodBody()
+		self.writer.endMethod()
+		
+	#helper method
+	def writeEnterDefault(self, entered_node):
+		self.writer.beginMethod("enterDefault_" + entered_node.full_name)
+		self.writer.beginMethodBody()
+		self.writer.add(GLC.FunctionCall(GLC.SelfProperty("enter_"+entered_node.full_name)))
+		if entered_node.is_composite:
+			l = entered_node.defaults
+			for i in l:
+				if i.is_composite:
+					self.writer.add(GLC.FunctionCall(GLC.SelfProperty("enterDefault_" + i.full_name)))
+				elif i.is_basic:
+					self.writer.add(GLC.FunctionCall(GLC.SelfProperty("enter_" + i.full_name)))
+		self.writer.endMethodBody()
+		self.writer.endMethod()
+		 
+	def visit_ExitAction(self, exit_method):
+		exited_node = exit_method.parent_node
+		self.writer.beginMethod("exit_" + exited_node.full_name)
+		self.writer.beginMethodBody()
+
+		#If the exited node is composite take care of potential history and the leaving of descendants
+		if exited_node.is_composite :
+			#handle history
+			if exited_node.save_state_on_exit :
+				self.writer.addAssignment(
+					GLC.MapIndexedExpression(
+						GLC.SelfProperty("history_state"),
+						GLC.SelfProperty(exited_node.full_name)),
+					GLC.MapIndexedExpression(
+						GLC.SelfProperty("current_state"),
+						GLC.SelfProperty(exited_node.full_name)))
+			
+			#Take care of leaving children
+			children = exited_node.children
+			if exited_node.is_parallel_state:
+				for child in children:
+					if not child.is_history :
+						self.writer.add(GLC.FunctionCall(GLC.SelfProperty("exit_"+child.full_name)))
+			else:
+				for child in children:
+					if not child.is_history :
+						self.writer.beginIf(GLC.ArrayContains(
+								GLC.MapIndexedExpression(
+									GLC.SelfProperty("current_state"),
+									GLC.SelfProperty(exited_node.full_name)),
+								GLC.SelfProperty(child.full_name)))
+						self.writer.add(GLC.FunctionCall(GLC.SelfProperty("exit_"+child.full_name)))
+						self.writer.endIf()
+		
+		# take care of any AFTER events
+		for transition in exited_node.transitions :
+			trigger = transition.getTrigger()
+			if trigger.isAfter() :
+				self.writer.add(GLC.MapRemoveElement(
+					GLC.SelfProperty("timers"),
+					str(trigger.getAfterIndex())))
+				
+		#Execute user-defined exit action if present
+		if exit_method.action:
+			exit_method.action.accept(self)
+			
+		#Adjust state
+		self.writer.addAssignment(
+			GLC.MapIndexedExpression(
+				GLC.SelfProperty("current_state"),
+				GLC.SelfProperty(exited_node.parent.full_name)),
+			GLC.ArrayExpression()) # SPECIAL CASE FOR ORTHOGONAL??
+		
+		self.writer.endMethodBody()
+		self.writer.endMethod()
+		
+			
+	#helper method
+	def writeEnterHistory(self, entered_node, is_deep):
+		self.writer.beginMethod("enterHistory" + ("Deep" if is_deep else "Shallow") + "_" + entered_node.full_name)
+		self.writer.beginMethodBody()
+
+		self.writer.beginIf(GLC.EqualsExpression(
+			GLC.ArrayLength(
+				GLC.MapIndexedExpression(
+					GLC.SelfProperty("history_state"),
+					GLC.SelfProperty(entered_node.full_name))),
+			"0"))
+		"""self.writer.beginIfBlock(GLC.EqualsExpression(
+			GLC.ArrayLength(
+				GLC.MapIndexedExpression(
+					GLC.SelfProperty("history_state"),
+					GLC.SelfProperty(entered_node.full_name))),
+			"0"))"""
+		defaults = entered_node.defaults
+
+		for node in defaults:
+			if node.is_basic :
+				self.writer.add(GLC.FunctionCall(GLC.SelfProperty("enter_"+node.full_name)))
+			elif node.is_composite :
+				self.writer.add(GLC.FunctionCall(GLC.SelfProperty("enterDefault_"+node.full_name)))
+
+		self.writer.endIf()
+		self.writer.beginElse()
+		children = entered_node.children
+		if entered_node.is_parallel_state:
+			for child in children:
+				if not child.is_history :
+					self.writer.add(GLC.FunctionCall(GLC.SelfProperty("enter_"+child.full_name)))
+					self.writer.add(GLC.FunctionCall(GLC.SelfProperty("enterHistory"+("Deep" if is_deep else "Shallow")+"_"+child.full_name)))
+		else:
+			for child in children:
+				if not child.is_history :
+					self.writer.beginIf(GLC.ArrayContains(
+						GLC.MapIndexedExpression(
+							GLC.SelfProperty("history_state"),
+							GLC.SelfProperty(entered_node.full_name)),
+						GLC.SelfProperty(child.full_name)))
+					if child.is_composite:
+						if is_deep :
+							self.writer.add(GLC.FunctionCall(GLC.SelfProperty("enter_"+child.full_name)))
+							self.writer.add(GLC.FunctionCall(GLC.SelfProperty("enterHistoryDeep_"+child.full_name)))
+						else :
+							self.writer.add(GLC.FunctionCall(GLC.SelfProperty("enterDefault_"+child.full_name)))
+					else:
+						self.writer.add(GLC.FunctionCall(GLC.SelfProperty("enter_"+child.full_name)))
+					self.writer.endIf()
+		self.writer.endElse()
+
+		self.writer.endMethodBody()
+		self.writer.endMethod()
+
+	def visit_StateChart(self, statechart):
+
+		# assign each node a unique ID
+		self.writer.addVSpace()
+		self.writer.addComment("Unique IDs for all statechart nodes")
+		for (i,node) in enumerate(statechart.composites + statechart.basics):
+			self.writer.addStaticAttribute(node.full_name, str(i))
+
+
+
+		self.writer.addVSpace()
+		self.writer.addComment("Statechart enter/exit action method(s)")
+		
+		#visit enter and exit action of children
+		for i in statechart.composites + statechart.basics:
+			if i is not statechart.root :
+				i.enter_action.accept(self)
+				i.exit_action.accept(self)
+
+		# write out statecharts methods for enter/exit state
+		if len(statechart.composites) > 1 :
+			self.writer.addVSpace()
+			self.writer.addComment("Statechart enter/exit default method(s)")
+			for i in statechart.composites :
+				if i is not statechart.root :
+					self.writeEnterDefault(i)
+
+		# write out statecharts methods for enter/exit history
+		if statechart.histories:
+			self.writer.addVSpace()
+			self.writer.addComment("Statechart enter/exit history method(s)")
+			for i in statechart.shallow_history_parents:
+				self.writeEnterHistory(i, False)
+			for i in statechart.deep_history_parents:
+				self.writeEnterHistory(i, True) 
+
+		self.writer.addVSpace()
+		self.writer.addComment("Statechart transitions")
+		self.writeTransitionsRecursively(statechart.root)			
+				
+		# write out transition function
+		self.writer.beginMethod("generateCandidates", "Generate transition candidates for current small step")
+		self.writer.beginMethodBody()
+		self.writer.add(GLC.FunctionCall(
+				GLC.SelfProperty("generateCandidates_"+statechart.root.full_name)))
+		self.writer.endMethodBody()
+		self.writer.endMethod()
+
+	def visit_SelfReference(self, self_reference):
+		self.writer.add(GLC.SelfExpression())
+
+	def visit_StateReference(self, state_ref):
+		self.writer.beginArray()
+		for node in state_ref.getNodes():
+			self.writer.add(GLC.SelfProperty(node.full_name))
+		self.writer.endArray()
+
+	def visit_InStateCall(self, in_state_call):
+		self.writer.beginFunctionCall(GLC.SelfProperty("inState"))
+		self.writer.startRecordingExpression()
+		in_state_call.target.accept(self)
+		expr = self.writer.stopRecordingExpression()
+		self.writer.addActualParameter(expr)
+		self.writer.endFunctionCall()
+
+	def visit_Expression(self, expression):
+		self.writer.startRecordingExpression()
+		self.writer.beginGlue()
+		for part in expression.expression_parts:
+			part.accept(self)
+		self.writer.endGlue()
+		expr = self.writer.stopRecordingExpression()
+		self.writer.add(expr)
+
+	def visit_ExpressionPartString(self, e):
+		self.writer.add(e.string)
+		
+	def visit_RaiseEvent(self, raise_event):
+		self.writer.startRecordingExpression()
+		self.writer.begin(GLC.NewExpression("Event"))
+
+		self.writer.addActualParameter(GLC.String(raise_event.getEventName()))
+		if raise_event.isOutput():
+			self.writer.addActualParameter(GLC.String(raise_event.getPort()))
+		else:
+			self.writer.addActualParameter(GLC.NoneExpression())
+
+		self.writer.end()
+		new_event_expr = self.writer.stopRecordingExpression()
+
+		self.writer.startRecordingExpression()
+		self.writer.beginArray()
+		if raise_event.isCD():
+			self.writer.add(GLC.SelfExpression())
+		for param in raise_event.getParameters() :
+			param.accept(self) # -> visit_Expression will cause expressions to be added to array
+		self.writer.endArray()
+		parameters_array_expr = self.writer.stopRecordingExpression()
+		new_event_expr.getActualParameters().add(parameters_array_expr)
+
+		if raise_event.isNarrow():
+			self.writer.add(GLC.FunctionCall(
+				GLC.Property(GLC.SelfProperty("big_step"), "outputEventOM"), [
+					GLC.NewExpression("Event", [
+						GLC.String("narrow_cast"),
+						GLC.NoneExpression(),
+						GLC.ArrayExpression([
+							GLC.SelfExpression(),
+							raise_event.getTarget(),
+							new_event_expr])])]))
+		elif raise_event.isLocal():
+			self.writer.add(GLC.FunctionCall(
+				GLC.SelfProperty("raiseInternalEvent"),
+				[new_event_expr]))
+		elif raise_event.isOutput():
+			self.writer.add(GLC.FunctionCall(
+				GLC.Property(GLC.SelfProperty("big_step"), "outputEvent"),
+				[new_event_expr]))
+		elif raise_event.isCD():
+			self.writer.add(GLC.FunctionCall(
+				GLC.Property(GLC.SelfProperty("big_step"), "outputEventOM"),
+				[new_event_expr]))
+		elif raise_event.isBroad():
+			self.writer.add(GLC.FunctionCall(
+				GLC.Property(GLC.SelfProperty("big_step"), "outputEventOM"),
+				[GLC.NewExpression("Event", [
+					GLC.String("broad_cast"),
+					GLC.NoneExpression(),
+					GLC.ArrayExpression([
+						new_event_expr])])]))
+			
+	def visit_Script(self, script):
+		self.writer.addRawCode(script.code)
+		
+	def visit_Log(self, log):
+		self.writer.add(GLC.LogStatement(log.message))
+		
+	def visit_Assign(self, assign):
+		self.writer.startRecordingExpression()
+		assign.lvalue.accept(self) # --> visit_Expression
+		lvalue = self.writer.stopRecordingExpression()
+		self.writer.startRecordingExpression()
+		assign.expression.accept(self) # --> visit_Expression
+		rvalue = self.writer.stopRecordingExpression()
+		self.writer.addAssignment(lvalue, rvalue)
+

+ 990 - 0
src/python_sccd_compiler/generic_language_constructs.py

@@ -0,0 +1,990 @@
+import abc
+from visitor import Visitor, Visitable
+
+
+class GenericConstruct(Visitable):
+	__metaclass__ = abc.ABCMeta
+
+
+# base class for constructs that are a collection of other constructs
+class AbstractList:
+	__metaclass__ = abc.ABCMeta
+
+	@abc.abstractmethod
+	def add(self, generic_construct):
+		pass
+
+
+class BlockEntry(GenericConstruct):
+	__metaclass__ = abc.ABCMeta
+
+	@abc.abstractmethod
+	def isEmpty(self):
+		pass
+
+
+class DeclarationBase:
+	def __init__(self, identifier, description = None):
+		self.identifier = identifier
+		self.description = description # string describing declared artifact
+
+	def getIdentifier(self):
+		return self.identifier
+
+	def getDescription(self):
+		return self.description
+
+
+class Statement(BlockEntry):
+	pass
+
+
+class Package(Statement, AbstractList, DeclarationBase):
+	def __init__(self, identifier, description = None):
+		DeclarationBase.__init__(self, identifier, description)
+		self.declarations = []
+
+	def add(self, item):
+		self.declarations.append(MakeDeclaration(item))
+
+	def getDeclarations(self):
+		return self.declarations
+
+	def isEmpty(self):
+		return False
+
+
+class FormalParameters(GenericConstruct, AbstractList):
+	def __init__(self, parameter_list = None):
+		if parameter_list is None: parameter_list = []
+		self.parameter_list = parameter_list
+
+	def add(self, parameter):
+		self.parameter_list.append(parameter)
+
+	def getParameterList(self):
+		return self.parameter_list
+
+class AST(GenericConstruct, AbstractList):
+	def __init__(self):
+		self.entries = []
+
+	def add(self, entry):
+		self.entries.append(MakeBlockEntry(entry))
+
+	def getEntries(self):
+		return self.entries
+
+
+class Block(AST):
+	def __init__(self):
+		AST.__init__(self)
+
+	def isEmpty(self):
+		for e in self.getEntries():
+			if not e.isEmpty():
+				return False
+		return True
+
+
+class ForLoopBody(Block):
+	def __init__(self, for_loop):
+		Block.__init__(self)
+		self.for_loop = for_loop
+
+	def getForLoop(self):
+		return self.for_loop
+
+
+class MethodBody(Block):
+	def __init__(self, method):
+		Block.__init__(self)
+		self.method = method
+
+	def getMethod(self):
+		return self.method
+
+
+#class ConstructorBody(MethodBody):
+#	def __init__(self, method):
+#		MethodBody.__init__(self, method)
+
+#class DestructorBody(MethodBody):
+#	def __init__(self, method):
+#		MethodBody.__init__(self, method)
+
+
+class ClassMember(GenericConstruct, DeclarationBase):
+	def __init__(self, c, identifier, description = None):
+		DeclarationBase.__init__(self, identifier, description)
+		self.c = c # Class
+
+	def getClass(self):
+		return self.c
+
+
+class MethodBase(ClassMember):
+	def __init__(self, c, identifier, description = None):
+		ClassMember.__init__(self, c, identifier, description)
+		self.formal_parameters = FormalParameters()
+		self.body = MethodBody(self)
+
+	def getBody(self):
+		return self.body
+
+	def getFormalParameters(self):
+		return self.formal_parameters
+
+
+class Method(MethodBase):
+	def __init__(self, c, identifier, description = None):
+		MethodBase.__init__(self, c, identifier, description)
+
+
+class Constructor(MethodBase):
+	def __init__(self, c, description = None):
+		MethodBase.__init__(self, c, None, description)
+
+
+class Destructor(MethodBase):
+	def __init__(self, c, description = None):
+		MethodBase.__init__(self, c, None, description)
+
+
+class Class(GenericConstruct, AbstractList, DeclarationBase):
+	def __init__(self, identifier, super_class_identifier_list = None, description = None):
+		DeclarationBase.__init__(self, identifier, description)
+		self.super_class_identifier_list = super_class_identifier_list # string
+		self.constructor = Constructor(self)
+		self.destructor = Destructor(self)
+		self.members = []
+
+	def getSuperClassIdentifierList(self):
+		return self.super_class_identifier_list
+
+	def getConstructor(self):
+		return self.constructor
+
+	def getDestructor(self):
+		return self.destructor
+
+	def add(self, class_member):
+		self.members.append(class_member)
+
+	def getMembers(self):
+		return self.members
+
+
+class AttributeBase(ClassMember):
+	def __init__(self, c, identifier, init_value = None):
+		ClassMember.__init__(self, c, identifier)
+		self.init_value = MakeExpression(init_value)
+
+	def getInitValue(self):
+		return self.init_value
+
+
+class Attribute(AttributeBase):
+	def __init__(self, c, identifier, init_value = None):
+		AttributeBase.__init__(self, c, identifier, init_value)
+
+
+class StaticAttribute(AttributeBase):
+	def __init__(self, c, name, init_value = None):
+		AttributeBase.__init__(self, c, name, init_value)
+
+
+class FormalParameter(GenericConstruct, DeclarationBase):
+	def __init__(self, identifier, default_value = None, description = None):
+		DeclarationBase.__init__(self, identifier, description)
+		#self.identifier = identifier
+		self.default_value = MakeExpression(default_value)
+
+	def getDefaultValue(self):
+		return self.default_value
+
+
+class IncludeStatement(Statement):
+	def __init__(self, module_path, imported_symbols = None):
+		if imported_symbols is None: imported_symbols = []
+		self.module_path = MakeExpressionList(module_path) # list of modules
+		self.imported_symbols = imported_symbols
+
+	def getModulePath(self):
+		return self.module_path
+
+	def getImportedSymbols(self):
+		return self.imported_symbols
+
+	def isEmpty(self):
+		return False
+
+
+class ReturnStatement(Statement):
+	def __init__(self, expr):
+		self.expr = MakeExpression(expr)
+
+	def getExpression(self):
+		return self.expr
+
+	def isEmpty(self):
+		return False
+
+class BreakStatement(Statement):
+	def isEmpty(self):
+		return False	
+
+class ThrowExceptionStatement(Statement):
+	def __init__(self, expr):
+		self.expr = MakeExpression(expr)
+
+	def getExpression(self):
+		return self.expr
+
+	def isEmpty(self):
+		return False
+
+
+class VSpace(BlockEntry):
+	def isEmpty(self):
+		return True
+
+
+class CommentBase(BlockEntry):
+	def __init__(self, text):
+		self.text = text
+
+	def isEmpty(self):
+		return True
+
+	def getText(self):
+		return self.text
+
+
+class SingleLineComment(CommentBase):
+	def __init__(self, text):
+		CommentBase.__init__(self,text)
+
+
+class MultiLineComment(CommentBase):
+	def __init__(self, text):
+		CommentBase.__init__(self,text)
+
+
+class ConditionalStatementBase(Statement, AbstractList):
+	def __init__(self, body = None):
+		if body is None: body = Block()
+		self.body = body
+
+	def add(self, stmt):
+		self.body.add(stmt)
+
+	def getBody(self):
+		return self.body
+
+	def isEmpty(self):
+		return False
+
+
+class IfStatement(ConditionalStatementBase):
+	def __init__(self, condition):
+		ConditionalStatementBase.__init__(self)
+		self.condition = MakeExpression(condition)
+
+	def getCondition(self):
+		return self.condition
+
+
+class ElseStatement(ConditionalStatementBase):
+	def __init__(self):
+		ConditionalStatementBase.__init__(self)
+
+
+class ElseIfStatement(IfStatement):
+	def __init__(self, condition, is_first = False):
+		IfStatement.__init__(self, condition)
+		self.is_first = is_first
+
+	# in a series of ElseIfStatements, the first ElseIfStatement will be a normal if statement
+	def isFirst(self):
+		return self.is_first
+
+
+class ForLoopIterateBase(ConditionalStatementBase):
+	def __init__(self, collection_expr, iterator_identifier):
+		ConditionalStatementBase.__init__(self, ForLoopBody(self))
+		self.collection_expr = MakeExpression(collection_expr)
+		self.iterator_identifier = iterator_identifier
+
+	def getCollectionExpression(self):
+		return self.collection_expr
+
+	def getIteratorIdentifier(self):
+		return self.iterator_identifier
+
+
+class ForLoopIterateArray(ForLoopIterateBase):
+	def __init__(self, array_expr, iterator_identifier):
+		ForLoopIterateBase.__init__(self, array_expr, iterator_identifier)
+
+
+class ForLoopIterateMapValues(ForLoopIterateBase):
+	def __init__(self, map_expr, iterator_identifier):
+		ForLoopIterateBase.__init__(self, map_expr, iterator_identifier)
+
+
+class ExpressionStatement(Statement):
+	def __init__(self, expression):
+		self.expression = expression
+
+	def getExpression(self):
+		return self.expression
+
+	def isEmpty(self):
+		return False
+
+
+# block of raw code
+class RawCode(BlockEntry):
+	def __init__(self, text):
+		self.text = text
+
+	def getText(self):
+		return self.text
+
+	def isEmpty(self):
+		return (len(self.text.strip()) == 0)
+
+
+# log message to console
+class LogStatement(Statement):
+	def __init__(self, msg):
+		self.msg = msg
+
+	def getMessage(self):
+		return self.msg
+
+	def isEmpty(self):
+		return False
+
+
+class Expression(GenericConstruct):
+	__metaclass__ = abc.ABCMeta
+
+	@abc.abstractmethod
+	def isCompound(self):
+		pass
+
+class SimpleExpression(Expression):
+	def isCompound(self):
+		return False
+
+class CompoundExpression(Expression):
+	def isCompound(self):
+		return True
+
+class RuntimeModuleIdentifier(SimpleExpression):
+	pass
+
+# Not a real language construct, simply 'glues' expressions together.
+class Glue(SimpleExpression, AbstractList):
+	def __init__(self):
+		self.expression_list = []
+
+	def add(self, expr):
+		self.expression_list.append(MakeExpression(expr))
+
+	def getExpressionList(self):
+		return self.expression_list
+
+
+class ForLoopCurrentElement(SimpleExpression):
+	def __init__(self, collection_expr, iterator_identifier):
+		self.collection_expr = MakeExpression(collection_expr)
+		self.iterator_identifier = iterator_identifier
+
+	def getCollectionExpression(self):
+		return self.collection_expr
+
+	def getIteratorIdentifier(self):
+		return self.iterator_identifier
+
+
+class Literal(SimpleExpression):
+	def __init__(self, text):
+		self.text = text
+
+	def getText(self):
+		return self.text
+
+
+class String(Literal):
+	def __init__(self, text):
+		Literal.__init__(self, text)
+
+
+class Property(SimpleExpression):
+	def __init__(self, owner, prop):
+		self.owner = MakeExpression(owner)
+		self.prop = prop
+
+	def getOwnerExpression(self):
+		return self.owner
+
+	def getProperty(self):
+		return self.prop
+
+
+class MapIndexedExpression(SimpleExpression):
+	def __init__(self, map_expr, key_expr):
+		self.map_expr = MakeExpression(map_expr)
+		self.key_expr = MakeExpression(key_expr)
+
+	def getMapExpression(self):
+		return self.map_expr
+
+	def getKeyExpression(self):
+		return self.key_expr
+
+
+class ArrayIndexedExpression(SimpleExpression):
+	def __init__(self, array_expr, index_expr):
+		self.array_expr = MakeExpression(array_expr)
+		self.index_expr = MakeExpression(index_expr)
+
+	def getArrayExpression(self):
+		return self.array_expr
+
+	def getIndexExpression(self):
+		return self.index_expr
+
+
+class ActualParameters(GenericConstruct, AbstractList):
+	def __init__(self, parameter_list = None):
+		if parameter_list is None: parameter_list = []
+		self.parameter_list = MakeExpressionList(parameter_list)
+
+	def add(self, p):
+		self.parameter_list.append(MakeExpression(p))
+		pass
+
+	def getParameterList(self):
+		return self.parameter_list
+
+
+class FunctionCallBase(SimpleExpression):
+	def __init__(self, actual_parameters = None):
+		if actual_parameters is None: actual_parameters = ActualParameters()
+		self.actual_parameters = MakeActualParameters(actual_parameters)
+
+	def getActualParameters(self):
+		return self.actual_parameters
+	
+
+
+class FunctionCall(FunctionCallBase):
+	def __init__(self, function_expr, actual_parameters = None):
+		FunctionCallBase.__init__(self, actual_parameters)
+		self.function_expr = MakeExpression(function_expr)
+
+	def getFunctionExpression(self):
+		return self.function_expr
+
+
+class SuperClassCallBase(FunctionCallBase):
+	def __init__(self, super_class_identifier, actual_parameters = None):
+		FunctionCallBase.__init__(self, actual_parameters)
+		self.super_class_identifier = super_class_identifier
+
+	def getSuperClassIdentifier(self):
+		return self.super_class_identifier
+
+
+class SuperClassConstructorCall(SuperClassCallBase):
+	def __init__(self, super_class_identifier, actual_parameters = None):
+		SuperClassCallBase.__init__(self, super_class_identifier, actual_parameters)
+
+
+class SuperClassDestructorCall(SuperClassCallBase):
+	def __init__(self, super_class_identifier):
+		SuperClassCallBase.__init__(self, super_class_identifier)
+
+
+class SuperClassMethodCall(SuperClassCallBase):
+	def __init__(self, super_class_identifier, method_identifier, actual_parameters = None):
+		SuperClassCallBase.__init__(self, super_class_identifier, actual_parameters)
+		self.method_identifier = method_identifier
+
+	def getMethodIdentifier(self):
+		return self.method_identifier
+
+
+class NewExpression(FunctionCallBase):
+	def __init__(self, type_expr, actual_parameters = None):
+		FunctionCallBase.__init__(self, actual_parameters)
+		self.type_expr = MakeExpression(type_expr)
+
+	def getTypeExpression(self):
+		return self.type_expr
+
+
+class SelfExpression(SimpleExpression):
+	pass
+
+
+class SelfProperty(Property):
+	def __init__(self, prop):
+		Property.__init__(self, SelfExpression(), prop)
+
+
+class Operator(GenericConstruct):
+	pass
+
+
+class AndOperator(Operator):
+	pass
+
+class OrOperator(Operator):
+	pass
+
+class LessThanOperator(Operator):
+	pass
+
+class GreaterThanOperator(Operator):
+	pass
+
+class NotOperator(Operator):
+	pass
+
+class EqualsOperator(Operator):
+	pass
+
+class AssignmentOperator(Operator):
+	pass
+
+class ProductOperator(Operator):
+	pass
+
+
+class UnaryExpression(CompoundExpression):
+	def __init__(self, operator, expr):
+		self.operator = operator
+		self.expr = MakeExpression(expr)
+
+	def getExpression(self):
+		return self.expr
+
+	def getOperator(self):
+		return self.operator
+
+
+class BinaryExpression(CompoundExpression):
+	def __init__(self, lhs_expr, operator, rhs_expr):
+		self.lhs_expr = MakeExpression(lhs_expr)
+		self.operator = operator
+		self.rhs_expr = MakeExpression(rhs_expr)
+
+	def getLhsExpression(self):
+		return self.lhs_expr
+
+	def getRhsExpression(self):
+		return self.rhs_expr
+
+	def getOperator(self):
+		return self.operator
+
+
+class NotExpression(UnaryExpression):
+	def __init__(self, expr):
+		UnaryExpression.__init__(self, NotOperator(), expr)
+
+class AndExpression(BinaryExpression):
+	def __init__(self, lexpr = None, rexpr = None):
+		BinaryExpression.__init__(self, lexpr, AndOperator(), rexpr)
+
+class OrExpression(BinaryExpression):
+	def __init__(self, lexpr = None, rexpr = None):
+		BinaryExpression.__init__(self, lexpr, OrOperator(), rexpr)
+
+class LessThanExpression(BinaryExpression):
+	def __init__(self, lexpr = None, rexpr = None):
+		BinaryExpression.__init__(self, lexpr, LessThanOperator(), rexpr)
+
+class GreaterThanExpression(BinaryExpression):
+	def __init__(self, lexpr = None, rexpr = None):
+		BinaryExpression.__init__(self, lexpr, GreaterThanOperator(), rexpr)
+
+class EqualsExpression(BinaryExpression):
+	def __init__(self, lexpr = None, rexpr = None):
+		BinaryExpression.__init__(self, lexpr, EqualsOperator(), rexpr)
+
+class AssignmentExpression(BinaryExpression):
+	def __init__(self, lexpr = None, rexpr = None):
+		BinaryExpression.__init__(self, lexpr, AssignmentOperator(), rexpr)
+
+class ProductExpression(BinaryExpression):
+	def __init__(self, lexpr = None, rexpr = None):
+		BinaryExpression.__init__(self, lexpr, ProductOperator(), rexpr)
+
+
+class FalseExpression(SimpleExpression):
+	pass
+
+class TrueExpression(SimpleExpression):
+	pass
+
+
+class LocalVariableDeclaration(Expression, DeclarationBase):
+	def __init__(self, identifier, init_value = None, description = None):
+		DeclarationBase.__init__(self, identifier, description)
+		self.init_value = MakeExpression(init_value)
+
+	def getInitValue(self):
+		self.init_value
+
+	def isCompound(self):
+		return (self.init_value != None)
+
+
+class MapExpression(SimpleExpression):
+	def __init__(self, elements = None):
+		if elements is None: elements = {}
+		self.elements = MakeExpressionMap(elements)
+
+	def getElements(self):
+		return self.elements
+
+class MapRemoveElement(Statement):
+	def __init__(self, map_expr, key_expr):
+		self.map_expr = MakeExpression(map_expr)
+		self.key_expr = MakeExpression(key_expr)
+
+	def getMapExpression(self):
+		return self.map_expr
+
+	def getKeyExpression(self):
+		return self.key_expr
+
+	def isEmpty(self):
+		return False
+
+
+class ArrayExpression(SimpleExpression, AbstractList):
+	def __init__(self, elements = None):
+		if elements is None: elements = []
+		self.elements = MakeExpressionList(elements)
+
+	def add(self, element):
+		self.elements.append(MakeExpression(element))
+
+	def getElements(self):
+		return self.elements
+
+
+class ArrayLength(SimpleExpression):
+	def __init__(self, array_expr):
+		self.array_expr = MakeExpression(array_expr)
+
+	def getArrayExpression(self):
+		return self.array_expr
+
+
+class ArrayElementOperation(Expression):
+	def __init__(self, array_expr, elem_expr):
+		self.array_expr = MakeExpression(array_expr)
+		self.elem_expr = MakeExpression(elem_expr)
+
+	def getArrayExpression(self):
+		return self.array_expr
+
+	def getElementExpression(self):
+		return self.elem_expr
+
+class ArrayIndexOf(ArrayElementOperation, SimpleExpression):
+	def __init__(self, array_expr, elem_expr):
+		ArrayElementOperation.__init__(self, array_expr, elem_expr)
+
+class ArrayContains(ArrayElementOperation, CompoundExpression):
+	def __init__(self, array_expr, elem_expr):
+		ArrayElementOperation.__init__(self, array_expr, elem_expr)
+
+class ArrayPushBack(ArrayElementOperation, SimpleExpression):
+	def __init__(self, array_expr, elem_expr):
+		ArrayElementOperation.__init__(self, array_expr, elem_expr)
+
+
+class NoneExpression(SimpleExpression):
+	pass
+
+
+# helpers
+
+def MakeExpression(expr):
+	if isinstance(expr, Expression):
+		return expr
+	elif isinstance(expr, basestring):
+		return Literal(expr)
+	elif expr is None:
+		return None
+	else:
+		raise Exception("Can't turn argument of type '" + str(type(expr)) + "' into Expression.")
+
+def MakeExpressionList(l):
+	if not isinstance(l, list):
+		raise Exception("Expected argument of type 'list'.")
+	for i in range(len(l)):
+		l[i] = MakeExpression(l[i])
+	return l
+
+def MakeExpressionMap(m):
+	if not isinstance(m, dict):
+		raise Exception("Expected argument of type 'dict'.")
+	for key in m.keys():
+		m[key] = MakeExpression(m[key])
+	return m
+
+def MakeBlockEntry(stmt):
+	if isinstance(stmt, BlockEntry):
+		return stmt
+	elif isinstance(stmt, Expression):
+		return ExpressionStatement(stmt)
+	elif stmt is None:
+		return None
+	else:
+		raise Exception("Can't turn argument of type '" + str(type(stmt)) + "' into BlockEntry.")
+
+def MakeDeclaration(obj):
+	if isinstance(obj, DeclarationBase):
+		return obj
+	else:
+		raise Exception("Can't turn argument of type '" + str(type(stmt)) + "' into DeclarationBase.")
+
+def MakeActualParameters(obj):
+	if isinstance(obj, ActualParameters):
+		return obj
+	elif isinstance (obj, list):
+		return ActualParameters(obj)
+	else:
+		raise Exception("Can't turn argument of type '" + str(type(obj)) + "' into ActualParameters.")
+
+"""def MakeFormalParameter(parameter, default_value):
+	if isinstance(parameter, FormalParameter):
+		return parameter
+	elif default_value:
+		return FormalParameter(parameter, default_value)
+	else:
+		return FormalParameter(parameter)"""
+
+
+class GenericWriterBase(Visitor):
+	__metaclass__ = abc.ABCMeta
+
+	# overrides Visitor.generic_visit
+	def generic_visit(self, node):
+		raise Exception("Writer has no visit method for node of type '" + str(type(node)) + "'.")
+
+	#### HELPERS ####
+
+	def writeAll(self, l):
+		for item in l:
+			item.accept(self)
+
+	def writeTuple(self, obj):
+		self.out.extendWrite("(")
+		self.writeCommaSeparated(obj)
+		self.out.extendWrite(")")
+
+	@abc.abstractmethod
+	def writeComment(self, text):
+		pass
+
+	@abc.abstractmethod
+	def writeMultiLineComment(self, text):
+		pass
+
+	def writeCommaSeparated(self, l):
+		for i in range(len(l)):
+			if i != 0:
+				self.out.extendWrite(", ")
+			l[i].accept(self)
+
+	def writeDescription(self, decl):
+		description = decl.getDescription()
+		if description:
+			self.writeComment(description)
+
+	def writeCompoundExpr(self, expr):
+		if expr.isCompound():
+			self.out.extendWrite("(")
+		expr.accept(self)
+		if expr.isCompound():
+			self.out.extendWrite(")")
+
+	#### VISIT METHODS BASE IMPLEMENTATIONS ####
+
+	def visit_ArrayIndexedExpression(self, i):
+		a = i.getArrayExpression()
+		index = i.getIndexExpression()
+
+		a.accept(self)
+		self.out.extendWrite("[")
+		index.accept(self)
+		self.out.extendWrite("]")
+
+	def visit_ActualParameters(self, p):
+		self.writeTuple(p.getParameterList())
+
+	def visit_AssignmentOperator(self, assign):
+		self.out.extendWrite(" = ")
+
+	def visit_BinaryExpression(self, b):
+		lhs = b.getLhsExpression()
+		rhs = b.getRhsExpression()
+		op = b.getOperator()
+
+		self.writeCompoundExpr(lhs)
+		op.accept(self)
+		self.writeCompoundExpr(rhs)
+
+	def visit_FormalParameters(self, p):
+		self.writeTuple(p.getParameterList())
+
+	def visit_FunctionCall(self, f):
+		func = f.getFunctionExpression()
+		params = f.getActualParameters()
+
+		func.accept(self)
+		params.accept(self)
+
+	def visit_Glue(self, g):
+		self.writeAll(g.getExpressionList())
+
+	def visit_GreaterThanOperator(self, g):
+		self.out.extendWrite(" > ")
+
+	def visit_LessThanOperator(self, l):
+		self.out.extendWrite(" < ")
+
+	def visit_Literal(self, l):
+		self.out.extendWrite(l.getText())
+
+	def visit_MultiLineComment(self, c):
+		self.writeMultiLineComment(c.getText())
+
+	def visit_ProductOperator(self, p):
+		self.out.extendWrite(" * ")
+
+	def visit_Property(self, p):
+		owner = p.getOwnerExpression()
+		prop = p.getProperty()
+
+		owner.accept(self)
+		self.out.extendWrite("." + prop)
+
+	def visit_RawCode(self, c):
+		self.out.writeCodeCorrectIndent(c.getText())
+
+	def visit_SingleLineComment(self, comment):
+		self.writeComment(comment.getText())
+
+	def visit_String(self, string):
+		self.out.extendWrite("\"" + string.getText().replace("\"", "\\\"") + "\"")
+
+	def visit_UnaryExpression(self, u):
+		expr = u.getExpression()
+		op = u.getOperator()
+
+		op.accept(self)
+		self.writeCompoundExpr(expr)
+
+	def visit_VSpace(self, v):
+		self.out.write()
+
+
+class CLikeWriterBase(GenericWriterBase):
+
+	### HELPERS ###
+
+	def writeComment(self, text):
+		self.out.write("// " + text)
+
+	def writeMultiLineComment(self, text):
+		self.out.write("/* " + text + "*/")
+
+	### VISIT METHODS ###
+
+	def visit_AndOperator(self, a):
+		self.out.extendWrite(" && ")
+
+	def visit_Block(self, b):
+		self.out.extendWrite(" {")
+		self.out.indent()
+		self.writeAll(b.getEntries())
+		self.out.dedent()
+		self.out.write("}")
+
+	def visit_BreakStatement(self, b):
+		self.out.write("break;")
+
+	def visit_ElseStatement(self, else_stmt):
+		self.out.extendWrite(" else ")
+		else_stmt.getBody().accept(self)
+
+	def visit_ElseIfStatement(self, else_if):
+		condition = else_if.getCondition()
+		body = else_if.getBody()
+
+		if else_if.isFirst():
+			self.out.write("if (")
+		else:
+			self.out.extendWrite(" else if (")
+		condition.accept(self)
+		self.out.extendWrite(")")
+		body.accept(self)
+
+	def visit_EqualsOperator(self, e):
+		self.out.extendWrite(" == ")
+
+	def visit_ExpressionStatement(self, stmt):
+		self.out.write() # expressions never begin with a newline
+		stmt.getExpression().accept(self)
+		self.out.extendWrite(";")
+
+	def visit_FalseExpression(self, f):
+		self.out.extendWrite("false")
+
+	def visit_IfStatement(self, if_stmt):
+		condition = if_stmt.getCondition()
+		body = if_stmt.getBody()
+
+		self.out.write("if (")
+		condition.accept(self)
+		self.out.extendWrite(")")
+		body.accept(self)
+
+	def visit_NewExpression(self, new):
+		type_expr = new.getTypeExpression()
+		params = new.getActualParameters()
+
+		self.out.extendWrite("new ")
+		type_expr.accept(self)
+		params.accept(self)
+
+	def visit_NotOperator(self, n):
+		self.out.extendWrite("!")
+
+	def visit_OrOperator(self, o):
+		self.out.extendWrite(" || ")
+
+	def visit_ReturnStatement(self, r):
+		self.out.write("return ")
+		r.getExpression().accept(self)
+		self.out.extendWrite(";")
+
+	def visit_SelfExpression(self, s):
+		self.out.extendWrite("this")
+
+	def visit_TrueExpression(self, t):
+		self.out.extendWrite("true")
+
+

+ 285 - 0
src/python_sccd_compiler/javascript_writer.py

@@ -0,0 +1,285 @@
+from visitor import Visitor
+from generic_language_constructs import *
+
+class JavascriptWriter(CLikeWriterBase):
+	def __init__(self, outputter):
+		self.out = outputter
+
+	### VISIT METHODS ###
+
+	def visit_ArrayContains(self, a):
+		array = a.getArrayExpression()
+		el = a.getElementExpression()
+
+		self.out.extendWrite("(")
+		array.accept(self)
+		self.out.extendWrite(".indexOf(")
+		el.accept(self)
+		self.out.extendWrite(") !== -1)")
+
+	def visit_ArrayExpression(self, a):
+		elements = a.getElements()
+		if len(elements) == 0:
+			self.out.extendWrite("new Array()")
+		else:
+			self.out.extendWrite("[")
+			self.writeCommaSeparated(elements)
+			self.out.extendWrite("]")
+
+	def visit_ArrayIndexOf(self, a):
+		array = a.getArrayExpression()
+		el = a.getElementExpression()
+
+		array.accept(self)
+		self.out.extendWrite(".indexOf(")
+		el.accept(self)
+		self.out.extendWrite(")")
+
+	def visit_ArrayLength(self, a):
+		a.getArrayExpression().accept(self)
+		self.out.extendWrite(".length")
+
+	def visit_ArrayPushBack(self, a):
+		array = a.getArrayExpression()
+		el = a.getElementExpression()
+
+		array.accept(self)
+		self.out.extendWrite(".push(")
+		el.accept(self)
+		self.out.extendWrite(")")
+
+	def visit_AST(self, ast):
+		self.writeAll(ast.getEntries())
+
+	def visit_Class(self, c):
+		class_name = c.getIdentifier()
+		constructor = c.getConstructor()
+		super_classes = c.getSuperClassIdentifierList()
+		description = c.getDescription()
+
+		self.out.write()
+		if description:
+			self.writeComment(description)
+		constructor.accept(self)
+		if super_classes:
+			self.out.write(class_name + ".prototype = new Object();")
+			self.out.write("(function() {")
+			self.out.indent()
+			for s in super_classes:
+				# workaround for multiple inheritance
+				self.out.write("var proto = new " + s + "();")
+				self.out.write("for (prop in proto) {")
+				self.out.indent()
+				self.out.write(class_name + ".prototype[prop] = proto[prop];")
+				self.out.dedent()
+				self.out.write("}")
+			self.out.dedent()
+			self.out.write("})();")
+		self.writeAll(c.getMembers())
+
+	def visit_Constructor(self, constructor):
+		class_name = constructor.getClass().getIdentifier()
+		parameters = constructor.getFormalParameters()
+		body = constructor.getBody()
+
+		self.out.write("var " + class_name + " = function")
+		parameters.accept(self)
+		body.accept(self)
+		self.out.extendWrite(";")
+
+	def visit_EqualsOperator(self, e):
+		self.out.extendWrite(" === ")
+
+	def visit_ForLoopBody(self, body):
+		for_loop = body.getForLoop()
+		collection_expr = for_loop.getCollectionExpression()
+		iterator_identifier = for_loop.getIteratorIdentifier()
+
+		self.out.extendWrite(" {")
+		self.out.indent()
+		self.out.write("if (!")
+		collection_expr.accept(self)
+		self.out.extendWrite(".hasOwnProperty(" + iterator_identifier + ")) continue;")
+		self.writeAll(body.getEntries())
+		self.out.dedent()
+		self.out.write("}")
+
+	def visit_ForLoopCurrentElement(self, el):
+		collection = el.getCollectionExpression()
+		iterator = el.getIteratorIdentifier()
+
+		collection.accept(self)
+		self.out.extendWrite("["+iterator+"]")
+
+	def visit_ForLoopIterateArray(self, loop):
+		collection = loop.getCollectionExpression()
+		iterator = loop.getIteratorIdentifier()
+		body = loop.getBody()
+
+		self.out.write("for (var " + iterator + " in ")
+		collection.accept(self)
+		self.out.extendWrite(")")
+		body.accept(self)
+
+	def visit_ForLoopIterateMapValues(self, loop):
+		collection = loop.getCollectionExpression()
+		iterator = loop.getIteratorIdentifier()
+		body = loop.getBody()
+
+		self.out.write("for (var " + iterator + " in ")
+		collection.accept(self)
+		self.out.extendWrite(")")
+		body.accept(self)
+
+	def visit_FormalParameter(self, parameter):
+		self.out.extendWrite(parameter.getIdentifier())
+
+	def visit_IncludeStatement(self, i):
+		pass # javascript doesn't have an include mechanism
+
+	def visit_LocalVariableDeclaration(self, decl):
+		identifier = decl.getIdentifier()
+		init_value = decl.getInitValue()
+
+		self.out.extendWrite("var " + identifier)
+		if init_value:
+			self.out.extendWrite(" = ")
+			init_value.accept(self)
+
+	def visit_LogStatement(self, l):
+		self.out.write("console.log(\"" + l.getMessage() + "\");")
+
+	def visit_MapExpression(self, m):
+		elements = m.getElements()
+		if len(elements) == 0:
+			self.out.extendWrite("new Object()")
+		else:
+			self.out.extendWrite("{")
+			keys = elements.keys()
+			for i in range(len(keys)):
+				if i != 0:
+					self.out.extendWrite(", ")			
+				self.out.extendWrite(keys[i] + " : ")
+				self.out.extendWrite(" : ")
+				elements[keys[i]].accept(self)
+			self.out.extendWrite("}")
+
+	def visit_MapIndexedExpression(self, i):
+		m = i.getMapExpression()
+		key = i.getKeyExpression()
+
+		m.accept(self)
+		self.out.extendWrite("[")
+		key.accept(self)
+		self.out.extendWrite("]")
+
+	def visit_MapRemoveElement(self, stmt):
+		map_expr = stmt.getMapExpression()
+		key_expr = stmt.getKeyExpression()
+
+		self.out.write("delete ") # this is a statement, not an expression
+		map_expr.accept(self)
+		self.out.extendWrite("[")
+		key_expr.accept(self)
+		self.out.extendWrite("];")		
+
+	def visit_Method(self, method):
+		class_name = method.getClass().getIdentifier()
+		method_name = method.getIdentifier()
+		description = method.getDescription()
+		body = method.getBody()
+		parameters = method.getFormalParameters()
+
+		self.out.write()
+		if description:
+			self.writeComment(description)
+		self.writeDescription(method)
+		self.out.write(class_name + ".prototype." + method_name + " = function")
+		parameters.accept(self)
+		body.accept(self)
+		self.out.extendWrite(";")
+
+	def visit_MethodBody(self, body):
+		method = body.getMethod()
+		formal_parameters = method.getFormalParameters()
+		formal_parameter_list = formal_parameters.getParameterList()
+
+		self.out.extendWrite(" {")
+		self.out.indent()
+		# check for undefined parameters and replace them with default values
+		for p in formal_parameter_list:
+			p_id = p.getIdentifier()
+			p_default = p.getDefaultValue()
+			if p_default:
+				self.out.write("if (" + p_id + " === undefined) " + p_id + " = ")
+				p_default.accept(self)
+				self.out.extendWrite(";")
+		self.writeAll(body.getEntries())
+		self.out.dedent()
+		self.out.write("}")
+
+	def visit_NoneExpression(self, n):
+		self.out.extendWrite("null")
+
+	def visit_Package(self, package):
+		name = package.getIdentifier()
+		description = package.getDescription()
+
+		self.writeComment("package \"" + name + "\"")
+		if description:
+			self.writeComment(description)
+		self.out.write("var " + name + " = {};")
+		self.out.write("(function() {")
+		for d in package.getDeclarations():
+			d_id = d.getIdentifier()
+			d.accept(self)
+			self.out.write()
+			self.out.write("// add symbol '" + d_id + "' to package '" + name + "'")
+			self.out.write(name + "." + d_id + " = " + d_id + ";")
+		self.out.write("})();")
+
+	def visit_RuntimeModuleIdentifier(self, r):
+		self.out.extendWrite("javascript_runtime")
+
+	def visit_StaticAttribute(self, attr):
+		name = attr.getIdentifier()
+		init_value = attr.getInitValue()
+		class_name = attr.getClass().getIdentifier()
+
+		if init_value:
+			self.out.write(class_name + ".prototype." + name + " = ")
+			init_value.accept(self)
+			self.out.extendWrite(";")
+		else:
+			self.out.write(class_name + ".prototype." + name + " = null;")
+
+	def visit_SuperClassConstructorCall(self, call):
+		super_class = call.getSuperClassIdentifier()
+		params = call.getActualParameters()
+		param_list = [Literal("this")] + params.getParameterList()
+		params = ActualParameters(param_list)
+
+		self.out.extendWrite(super_class)
+		self.out.extendWrite(".call")
+		params.accept(self)
+
+	def visit_SuperClassDestructorCall(self, call):
+		pass # Javascript doesn't have destructors
+
+	def visit_SuperClassMethodCall(self, call):
+		super_class = call.getSuperClassIdentifier()
+		method_name = call.getMethodIdentifier()
+		params = call.getActualParameters()
+		param_list = [Literal("this")] + params.getParameterList()
+		params = ActualParameters(param_list)
+
+		self.out.extendWrite(super_class)
+		self.out.extendWrite(".prototype." + method_name + ".call")
+		params.accept(self)
+
+	def visit_ThrowExceptionStatement(self, stmt):
+		self.out.write("throw new Error(")
+		stmt.getExpression().accept(self)
+		self.out.extendWrite(");")
+
+

+ 170 - 0
src/python_sccd_compiler/lexer.py

@@ -0,0 +1,170 @@
+from utils import Enum
+
+TokenType = Enum("SLASH",
+				 "LBRACKET",
+				 "RBRACKET",
+				 "COMMA",
+				 "DOT",
+				 "NUMBER",
+				 "WORD",
+				 "QUOTED",
+				 "WHITESPACE",
+				 "BINARYOPERATOR",
+				 "UNARYOPERATOR",
+				 "UNKNOWN"
+				)
+
+class Token(object):
+	""" A simple Token structure. Token type, value and position.
+	"""
+	def __init__(self, token_type, val, pos):
+		self.type = token_type
+		self.val = val
+		self.pos = pos
+
+	def __str__(self):
+		return '%s(%s) at %s' % (TokenType.name_of(self.type), self.val, self.pos)
+
+
+class LexerError(Exception):
+	def __init__(self, pos):
+		self.pos = pos
+		
+class Lexer(object):
+	single_rules = {
+			'/': TokenType.SLASH,
+			'(': TokenType.LBRACKET,
+			')': TokenType.RBRACKET,
+			',': TokenType.COMMA,
+			'.': TokenType.DOT,
+			'+': TokenType.BINARYOPERATOR,
+			'-': TokenType.BINARYOPERATOR,
+			'<': TokenType.BINARYOPERATOR,
+			'>': TokenType.BINARYOPERATOR,
+			'==': TokenType.BINARYOPERATOR,
+			'<=': TokenType.BINARYOPERATOR,
+			'>=': TokenType.BINARYOPERATOR,
+			'=': TokenType.BINARYOPERATOR,
+			'+=': TokenType.BINARYOPERATOR,
+			'-=': TokenType.BINARYOPERATOR,
+			'&&': TokenType.BINARYOPERATOR,
+			'||': TokenType.BINARYOPERATOR,
+			'!': TokenType.UNARYOPERATOR}
+	
+	def __init__(self, skip_white_space = True, accept_unknown_tokens = False):
+		self.skip_white_space = skip_white_space
+		self.accept_unknown_tokens = accept_unknown_tokens
+
+	def input(self, buf):
+		""" Initialize the lexer with a buffer as input.
+		"""
+		self.buf = buf
+		self.pos = 0
+		self.buflen = len(buf)
+
+	def nextToken(self):
+		""" Return the next token (a Token object) found in the
+			input buffer. None is returned if the end of the
+			buffer was reached.
+			In case of a lexing error (the current chunk of the
+			buffer matches no rule), a LexerError is raised.
+		"""
+		if self.skip_white_space :
+			self.skipWhiteSpace() 
+		if self.pos >= self.buflen:
+			return None
+
+		#c part of next token
+		c = self.buf[self.pos]
+		
+		#check if it is an operator
+		result_type = self.single_rules.get(c,None)
+		if result_type is not None :
+			if self.pos < self.buflen-1:
+				c2 = c+self.buf[self.pos+1]
+				result_type2 = self.single_rules.get(c2, None)
+				if result_type2 is not None:
+					c = c2
+					result_type = result_type2
+					self.pos += 1
+			token = Token(result_type, c, self.pos)
+			self.pos += 1
+			return token
+		else : #not an operator
+			if (self.isAlpha(c)) :
+				return self.processIdentifier()
+			elif (self.isDigit(c)) :
+				return self.processNumber()
+			elif ( c == "'" or c == '"') :
+				return self.processQuote()
+			elif (self.isWhiteSpace(c)) :
+				return self.processWhiteSpace()
+
+		# if we're here, no rule matched
+		if self.accept_unknown_tokens :
+			token = Token(TokenType.UNKNOWN, c, self.pos)
+			self.pos += 1
+			return token
+		raise LexerError("Invalid character at position " + str(self.pos) + ".")
+
+	def tokens(self):
+		""" Returns an iterator to the tokens found in the buffer.
+		"""
+		while True:
+			tok = self.nextToken()
+			if tok is None: break
+			yield tok
+			
+	def skipWhiteSpace(self):
+		while (self.pos < self.buflen) : 
+			if self.isWhiteSpace(self.buf[self.pos]) :
+				self.pos += 1
+			else :
+				break	  
+			
+	def isAlpha(self, c):
+		return c.isalpha() or c == '_';
+	
+	def isAlphaNum(self, c):
+		return c.isalnum() or c == '_';
+	
+	def isDigit(self, c):
+		return c.isdigit()
+	
+	def isWhiteSpace(self, c):
+		return c == ' ' or c == '\t' or c == '\r' or c == '\n'
+	
+	def processNumber(self):
+		nextpos = self.pos + 1
+		while (nextpos < self.buflen) and (self.isDigit(self.buf[nextpos])) :
+			nextpos += 1;
+		token = Token(TokenType.NUMBER, self.buf[self.pos:nextpos], self.pos)
+		self.pos = nextpos
+		return token
+	
+	def processIdentifier(self):
+		nextpos = self.pos + 1
+		while (nextpos < self.buflen) and (self.isAlphaNum(self.buf[nextpos])) :
+			nextpos += 1;
+		token = Token(TokenType.WORD, self.buf[self.pos:nextpos], self.pos)
+		self.pos = nextpos
+		return token
+	
+	def processQuote(self):
+		# self.pos points at the opening quote. Find the ending quote.
+		end_index = self.buf.find(self.buf[self.pos], self.pos + 1)
+	
+		if (end_index == -1) :
+			raise LexerError("Missing matching quote for the quote at position " + str(self.pos) + ".")
+		token = Token(TokenType.QUOTED, self.buf[self.pos:end_index+1], self.pos)
+
+		self.pos = end_index + 1;
+		return token;
+	
+	def processWhiteSpace(self):
+		nextpos = self.pos + 1
+		while (nextpos < self.buflen) and (self.isWhiteSpace(self.buf[nextpos])) :
+			nextpos += 1;
+		token = Token(TokenType.WHITESPACE, self.buf[self.pos:nextpos], self.pos)
+		self.pos = nextpos
+		return token

+ 701 - 0
src/python_sccd_compiler/old_generators/csharp_generator.py

@@ -0,0 +1,701 @@
+"""Generates C#"""
+
+import time
+from constructs import FormalParameter
+from code_generation import CodeGenerator, Platforms
+
+class CSharpGenerator(CodeGenerator):
+    
+    def __init__(self):
+        self.supported_platforms = [Platforms.Threads, Platforms.GameLoop]
+                
+    def visit_ClassDiagram(self, class_diagram):
+        self.fOut.write("/*")
+        self.fOut.indent()
+        self.fOut.write("Statecharts + Class Diagram compiler by Glenn De Jonghe")
+        self.fOut.write()
+        self.fOut.write("Date:   " + time.asctime())
+        if class_diagram.name or class_diagram.author or class_diagram.description:
+            self.fOut.write()
+        if class_diagram.author:
+            self.fOut.write("Model author: " + class_diagram.author)
+        if class_diagram.name:
+            self.fOut.write("Model name:   " + class_diagram.name)
+        if class_diagram.description.strip():
+            self.fOut.write("Model description:")
+            self.fOut.write()
+            self.fOut.indent()
+            self.fOut.write(class_diagram.description.strip())
+            self.fOut.dedent()
+        self.fOut.dedent()
+        self.fOut.write('*/')
+        self.fOut.write()
+        
+        #Namespace using declarations by the user
+        self.fOut.write('using System;')
+        self.fOut.write('using System.Collections.Generic;')
+        self.fOut.write('using sccdlib;')
+
+        #User imports
+        if class_diagram.top.strip():
+            self.writeCodeCorrectIndent(class_diagram.top)
+        self.fOut.write()
+        
+        #visit children
+        for c in class_diagram.classes :
+            c.accept(self)
+         
+        #writing out ObjectManager
+        self.fOut.write('public class ObjectManager : ObjectManagerBase')
+        self.fOut.write('{')
+        self.fOut.indent()
+        self.fOut.write('public ObjectManager(ControllerBase controller): base(controller)')
+        self.fOut.write("{")
+        self.fOut.write("}")
+        self.fOut.write()
+        
+        self.fOut.write('protected override InstanceWrapper instantiate(string class_name, object[] construct_params)')
+        self.fOut.write('{')
+        self.fOut.indent()
+        self.fOut.write("RuntimeClassBase instance = null;")
+        self.fOut.write("List<Association> associations = new List<Association>();")
+        for index, c in enumerate(class_diagram.classes) :
+            if index == 0 :
+                self.fOut.write()
+            else :
+                self.fOut.write('}else ')
+            self.fOut.extendWrite('if (class_name == "' + c.name + '" ){')
+            self.fOut.indent()
+            self.fOut.write('object[] new_parameters = new object[construct_params.Length + 1];')
+            self.fOut.write('new_parameters[0] = this.controller;')
+            self.fOut.write('Array.Copy(construct_params, 0, new_parameters, 1, construct_params.Length);')
+            self.fOut.write('instance = (RuntimeClassBase) Activator.CreateInstance(typeof(' + c.name + '), new_parameters);')
+            for a in c.associations :
+                a.accept(self)
+            self.fOut.dedent()
+            if index == len(class_diagram.classes)-1 :
+                self.fOut.write('}')
+            
+        self.fOut.write('if (instance != null) {')
+        self.fOut.indent()
+        self.fOut.write('return new InstanceWrapper(instance, associations);')
+        self.fOut.dedent()
+        self.fOut.write('}')
+        self.fOut.write('return null;')
+        self.fOut.dedent()
+        self.fOut.write('}')
+        self.fOut.dedent()
+        self.fOut.write('}')
+        
+        # write out controller
+        self.fOut.write()
+        if self.platform == Platforms.Threads :
+            controller_sub_class = "ThreadsControllerBase"
+        elif self.platform == Platforms.GameLoop :
+            controller_sub_class = "GameLoopControllerBase"
+        self.fOut.write("public class Controller : " + controller_sub_class)
+        self.fOut.write("{")
+        self.fOut.indent()
+    
+        # write out constructor(s)
+        if class_diagram.default_class.constructors :
+            for constructor in class_diagram.default_class.constructors :
+                self.writeControllerConstructor(class_diagram, constructor.parameters)
+        else :
+            self.writeControllerConstructor(class_diagram)
+        
+        self.fOut.write("public static void Main()")
+        self.fOut.write("{")
+        self.fOut.indent()
+        self.fOut.write("Controller controller = new Controller();")
+        self.fOut.write("controller.start();")
+        self.fOut.dedent()
+        self.fOut.write("}")
+        
+        self.fOut.dedent()
+        self.fOut.write("}")
+        
+    #helper method
+    def writeControllerConstructor(self, class_diagram, parameters = []):
+        self.fOut.write('public Controller(')
+        self.writeFormalParameters(parameters + [FormalParameter("keep_running", "bool", "true")])
+        self.fOut.extendWrite(") : base(keep_running)")
+        self.fOut.write('{')
+        self.fOut.indent()
+        
+        for p in class_diagram.inports:
+            self.fOut.write('this.addInputPort("' + p + '");')
+        for p in class_diagram.outports:
+            self.fOut.write('this.addOutputPort("' + p + '");')
+        self.fOut.write('this.object_manager = new ObjectManager(this);')
+        actual_parameters = [p.getIdent() for p in parameters]
+        self.fOut.write('this.object_manager.createInstance("'+ class_diagram.default_class.name +'", new object[]{' +  ', '.join(actual_parameters)+ '});')
+        self.fOut.dedent()
+        self.fOut.write('}')
+
+    def visit_Class(self, class_node):
+        """
+        Generate code for Class construct
+        """
+        self.fOut.write()
+        self.fOut.write("public class " + class_node.name )
+        # Take care of inheritance
+        if len(class_node.super_classes) > 1 :
+            raise Exception("C# doesn't allow multiple inheritance.");
+        elif len(class_node.super_classes) == 1 :
+            self.fOut.extendWrite(" : " + class_node.super_classes[0])
+        else :
+            self.fOut.extendWrite(" : " + "RuntimeClassBase")
+        self.fOut.write("{")
+        self.fOut.indent()
+        self.fOut.write()
+        
+        if class_node.statechart is not None:
+            # assign each node a unique ID
+            self.fOut.write("/// <summary>")
+            self.fOut.write("/// Enum uniquely representing all statechart nodes.")
+            self.fOut.write("/// </summary>")
+            self.fOut.write("public enum Node {")
+            self.fOut.indent()
+            for node in class_node.statechart.composites + class_node.statechart.basics:
+                self.fOut.write(node.full_name + ",");
+            self.fOut.dedent();
+            self.fOut.write("};")
+            self.fOut.write()
+            self.fOut.write("Dictionary<Node,List<Node>> current_state = new Dictionary<Node,List<Node>>();");
+            if len(class_node.statechart.histories) > 0 :
+                self.fOut.write("Dictionary<Node,List<Node>> history_state = new Dictionary<Node,List<Node>>();");
+            self.fOut.write();
+            
+        #User defined attributes
+        if class_node.attributes:
+            self.fOut.write("//User defined attributes")
+            for attribute in class_node.attributes:
+                self.fOut.write(attribute.type + " " + attribute.name)
+                if attribute.init_value is not None :
+                    self.fOut.write(" = " + attribute.init_value);
+                self.fOut.extendWrite(";")     
+            self.fOut.write()
+
+        if class_node.statechart is not None:  
+            self.fOut.write("/// <summary>")
+            self.fOut.write("/// Constructor part that is common for all constructors.")
+            self.fOut.write("/// </summary>")
+            self.fOut.write("private void commonConstructor(ControllerBase controller = null)")
+            self.fOut.write("{")
+            self.fOut.indent() 
+            self.fOut.write("this.controller = controller;")
+            self.fOut.write("this.object_manager = controller.getObjectManager();")
+            if class_node.statechart.nr_of_after_transitions != 0:
+                self.fOut.write("this.timers = new Dictionary<int,double>();")
+
+            self.fOut.write()
+            self.fOut.write("//Initialize statechart :")
+            self.fOut.write()
+
+            if class_node.statechart.histories:
+                for node in class_node.statechart.combined_history_parents:
+                    self.fOut.write("this.history_state[Node." + node.full_name + "] = new List<Node>();")
+                self.fOut.write()
+
+            for node in class_node.statechart.composites :
+                self.fOut.write("this.current_state[Node." + node.full_name + "] = new List<Node>();")
+                
+        self.fOut.dedent()
+        self.fOut.write("}")
+        self.fOut.write()
+        
+        self.fOut.write("public override void start()")
+        self.fOut.write("{")
+        
+        self.fOut.indent()
+        self.fOut.write("base.start();")
+        for default_node in class_node.statechart.root.defaults:
+            if default_node.is_composite:
+                self.fOut.write("this.enterDefault_" + default_node.full_name + "();")
+            elif default_node.is_basic:
+                self.fOut.write("this.enter_" + default_node.full_name + "();")
+        self.fOut.dedent()
+        self.fOut.write("}")
+        self.fOut.write()
+        
+        #visit children
+        for i in class_node.constructors :
+            i.accept(self)
+        for i in class_node.destructors :
+            i.accept(self)
+        for i in class_node.methods :
+            i.accept(self)
+        if class_node.statechart is not None:
+            class_node.statechart.accept(self)
+          
+        self.fOut.dedent()
+        self.fOut.write("}")
+        self.fOut.write()
+
+    def writeFormalParameters(self, parameters = []):
+        """Helper method that writes a correct comma separated list of formal parameters"""    
+        first = True       
+        for param in parameters :
+            if first :
+                first = False
+            else :
+                self.fOut.extendWrite(', ')
+            param.accept(self)
+        
+    def visit_FormalParameter(self, formal_parameter):
+        self.fOut.extendWrite(formal_parameter.getType() + " " + formal_parameter.getIdent())
+        if formal_parameter.hasDefault() :
+            self.fOut.extendWrite(" = " + formal_parameter.getDefault())
+                    
+    def visit_Constructor(self, constructor):
+
+        self.fOut.write(constructor.access + " " + constructor.parent_class.name + "(")
+        self.writeFormalParameters([FormalParameter("controller", "ControllerBase", None)] + constructor.getParams())
+        self.fOut.extendWrite(")")
+        self.fOut.write("{")
+        self.fOut.indent()
+        self.fOut.write("this.commonConstructor(controller);")
+        if constructor.body :
+            self.fOut.write()
+            self.fOut.write("//constructor body (user-defined)")
+            self.writeCodeCorrectIndent(constructor.body)
+        self.fOut.dedent()
+        self.fOut.write("}")
+        self.fOut.write()
+        
+    def visit_Destructor(self, destructor):
+        self.fOut.write("~" + destructor.parent_class.name + "()")
+        self.fOut.write("{")
+        if destructor.body :
+            self.fOut.indent()
+            self.writeCodeCorrectIndent(destructor.body)
+            self.fOut.dedent()
+        self.fOut.write("}")
+        self.fOut.write()
+        
+    def visit_Method(self, method):
+        self.fOut.write(method.access + " " + method.return_type + " " + method.name + "(")
+        self.writeFormalParameters(method.getParams())
+        self.fOut.extendWrite(")")
+        self.fOut.write("{")
+        self.fOut.indent()
+        if method.body :
+            self.fOut.indent()
+            self.writeCodeCorrectIndent(method.body)
+            self.fOut.dedent()
+        self.fOut.dedent()
+        self.fOut.write("}")
+        self.fOut.write()
+        
+    def visit_Association(self, association):
+        self.fOut.write('associations.Add(new Association("' + association.name + '", "' + association.to_class + '", ' + str(association.min) + ', ' + str(association.max) + '));')
+        
+    #helper method
+    def writeTransitionsRecursively(self, current_node):
+        self.fOut.write("private bool transition_" + current_node.full_name + "(Event e)")
+        self.fOut.write("{")
+        self.fOut.indent()
+        
+        valid_children = []
+        for child in current_node.children :
+            if child.is_composite or child.is_basic :
+                valid_children.append(child)  
+         
+        self.fOut.write("bool catched = false;")
+        do_dedent = False
+        if current_node.solves_conflict_outer :
+            self.writeFromTransitions(current_node)
+            if current_node.is_parallel_state or current_node.is_composite :
+                self.fOut.write("if (!catched){")
+                self.fOut.indent()
+                do_dedent = True
+            
+        if current_node.is_parallel_state:
+            for child in valid_children :     
+                self.fOut.write("catched = this.transition_" + child.full_name + "(e) || catched;")
+        elif current_node.is_composite:
+            self.fOut.write()
+            for i, child in enumerate(valid_children) :
+                if i > 0 :
+                    self.fOut.extendWrite(" else ")
+                self.fOut.extendWrite("if (this.current_state[Node." + current_node.full_name + "][0] == Node." + child.full_name + "){")
+                self.fOut.indent()
+                self.fOut.write("catched = this.transition_" + child.full_name + "(e);")
+                self.fOut.dedent()
+                self.fOut.write("}")
+                
+        if current_node.solves_conflict_outer :
+            if do_dedent :
+                self.fOut.dedent()
+                self.fOut.write("}")
+        elif len(current_node.transitions) > 0 :
+                self.fOut.write("if (!catched) {")
+                self.fOut.indent()
+                self.writeFromTransitions(current_node)
+                self.fOut.dedent()
+                self.fOut.write("}")
+            
+        self.fOut.write("return catched;")
+        self.fOut.dedent()
+        self.fOut.write("}")
+        self.fOut.write();
+        
+        for child in valid_children :
+            self.writeTransitionsRecursively(child)
+                
+    #helper method
+    def writeFromTransitions(self, current_node): 
+        # get all transition out of this state
+        out_transitions = current_node.transitions
+        if len(out_transitions) == 0 :
+            return
+        
+        self.fOut.write('List<int> enableds = new List<int>();')
+        for index, transition in enumerate(out_transitions):
+            self.writeTransitionCondition(transition, index)
+            
+        self.fOut.write("if (enableds.Count > 1){")
+        self.fOut.indent()
+        self.fOut.write('Console.WriteLine("Runtime warning : indeterminism detected in a transition from node ' +  current_node.full_name+ '. Only the first in document order enabled transition is executed.");')
+        self.fOut.dedent()
+        self.fOut.write('}')
+        self.fOut.write("if (enableds.Count > 0){")
+        self.fOut.indent()
+        self.fOut.write('int enabled = enableds[0];')
+        self.fOut.write()      
+              
+        for index, transition in enumerate(out_transitions):
+            self.writeTransitionAction(transition, index)
+        
+        self.fOut.write('catched = true;')   
+        self.fOut.dedent()
+        self.fOut.write('}')         
+        self.fOut.write()
+        
+    def visit_FormalEventParameter(self, formal_event_parameter):
+        self.fOut.extendWrite(formal_event_parameter.getType() + " " + formal_event_parameter.name)
+        
+    def writeFormalEventParameters(self, transition):
+        parameters = transition.getTrigger().getParameters()
+        if(len(parameters) > 0) :
+            self.fOut.write('object[] parameters = e.getParameters();')
+            for index, parameter in enumerate(parameters):
+                self.fOut.write()
+                parameter.accept(self)
+                self.fOut.extendWrite(' = (' + parameter.getType() + ')parameters[' + str(index) + '];')
+        
+    def writeTransitionAction(self, transition, index):
+        if index > 1 :
+            self.fOut.extendWrite(" else ")
+        else :
+            self.fOut.write()
+        self.fOut.extendWrite("if (enabled == " + str(index) + "){")
+        self.fOut.indent()
+
+        # handle parameters to actually use them             
+        self.writeFormalEventParameters(transition)
+        
+        exits = transition.getExitNodes()
+        
+        # write out exit actions
+        if not exits[-1].is_basic:
+            self.fOut.write("this.exit_" + exits[-1].full_name + "();")
+        else:
+            for node in exits:
+                if node.is_basic:
+                    self.fOut.write("this.exit_" + node.full_name + "();")
+                    
+        # write out trigger actions
+        transition.getAction().accept(self)
+        
+        for (entering_node, is_ending_node) in transition.getEnterNodes() : 
+            if is_ending_node :
+                if entering_node.is_composite:
+                    self.fOut.write("this.enterDefault_" + entering_node.full_name + "();")
+                elif entering_node.is_history:
+                    if (entering_node.is_history_deep) :
+                        self.fOut.write("this.enterHistoryDeep_" + entering_node.parent.full_name + "();")
+                    else :
+                        self.fOut.write("this.enterHistoryShallow_" + entering_node.parent.full_name + "();")
+                else:
+                    self.fOut.write("this.enter_" + entering_node.full_name + "();")
+            else :
+                if entering_node.is_composite:
+                    self.fOut.write("this.enter_" + entering_node.full_name + "();")
+
+        self.fOut.dedent()
+        self.fOut.write('}')
+                        
+    def writeTransitionCondition(self, transition, index):
+        trigger = transition.getTrigger()
+        if not trigger.isUC():  
+            self.fOut.write('if (e.getName() == "' + trigger.getEvent() + '" && e.getPort() == "' + trigger.getPort() + '"){')
+            self.fOut.indent()   
+        # evaluate guard
+        if transition.hasGuard() :   
+            # handle parameters for guard evaluation       
+            self.writeFormalEventParameters(transition)  
+
+            self.fOut.write('if (')
+            transition.getGuard().accept(self)
+            self.fOut.extendWrite('){')
+            self.fOut.indent()    
+            
+        self.fOut.write("enableds.Add(" + str(index) + ");")
+
+        if transition.hasGuard() :
+            self.fOut.dedent()
+            self.fOut.write('}')
+        if not trigger.isUC() :
+            self.fOut.dedent()
+            self.fOut.write('}')
+        self.fOut.write()
+    
+    def visit_EnterAction(self, enter_method):
+        parent_node = enter_method.parent_node
+        self.fOut.write("private void enter_" + parent_node.full_name + "()")
+        self.fOut.write("{")
+        self.fOut.indent()
+        
+        # take care of any AFTER events
+        for transition in parent_node.transitions :
+            trigger = transition.getTrigger()
+            if trigger.isAfter() :
+                self.fOut.write("this.timers[" + str(trigger.getAfterIndex()) + "] = ")
+                trigger.after.accept(self)
+                self.fOut.extendWrite(";")
+        if enter_method.action:
+            enter_method.action.accept(self)
+        self.fOut.write("this.current_state[Node." + parent_node.parent.full_name + "].Add(Node." + parent_node.full_name + ");")
+        self.fOut.dedent()
+        self.fOut.write("}")
+        self.fOut.write()
+        
+    #helper method
+    def writeEnterDefault(self, entered_node):
+        self.fOut.write("private void enterDefault_" + entered_node.full_name + "()")
+        self.fOut.write("{")
+        self.fOut.indent()
+        self.fOut.write("this.enter_" + entered_node.full_name + "();")
+        if entered_node.is_composite:
+            l = entered_node.defaults
+            for i in l:
+                if i.is_composite:
+                    self.fOut.write("this.enterDefault_" + i.full_name + "();")
+                elif i.is_basic:
+                    self.fOut.write("this.enter_" + i.full_name + "();")
+        self.fOut.dedent()
+        self.fOut.write("}")
+        self.fOut.write()
+         
+    def visit_ExitAction(self, exit_method):
+        exited_node = exit_method.parent_node
+        self.fOut.write("private void exit_" + exited_node.full_name + "()")
+        self.fOut.write("{")
+        self.fOut.indent()
+        #If the exited node is composite take care of potential history and the leaving of descendants
+        if exited_node.is_composite :
+            #handle history
+            if exited_node.save_state_on_exit:
+                self.fOut.write("this.history_state[Node." + exited_node.full_name + "].AddRange(this.current_state[Node." + exited_node.full_name + "]);")
+            
+            #Take care of leaving children
+            children = exited_node.children
+            if exited_node.is_parallel_state:
+                for child in children:
+                    if not child.is_history :
+                        self.fOut.write("this.exit_" + child.full_name + "();")
+            else:
+                for child in children:
+                    if not child.is_history :
+                        self.fOut.write("if (this.current_state[Node." + exited_node.full_name + "].Contains(Node." + child.full_name +  ")){")
+                        self.fOut.indent()
+                        self.fOut.write("this.exit_" + child.full_name + "();")
+                        self.fOut.dedent()  
+                        self.fOut.write("}")
+        
+        
+        # take care of any AFTER events
+        for transition in exited_node.transitions :
+            trigger = transition.getTrigger()
+            if trigger.isAfter() :
+                self.fOut.write("this.timers.Remove(" + str(trigger.getAfterIndex()) + ");")
+                
+        #Execute user-defined exit action if present
+        if exit_method.action:
+            exit_method.action.accept(self)
+            
+        #Adjust state
+        self.fOut.write("this.current_state[Node." + exited_node.parent.full_name + "].Remove(Node." + exited_node.full_name + ");")
+
+        self.fOut.dedent()
+        self.fOut.write("}")
+        self.fOut.write()
+        
+            
+    #helper method
+    def writeEnterHistory(self, entered_node, is_deep):
+        self.fOut.write("private void enterHistory" + ("Deep" if is_deep else "Shallow") + "_" + entered_node.full_name + "()")
+        self.fOut.write("{")
+        self.fOut.indent()
+        self.fOut.write("if (this.history_state[Node." + entered_node.full_name + "].Count == 0){")
+        self.fOut.indent()
+        defaults = entered_node.defaults
+
+        for node in defaults:
+            if node.is_basic :
+                self.fOut.write("this.enter_" + node.full_name + "();")
+            elif node.is_composite :
+                self.fOut.write("this.enterDefault_" + node.full_name + "();")
+
+        self.fOut.dedent()
+        self.fOut.write("} else {")
+        self.fOut.indent()
+        children = entered_node.children
+        if entered_node.is_parallel_state:
+            for child in children:
+                if not child.is_history :
+                    self.fOut.write("this.enterHistory" + ("Deep" if is_deep else "Shallow") + "_" + child.full_name + "();")
+        else:
+            for child in children:
+                if not child.is_history :
+                    self.fOut.write("if (this.history_state[Node." + entered_node.full_name + "].Contains(Node." + child.full_name + ")){")
+                    self.fOut.indent()
+                    if child.is_composite:
+                        if is_deep :
+                            self.fOut.write("this.enter_" + child.full_name + "();")
+                            self.fOut.write("this.enterHistoryDeep_" + child.full_name + "();")
+                        else :
+                            self.fOut.write("this.enterDefault_" + child.full_name + "();")
+                    else:
+                        self.fOut.write("this.enter_" + child.full_name + "();")
+                    self.fOut.dedent()
+                    self.fOut.write("}")
+        self.fOut.dedent()
+        self.fOut.write("}")
+        self.fOut.dedent()
+        self.fOut.write("}")
+        self.fOut.write()
+
+    def visit_StateChart(self, statechart):
+        self.fOut.write("//Statechart enter/exit action method(s) :")
+        self.fOut.write()
+        
+        #visit enter and exit actions of children
+        for i in statechart.composites + statechart.basics:
+            if i is not statechart.root :
+                i.enter_action.accept(self)
+                i.exit_action.accept(self)
+
+        # write out statecharts methods for enter/exit state
+        if len(statechart.composites) > 1 :
+            self.fOut.write("//Statechart enter/exit default method(s) :")
+            self.fOut.write()
+            for i in statechart.composites :
+                if i is not statechart.root :
+                    self.writeEnterDefault(i)
+
+        # write out statecharts methods for enter/exit history
+        if statechart.histories:
+            self.fOut.write("//Statechart enter/exit history method(s) :")
+            self.fOut.write()
+            for i in statechart.shallow_history_parents:
+                self.writeEnterHistory(i, False)
+            for i in statechart.deep_history_parents:
+                self.writeEnterHistory(i, True)   
+                
+        self.fOut.write("//Statechart transitions :")
+        self.fOut.write()
+        self.writeTransitionsRecursively(statechart.root)            
+                
+        # write out transition function
+        self.fOut.write("protected override void transition (Event e = null)")
+        self.fOut.write("{")
+        self.fOut.indent()
+        self.fOut.write("if (e == null) {");
+        self.fOut.indent()
+        self.fOut.write("e = new Event();")
+        self.fOut.dedent()
+        self.fOut.write("}")
+        self.fOut.write("this.state_changed = this.transition_" + statechart.root.full_name + "(e);")
+        self.fOut.dedent()
+        self.fOut.write("}")
+        self.fOut.write()
+
+        # write out inState function
+        self.fOut.write("public bool inState(List<Node> nodes)")
+        self.fOut.write("{")
+        self.fOut.indent()
+        self.fOut.write("foreach(List<Node> actives in current_state.Values){")
+        self.fOut.indent()
+        self.fOut.write("foreach(Node node in actives)")
+        self.fOut.indent()
+        self.fOut.write("nodes.Remove (node);")
+        self.fOut.dedent()
+        self.fOut.write("if (nodes.Count == 0){")
+        self.fOut.indent()
+        self.fOut.write("return true;")
+        self.fOut.dedent()
+        self.fOut.write("}")
+        self.fOut.dedent()
+        self.fOut.write("}")
+        self.fOut.write("return false;")
+        self.fOut.dedent()
+        self.fOut.write("}")
+        self.fOut.write()
+        
+    def visit_ExpressionPartString(self, bare_string):
+        self.fOut.extendWrite(bare_string.string)
+        
+    def visit_SelfReference(self, self_reference):
+        self.fOut.extendWrite("this")
+        
+    def visit_StateReference(self, state_ref):
+        self.fOut.extendWrite("new List<Node>() {")
+        self.fOut.extendWrite(", ".join(["Node." + node.full_name for node in state_ref.getNodes()]))
+        self.fOut.extendWrite("}")
+        
+    def visit_InStateCall(self, in_state_call):
+        self.fOut.extendWrite("this.inState(")
+        in_state_call.target.accept(self)
+        self.fOut.extendWrite(")")
+        
+    def visit_RaiseEvent(self, raise_event):
+        if raise_event.isNarrow() or raise_event.isBroad():
+            self.fOut.write('Event send_event = new Event("' + raise_event.getEventName() + '", "", new object[] {')
+        elif raise_event.isLocal():
+            self.fOut.write('this.addEvent( new Event("' + raise_event.getEventName() +'", "", new object[] {')
+        elif raise_event.isOutput():
+            self.fOut.write('this.controller.outputEvent(new Event("' + raise_event.getEventName() + '", "' + raise_event.getPort() + '", new object[] {')
+        elif raise_event.isCD():
+            self.fOut.write('this.object_manager.addEvent(new Event("' + raise_event.getEventName() + '", "", new object[] { this, ')
+        first_param = True
+        for param in raise_event.getParameters() :
+            if first_param :
+                first_param = False
+            else :
+                self.fOut.extendWrite(',')
+            param.accept(self)
+        if raise_event.isNarrow():
+            self.fOut.extendWrite('});')
+            self.fOut.write('this.object_manager.addEvent(new Event("narrow_cast", "", new object[] {this, "' + raise_event.getTarget() + '" ,send_event}));')
+        elif raise_event.isBroad():
+            self.fOut.extendWrite('});')
+            self.fOut.write('this.object_manager.addEvent(new Event("broad_cast", "", new object[] {send_event}));')
+        else :
+            self.fOut.extendWrite('}));')
+            
+    def visit_Script(self, script):
+        self.writeCodeCorrectIndent(script.code)
+        
+    def visit_Log(self, log):
+        self.fOut.write('Console.WriteLine("' + log.message + '");')
+        
+    def visit_Assign(self, assign):
+        self.fOut.write()
+        assign.lvalue.accept(self)
+        self.fOut.extendWrite(" = ")
+        assign.expression.accept(self)
+        self.fOut.extendWrite(";")
+        

+ 741 - 0
src/python_sccd_compiler/old_generators/javascript_generator.py

@@ -0,0 +1,741 @@
+import time
+from constructs import FormalParameter
+from code_generation import CodeGenerator, Platforms
+
+class JavascriptGenerator(CodeGenerator):
+	
+	def __init__(self):
+		self.supported_platforms = [Platforms.Threads, Platforms.GameLoop]
+				
+	def visit_ClassDiagram(self, class_diagram):
+		# header
+		self.fOut.write("/**");
+		self.fOut.write(" * Statechart compiler by Glenn De Jonghe")
+		self.fOut.write(" * Javascript generator by Joeri Exelmans")
+		self.fOut.write(" * ")
+		self.fOut.write(" * Date:   " + time.asctime())
+		if class_diagram.name or class_diagram.author or class_diagram.description:
+			self.fOut.write(" * ")
+		if class_diagram.author:
+			self.fOut.write(" * Model author: " + class_diagram.author)
+		if class_diagram.name:
+			self.fOut.write(" * Model name:   " + class_diagram.name)
+		if class_diagram.description.strip():
+			self.fOut.write(" * Model description:")
+			self.fOut.indent()
+			self.fOut.write(class_diagram.description.strip())
+			self.fOut.dedent()
+		self.fOut.write(" */")
+		
+		self.fOut.write()
+
+		self.fOut.write("// put everything in an object (serves as \"namespace\")")
+		self.fOut.write(class_diagram.name + " = {};")
+		self.fOut.write()
+		self.fOut.write("// closure scope")
+		self.fOut.write("(function() {")
+		self.fOut.write()
+		
+		#visit children
+		for c in class_diagram.classes :
+			c.accept(self)
+			self.fOut.write("// put class in global diagram object")
+			self.fOut.write(class_diagram.name + '.' + c.name + ' = ' + c.name + ';')
+			self.fOut.write()
+		 
+		#writing out ObjectManager
+		self.fOut.write('var ObjectManager = function(controller) {')
+		self.fOut.indent()
+		self.fOut.write("ObjectManagerBase.call(this, controller);")
+		self.fOut.dedent()
+		self.fOut.write("};")
+		self.fOut.write()
+
+		self.fOut.write("ObjectManager.prototype = new ObjectManagerBase();")
+		self.fOut.write()
+		
+		self.fOut.write('ObjectManager.prototype.instantiate = function(class_name, construct_params) {')
+		self.fOut.indent()
+		for index, c in enumerate(class_diagram.classes) :
+			if index == 0 : 
+				self.fOut.write()
+			else :
+				self.fOut.extendWrite(' else ')
+			self.fOut.extendWrite('if (class_name === "' + c.name + '") {')
+			self.fOut.indent()
+			if c.statechart :
+				self.fOut.write('var instance = new ' + c.name + '(this.controller')
+				param_count = 0
+				for p in c.constructors[0].parameters:
+					self.fOut.extendWrite(', construct_params[' + str(param_count) + ']')
+					param_count += 1
+				self.fOut.extendWrite(');')
+			else :
+				self.fOut.write('var instance = new ' + c.name + '(')
+				param_count = 0
+				for p in c.constructors[0].parameters:
+					if (param_count != 0):
+						self.fOut.extendWrite(', ')
+					self.fOut.extendWrite('construct_params[' + str(param_count) + ']')
+					param_count += 1
+				self.fOut.extendWrite(');');
+			self.fOut.write('instance.associations = new Object();')
+			for a in c.associations :
+				a.accept(self)
+			self.fOut.dedent()
+			self.fOut.write('}')
+		self.fOut.write('return instance;')
+		self.fOut.dedent()
+		self.fOut.write("};")
+
+		self.fOut.write()
+		self.fOut.write("// put in global diagram object")
+		self.fOut.write(class_diagram.name + '.ObjectManager = ObjectManager;')
+
+		self.fOut.write()
+		if self.platform == Platforms.Threads :
+			controller_sub_class = "JsEventLoopControllerBase"
+		elif self.platform == Platforms.GameLoop :
+			controller_sub_class = "GameLoopControllerBase"
+
+		# write out __init__ method
+		if class_diagram.default_class.constructors :
+			self.writeControllerConstructor(class_diagram, controller_sub_class, class_diagram.default_class.constructors[0].parameters)
+		else :
+			self.writeControllerConstructor(class_diagram, controller_sub_class)
+
+		self.fOut.write("Controller.prototype = new " + controller_sub_class + "();")
+		self.fOut.write()
+		self.fOut.write("// put in global diagram object")
+		self.fOut.write(class_diagram.name + '.Controller = Controller;')
+		self.fOut.write()
+		self.fOut.write("})();")
+		self.fOut.write()
+
+	#helper method
+	def writeControllerConstructor(self, class_diagram, controller_sub_class, parameters = []):
+		self.writeConstructorSignature("Controller", parameters + [FormalParameter("keep_running", "", "true"), FormalParameter("finished_callback", "", None)])
+		self.fOut.indent()
+		self.fOut.write(controller_sub_class + ".call(this, new ObjectManager(this), keep_running, finished_callback);")
+		for i in class_diagram.inports:
+			self.fOut.write('this.addInputPort("' + i + '");')
+		for i in class_diagram.outports:
+			self.fOut.write('this.addOutputPort("' + i + '");')
+		actual_parameters = [p.getIdent() for p in parameters]
+		self.fOut.write('this.object_manager.createInstance("'+ class_diagram.default_class.name +'", [' +  ', '.join(actual_parameters)+ ']);')
+		self.fOut.dedent()
+		self.fOut.write('};')
+		self.fOut.write()
+
+	def visit_Class(self, class_node):
+		"""
+		Generate code for Class construct
+		"""
+
+		if class_node.super_classes:
+			super_classes = []
+			for super_class in class_node.super_classes:
+				super_classes.append(super_class)
+		else:
+			super_classes = ["RuntimeClassBase"]
+
+		#visit children
+		for i in class_node.constructors :
+			i.accept(self)
+
+		self.fOut.write()
+		self.fOut.write(class_node.name + ".prototype = new " + super_classes[0] + "();")
+		self.fOut.write()
+
+		if class_node.statechart is not None:
+			# assign each node a unique ID
+			self.fOut.write("// Unique IDs for all statechart nodes")
+			for (i,node) in enumerate(class_node.statechart.composites + class_node.statechart.basics):
+				self.fOut.write(class_node.name + ".prototype." + node.full_name + " = " + str(i) + ";")
+			self.fOut.write()
+
+		#visit children
+		for i in class_node.destructors :
+			i.accept(self)
+		for i in class_node.methods :
+			i.accept(self)
+		if class_node.statechart is not None:
+			class_node.statechart.accept(self)
+
+		self.writeMethodSignature(class_node.name, "user_defined_constructor", class_node.constructors[0].getParams())
+
+		self.fOut.indent()
+
+		for super_class in class_node.super_classes:
+			self.fOut.write(super_class + ".prototype.user_defined_constructor.call(this")
+			for p in class_node.constructors[0].super_class_parameters[super_class]:
+				self.fOut.extendWrite(", " + p)
+			self.fOut.extendWrite(");")
+
+
+		self.writeCodeCorrectIndent(class_node.constructors[0].body)
+		
+		self.fOut.dedent()
+		self.fOut.write("};")
+		self.fOut.write()
+		
+		self.writeMethodSignature(class_node.name, "start")
+		self.fOut.indent()
+		self.fOut.write(super_classes[0] + ".prototype.start.call(this);")
+		for default_node in class_node.statechart.root.defaults:
+			if default_node.is_composite:
+				self.fOut.write("this.enterDefault_" + default_node.full_name + "();")
+			elif default_node.is_basic:
+				self.fOut.write("this.enter_" + default_node.full_name + "();")
+		self.fOut.dedent()
+		self.fOut.write("};")
+		self.fOut.write()
+
+	#helper method
+	def writeConstructorSignature(self, prototype_name, parameters = []):
+		self.fOut.write("var " + prototype_name + " = function(")		   
+		for param in parameters :
+			if parameters.index(param) != 0:
+				self.fOut.extendWrite(', ')
+			param.accept(self)
+		self.fOut.extendWrite(") {")
+		self.fOut.indent()
+		for param in parameters :
+			if param.hasDefault() :
+				self.fOut.write("if (" + param.getIdent() + " === undefined) " +
+					param.getIdent() + " = " + param.getDefault() + ";")
+		self.fOut.dedent()
+
+	#helper method
+	def writeMethodSignature(self, prototype_name, method_name, parameters = []):
+		self.fOut.write(prototype_name + ".prototype." + method_name + " = function(")
+		for param in parameters :
+			if parameters.index(param) != 0 :
+				self.fOut.extendWrite(', ')
+			param.accept(self)
+		self.fOut.extendWrite(") {")
+		self.fOut.indent()
+		for param in parameters :
+			if param.hasDefault() :
+				self.fOut.write("if (!" + param.getIdent() + ") " +
+					param.getIdent() + " = " + param.getDefault() + ";")
+		self.fOut.dedent()
+		
+	#helper method
+	def writeMethod(self, prototype_name, name, parameters, return_type, body):
+		self.writeMethodSignature(prototype_name, name, parameters)
+		self.fOut.indent()
+		if body.strip():
+			self.writeCodeCorrectIndent(body)
+		self.fOut.write()
+		self.fOut.dedent()
+		self.fOut.write("};");
+		
+	def visit_FormalParameter(self, formal_parameter):
+		self.fOut.extendWrite(formal_parameter.getIdent())
+		
+	def visit_Constructor(self, constructor):
+		self.fOut.write("// Constructor")
+		parameters =  [FormalParameter("controller", "", None)] + constructor.getParams()
+		self.writeConstructorSignature(constructor.parent_class.name, parameters)
+		self.fOut.indent()
+
+		if constructor.parent_class.super_classes:
+			self.fOut.write(constructor.parent_class.super_classes[0] + ".call(this);")
+		else:
+			self.fOut.write("RuntimeClassBase.call(this);")
+
+		self.fOut.write()
+		self.fOut.write("if (controller) {")
+		self.fOut.indent()
+
+		#visit input, output ports
+		self.fOut.write("// User defined input ports")
+		self.fOut.write("this.inports = new Object();")
+		for p in constructor.parent_class.inports:
+			self.fOut.write("this.inports[\""+p+"\"] = controller.addInputPort(\""+p+"\", this);")
+
+		#for p in class_node.outports:
+
+		# write attributes
+		if constructor.parent_class.attributes:
+			self.fOut.write()
+			self.fOut.write("// User defined attributes")
+			for attribute in constructor.parent_class.attributes:
+				if attribute.init_value is None :
+					self.fOut.write("this." +  attribute.name + " = null;")
+				else :
+					self.fOut.write("this." +  attribute.name + " = " + attribute.init_value + ";")
+			self.fOut.write()
+
+		# if there is a statechart
+		if constructor.parent_class.statechart is not None:			
+			self.fOut.write("this.controller = controller;")
+			self.fOut.write("this.object_manager = controller.object_manager;")
+			self.fOut.write("this.current_state = new Object();")
+			self.fOut.write("this.history_state = new Object();")
+			if constructor.parent_class.statechart.nr_of_after_transitions:
+				self.fOut.write("this.timers = new Object();")
+			self.fOut.write()
+			self.fOut.write("// Initialize statechart")
+			
+			if constructor.parent_class.statechart.histories:
+				for node in constructor.parent_class.statechart.combined_history_parents:
+					self.fOut.write("this.history_state[" + constructor.parent_class.name + "." + node.full_name + "] = new Array();")
+				self.fOut.write()
+
+			for c in constructor.parent_class.statechart.composites :
+				self.fOut.write("this.current_state[this." + c.full_name + "] = new Array();")
+
+		self.fOut.write()
+		self.fOut.write("// Call user defined constructor")
+		self.fOut.write(constructor.parent_class.name + ".prototype.user_defined_constructor.call(this")
+		for p in constructor.getParams():
+			self.fOut.extendWrite(", ")
+			p.accept(self)
+		self.fOut.extendWrite(");")
+
+
+		self.fOut.dedent()
+		self.fOut.write("}")
+		self.fOut.dedent()
+		self.fOut.write("};")
+		self.fOut.write()
+
+	def visit_Destructor(self, destructor):
+		self.fOut.write("// User defined destructor")
+
+		self.writeMethodSignature(destructor.parent_class.name, "user_defined_destructor", [])
+		self.fOut.indent()
+		if destructor.body.strip():
+			self.writeCodeCorrectIndent(destructor.body)
+
+		if destructor.parent_class.super_classes:
+			self.fOut.write()
+			self.fOut.write("// Call super class destructors")
+			for super_class in destructor.parent_class.super_classes:
+				self.fOut.write(super_class + ".prototype.user_defined_destructor.call(this);")
+
+		self.fOut.dedent()
+		self.fOut.write("};");
+		self.fOut.write()
+		
+	def visit_Method(self, method):
+		self.fOut.write("// User defined method")
+		self.writeMethod(method.parent_class.name, method.name, method.parameters, method.return_type, method.body)
+		
+	def visit_Association(self, association):
+		self.fOut.write('instance.associations["' + association.name + '"] = new Association("' + association.to_class + '", ' + str(association.min) + ', ' + str(association.max) + ');')
+		
+	#helper method
+	def writeTransitionsRecursively(self, current_node):
+
+		self.writeMethodSignature(current_node.statechart.class_obj.name, "transition_" + current_node.full_name, [FormalParameter("event", "event")])
+		self.fOut.indent()
+		
+		valid_children = []
+		for child in current_node.children :
+			if child.is_composite or child.is_basic :
+				valid_children.append(child)  
+		 
+		self.fOut.write("var catched = false;")
+		do_dedent = False
+		if current_node.solves_conflict_outer :
+			self.writeFromTransitions(current_node)
+			if current_node.is_parallel_state or current_node.is_composite :
+				self.fOut.write("if (!catched) {")
+				self.fOut.indent()
+				do_dedent = True
+			
+		if current_node.is_parallel_state:
+			for child in valid_children :	 
+				self.fOut.write("catched = this.transition_" + child.full_name + "(event) || catched")
+		elif current_node.is_composite:
+			for i, child in enumerate(valid_children) :
+				if i > 0 :
+					self.fOut.write("else ")
+				else :
+					self.fOut.write()
+				self.fOut.extendWrite("if (this.current_state[this." + current_node.full_name + "][0] === this." + child.full_name + ") {")
+				self.fOut.indent()
+				self.fOut.write("catched = this.transition_" + child.full_name + "(event);")
+				self.fOut.dedent()
+				self.fOut.write("}")
+				
+		if current_node.solves_conflict_outer :
+			if do_dedent :
+				self.fOut.dedent()
+				self.fOut.write("}")
+		elif len(current_node.transitions) > 0 :
+				self.fOut.write("if (!catched) {")
+				self.fOut.indent()
+				self.writeFromTransitions(current_node)
+				self.fOut.dedent()
+				self.fOut.write("}");
+			
+		self.fOut.write("return catched;")
+		self.fOut.dedent()
+		self.fOut.write("};");
+		self.fOut.write();
+		
+		for child in valid_children :
+			self.writeTransitionsRecursively(child)
+				
+	#helper method
+	def writeFromTransitions(self, current_node): 
+		# get all transition out of this state
+		out_transitions = current_node.transitions
+		if len(out_transitions) == 0 :
+			return
+		
+		self.fOut.write('var enableds = new Array();')
+		for index, transition in enumerate(out_transitions, start=1):
+			self.writeTransitionCondition(transition, index)
+			
+		self.fOut.write("if (enableds.length > 1) {")
+		self.fOut.indent()
+		self.fOut.write('console.log("Runtime warning : indeterminism detected in a transition from node ' +  current_node.full_name+ '. Only the first in document order enabled transition is executed.")')
+		self.fOut.dedent()
+		self.fOut.write("}")
+		self.fOut.write()
+		self.fOut.write("if (enableds.length > 0) {")
+		self.fOut.indent()
+		self.fOut.write('var enabled = enableds[0];')	  
+			  
+		for index, transition in enumerate(out_transitions, start=1):
+			self.writeTransitionAction(transition, index)
+		
+		self.fOut.write('catched = true;')   
+		self.fOut.dedent()
+		self.fOut.write("}")
+		self.fOut.write()
+		
+	def visit_FormalEventParameter(self, formal_event_parameter):
+		self.fOut.extendWrite(formal_event_parameter.name)
+		
+	def writeFormalEventParameters(self, transition):
+		parameters = transition.getTrigger().getParameters()
+		if(len(parameters) > 0) :
+			self.fOut.write('var parameters = event.parameters;')
+			for index, parameter in enumerate(parameters):
+				self.fOut.write()
+				self.fOut.write("var ")
+				parameter.accept(self)
+				self.fOut.extendWrite(' = parameters[' + str(index) + '];')
+		
+		
+	def writeTransitionAction(self, transition, index):
+		if index > 1 :
+			self.fOut.write("else ")
+		else :
+			self.fOut.write()
+		self.fOut.extendWrite("if (enabled === " + str(index) + ") {")
+		self.fOut.indent()
+
+		# handle parameters to actually use them			 
+		self.writeFormalEventParameters(transition)
+		
+		exits = transition.getExitNodes()
+		
+		# write out exit actions
+		if not exits[-1].is_basic:
+			self.fOut.write("this.exit_" + exits[-1].full_name + "();")
+		else:
+			for node in exits:
+				if node.is_basic:
+					self.fOut.write("this.exit_" + node.full_name + "();")
+					
+		# write out trigger actions
+		transition.getAction().accept(self)
+		
+		for (entering_node, is_ending_node) in transition.getEnterNodes() : 
+			if is_ending_node :
+				if entering_node.is_composite:
+					self.fOut.write("this.enterDefault_" + entering_node.full_name + "();")
+				elif entering_node.is_history:
+					if (entering_node.is_history_deep) :
+						self.fOut.write("this.enterHistoryDeep_" + entering_node.parent.full_name + "();")
+					else :
+						self.fOut.write("this.enterHistoryShallow_" + entering_node.parent.full_name + "();")
+				else:
+					self.fOut.write("this.enter_" + entering_node.full_name + "();")
+			else :
+				if entering_node.is_composite:
+					self.fOut.write("this.enter_" + entering_node.full_name + "();")
+
+		self.fOut.dedent()
+		self.fOut.write("}")
+						
+	def writeTransitionCondition(self, transition, index):
+		trigger = transition.getTrigger()
+		if not trigger.isUC():  
+			self.fOut.write('if (event.name === "' + trigger.getEvent() + '"' + ((' && event.port === "' + trigger.getPort()+'"') if trigger.getPort() != "" else '') + ') {')
+			self.fOut.indent()   
+		# evaluate guard
+		if transition.hasGuard() :   
+			# handle parameters for guard evaluation	   
+			self.writeFormalEventParameters(transition)
+
+			self.fOut.write('if (')
+			transition.getGuard().accept(self)
+			self.fOut.extendWrite(') {')
+			self.fOut.indent()	
+			
+		self.fOut.write("enableds.push(" + str(index) + ");")
+
+		if transition.hasGuard() :
+			self.fOut.dedent()
+			self.fOut.write("}")
+		if not trigger.isUC() :
+			self.fOut.dedent()
+			self.fOut.write("}")
+		self.fOut.write()
+	
+	def visit_EnterAction(self, enter_method):
+		parent_node = enter_method.parent_node
+		self.writeMethodSignature(parent_node.statechart.class_obj.name, "enter_" + parent_node.full_name, [])
+		self.fOut.indent()
+		# take care of any AFTER events
+		for transition in parent_node.transitions :
+			trigger = transition.getTrigger()
+			if trigger.isAfter() :
+				self.fOut.write("this.timers[" + str(trigger.getAfterIndex()) + "] = ")
+				trigger.after.accept(self)
+				self.fOut.extendWrite(" * 1000.0; /* convert ms to s */")
+		if enter_method.action:
+			enter_method.action.accept(self)
+		self.fOut.write("this.current_state[this." + parent_node.parent.full_name + "].push(this." + parent_node.full_name + ");")
+		self.fOut.dedent()
+		self.fOut.write("};")
+		self.fOut.write()
+		
+	#helper method
+	def writeEnterDefault(self, entered_node):
+		self.writeMethodSignature(entered_node.statechart.class_obj.name, "enterDefault_" + entered_node.full_name, [])
+		self.fOut.indent()
+		self.fOut.write("this.enter_" + entered_node.full_name + "();")
+		if entered_node.is_composite:
+			l = entered_node.defaults
+			for i in l:
+				if i.is_composite:
+					self.fOut.write("this.enterDefault_" + i.full_name + "();")
+				elif i.is_basic:
+					self.fOut.write("this.enter_" + i.full_name + "();")
+		self.fOut.dedent()
+		self.fOut.write("};")
+		self.fOut.write()
+		 
+	def visit_ExitAction(self, exit_method):
+		exited_node = exit_method.parent_node
+		self.writeMethodSignature(exited_node.statechart.class_obj.name, "exit_" + exited_node.full_name, [])
+		self.fOut.indent()
+		
+		#If the exited node is composite take care of potential history and the leaving of descendants
+		if exited_node.is_composite :
+			#handle history
+			if exited_node.save_state_on_exit :
+				self.fOut.write("this.history_state[this." + exited_node.full_name + "] = this.current_state[this." + exited_node.full_name + "];")
+			
+			#Take care of leaving children
+			children = exited_node.children
+			if exited_node.is_parallel_state:
+				for child in children:
+					if not child.is_history :
+						self.fOut.write("this.exit_" + child.full_name + "();")
+			else:
+				for child in children:
+					if not child.is_history :
+						self.fOut.write("if (this.current_state[this." + exited_node.full_name + "].indexOf(this." + child.full_name +  ") !== -1) {")
+						self.fOut.indent()
+						self.fOut.write("this.exit_" + child.full_name + "();")
+						self.fOut.dedent()
+						self.fOut.write("}")
+		
+		
+		# take care of any AFTER events
+		for transition in exited_node.transitions :
+			trigger = transition.getTrigger()
+			if trigger.isAfter() :
+				self.fOut.write("delete this.timers[" + str(trigger.getAfterIndex()) + "];")
+				
+		#Execute user-defined exit action if present
+		if exit_method.action:
+			exit_method.action.accept(self)
+			
+		#Adjust state
+		self.fOut.write("this.current_state[this." + exited_node.parent.full_name + "] = new Array();") # SPECIAL CASE FOR ORTHOGONAL??
+		
+		self.fOut.dedent()
+		self.fOut.write("};")
+		self.fOut.write()
+		
+			
+	#helper method
+	def writeEnterHistory(self, entered_node, is_deep):
+		self.writeMethodSignature(entered_node.statechart.class_obj.name, "enterHistory" + ("Deep" if is_deep else "Shallow") + "_" + entered_node.full_name, [])
+		self.fOut.indent()
+		self.fOut.write("if (this.history_state[this." + entered_node.full_name + "].length === 0) {")
+		self.fOut.indent()
+		defaults = entered_node.defaults
+
+		for node in defaults:
+			if node.is_basic :
+				self.fOut.write("this.enter_" + node.full_name + "();")
+			elif node.is_composite :
+				self.fOut.write("this.enterDefault_" + node.full_name + "();")
+
+		self.fOut.dedent()
+		self.fOut.write("} else {")
+		self.fOut.indent()
+		children = entered_node.children
+		if entered_node.is_parallel_state:
+			for child in children:
+				if not child.is_history :
+					self.fOut.write("this.enterHistory" + ("Deep" if is_deep else "Shallow") + "_" + child.full_name + "();")
+		else:
+			for child in children:
+				if not child.is_history :
+					self.fOut.write("if (this.history_state[this." + entered_node.full_name + "].indexOf(this." + child.full_name + ") !== -1) {")
+					self.fOut.indent()
+					if child.is_composite:
+						if is_deep :
+							self.fOut.write("this.enter_" + child.full_name + "()")
+							self.fOut.write("this.enterHistoryDeep_" + child.full_name + "()")
+						else :
+							self.fOut.write("this.enterDefault_" + child.full_name + "()")
+					else:
+						self.fOut.write("this.enter_" + child.full_name + "()")
+					self.fOut.dedent()
+					self.fOut.write("}")
+		self.fOut.dedent()
+		self.fOut.write("}")
+		self.fOut.dedent()
+		self.fOut.write("};")
+		self.fOut.write()
+
+	def visit_StateChart(self, statechart):
+		self.fOut.write("// Statechart enter/exit action method(s) :")
+		self.fOut.write()
+		
+		#visit enter and exit action of children
+		for i in statechart.composites + statechart.basics:
+			if i is not statechart.root :
+				i.enter_action.accept(self)
+				i.exit_action.accept(self)
+
+		# write out statecharts methods for enter/exit state
+		if len(statechart.composites) > 1 :
+			self.fOut.write("// Statechart enter/exit default method(s) :")
+			self.fOut.write()
+			for i in statechart.composites :
+				if i is not statechart.root :
+					self.writeEnterDefault(i)
+
+		# write out statecharts methods for enter/exit history
+		if statechart.histories:
+			self.fOut.write("// Statechart enter/exit history method(s) :")
+			self.fOut.write()
+			for i in statechart.shallow_history_parents:
+				self.writeEnterHistory(i, False)
+			for i in statechart.deep_history_parents:
+				self.writeEnterHistory(i, True) 
+		   
+		   
+		self.fOut.write("// Statechart transitions :")	 
+		self.fOut.write()
+		self.writeTransitionsRecursively(statechart.root)			
+				
+		# write out transition function
+		self.fOut.write("// Execute transitions")
+		self.writeMethodSignature(statechart.class_obj.name, "transition", [FormalParameter("event", "Event", "new Event()")])
+		self.fOut.indent()
+		self.fOut.write("this.state_changed = this.transition_" + statechart.root.full_name + "(event);")
+		self.fOut.dedent()
+		self.fOut.write("};");
+		self.fOut.write()
+
+		# write out inState function
+		self.fOut.write("// inState method for statechart")
+		self.writeMethodSignature(statechart.class_obj.name, "inState", [FormalParameter("nodes", "Array")])
+		#self.fOut.write("def inState(self, nodes):")
+		self.fOut.indent()
+		self.fOut.write("for (var c in this.current_state) {")
+		self.fOut.indent()
+		self.fOut.write("if (!this.current_state.hasOwnProperty(c)) continue;")
+
+		self.fOut.write("var new_nodes = new Array();")
+		self.fOut.write("for (var n in nodes) {")
+		self.fOut.indent()
+		self.fOut.write("if (!nodes.hasOwnProperty(n)) continue;")
+		self.fOut.write("if (this.current_state[c].indexOf(nodes[n]) === -1) {")
+		self.fOut.indent()
+		self.fOut.write("new_nodes.push(nodes[n]);")
+		self.fOut.dedent()
+		self.fOut.write("}")
+		self.fOut.dedent()
+		self.fOut.write("}")
+		self.fOut.write("nodes = new_nodes;")
+		self.fOut.write("if (nodes.length === 0) {")
+		self.fOut.indent()
+		self.fOut.write("return true;")
+		self.fOut.dedent()
+
+		self.fOut.write("}")
+		self.fOut.dedent()
+		self.fOut.write("}")
+		self.fOut.write("return false;")
+		self.fOut.dedent()
+		self.fOut.write("};")
+		self.fOut.write()
+
+	def visit_ExpressionPartString(self, bare_string):
+		self.fOut.extendWrite(bare_string.string)
+		
+	def visit_SelfReference(self, self_reference):
+		self.fOut.extendWrite("this")
+		
+	def visit_StateReference(self, state_ref):
+		self.fOut.extendWrite("[" + ",".join(["this." + node.full_name for node in state_ref.getNodes()]) + "]")
+		
+	def visit_InStateCall(self, in_state_call):
+		self.fOut.extendWrite("this.inState(")
+		in_state_call.target.accept(self)
+		self.fOut.extendWrite(")")
+		
+	def visit_RaiseEvent(self, raise_event):
+		if raise_event.isNarrow() or raise_event.isBroad():
+			self.fOut.write('var send_event = new Event("' + raise_event.getEventName() + '", null, [')
+		elif raise_event.isLocal():
+			self.fOut.write('this.addEvent(new Event("' + raise_event.getEventName() + '", null, [')
+		elif raise_event.isOutput():
+			self.fOut.write('this.controller.outputEvent(new Event("' + raise_event.getEventName() + '", "' + raise_event.getPort() + '", [')
+		elif raise_event.isCD():
+			self.fOut.write('this.object_manager.addEvent(new Event("' + raise_event.getEventName() + '", null, [this, ')
+		first_param = True
+		for param in raise_event.getParameters() :
+			if first_param :
+				first_param = False
+			else :
+				self.fOut.extendWrite(',')
+			param.accept(self)
+		if raise_event.isNarrow():
+			self.fOut.extendWrite(']);')
+			self.fOut.write('this.object_manager.addEvent(new Event("narrow_cast", null, [this, ' + raise_event.getTarget() + ' , send_event]));')
+		elif raise_event.isBroad():
+			self.fOut.extendWrite(']);')
+			self.fOut.write('this.object_manager.addEvent(new Event("broad_cast", null, [send_event]));')
+		else :
+			self.fOut.extendWrite(']));')
+			
+	def visit_Script(self, script):
+		self.writeCodeCorrectIndent(script.code)
+		
+	def visit_Log(self, log):
+		self.fOut.write('console.log("' + log.message + '");')
+		
+	def visit_Assign(self, assign):
+		self.fOut.write()
+		assign.lvalue.accept(self)
+		self.fOut.extendWrite(" = ")
+		assign.expression.accept(self)
+	

+ 644 - 0
src/python_sccd_compiler/old_generators/python_generator.py

@@ -0,0 +1,644 @@
+import time
+from constructs import FormalParameter
+from code_generation import CodeGenerator, Platforms
+
+class PythonGenerator(CodeGenerator):
+	
+	def __init__(self):
+		self.supported_platforms = [Platforms.Threads, Platforms.GameLoop]
+				
+	def visit_ClassDiagram(self, class_diagram):
+		self.fOut.write("# Statechart compiler by Glenn De Jonghe")
+		self.fOut.write("#")
+		self.fOut.write("# Date:   " + time.asctime())
+		if class_diagram.name or class_diagram.author or class_diagram.description:
+			self.fOut.write()
+		if class_diagram.author:
+			self.fOut.write("# Model author: " + class_diagram.author)
+		if class_diagram.name:
+			self.fOut.write("# Model name:   " + class_diagram.name)
+		if class_diagram.description.strip():
+			self.fOut.write("# Model description:")
+			self.fOut.write('"""')
+			self.fOut.indent()
+			self.fOut.write(class_diagram.description.strip())
+			self.fOut.dedent()
+			self.fOut.write('"""')
+		self.fOut.write()
+		
+		#Mandatory imports
+		self.fOut.write('from python_runtime.statecharts_core import ObjectManagerBase, Event, InstanceWrapper, RuntimeClassBase, Association')
+		#User imports
+		if class_diagram.top.strip():
+			self.writeCodeCorrectIndent(class_diagram.top)
+		self.fOut.write()
+		
+		#visit children
+		for c in class_diagram.classes :
+			c.accept(self)
+		 
+		#writing out ObjectManager
+		self.fOut.write('class ObjectManager (ObjectManagerBase):')
+		self.fOut.indent()
+		self.fOut.write('def __init__(self, controller):')
+		self.fOut.indent()
+		self.fOut.write("super(ObjectManager, self).__init__(controller)")
+		self.fOut.dedent()
+		self.fOut.write()
+		
+		self.fOut.write('def instantiate(self, class_name, construct_params):')
+		self.fOut.indent()
+		self.fOut.write("associations = []")
+		for index, c in enumerate(class_diagram.classes) :
+			if index == 0 : 
+				self.fOut.write()
+			else :
+				self.fOut.write('el')
+			self.fOut.extendWrite('if class_name == "' + c.name + '" :')
+			self.fOut.indent()
+			if c.statechart :
+				self.fOut.write('instance =  ' + c.name + '(self.controller, *construct_params)')
+			else :
+				self.fOut.write('instance =  ' + c.name + '(*construct_params)')
+			for a in c.associations :
+				a.accept(self)
+			self.fOut.dedent()
+		self.fOut.write('if instance:')
+		self.fOut.indent()
+		self.fOut.write('return InstanceWrapper(instance, associations)')
+		self.fOut.dedent()
+		self.fOut.write('else :')
+		self.fOut.indent()
+		self.fOut.write('return None')
+		self.fOut.dedent()
+		self.fOut.dedent()
+		self.fOut.dedent()
+		
+		self.fOut.write()
+		if self.platform == Platforms.Threads :
+			controller_sub_class = "ThreadsControllerBase"
+		elif self.platform == Platforms.GameLoop :
+			controller_sub_class = "GameLoopControllerBase"
+		self.fOut.write("from python_runtime.statecharts_core import " + controller_sub_class)
+
+		# write out controller
+		self.fOut.write("class Controller(" + controller_sub_class + "):")
+		self.fOut.indent()
+	
+		# write out __init__ method
+		if class_diagram.default_class.constructors :
+			for constructor in class_diagram.default_class.constructors :
+				self.writeControllerConstructor(class_diagram, constructor.parameters)
+		else :
+			self.writeControllerConstructor(class_diagram)
+
+		self.fOut.dedent()
+		self.fOut.write("def main():")
+		self.fOut.indent()
+		self.fOut.write("controller = Controller()")
+		self.fOut.write("controller.start()")
+		self.fOut.dedent()
+		self.fOut.write()
+	
+		self.fOut.write('if __name__ == "__main__":')
+		self.fOut.indent()
+		self.fOut.write("main()")
+		self.fOut.dedent()
+		self.fOut.write()
+		
+	#helper method
+	def writeControllerConstructor(self, class_diagram, parameters = []):
+		self.writeMethodSignature('__init__', parameters + [FormalParameter("keep_running", "", "True")])
+		self.fOut.indent()
+		self.fOut.write("super(Controller, self).__init__(ObjectManager(self), keep_running)")
+		for i in class_diagram.inports:
+			self.fOut.write('self.addInputPort("' + i + '")')
+		for i in class_diagram.outports:
+			self.fOut.write('self.addOutputPort("' + i + '")')
+		actual_parameters = [p.getIdent() for p in parameters]
+		self.fOut.write('self.object_manager.createInstance("'+ class_diagram.default_class.name +'", [' +  ', '.join(actual_parameters)+ '])')
+		self.fOut.write()
+		self.fOut.dedent()
+
+	def visit_Class(self, class_node):
+		"""
+		Generate code for Class construct
+		"""
+		self.fOut.write()
+		# take care of inheritance
+		if class_node.super_classes:
+			class_node.super_classes.append("RuntimeClassBase")
+			super_classes = []
+			for super_class in class_node.super_classes:
+				super_classes.append(super_class)
+			self.fOut.write("class " + class_node.name + "(" + ", ".join(super_classes) +  "):")
+		else:
+			self.fOut.write("class " + class_node.name + "(RuntimeClassBase):")
+
+		self.fOut.indent()
+		self.fOut.write()
+		
+		if class_node.statechart is not None:
+			# assign each node a unique ID
+			self.fOut.write("# Unique IDs for all statechart nodes")
+			for (i,node) in enumerate(class_node.statechart.composites + class_node.statechart.basics):
+				self.fOut.write(node.full_name + " = " + str(i))
+	
+			self.fOut.write()
+			self.writeMethodSignature("commonConstructor", [FormalParameter("controller", "", "None")])
+		else :
+			self.writeMethodSignature("commonConstructor")
+		self.fOut.indent()
+		self.fOut.write('"""Constructor part that is common for all constructors."""')
+		self.fOut.write("RuntimeClassBase.__init__(self)")
+
+		# write private input/output ports
+		self.fOut.write()
+		self.fOut.write("# User defined input ports")
+		self.fOut.write("self.inports = {}")
+		for p in class_node.inports:
+			self.fOut.write("self.inports[\""+p+"\"] = controller.addInputPort(\""+p+"\", self)")
+
+		# write attributes
+		if class_node.attributes:
+			self.fOut.write()
+			self.fOut.write("# User defined attributes")
+			for attribute in class_node.attributes:
+				if attribute.init_value is None :
+					self.fOut.write("self." +  attribute.name + " = None")
+				else :
+					self.fOut.write("self." +  attribute.name + " = " + attribute.init_value)	 
+			self.fOut.write()
+
+		# if there is a statechart
+		if class_node.statechart is not None:			
+			self.fOut.write("self.controller = controller")
+			self.fOut.write("self.object_manager = controller.getObjectManager()")
+			self.fOut.write("self.current_state = {}")
+			self.fOut.write("self.history_state = {}")
+			if class_node.statechart.nr_of_after_transitions:
+				self.fOut.write("self.timers = {}")
+			self.fOut.write()
+			self.fOut.write("#Initialize statechart :")
+			self.fOut.write()
+			
+			if class_node.statechart.histories:
+				for node in class_node.statechart.combined_history_parents:
+					self.fOut.write("self.history_state[" + class_node.name + "." + node.full_name + "] = []")
+				self.fOut.write()
+
+			for c in class_node.statechart.composites :
+				self.fOut.write("self.current_state[self." + c.full_name + "] = []")
+		
+		self.fOut.dedent()
+		self.fOut.write()
+		
+		self.writeMethodSignature("start")
+		self.fOut.indent()
+		self.fOut.write("super(" + class_node.name + ", self).start()")
+		if class_node.statechart:
+			for default_node in class_node.statechart.root.defaults:
+				if default_node.is_composite:
+					self.fOut.write("self.enterDefault_" + default_node.full_name + "()")
+				elif default_node.is_basic:
+					self.fOut.write("self.enter_" + default_node.full_name + "()")
+		self.fOut.dedent()
+		self.fOut.write()
+		
+		#visit children
+		for i in class_node.constructors :
+			i.accept(self)
+		for i in class_node.destructors :
+			i.accept(self)
+		for i in class_node.methods :
+			i.accept(self)
+		if class_node.statechart is not None:
+			class_node.statechart.accept(self)
+		  
+		# write out str method
+		self.fOut.dedent()
+
+	#helper method
+	def writeMethodSignature(self, name, parameters = []):
+		self.fOut.write("def " + name + "(self")		   
+		for param in parameters :
+			self.fOut.extendWrite(', ')
+			param.accept(self)
+		self.fOut.extendWrite("):")
+		
+	#helper method
+	def writeMethod(self, name, parameters, return_type, body):
+		self.writeMethodSignature(name, parameters)
+		self.fOut.indent()
+		if body.strip():
+			self.writeCodeCorrectIndent(body)
+		else:
+			self.fOut.write("return")
+		self.fOut.write()
+		self.fOut.dedent()
+		
+	def visit_FormalParameter(self, formal_parameter):
+		self.fOut.extendWrite(formal_parameter.getIdent())
+		if formal_parameter.hasDefault() :
+			self.fOut.extendWrite(" = " + formal_parameter.getDefault())
+		
+	def visit_Constructor(self, constructor):
+		self.fOut.write("#The actual constructor")
+		parameters =  [FormalParameter("controller", "", None)] + constructor.getParams()
+		self.writeMethodSignature("__init__", parameters)
+		self.fOut.indent()
+		if constructor.parent_class.statechart is not None :
+			self.fOut.write("self.commonConstructor(controller)")
+		else :
+			self.fOut.write("self.commonConstructor()")
+		if constructor.body :
+			self.fOut.write()
+			self.fOut.write("#constructor body (user-defined)")
+			self.writeCodeCorrectIndent(constructor.body)
+		self.fOut.dedent()
+		self.fOut.write()
+		
+	def visit_Destructor(self, destructor):
+		self.fOut.write("# User defined destructor")
+		self.writeMethod("__del__", [], "", destructor.body)
+		
+	def visit_Method(self, method):
+		self.fOut.write("# User defined method")
+		self.writeMethod(method.name, method.parameters, method.return_type, method.body)
+		
+	def visit_Association(self, association):
+		self.fOut.write('associations.append(Association("' + association.name + '", "' + association.to_class + '", ' + str(association.min) + ', ' + str(association.max) + '))')
+		
+	#helper method
+	def writeTransitionsRecursively(self, current_node):
+		self.fOut.write("def transition_" + current_node.full_name + "(self, event) :")
+		self.fOut.indent()
+		
+		valid_children = []
+		for child in current_node.children :
+			if child.is_composite or child.is_basic :
+				valid_children.append(child)  
+		 
+		self.fOut.write("catched = False")
+		do_dedent = False
+		if current_node.solves_conflict_outer :
+			self.writeFromTransitions(current_node)
+			if current_node.is_parallel_state or current_node.is_composite :
+				self.fOut.write("if not catched :")
+				self.fOut.indent()
+				do_dedent = True
+			
+		if current_node.is_parallel_state:
+			for child in valid_children :	 
+				self.fOut.write("catched = self.transition_" + child.full_name + "(event) or catched")
+		elif current_node.is_composite:
+			for i, child in enumerate(valid_children) :
+				if i > 0 :
+					self.fOut.write("el")
+				else :
+					self.fOut.write()
+				self.fOut.extendWrite("if self.current_state[self." + current_node.full_name + "][0] == self." + child.full_name + ":")
+				self.fOut.indent()
+				self.fOut.write("catched = self.transition_" + child.full_name + "(event)")
+				self.fOut.dedent()
+				
+		if current_node.solves_conflict_outer :
+			if do_dedent :
+				self.fOut.dedent()
+		elif len(current_node.transitions) > 0 :
+				self.fOut.write("if not catched :")
+				self.fOut.indent()
+				self.writeFromTransitions(current_node)
+				self.fOut.dedent()
+			
+		self.fOut.write("return catched")
+		self.fOut.dedent()
+		self.fOut.write();
+		
+		for child in valid_children :
+			self.writeTransitionsRecursively(child)
+				
+	#helper method
+	def writeFromTransitions(self, current_node): 
+		# get all transition out of this state
+		out_transitions = current_node.transitions
+		if len(out_transitions) == 0 :
+			return
+		
+		self.fOut.write('enableds = []')
+		for index, transition in enumerate(out_transitions, start=1):
+			self.writeTransitionCondition(transition, index)
+			
+		self.fOut.write("if len(enableds) > 1 :")
+		self.fOut.indent()
+		self.fOut.write('print "Runtime warning : indeterminism detected in a transition from node ' +  current_node.full_name+ '. Only the first in document order enabled transition is executed."')
+		self.fOut.dedent()
+		self.fOut.write()
+		self.fOut.write("if len(enableds) > 0 :")
+		self.fOut.indent()
+		self.fOut.write('enabled = enableds[0]')	  
+			  
+		for index, transition in enumerate(out_transitions, start=1):
+			self.writeTransitionAction(transition, index)
+		
+		self.fOut.write('catched = True')   
+		self.fOut.dedent()		 
+		self.fOut.write()
+		
+	def visit_FormalEventParameter(self, formal_event_parameter):
+		self.fOut.extendWrite(formal_event_parameter.name)
+		
+	def writeFormalEventParameters(self, transition):
+		parameters = transition.getTrigger().getParameters()
+		if(len(parameters) > 0) :
+			self.fOut.write('parameters = event.getParameters()')
+			for index, parameter in enumerate(parameters):
+				self.fOut.write()
+				parameter.accept(self)
+				self.fOut.extendWrite(' = parameters[' + str(index) + ']')
+		
+		
+	def writeTransitionAction(self, transition, index):
+		if index > 1 :
+			self.fOut.write("el")
+		else :
+			self.fOut.write()
+		self.fOut.extendWrite("if enabled == " + str(index) + " :")
+		self.fOut.indent()
+
+		# handle parameters to actually use them			 
+		self.writeFormalEventParameters(transition)
+		
+		exits = transition.getExitNodes()
+		
+		# write out exit actions
+		if not exits[-1].is_basic:
+			self.fOut.write("self.exit_" + exits[-1].full_name + "()")
+		else:
+			for node in exits:
+				if node.is_basic:
+					self.fOut.write("self.exit_" + node.full_name + "()")
+					
+		# write out trigger actions
+		transition.getAction().accept(self)
+		
+		for (entering_node, is_ending_node) in transition.getEnterNodes() : 
+			if is_ending_node :
+				if entering_node.is_composite:
+					self.fOut.write("self.enterDefault_" + entering_node.full_name + "()")
+				elif entering_node.is_history:
+					if (entering_node.is_history_deep) :
+						self.fOut.write("self.enterHistoryDeep_" + entering_node.parent.full_name + "()")
+					else :
+						self.fOut.write("self.enterHistoryShallow_" + entering_node.parent.full_name + "()")
+				else:
+					self.fOut.write("self.enter_" + entering_node.full_name + "()")
+			else :
+				if entering_node.is_composite:
+					self.fOut.write("self.enter_" + entering_node.full_name + "()")
+
+		self.fOut.dedent()
+						
+	def writeTransitionCondition(self, transition, index):
+		trigger = transition.getTrigger()
+		if not trigger.isUC():  
+			self.fOut.write('if event.name == "' + trigger.getEvent() + '" and event.getPort() == "' + trigger.getPort() + '" :')
+			self.fOut.indent()   
+		# evaluate guard
+		if transition.hasGuard() :   
+			# handle parameters for guard evaluation	   
+			self.writeFormalEventParameters(transition)
+
+			self.fOut.write('if ')
+			transition.getGuard().accept(self)
+			self.fOut.extendWrite(' :')
+			self.fOut.indent()	
+			
+		self.fOut.write("enableds.append(" + str(index) + ")")
+
+		if transition.hasGuard() :
+			self.fOut.dedent()
+		if not trigger.isUC() :
+			self.fOut.dedent()
+		self.fOut.write()
+	
+	def visit_EnterAction(self, enter_method):
+		parent_node = enter_method.parent_node
+		self.writeMethodSignature("enter_" + parent_node.full_name, [])
+		self.fOut.indent()
+		# take care of any AFTER events
+		for transition in parent_node.transitions :
+			trigger = transition.getTrigger()
+			if trigger.isAfter() :
+				self.fOut.write("self.timers[" + str(trigger.getAfterIndex()) + "] = ")
+				trigger.after.accept(self)
+		if enter_method.action:
+			enter_method.action.accept(self)
+		self.fOut.write("self.current_state[self." + parent_node.parent.full_name + "].append(self." + parent_node.full_name + ")")
+		self.fOut.dedent()
+		self.fOut.write()
+		
+	#helper method
+	def writeEnterDefault(self, entered_node):
+		self.writeMethodSignature("enterDefault_" + entered_node.full_name, [])
+		self.fOut.indent()
+		self.fOut.write("self.enter_" + entered_node.full_name + "()")
+		if entered_node.is_composite:
+			l = entered_node.defaults
+			for i in l:
+				if i.is_composite:
+					self.fOut.write("self.enterDefault_" + i.full_name + "()")
+				elif i.is_basic:
+					self.fOut.write("self.enter_" + i.full_name + "()")
+		self.fOut.dedent()
+		self.fOut.write()
+		 
+	def visit_ExitAction(self, exit_method):
+		exited_node = exit_method.parent_node
+		self.writeMethodSignature("exit_" + exited_node.full_name, [])
+		self.fOut.indent()
+		
+		#If the exited node is composite take care of potential history and the leaving of descendants
+		if exited_node.is_composite :
+			#handle history
+			if exited_node.save_state_on_exit :
+				self.fOut.write("self.history_state[self." + exited_node.full_name + "] = self.current_state[self." + exited_node.full_name + "]")
+			
+			#Take care of leaving children
+			children = exited_node.children
+			if exited_node.is_parallel_state:
+				for child in children:
+					if not child.is_history :
+						self.fOut.write("self.exit_" + child.full_name + "()")
+			else:
+				for child in children:
+					if not child.is_history :
+						self.fOut.write("if self." + child.full_name +  " in self.current_state[self." + exited_node.full_name + "] :")
+						self.fOut.indent()
+						self.fOut.write("self.exit_" + child.full_name + "()")
+						self.fOut.dedent()  
+		
+		
+		# take care of any AFTER events
+		for transition in exited_node.transitions :
+			trigger = transition.getTrigger()
+			if trigger.isAfter() :
+				self.fOut.write("self.timers.pop(" + str(trigger.getAfterIndex()) + ", None)")
+				
+		#Execute user-defined exit action if present
+		if exit_method.action:
+			exit_method.action.accept(self)
+			
+		#Adjust state
+		self.fOut.write("self.current_state[self." + exited_node.parent.full_name + "] = []") # SPECIAL CASE FOR ORTHOGONAL??
+		
+		self.fOut.dedent()
+		self.fOut.write()
+		
+			
+	#helper method
+	def writeEnterHistory(self, entered_node, is_deep):
+		self.writeMethodSignature("enterHistory" + ("Deep" if is_deep else "Shallow") + "_" + entered_node.full_name, [])
+		self.fOut.indent()
+		self.fOut.write("if self.history_state[self." + entered_node.full_name + "] == []:")
+		self.fOut.indent()
+		defaults = entered_node.defaults
+
+		for node in defaults:
+			if node.is_basic :
+				self.fOut.write("self.enter_" + node.full_name + "()")
+			elif node.is_composite :
+				self.fOut.write("self.enterDefault_" + node.full_name + "()")
+
+		self.fOut.dedent()
+		self.fOut.write("else:")
+		self.fOut.indent()
+		children = entered_node.children
+		if entered_node.is_parallel_state:
+			for child in children:
+				if not child.is_history :
+					self.fOut.write("self.enterHistory" + ("Deep" if is_deep else "Shallow") + "_" + child.full_name + "()")
+		else:
+			for child in children:
+				if not child.is_history :
+					self.fOut.write("if self." + child.full_name + " in self.history_state[self." + entered_node.full_name + "] :")
+					self.fOut.indent()
+					if child.is_composite:
+						if is_deep :
+							self.fOut.write("self.enter_" + child.full_name + "()")
+							self.fOut.write("self.enterHistoryDeep_" + child.full_name + "()")
+						else :
+							self.fOut.write("self.enterDefault_" + child.full_name + "()")
+					else:
+						self.fOut.write("self.enter_" + child.full_name + "()")
+					self.fOut.dedent()
+		self.fOut.dedent()
+		self.fOut.dedent()
+		self.fOut.write()
+
+	def visit_StateChart(self, statechart):
+		self.fOut.write("# Statechart enter/exit action method(s) :")
+		self.fOut.write()
+		
+		#visit enter and exit action of children
+		for i in statechart.composites + statechart.basics:
+			if i is not statechart.root :
+				i.enter_action.accept(self)
+				i.exit_action.accept(self)
+
+		# write out statecharts methods for enter/exit state
+		if len(statechart.composites) > 1 :
+			self.fOut.write("#Statechart enter/exit default method(s) :")
+			self.fOut.write()
+			for i in statechart.composites :
+				if i is not statechart.root :
+					self.writeEnterDefault(i)
+
+		# write out statecharts methods for enter/exit history
+		if statechart.histories:
+			self.fOut.write("#Statechart enter/exit history method(s) :")
+			self.fOut.write()
+			for i in statechart.shallow_history_parents:
+				self.writeEnterHistory(i, False)
+			for i in statechart.deep_history_parents:
+				self.writeEnterHistory(i, True) 
+		   
+		   
+		self.fOut.write("#Statechart transitions :")	 
+		self.fOut.write()
+		self.writeTransitionsRecursively(statechart.root)			
+				
+		# write out transition function
+		self.fOut.write("# Execute transitions")
+		self.fOut.write("def transition(self, event = Event(\"\")):")
+		self.fOut.indent()
+		self.fOut.write("self.state_changed = self.transition_" + statechart.root.full_name + "(event)")
+		self.fOut.dedent()
+
+		# write out inState function
+		self.fOut.write("# inState method for statechart")
+		self.fOut.write("def inState(self, nodes):")
+		self.fOut.indent()
+		self.fOut.write("for actives in self.current_state.itervalues():")
+		self.fOut.indent()
+		self.fOut.write("nodes = [node for node in nodes if node not in actives]")
+		self.fOut.write("if not nodes :")
+		self.fOut.indent()
+		self.fOut.write("return True")
+		self.fOut.dedent()
+		self.fOut.dedent()
+		self.fOut.write("return False")
+		self.fOut.dedent()
+		self.fOut.write()
+		
+	def visit_ExpressionPartString(self, bare_string):
+		self.fOut.extendWrite(bare_string.string)
+		
+	def visit_SelfReference(self, self_reference):
+		self.fOut.extendWrite("self")
+		
+	def visit_StateReference(self, state_ref):
+		self.fOut.extendWrite("[" + ",".join(["self." + node.full_name for node in state_ref.getNodes()]) + "]")
+		
+	def visit_InStateCall(self, in_state_call):
+		self.fOut.extendWrite("self.inState(")
+		in_state_call.target.accept(self)
+		self.fOut.extendWrite(")")
+		
+	def visit_RaiseEvent(self, raise_event):
+		if raise_event.isNarrow() or raise_event.isBroad():
+			self.fOut.write('send_event = Event("' + raise_event.getEventName() + '", parameters = [')
+		elif raise_event.isLocal():
+			self.fOut.write('self.addEvent(Event("' + raise_event.getEventName() +'", parameters = [')
+		elif raise_event.isOutput():
+			self.fOut.write('self.controller.outputEvent(Event("' + raise_event.getEventName() + '", port="' + raise_event.getPort() + '", parameters = [')
+		elif raise_event.isCD():
+			self.fOut.write('self.object_manager.addEvent(Event("' + raise_event.getEventName() + '", parameters = [self, ')
+		first_param = True
+		for param in raise_event.getParameters() :
+			if first_param :
+				first_param = False
+			else :
+				self.fOut.extendWrite(',')
+			param.accept(self)
+		if raise_event.isNarrow():
+			self.fOut.extendWrite('])')
+			self.fOut.write('self.object_manager.addEvent(Event("narrow_cast", parameters = [self, ' + raise_event.getTarget() + ' , send_event]))')
+		elif raise_event.isBroad():
+			self.fOut.extendWrite('])')
+			self.fOut.write('self.object_manager.addEvent(Event("broad_cast", parameters = [send_event]))')
+		else :
+			self.fOut.extendWrite(']))')
+			
+	def visit_Script(self, script):
+		self.writeCodeCorrectIndent(script.code)
+		
+	def visit_Log(self, log):
+		self.fOut.write('print "' + log.message + '"')
+		
+	def visit_Assign(self, assign):
+		self.fOut.write()
+		assign.lvalue.accept(self)
+		self.fOut.extendWrite(" = ")
+		assign.expression.accept(self)
+	

+ 81 - 0
src/python_sccd_compiler/path_calculator.py

@@ -0,0 +1,81 @@
+from compiler_exceptions import *
+from visitor import Visitor
+
+class PathCalculator(Visitor):
+	""" Computes the states that must be exited and entered for a specific transition if the system is to make
+		that transition. 
+	"""
+	
+	def visit_ClassDiagram(self, class_diagram): 
+		for c in class_diagram.classes :
+			c.accept(self)
+
+	def visit_Class(self, c):
+		if c.statechart:
+			c.statechart.accept(self)
+		
+	def visit_StateChart(self, statechart):
+		for node in statechart.basics + statechart.composites:
+			node.accept(self)
+					 
+	def visit_StateChartNode(self, node):
+		for transition in node.transitions :
+			transition.accept(self)
+			
+	def visit_StateChartTransition(self, transition):
+		#Find the scope of the transition (lowest common proper ancestor)
+		#TODO: Could it be made more efficient if we calculated the LCA from the source node and just one of the target nodes?
+		LCA = self.calculateLCA(transition)
+		
+		if LCA == None:
+			#raise CompilerException("Transision with source " + transition.parent_node.name + " and target " + transition.target_nodes + " has no lowest common ancestor node.")
+			raise CompilerException("Transision with source '" + transition.parent_node.name + "' and target + '" + transition.target_string + "' has no lowest common ancestor node.")
+
+		#Calculate exit nodes
+		transition.exit_nodes = [transition.parent_node]
+		for node in transition.parent_node.getAncestors() :
+			if (node == LCA) :
+				break
+			transition.exit_nodes.append(node)
+	   
+		#Calculate enter nodes
+		transition.enter_nodes = []
+		
+		#we then add the branching paths to the other nodes
+		for target_node in transition.target.target_nodes :
+			to_append_list = [(target_node, True)]
+			for anc in target_node.getAncestors() :
+				if anc == LCA : #If we reach the LCA in the ancestor hierarchy we break
+					break;
+				to_add = True;  #boolean value to see if the current ancestor should be added to the result
+				for enter_node_entry in transition.enter_nodes :
+					if anc == enter_node_entry[0] :
+						to_add = False #If we reach an ancestor in the hierarchy that is already listed as enter node, we don't add and break
+						break
+				if to_add:
+					to_append_list.append((anc, False)) #Only the first from the ancestor list should get True
+				else :
+					break
+					
+			to_append_list.reverse() #the enter sequence should be in the reverse order of the ancestor hierarchy
+			transition.enter_nodes.extend(to_append_list)
+
+		# Calculate arena
+		current = LCA
+		while not current.is_composite:
+			current = current.parent
+		transition.arena = current
+
+	def calculateLCA(self, transition):
+		"""
+		Calculates the lowest common ancestor of a transition
+		""" 
+		for anc in transition.parent_node.getAncestors() :
+			all_descendants = True 
+			for node in transition.target.getNodes() :
+				if not node.isDescendantOf(anc) :
+					all_descendants = False
+					break
+			if all_descendants :
+				return anc
+		return None

+ 353 - 0
src/python_sccd_compiler/python_writer.py

@@ -0,0 +1,353 @@
+from generic_language_constructs import *
+
+class PythonWriter(GenericWriterBase):
+	def __init__(self, outputter):
+		self.out = outputter
+
+
+	def writeComment(self, text):
+		self.out.write("# " + text)
+
+	def writeMultiLineComment(self, text):
+		self.out.write("\"\"\"\n" + text + "\n\"\"\"")
+
+	def visit_AndOperator(self, a):
+		self.out.extendWrite(" and ")
+
+	def visit_ArrayContains(self, a):
+		array = a.getArrayExpression()
+		el = a.getElementExpression()
+
+		el.accept(self)
+		self.out.extendWrite(" in ")
+		array.accept(self)
+
+	def visit_ArrayExpression(self, a):
+		self.out.extendWrite("[")
+		self.writeCommaSeparated(a.getElements())
+		self.out.extendWrite("]")
+
+	def visit_ArrayIndexOf(self, a):
+		array = a.getArrayExpression()
+		el = a.getElementExpression()
+
+		array.accept(self)
+		self.out.extendWrite(".index(")
+		el.accept(self)
+		self.out.extendWrite(")")
+
+	def visit_ArrayLength(self, a):
+		self.out.extendWrite("len(")
+		a.getArrayExpression().accept(self)
+		self.out.extendWrite(")")
+
+	def visit_ArrayPushBack(self, a):
+		array = a.getArrayExpression()
+		el = a.getElementExpression()
+
+		array.accept(self)
+		self.out.extendWrite(".append(")
+		el.accept(self)
+		self.out.extendWrite(")")
+
+	def visit_AST(self, ast):
+		self.writeAll(ast.getEntries())
+
+	def visit_Block(self, b):
+		self.out.indent()
+		self.writeAll(b.getEntries())
+		if b.isEmpty():
+			self.out.write("pass")
+		self.out.dedent()
+
+	def visit_BreakStatement(self, b):
+		self.out.write("break")
+
+	def visit_Class(self, c):
+		class_name = c.getIdentifier()
+		constructor = c.getConstructor()
+		super_classes = c.getSuperClassIdentifierList()
+		description = c.getDescription()
+
+		self.out.write()
+		if description:
+			self.writeComment(description)
+		self.out.write("class " + class_name)
+		if super_classes:
+			self.out.extendWrite("(" + ", ".join(super_classes) + ")")
+		self.out.extendWrite(":")
+		self.out.indent()
+		constructor.accept(self)
+		self.writeAll(c.getMembers())
+		self.out.dedent()
+
+	def visit_Constructor(self, constructor):
+		#class_name = constructor.getClass().getIdentifier()
+		parameters = constructor.getFormalParameters()
+		body = constructor.getBody()
+
+		self.out.write("def __init__")
+		parameters.accept(self)
+		self.out.extendWrite(":")
+		body.accept(self)
+
+	def visit_Destructor(self, destructor):
+		#class_name = destructor.getClass().getIdentifier()
+		parameters = destructor.getFormalParameters()
+		body = destructor.getBody()
+
+		self.out.write("def __del__")
+		parameters.accept(self)
+		self.out.extendWrite(":")
+		body.accept(self)
+
+	def visit_ElseStatement(self, else_stmt):
+		self.out.write("else:")
+		else_stmt.getBody().accept(self)
+
+	def visit_ElseIfStatement(self, else_if):
+		condition = else_if.getCondition()
+		body = else_if.getBody()
+
+		if else_if.isFirst():
+			self.out.write("if ")
+		else:
+			self.out.write("elif ")
+		condition.accept(self)
+		self.out.extendWrite(":")
+		body.accept(self)
+
+	def visit_EqualsOperator(self, e):
+		self.out.extendWrite(" == ")
+
+	def visit_ExpressionStatement(self, stmt):
+		self.out.write() # expressions don't begin with a newline
+		stmt.expression.accept(self)
+
+	def visit_FalseExpression(self, f):
+		self.out.extendWrite("False")
+
+	def visit_FormalParameter(self, parameter):
+		self.out.extendWrite(parameter.getIdentifier())
+		if parameter.getDefaultValue():
+			self.out.extendWrite(" = None") # correct default value will be assigned in function body
+
+	def visit_FormalParameters(self, p):
+		params = [Literal("self")] + p.getParameterList()
+		self.writeTuple(params)
+
+	def visit_ForLoopCurrentElement(self, el):
+		#collection = el.getCollectionExpression()
+		iterator = el.getIteratorIdentifier()
+
+		self.out.extendWrite(iterator)
+
+	def visit_ForLoopIterateArray(self, loop):
+		collection = loop.getCollectionExpression()
+		iterator = loop.getIteratorIdentifier()
+		body = loop.getBody()
+
+		self.out.write("for " + iterator + " in ")
+		collection.accept(self)
+		self.out.extendWrite(":")
+		body.accept(self)
+
+	def visit_ForLoopIterateMapValues(self, loop):
+		collection = loop.getCollectionExpression()
+		iterator = loop.getIteratorIdentifier()
+		body = loop.getBody()
+
+		self.out.write("for " + iterator + " in ")
+		collection.accept(self)
+		self.out.extendWrite(".itervalues():")
+		body.accept(self)
+
+	def visit_IfStatement(self, if_stmt):
+		condition = if_stmt.getCondition()
+		body = if_stmt.getBody()
+
+		self.out.write("if ")
+		condition.accept(self)
+		self.out.extendWrite(":")
+		body.accept(self)
+
+	def visit_IncludeStatement(self, i):
+		module_path = i.getModulePath()
+		imported_symbols = i.getImportedSymbols()
+
+		self.out.write("from ")
+		for j in range(len(module_path)):
+			if j != 0:
+				self.out.extendWrite(".")
+			module_path[j].accept(self)
+		self.out.extendWrite(" import ")
+		if imported_symbols:
+			self.writeCommaSeparated(imported_symbols)
+		else:
+			self.out.extendWrite("*")
+
+	def visit_LocalVariableDeclaration(self, decl):
+		identifier = decl.getIdentifier()
+		init_value = decl.getInitValue()
+
+		self.out.extendWrite(decl.getIdentifier())
+		if init_value:
+			self.out.extendWrite(" = ")
+			init_value.accept(self)
+
+	def visit_LogStatement(self, l):
+		self.out.write("print \"" + l.getMessage() + "\"")
+
+	def visit_MapExpression(self, m):
+		elements = m.getElements()
+		self.out.extendWrite("{")
+		keys = elements.keys()
+		for i in range(len(keys)):
+			if i != 0:
+				self.out.extendWrite(", ")			
+			self.out.extendWrite(keys[i] + " : ")
+			self.out.extendWrite(" : ")
+			elements[keys[i]].accept(self)
+		self.out.extendWrite("}")
+
+	def visit_MapIndexedExpression(self, i):
+		m = i.getMapExpression()
+		key = i.getKeyExpression()
+
+		m.accept(self)
+		self.out.extendWrite("[")
+		key.accept(self)
+		self.out.extendWrite("]")
+
+	def visit_MapRemoveElement(self, stmt):
+		map_expr = stmt.getMapExpression()
+		key_expr = stmt.getKeyExpression()
+
+		self.out.write() # this is a statement, not an expression
+		map_expr.accept(self)
+		self.out.extendWrite(".pop(")
+		key_expr.accept(self)
+		self.out.extendWrite(", None)")
+
+	def visit_Method(self, method):
+		class_name = method.getClass().getIdentifier()
+		method_name = method.getIdentifier()
+		description = method.getDescription()
+		body = method.getBody()
+		parameters = method.getFormalParameters()
+
+		self.out.write()
+		if description:
+			self.writeComment(description)
+		self.out.write("def " + method_name + "")
+		parameters.accept(self)
+		self.out.extendWrite(":")
+		body.accept(self)
+
+	def visit_MethodBody(self, body):
+		method = body.getMethod()
+		formal_parameters = method.getFormalParameters()
+		formal_parameter_list = formal_parameters.getParameterList()
+
+		self.out.indent()
+		# check for undefined parameters and replace them with default values
+		for p in formal_parameter_list:
+			p_id = p.getIdentifier()
+			p_default = p.getDefaultValue()
+			if p_default:
+				self.out.write("if " + p_id + " == None: " + p_id + " = ")
+				p_default.accept(self)
+		self.writeAll(body.getEntries())
+		if body.isEmpty():
+			self.out.write("pass")
+		self.out.dedent()
+
+	def visit_NewExpression(self, new):
+		type_expr = new.getTypeExpression()
+		params = new.getActualParameters()
+
+		type_expr.accept(self)
+		params.accept(self)
+
+	def visit_NoneExpression(self, n):
+		self.out.extendWrite("None")
+
+	def visit_NotOperator(self, n):
+		self.out.extendWrite("not ")
+
+	def visit_OrOperator(self, o):
+		self.out.extendWrite(" or ")
+
+	def visit_Package(self, package):
+		name = package.getIdentifier()
+		description = package.getDescription()
+
+		self.writeComment("package \"" + name + "\"")
+		if description:
+			self.writeComment(description)
+		self.writeAll(package.getDeclarations())
+
+	def visit_ReturnStatement(self, r):
+		self.out.write("return ")
+		r.getExpression().accept(self)
+
+	def visit_RuntimeModuleIdentifier(self, r):
+		self.out.extendWrite("python_runtime")
+
+	def visit_SelfExpression(self, s):
+		self.out.extendWrite("self")
+
+	def visit_StaticAttribute(self, attr):
+		name = attr.getIdentifier()
+		init_value = attr.getInitValue()
+		#class_name = attr.getClass().getIdentifier()
+
+		if init_value:
+			self.out.write(name + " = ")
+			init_value.accept(self)
+		else:
+			self.out.write(name + " = None")
+
+	def visit_SuperClassConstructorCall(self, call):
+		super_class = call.getSuperClassIdentifier()
+		params = call.getActualParameters()
+		param_list = [Literal("self")] + params.getParameterList()
+		params = ActualParameters(param_list)
+
+		self.out.extendWrite(super_class)
+		self.out.extendWrite(".__init__")
+		params.accept(self)
+
+	def visit_SuperClassDestructorCall(self, call):
+		super_class = call.getSuperClassIdentifier()
+		params = call.getActualParameters()
+		param_list = [Literal("self")] + params.getParameterList()
+		params = ActualParameters(param_list)
+
+		self.out.extendWrite("if hasattr(")
+		self.out.extendWrite(super_class)
+		self.out.extendWrite(", \"__del__\"):")
+		self.out.indent()
+		self.out.write(super_class)
+		self.out.extendWrite(".__del__")
+		params.accept(self)
+		self.out.dedent()
+
+	def visit_SuperClassMethodCall(self, call):
+		super_class = call.getSuperClassIdentifier()
+		method_name = call.getMethodIdentifier()
+		params = call.getActualParameters()
+		param_list = [Literal("self")] + params.getParameterList()
+		params = ActualParameters(param_list)
+
+		self.out.extendWrite(super_class + "." + method_name)
+		params.accept(self)
+
+	def visit_ThrowExceptionStatement(self, stmt):
+		self.out.write("raise Exception(")
+		stmt.getExpression().accept(self)
+		self.out.extendWrite(")")
+
+	def visit_TrueExpression(self, t):
+		self.out.extendWrite("True")
+

File diff suppressed because it is too large
+ 1131 - 0
src/python_sccd_compiler/sccd_constructs.py


+ 129 - 0
src/python_sccd_compiler/sccdc.py

@@ -0,0 +1,129 @@
+import argparse
+import os
+import sys
+from generic_generator import GenericGenerator, Platforms
+from utils import Enum, Logger, FileWriter
+from super_class_linker import SuperClassLinker
+from state_linker import StateLinker
+from path_calculator import PathCalculator
+from sccd_constructs import ClassDiagram
+from generic_language_constructs import GenericConstruct
+from compiler_exceptions import CompilerException
+
+from javascript_writer import JavascriptWriter
+from python_writer import PythonWriter
+
+def generate(input_file, output_file, target_language, platform):
+	sccd = xmlToSccd(input_file)
+
+	if not target_language:
+		if sccd.language:
+			target_language = sccd.language
+		else:
+			target_language = "python" # default
+	elif sccd.language and target_language != sccd.language:
+		Logger.showError("Diagram specifies target language as \"" + sccd.language + "\", but language option of compiler has been set to \"" + target_language + "\". No output has been generated.")
+		return
+
+	if target_language == "python" and not output_file.endswith(".py") :
+		output_file += ".py"
+	elif target_language == "javascript" and not output_file.endswith(".js") :
+		output_file += ".js"
+
+	generic = sccdToGeneric(sccd, platform)
+	genericToTarget(generic, target_language, output_file)
+
+def xmlToSccd(xml_file):
+	cd = ClassDiagram(xml_file) # create AST
+	cd.accept(SuperClassLinker())
+	#SuperClassLinker().visit(cd) # visitor linking super classs references
+	StateLinker().visit(cd) # visitor fixing state references
+	PathCalculator().visit(cd) # visitor calculating paths
+	return cd
+	
+def sccdToGeneric(sccd, platform):
+	succesfull_generation = False
+	generator = GenericGenerator(platform)
+	sccd.accept(generator)
+	generic = generator.get()
+	Logger.showInfo("Classes <" + ", ".join(sccd.class_names) + "> have been converted to generic language constructs.")
+	return generic
+
+def genericToTarget(generic, target_language, output_file):
+	try:
+		f = FileWriter(output_file)
+		if target_language == "javascript":
+			writer = JavascriptWriter(f)
+		elif target_language == "python":
+			writer = PythonWriter(f)
+		else:
+			raise Exception("Language not supported")
+		generic.accept(writer)
+		Logger.showInfo("Generic language constructs have been converted to target language constructs and have been written to file '" + output_file + "'.")
+	finally:
+		f.close()
+		
+def main():
+	parser = argparse.ArgumentParser()
+	parser.add_argument('input', help='The path to the XML file to be compiled.')
+	parser.add_argument('-o', '--output', type=str, help='The path to the generated code. Defaults to the same name as the input file but with matching extension.')
+	parser.add_argument('-v', '--verbose', type=int, help='2 = all output; 1 = only warnings and errors; 0 = only errors; -1 = no output.  Defaults to 2.', default = 2)
+	parser.add_argument('-p', '--platform', type=str, help="Let the compiled code run on top of threads, gameloop or eventloop. The default is eventloop.")
+	parser.add_argument('-l', '--language', type=str, help='Target language, either "javascript" or "python". Defaults to the latter.')
+	
+	args = vars(parser.parse_args())
+	#Set verbose
+	if args['verbose'] is not None:
+		if args['verbose'] in [-1, 0,1,2] :
+			Logger.verbose = args['verbose']
+		else :
+			Logger.showError("Invalid verbose argument.")
+	else :
+		Logger.verbose = 2
+
+	#Set source file
+	source = args['input']
+	if not source.endswith(".xml") :
+		Logger.showError("Input file not valid.")
+		return
+	
+	#Set target language
+	if args['language'] :
+		target_language = args['language']
+	else :
+		target_language = ""
+
+	#Set output file
+	if args['output'] :
+		output = args['output']
+	else:
+		output = os.path.splitext(os.path.split(source)[1])[0]
+		
+	#Set platform	
+	if args['platform'] :
+		args['platform'] = args['platform'].lower()
+		if args['platform'] == "threads" :
+			platform = Platforms.Threads
+		elif args['platform'] == "gameloop" :
+			platform = Platforms.GameLoop
+		elif args['platform'] == "eventloop" :
+			platform = Platforms.EventLoop
+		else :
+			Logger.showError("Invalid platform.")
+			return		  
+	else :
+		platform = Platforms.EventLoop
+		
+	#Compile	
+	try :
+		generate(source, output, target_language, platform)
+	except CompilerException as exception :
+		Logger.showError(str(exception));
+		return 1
+
+	return 0
+
+if __name__ == "__main__":
+	sys.exit(main())
+
+

+ 156 - 0
src/python_sccd_compiler/state_linker.py

@@ -0,0 +1,156 @@
+from visitor import Visitor
+from sccd_constructs import INSTATE_SEQ
+from compiler_exceptions import CompilerException
+from lexer import Lexer, Token, TokenType
+
+class StateReferenceException(CompilerException):
+	pass
+
+class StateLinker(Visitor):
+	
+	def __init__(self):
+		self.visiting_statechart = None
+		self.visiting_node = None
+		self.lexer = Lexer()
+	
+	def visit_ClassDiagram(self, class_diagram): 
+		for c in class_diagram.classes :
+			c.accept(self)
+
+	def visit_Class(self, c):
+		if c.statechart:
+			c.statechart.accept(self)
+		
+	def visit_StateChart(self, statechart):
+		self.visiting_statechart = statechart
+		for node in statechart.basics + statechart.composites:
+			node.accept(self)
+					 
+	def visit_StateChartNode(self, node):
+		self.visiting_node = node
+		node.enter_action.accept(self)
+		node.exit_action.accept(self)
+		for transition in node.transitions :
+			transition.accept(self)
+			
+	def visit_StateChartTransition(self, transition):
+		try :
+			transition.target.accept(self)
+		except StateReferenceException as exception :
+			raise StateReferenceException("Transition from <" + self.visiting_node.full_name + "> has invalid target. " + exception.message)
+		try :
+			transition.action.accept(self)
+		except StateReferenceException as exception :
+			raise StateReferenceException("Transition from <" + self.visiting_node.full_name + "> has invalid action. " + exception.message)
+		try :
+			if transition.guard :
+				transition.guard.accept(self)
+		except StateReferenceException as exception :
+			raise StateReferenceException("Transition from <" + self.visiting_node.full_name  + "> has invalid guard. " + exception.message)
+		
+	def visit_StateReference(self, state_reference):
+		state_reference.target_nodes = []
+		
+		current_node = None #Will be used to find the target state(s)
+		split_stack = [] #used for branching
+
+		self.lexer.input(state_reference.path_string)
+
+		for token in self.lexer.tokens() :
+			
+			if current_node == None : #current_node is not set yet or has been reset, the CHILD token can now have a special meaning
+				if token.type == TokenType.SLASH :
+					#Root detected
+					current_node = self.visiting_statechart.root
+					#Token consumed so continue
+					continue
+				else :
+					current_node = self.visiting_node
+					
+			if token.type == TokenType.DOT :
+				#Advance to next token
+				token = self.lexer.nextToken()
+				
+				if token is None or token.type == TokenType.SLASH :
+					#CURRENT operator "." detected
+					continue
+				elif token.type == TokenType.DOT :
+					#Advance to next token
+					token = self.lexer.nextToken()
+					if token is None or token.type == TokenType.SLASH :
+						#PARENT operator ".." detected
+						current_node = current_node.parent
+						if current_node is None :
+							raise StateReferenceException("Illegal use of PARENT \"..\" operator at position " + str(token.pos) + " in state reference. Root of statechart reached.")
+					
+					else :
+						raise StateReferenceException("Illegal use of PARENT \"..\" operator at position " + str(token.pos) + " in state reference.")
+	
+				else :
+					raise StateReferenceException("Illegal use of CURRENT \".\" operator at position " + str(token.pos) + " in state reference.")
+					
+			elif token.type == TokenType.SLASH :
+				continue
+			elif token.type == TokenType.WORD :
+				#try to advance to next child state
+				cname = token.val
+				found = False
+				for child in current_node.children :
+					if child.name == cname : 
+						found = True
+						current_node = child
+						break
+				if not found :
+					raise StateReferenceException("Refering to non exiting node at posisition " + str(token.pos) + " in state reference.")
+			elif token.type == TokenType.LBRACKET :
+				split_stack.append(current_node)
+			elif token.type == TokenType.RBRACKET :
+				if len(split_stack) > 0 :
+					split_stack.pop()
+				else :
+					raise StateReferenceException("Invalid token at position " + str(token.pos) + " in state reference.")
+			elif token.type == TokenType.COMMA :
+				state_reference.target_nodes.append(current_node)
+				if len(split_stack) > 0 :
+					current_node = split_stack[-1]
+				else :
+					current_node = None
+			
+			else :
+				raise StateReferenceException("Invalid token at position " + str(token.pos) + " in state reference.")
+		
+		if (len(split_stack) != 0) or (current_node is None) : #RB missing or extra COMMA
+			raise StateReferenceException("State reference ends unexpectedly.")
+		
+		#TODO better validation of the target! When is it a valid state configuration?
+		for node in state_reference.target_nodes :
+			if current_node == node :
+				raise StateReferenceException("A state reference can't reference the same node more than once.")
+			if node.isDescendantOrAncestorOf(current_node) :
+				raise StateReferenceException("A state reference can't reference a node and one of its descendants.");
+		
+		state_reference.target_nodes.append(current_node)
+			
+		if len(state_reference.target_nodes) == 0 :
+			raise StateReferenceException("Meaningless state reference.")
+
+	def visit_Expression(self, expression):
+		for part in expression.expression_parts :
+			part.accept(self)
+
+	def visit_EnterExitAction(self, action):
+		if action.action :
+			action.action.accept(self)
+			
+	def visit_Action(self, action):
+		for subaction in action.sub_actions :
+			subaction.accept(self)
+			
+	def visit_InStateCall(self, call):
+		try :
+			call.target.accept(self)
+		except StateReferenceException :
+			raise StateReferenceException("Invalid state reference for " + INSTATE_SEQ + " call.")
+		
+	def visit_Assign(self, assign):
+		assign.expression.accept(self)

+ 222 - 0
src/python_sccd_compiler/stateful_writer.py

@@ -0,0 +1,222 @@
+# Used by generic_generator to create an AST of generic language constructs
+# while visiting an AST of SCCD constructs
+
+from generic_language_constructs import *
+
+class ExpressionWrapper(SimpleExpression, AbstractList):
+	def __init__(self, expr = None):
+		self.expr = expr
+
+	def add(self, expr):
+		if self.expr:
+			raise Exception("Expression can only be set once.")
+		self.expr = expr
+
+	def get(self):
+		return self.expr
+
+
+class StatefulWriter:
+
+	def __init__(self):
+		self.ast = AST()
+		self.last = None
+		self.stack = [self.ast]
+
+	def get(self):
+		return self.stack[-1]
+
+	def startRecordingExpression(self):
+		self.stack.append(ExpressionWrapper())
+
+	def stopRecordingExpression(self):
+		self.last = self.stack.pop()
+		if not isinstance(self.last, ExpressionWrapper):
+			raise Exception("Assymetry detected.")
+		return self.last.get()
+
+
+	def add(self, block_entry):
+		self.get().add(block_entry)
+
+	#### SHORTHANDS ####
+
+	def addActualParameter(self, expr):
+		self.get().getActualParameters().add(expr)
+
+	def addAssignment(self, lhs, rhs):
+		self.add(AssignmentExpression(lhs, rhs))
+
+	def addInclude(self, module_path, symbols = None):
+		self.add(IncludeStatement(module_path, symbols))
+
+	def addComment(self, comment):
+		self.add(SingleLineComment(comment))
+
+	def addFormalParameter(self, parameter, default_value = None):
+		self.get().getFormalParameters().add(FormalParameter(parameter, default_value))
+
+	def addMultiLineComment(self, comment):
+		self.add(MultiLineComment(comment))
+
+	def addRawCode(self, raw):
+		self.add(RawCode(raw))
+
+	def addStaticAttribute(self, identifier, init_value):
+		self.add(StaticAttribute(self.get(), identifier, init_value))
+
+	def addVSpace(self):
+		self.add(VSpace())
+
+
+	#### STATEFUL OPERATIONS ####
+
+	def begin(self, generic_construct):
+		self.add(generic_construct)
+		self.stack.append(generic_construct)
+
+	def beginArray(self):
+		self.begin(ArrayExpression())
+
+	def beginClass(self, class_name, super_class_names = None, comment = None):
+		self.begin(Class(class_name, super_class_names, comment))
+
+	def beginConstructor(self):
+		c = self.get().getConstructor()
+		self.stack.append(c)
+
+	def beginDestructor(self):
+		d = self.get().getDestructor()
+		self.stack.append(d)
+
+	def beginElse(self):
+		self.begin(ElseStatement())
+
+	def beginElseIf(self, condition):
+		self.begin(ElseIfStatement(condition, not isinstance(self.last, ElseIfStatement)))
+
+	def beginForLoopIterateArray(self, array_expr, iterator_identifier):
+		f = ForLoopIterateArray(array_expr, iterator_identifier)
+		self.get().add(f)
+		self.stack.append(f.getBody())
+
+	def beginForLoopIterateMapValues(self, map_expr, iterator_identifier):
+		f = ForLoopIterateMapValues(map_expr, iterator_identifier)
+		self.get().add(f)
+		self.stack.append(f.getBody())
+
+	def beginFunctionCall(self, function_expr):
+		f = FunctionCall(function_expr)
+		self.get().add(f)
+		self.stack.append(f)
+
+	def beginGlue(self):
+		g = Glue()
+		self.get().add(g)
+		self.stack.append(g)
+
+	def beginIf(self, condition):
+		self.begin(IfStatement(condition))
+
+
+	def beginMethod(self, name, comment = None):
+		m = Method(self.get(), name, comment)
+		self.get().add(m)
+		self.stack.append(m)
+
+	def beginMethodBody(self):
+		b = self.get().getBody()
+		self.stack.append(b)
+
+	def beginPackage(self, package_name):
+		p = Package(package_name)
+		self.get().add(p)
+		self.stack.append(p)
+
+	def beginSuperClassConstructorCall(self, super_class_identifier):
+		c = SuperClassConstructorCall(super_class_identifier)
+		self.get().add(c)
+		self.stack.append(c)
+
+	def beginSuperClassDestructorCall(self, super_class_identifier):
+		c = SuperClassDestructorCall(super_class_identifier)
+		self.get().add(c)
+		self.stack.append(c)
+
+	def beginSuperClassMethodCall(self, super_class_identifier, method_identifier):
+		c = SuperClassMethodCall(super_class_identifier, method_identifier)
+		self.get().add(c)
+		self.stack.append(c)
+
+
+	def end(self):
+		self.stack.pop()
+
+	def endArray(self):
+		self.last = self.stack.pop()
+		assert isinstance(self.last, ArrayExpression)
+
+	def endClass(self):
+		self.last = self.stack.pop()
+		assert isinstance(self.last, Class)
+
+	def endConstructor(self):
+		self.last = self.stack.pop()
+		assert isinstance(self.last, Constructor)
+
+	def endDestructor(self):
+		self.last = self.stack.pop()
+		assert isinstance(self.last, Destructor)
+
+	def endElse(self):
+		self.last = self.stack.pop()
+		assert isinstance(self.last, ElseStatement)
+
+	def endElseIf(self):
+		self.last = self.stack.pop()
+		assert isinstance(self.last, ElseIfStatement)
+
+	def endForLoopIterateArray(self):
+		self.last = self.stack.pop()
+		assert isinstance(self.last, ForLoopBody)
+
+	def endForLoopIterateMapValues(self):
+		self.last = self.stack.pop()
+		assert isinstance(self.last, ForLoopBody)
+
+	def endFunctionCall(self):
+		self.last = self.stack.pop()
+		assert isinstance(self.last, FunctionCall)
+
+	def endGlue(self):
+		self.last = self.stack.pop()
+		assert isinstance(self.last, Glue)
+
+	def endIf(self):
+		self.last = self.stack.pop()
+		assert isinstance(self.last, IfStatement)
+
+	def endMethod(self):
+		self.last = self.stack.pop()
+		assert isinstance(self.last, Method)
+
+	def endMethodBody(self):
+		self.last = self.stack.pop()
+		assert isinstance(self.last, MethodBody)
+
+	def endPackage(self):
+		self.last = self.stack.pop()
+		assert isinstance(self.last, Package)
+
+	def endSuperClassConstructorCall(self):
+		self.last = self.stack.pop()
+		assert isinstance(self.last, SuperClassConstructorCall)
+
+	def endSuperClassDestructorCall(self):
+		self.last = self.stack.pop()
+		assert isinstance(self.last, SuperClassDestructorCall)
+
+	def endSuperClassMethodCall(self):
+		self.last = self.stack.pop()
+		assert isinstance(self.last, SuperClassMethodCall)
+

+ 52 - 0
src/python_sccd_compiler/super_class_linker.py

@@ -0,0 +1,52 @@
+from compiler_exceptions import *
+from utils import Logger
+from visitor import Visitor
+
+class SuperClassLinker(Visitor):
+	""" Computes the states that must be exited and entered for a specific transition if the system is to make
+		that transition. 
+	"""
+	
+	def visit_ClassDiagram(self, class_diagram): 
+		for c in class_diagram.classes :
+			c.accept(self)
+
+	def visit_Class(self, c):
+		# replace super class names by super class objects
+		for s in c.super_classes:
+			super_class = None
+			for clas in c.class_diagram.classes:
+				if clas.name == s:
+					super_class = clas
+			if super_class == None:
+				Logger.showWarning("Class <" + c.name + "> has undefined super class <" + s + ">.")
+			else:
+				c.super_class_objs[s] = super_class
+
+		# calculate list of abstract methods
+		c.abstract_method_names = getClassAbstractMethodNames(c)
+
+		# check if <super> tags exist for all inherited classes
+		for name,obj in c.super_class_objs.iteritems():
+			if obj:
+				if name not in c.constructors[0].super_class_parameters:
+					num_params = len(obj.constructors[0].parameters)
+					if num_params > 0:
+						raise CompilerException("Class <" + c.name + "> inherits <" + name + "> and <" + name + ">'s constructor has " + str(num_params) + " parameter(s), but there's no <super> entry for that class in <" + c.name + ">'s constructor.")
+
+def getClassAbstractMethodNames(c):
+	abstract_method_names = []
+	non_abstract_method_names = []
+	for m in c.methods:
+		if m.isAbstract():
+			abstract_method_names.append(m.name)
+		else:
+			non_abstract_method_names.append(m.name)
+	for s in c.super_classes:
+		if s in c.super_class_objs:
+			super_abstract_method_names = getClassAbstractMethodNames(c.super_class_objs[s])
+			for m_name in super_abstract_method_names:
+				if m_name not in non_abstract_method_names:
+					abstract_method_names.append(m_name)
+	return abstract_method_names
+

+ 118 - 0
src/python_sccd_compiler/utils.py

@@ -0,0 +1,118 @@
+from compiler_exceptions import CodeBlockException
+from sys import stdout
+
+class Logger(object):
+	verbose = 0 #-1= no output
+				#0 = only errors
+				#1 = only warnings and errors
+				#2 = all output
+				
+	@staticmethod   
+	def showError(error):
+		if(Logger.verbose > -1) :
+			print "ERROR : " + error
+				
+	@staticmethod
+	def showWarning(warning):
+		if(Logger.verbose > 0) :
+			print "WARNING : " + warning
+			
+	@staticmethod	
+	def showInfo(info):
+		if(Logger.verbose > 1) :
+			print "INFO : " + info
+
+#######################
+
+class Enum():	
+	def __init__(self, *entries):
+		self._keys = entries
+		self._map = {}
+		for v,k in enumerate(self._keys) :
+			self._map[k] = v
+			
+	def __getattr__(self, name):
+		return self._map[name]
+			
+	def name_of(self, index):
+		return self._keys[index]
+
+#######################
+
+NOT_SET = 0
+SPACES_USED = 1
+TABS_USED = 2
+
+class FormattedWriter:
+
+	def __init__(self, out = stdout):
+		self.out = out
+		self.indentLevel = 0
+		self.indentSpace = "\t"
+		self.first_write = True
+
+	def write(self, text = ""):
+		if self.first_write :
+			self.first_write = False
+			if text == "":
+				self.out.write(self.indentLevel*self.indentSpace)
+			else:
+				self.out.write(self.indentLevel*self.indentSpace + text)  
+		else:
+			if text == "":
+				self.out.write("\n" + self.indentLevel*self.indentSpace)
+			else:
+				self.out.write("\n" + self.indentLevel*self.indentSpace + text)
+	
+	def extendWrite(self, text = ""):
+		self.out.write(text)
+				
+	def indent(self):
+		self.indentLevel+=1
+
+	def dedent(self):
+		self.indentLevel-=1
+
+	def writeCodeCorrectIndent(self, body):
+		lines = body.split('\n')
+		while( len(lines) > 0 and lines[-1].strip() == "") :
+			del(lines[-1])
+	
+		index = 0;
+		while( len(lines) > index and lines[index].strip() == "") :	   
+			index += 1
+			
+		if index >= len(lines) :
+			return
+		#first index where valid code is present
+		to_strip_index = len(lines[index].rstrip()) - len(lines[index].strip()) 
+		indent_type = NOT_SET;
+			
+		while index < len(lines):
+			strip_part = lines[index][:to_strip_index]
+			
+			if( ('\t' in strip_part and ' ' in strip_part) or
+				(indent_type == SPACES_USED and '\t' in strip_part) or
+				(indent_type == TABS_USED and ' ' in strip_part)
+			) :
+				raise CodeBlockException("Mixed tab and space indentation!")
+			
+			if indent_type == NOT_SET :
+				if ' ' in strip_part :
+					indent_type = SPACES_USED
+				elif '\t' in strip_part :
+					indent_type = TABS_USED
+					
+			self.write(lines[index][to_strip_index:])
+			index += 1
+
+
+class FileWriter(FormattedWriter):
+
+	def __init__(self, filename):
+		FormattedWriter.__init__(self, open(filename, 'w'))
+
+	def close(self):
+		self.out.close()
+
+#######################

+ 30 - 0
src/python_sccd_compiler/visitor.py

@@ -0,0 +1,30 @@
+class Visitor(object):
+	def _visit(self, node, prepend, *args):
+		prepend = prepend + "_"
+		meth = None
+		for cls in node.__class__.__mro__:
+			meth_name = prepend + cls.__name__
+			meth = getattr(self, meth_name, None)
+			if meth:
+				break
+
+		if not meth:
+			meth = self.generic_visit
+		return meth(node, *args)
+	
+	def visit(self, node, *args):
+		self._visit(node, "visit", *args)
+	
+	def enter(self, node, *args):
+		self._visit(node, "enter", *args)
+		
+	def exit(self, node, *args):
+		self._visit(node, "exit", *args)
+
+	def generic_visit(self, node):
+		#print 'generic_visit '+node.__class__.__name__
+		pass
+		
+class Visitable(object):
+	def accept(self, visitor):
+		visitor.visit(self) 

File diff suppressed because it is too large
+ 1940 - 0
src/sccd.py


File diff suppressed because it is too large
+ 1040 - 0
src/sccd.xml


+ 176 - 0
src/scheduler.py

@@ -0,0 +1,176 @@
+# -*- coding: Latin-1 -*-
+"""
+The Activity Heap is based on a heap, though allows for reschedules. 
+
+To allow reschedules to happen, a model is accompagnied by a flag to 
+indicate whether or not it is still valid. 
+As soon as a model is rescheduled, the flag of the previously scheduled 
+time is set and another entry is added. This causes the heap to become *dirty*, 
+requiring a check for the flag as soon as the first element is requested.
+
+Due to the possibility for a dirty heap, the heap will be cleaned up as 
+soon as the number of invalid elements becomes too high. 
+This cleanup method has O(n) complexity and is therefore only 
+ran when the heap becomes way too dirty.
+
+Another problem is that it might consume more memory than other schedulers, 
+due to invalid elements being kept in memory. 
+However, the actual model and states are not duplicated as they are references. 
+The additional memory requirement should not be a problem in most situations.
+
+The 'activity' part from the name stems from the fact that only models where 
+the *timeNext* attribute is smaller than infinity will be scheduled. 
+Since these elements are not added to the heap, they aren't taken into account 
+in the complexity. This allows for severe optimisations in situations where 
+a lot of models can be scheduled for infinity.
+
+Of all provided schedulers, this one is the most mature due to it being the 
+oldest and also the default scheduler. It is also applicable in every situation 
+and it offers sufficient performance in most cases.
+
+This scheduler is ideal in situations where (nearly) no reschedules happen 
+and where most models transition at a different time.
+
+It results in slow behaviour in situations requiring lots of rescheduling, 
+and thus lots of dirty elements.
+
+This method is also applied in the VLE simulator and is the common approach 
+to heap schedulers that require invalidation. It varies from the scheduler in 
+ADEVS due to the heap from the heapq library being used, which doesn't offer 
+functions to restructure the heap. 
+Reimplementing these methods in pure Python would be unnecessarily slow.
+"""
+from heapq import heappush, heappop, heapify
+
+class Scheduler(object):
+    """
+    Scheduler class itself
+    """
+    def __init__(self, models, epsilon, totalModels):
+        """
+        Constructor
+
+        :param models: all models in the simulation
+        """
+        self.heap = []
+        self.id_fetch = [None] * totalModels
+        for model in models:
+            if model.timeNext[0] != float('inf'):
+                self.id_fetch[model.model_id] = [model.timeNext, model.model_id, True, model]
+                heappush(self.heap, self.id_fetch[model.model_id])
+            else:
+                self.id_fetch[model.model_id] = [model.timeNext, model.model_id, False, model]
+        
+        self.invalids = 0
+        self.maxInvalids = len(models)*2
+        self.epsilon = epsilon
+
+    def schedule(self, model):
+        """
+        Schedule a model
+
+        :param model: the model to schedule
+        """
+        # Create the entry, as we have accepted the model
+        elem = [model.timeNext, model.model_id, False, model]
+        try:
+            self.id_fetch[model.model_id] = elem
+        except IndexError:
+            # A completely new model
+            self.id_fetch.append(elem)
+            self.maxInvalids += 2
+        # Check if it requires to be scheduled
+        if model.timeNext[0] != float('inf'):
+            self.id_fetch[model.model_id][2] = True
+            heappush(self.heap, self.id_fetch[model.model_id])
+
+    def unschedule(self, model):
+        """
+        Unschedule a model
+
+        :param model: model to unschedule
+        """
+        if model.timeNext != float('inf'):
+            self.invalids += 1
+        # Update the referece still in the heap
+        self.id_fetch[model.model_id][2] = False
+        # Remove the reference in our id_fetch
+        self.id_fetch[model.model_id] = None
+        self.maxInvalids -= 2
+
+    def massReschedule(self, reschedule_set):
+        """
+        Reschedule all models provided. 
+        Equivalent to calling unschedule(model); schedule(model) on every element in the iterable.
+
+        :param reschedule_set: iterable containing all models to reschedule
+        """
+        #NOTE rather dirty, though a lot faster for huge models
+        inf = float('inf')
+        for model in reschedule_set:
+            event = self.id_fetch[model.model_id]
+            if event[2]:
+                if model.timeNext == event[0]:
+                    continue
+                elif event[0][0] != inf:
+                    self.invalids += 1
+                event[2] = False
+            if model.timeNext[0] != inf:
+                self.id_fetch[model.model_id] = [model.timeNext, model.model_id, True, model]
+                heappush(self.heap, self.id_fetch[model.model_id])
+        if self.invalids >= self.maxInvalids:
+            self.heap = [i for i in self.heap if i[2] and (i[0][0] != inf)]
+            heapify(self.heap)
+            self.invalids = 0
+
+    def readFirst(self):
+        """
+        Returns the time of the first model that has to transition
+
+        :returns: timestamp of the first model
+        """
+        self.cleanFirst()
+        return self.heap[0][0]
+
+    def cleanFirst(self):
+        """
+        Clean up the invalid elements in front of the list
+        """
+        try:
+            while not self.heap[0][2]:
+                heappop(self.heap)
+                self.invalids -= 1
+        except IndexError:
+            # Nothing left, so it as clean as can be
+            pass
+
+    def getImminent(self, time):
+        """
+        Returns a list of all models that transition at the provided time, with a specified epsilon deviation allowed.
+
+        :param time: timestamp to check for models
+
+        .. warning:: For efficiency, this method only checks the **first** elements, so trying to invoke this function with a timestamp higher than the value provided with the *readFirst* method, will **always** return an empty set.
+        """
+        immChildren = []
+        t, age = time
+        try:
+            # Age must be exactly the same
+            first = self.heap[0]
+            while (first[0][0] <= t) and (first[0][1] == age):
+                # Check if the found event is actually still active
+                if(first[2]):
+                    # Active, so event is imminent
+                    immChildren.append(first[3])
+                    first[2] = False
+                else:
+                    # Wasn't active, but we will have to pop this to get the next
+                    # So we can lower the number of invalids
+                    self.invalids -= 1
+
+                # Advance the while loop
+                heappop(self.heap)
+                first = self.heap[0]
+        except IndexError:
+            pass
+        return immChildren