MengGuo / P_MDP_TG

Planner for Markov Decision Processes with Temporal Goals
GNU General Public License v2.0
20 stars 3 forks source link

AttributeError: 'Motion_MDP' object has no attribute 'edge' #1

Open hapoy9 opened 6 years ago

hapoy9 commented 6 years ago

您好!请您原谅我用中文向您请教一些问题,担心自己英文无法描述清楚自己的问题。对您这个项目比较感兴趣,但是查阅您谷歌学术的论文也没有找到该项目对应的论文,您能提供一下该项目的相关论文吗?此外,我在运行此项目的test_example.py时,产生一下错误: Traceback (most recent call last): File "test_example.py", line 61, in <module> motion_mdp = Motion_MDP(node_dict, edge_dict, U, initial_node, initial_label) File "C:\Users\keyan\Desktop\P_MDP_TG-master\P_MDP_TG-master\MDP_TG\mdp.py", line 16, in __init__ self.add_edges(edge_dict, U) File "C:\Users\keyan\Desktop\P_MDP_TG-master\P_MDP_TG-master\MDP_TG\mdp.py", line 41, in add_edges prop = self.edge[f_node][t_node]['prop'] AttributeError: 'Motion_MDP' object has no attribute 'edge' 您在mdp.py没有定义edge属性,而且在基类digraph.py中也没有该属性,只有edges方法,所以prop = self.edge[f_node][t_node]['prop']报错,我尝试修改为edges也没有解决问题,不太理解您这句的含义,麻烦您帮忙解决一下,非常感谢!

MengGuo commented 6 years ago

Thanks for the interest!

For now, you may refter/cite the axiv version: https://arxiv.org/pdf/1706.05209.pdf

The edge error is due to the incompatibility between networkx 1.x and networkx 2.0. edge[][] is not allowed in 2.0 anymore. The modification should be very simple. You could:

. use networkx 1.x . use networkx 2.0 and fix these incompatibilities. And send me a merge request. . I will let you know when I move this repo to networkx 2.0 (most likely in the next month).

Let me know, so we don't double the work. /Meng

hapoy9 commented 6 years ago

@MengGuo 非常感谢您的帮助,根据您的建议使用networkx 1.9,现在edge的报错已经没有了,但是我将ltl2ba等换成了Windows版本后,调试又遇到一个新的问题,在promela.py中的代码抛出了异常,异常位置为: if self.accept(Parser.title_regex) == None: raise Exception("Expected 'DRA title' but got %s" % self.instring[self.pos]) 程序输出和错误提示为: -------Motion MDP Initialized------- -------Motion MDP Constructed------- 4 states and 12 edges Unify MDP Done Traceback (most recent call last): File "test_example.py", line 70, in <module> dra = Dra(sur_formula1) File "C:\Users\keyan\Desktop\P_MDP_TG-master\P_MDP_TG-master\MDP_TG\dra.py", line 20, in __init__ statenum, init, edges, aps, acc = parse_dra(ltl2dra_output) File "C:\Users\keyan\Desktop\P_MDP_TG-master\P_MDP_TG-master\MDP_TG\ltl2dra.py", line 29, in parse_dra states, init, edges, aps, acc = parser.parse() File "C:\Users\keyan\Desktop\P_MDP_TG-master\P_MDP_TG-master\MDP_TG\promela.py", line 50, in parse raise Exception("Expected 'DRA title' but got %s" % self.instring[self.pos]) Exception: Expected 'DRA title' but got D 我将项目中complex_case_study的例子运行出现了同样的错误,不知问题出在了哪里?

MengGuo commented 6 years ago

Hello, there is another executable ltl2dstar https://github.com/MengGuo/P_MDP_TG/blob/master/MDP_TG/ltl2dstar You may need the windows version for that also.

nevertheless, switch to Linux/unix if possible as it would make your life much easier. /Meng

hapoy9 commented 6 years ago

@MengGuo 我已经将ltl2dstar替换为http://www.ltl2dstar.de/提供的Windows版本,运行才出现的那个问题,如果没有替换windows版本直接报subprocess.CalledProcessError错误,而不是抛出异常,难道是我版本问题吗?我用终端执行ltl2dstra语句是有结果返回的,附图是执行的结果,麻烦您看一下有问题吗?如果一直没有解决我会接受您的建议在ubuntu下面运行该程序。 result

mingyucai commented 5 years ago

@MengGuo 我已经将ltl2dstar替换为http://www.ltl2dstar.de/提供的Windows版本,运行才出现的那个问题,如果没有替换windows版本直接报subprocess.CalledProcessError错误,而不是抛出异常,难道是我版本问题吗?我用终端执行ltl2dstra语句是有结果返回的,附图是执行的结果,麻烦您看一下有问题吗?如果一直没有解决我会接受您的建议在ubuntu下面运行该程序。 result That's correct. But it's better to use ubuntu to save time.

LiuZesensengsheng commented 3 years ago

@MengGuo 我已经将ltl2dstar替换为http://www.ltl2dstar.de/提供的Windows版本,运行才出现的那个问题,如果没有替换windows版本直接报subprocess.CalledProcessError错误,而不是抛出异常,难道是我版本问题吗?我用终端执行ltl2dstra语句是有结果返回的,附图是执行的结果,麻烦您看一下有问题吗?如果一直没有解决我会接受您的建议在ubuntu下面运行该程序。 result

Mr. Guo , I met the same question in Ubuntu and it seems that my ltl2dstar is correct.

MengGuo commented 3 years ago

@hapoy9 @mingyucai @LiuZesensengsheng I can't verify this, but have you guys also compiled ltl2dstar for your OS? as mentioned here?

SJTUGuofei commented 2 years ago

@MengGuo 我已经将ltl2dstar替换为http://www.ltl2dstar.de/提供的Windows版本,运行才出现的那个问题,如果没有替换windows版本直接报subprocess.CalledProcessError错误,而不是抛出异常,难道是我版本问题吗?我用终端执行ltl2dstra语句是有结果返回的,附图是执行的结果,麻烦您看一下有问题吗?如果一直没有解决我会接受您的建议在ubuntu下面运行该程序。 result That's correct. But it's better to use ubuntu to save time.

Which version Ubuntu is preferred? I use Ubuntu22, and there are some issues when run the examples?

-------Motion MDP Initialized------- -------Motion MDP Constructed------- 1444 states and 13696 edges Unify MDP Done MDP done, time: 0.30488014221191406 /home/figo/P_MDP_TG/MDP_TG/ltl2dstar /bin/sh: 1: /home/figo/P_MDP_TG/MDP_TG/ltl2dstar: Exec format error Traceback (most recent call last): File "/home/figo/P_MDP_TG/case_study_rex_changesize.py", line 154, in dra = Dra(all_base) File "/home/figo/P_MDP_TG/MDP_TG/dra.py", line 20, in init ltl2dra_output = run_ltl2dra(formula) File "/home/figo/P_MDP_TG/MDP_TG/ltl2dra.py", line 27, in run_ltl2dra raw_output = check_output(cmd, shell=True) File "/home/figo/anaconda3/lib/python3.9/subprocess.py", line 424, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/home/figo/anaconda3/lib/python3.9/subprocess.py", line 528, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command 'echo "& G F base1 & G F base2 & G F base3 G ! obstacle" | /home/figo/P_MDP_TG/MDP_TG/ltl2dstar --ltl2nba=spin:/home/figo/P_MDP_TG/MDP_TG/ltl2ba --stutter=no - -' returned non-zero exit status 126.

MengGuo commented 2 years ago

@SJTUGuofei it seems to be related your ltl2ba version. Make sure to compile under your OS from source.