I coupled a RL agent with a environment which is implemted in matlab. So I let the python script (using tensorflow V2) run, write a txt file with the actions and call the matlab environment via system command. In matlab the txt file is read, then the calculation is carried out in matlab and a result txt file is written. This txt file is then read by python, and the py script runs further.
That works, however the calculation times are relative long, one step takes between 9 and 13 seconds, although the matlab calculation need only about 1.5 -2 seconds. Therefore the training time is very high which is very annoying. Unfortunately you can't rewrite the environment to Python, would be too much work and compiling to c++ would also be rather difficult.
Is there nevertheless a better way? Does anyone have an idea how to improve that? Is there any interface between python and matlab which could help here?
Thanks in advance!
Best Chris