Skip to content

RRT integration issues #37

@stanleybak

Description

@stanleybak

I've made an initial integration of Aviral's rrt-hybrid repository code into the hyst repostory. Use this branch to perform further development: https://github.com/stanleybak/hyst/tree/rrt-printer

There are several things that need to be addressed before we integrate it into the main release.

First, I get errors when I run the rrt tool. I tried it on three models in our examples folder and got three different errors for each one. I suggest we make sure the tool works on the examples in the examples directory. I added to our regression tests which runs all tools on all models. You can run that script by going to src/tests/regression and doing python run_tests.py. Here's a snippet of the current output:

Test failed for 2/90 model lorenz with pyrrt: Error (Tool)

Log:
Running pyrrt on model /home/stan/repositories/hyst/src/tests/regression/models/lorenz/lorenz.xml
Hyst command: ['java', '-jar', '/home/stan/repositories/hyst/src/Hyst.jar', '/home/stan/repositories/hyst/src/tests/regression/models/lorenz/lorenz.xml', '-o', '/home/stan/repositories/hyst/src/tests/regression/result/lorenz_pyrrt.py', '-pyrrt']

Finished converting in 522 ms
Seconds for Hyst conversion: 2.05994796753
Traceback (most recent call last):
  File "/home/stan/repositories/hyst/src/hybridpy/hybridpy/tool_pyrrt.py", line 54, in <module>
    tool_main(PyRrtTool())
  File "/home/stan/repositories/hyst/src/hybridpy/hybridpy/hybrid_tool.py", line 75, in tool_main
    code = tool_obj.run()
  File "/home/stan/repositories/hyst/src/hybridpy/hybridpy/hybrid_tool.py", line 271, in run
    rv = self._run_tool()
  File "/home/stan/repositories/hyst/src/hybridpy/hybridpy/tool_pyrrt.py", line 30, in _run_tool
    self._result = run()
  File "/tmp/pyrrt_823_491011/lorenz_pyrrt.py", line 40, in run
  File "/home/stan/repositories/hyst/src/hybridpy/hybridpy/pyrrt/expt_opt.py", line 1133, in run
    my_rrt = RRT(ha, list_of_initial_states, init_states[0][0])
  File "/home/stan/repositories/hyst/src/hybridpy/hybridpy/pyrrt/expt_opt.py", line 342, in __init__
    self.ha.modes[modes].inv_strings, self.ha.variables)
  File "/home/stan/repositories/hyst/src/hybridpy/hybridpy/pyrrt/util.py", line 34, in parser
    eq = eq.replace(" ", "")
AttributeError: 'bool' object has no attribute 'replace'
Elapsed Seconds: 2.66518187523
Result: Error (Tool)

Error detected running regression tests.

The second issue is code quality and customization. For customization, the expt_opt function needs to take in parameters like the amount of time per step. The plotting function should automatically detect a reasonable plot range, in addition to being able to used fixed coordinates. The script outputs random output to stdout. A percent done or # of iterations might be okay, but it looks like debugging output at this point. The names are unclear, why is it called expt_opt? I renamed test_cvxopt to util since it looks like utilities. I moved the global variable t = np.linspace(0, 0.2, 4) into functions (why was it global?). There may be other such issues in the code which should be cleaned up. The global pylint score for pyrrt is currently 6.71/10, let's try to get it above 9.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions