我做了一个应用程序,除了所有其他的事情,试图找到一个有效的路线之间的两个机场。 我在sqlite3数据库中有所有需要的数据,我在PyQt5中嵌入的带有实时信号的底图中查询和绘制这些数据。 我的问题是我找不到算法,使所有可能的变化(与取消资格的一些,因为所有的可能性是巨大的)和存储它们输出最终有效的路线。 我认为Dijkstra的算法无法实现,因为任何时候一条路线都可能到达死胡同。你知道吗
我的主要问题是算法及其实现,而不是数据,所以不要犹豫,写任何可能的算法所需的任何数据。你知道吗
算法提示如下:
到目前为止,我对堆栈问题的看法是:
##finding base direction##
base_radians = math.atan2(self.dest_coord[0]-self.dep_coord[0], self.dest_coord[1]-self.dep_coord[1])
base_degrees = math.degrees(base_radians)
print(base_degrees)
if base_degrees < 0 :
base_heading = 'W'
else:
base_heading = 'E'
### finding all routes connected to first waypoint###
self.cursor.execute("select DISTINCT ats_ident,seq_num from dafif_ats where wpt1_ident = ? AND ats_icao = ? AND direction = ? ORDER BY ats_ident,seq_num ASC",('ATV','LGGG',base_heading))
sub_ats_idents = self.cursor.fetchall()
#### for each route find next waypoints###
for i in sub_ats_idents:
self.cursor.execute("select wpt1_ident,wpt2_ident from dafif_ats where ats_ident = ? and ats_icao = ? and direction = ? and seq_num >= ? ORDER BY seq_num ASC",(i[0],'LGGG',base_heading,i[1]))
each_wpt_combo = self.cursor.fetchall()
#### for each next waypoint find possible routes###
for x in each_wpt_combo:
self.cursor.execute("select DISTINCT ats_ident,seq_num from dafif_ats where wpt1_ident = ? AND ats_icao = ? AND direction = ? ORDER BY ats_ident,seq_num ASC",(x[0],'LGGG',base_heading))
each_ats = self.cursor.fetchall()
print(each_ats)
#### for each subroute plot waypoints###
for z in each_ats:
self.cursor.execute("select wpt1_dlon,wpt1_dlat,wpt2_dlon,wpt2_dlat from dafif_ats where wpt1_ident = ? AND ats_icao = ? AND direction = ? ORDER BY ats_ident,seq_num ASC",(x[0],'LGGG',base_heading))
plot_var = self.cursor.fetchall()
self.route_sender.emit(plot_var)
time.sleep(0.1)
任何材料或例子阅读将是超级。 提前打电话。你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐