简体   繁体   English

OSMNX:如何从 Q 学习算法的坐标中获得可能的中间方向

[英]OSMNX: How to get inmediate possible directions from coordinate for a Q-learning algorithm

I'm working on a Q-learning algorithm that navigates over OSMNX nodes.我正在研究在 OSMNX 节点上导航的 Q 学习算法。 My goal is to offer the Q-learning agent an step based context where on each step I can list the possible actions like: "straight, turn left, turn right...".我的目标是为 Q-learning 代理提供一个基于步骤的上下文,在其中我可以在每个步骤中列出可能的操作,例如:“直行、左转、右转……”。 So I would need a list of immediate connected nodes that could offer this decision context step by step.所以我需要一个直接连接的节点列表,可以逐步提供这个决策上下文。 The idea is to combine POI data so the agent can be "distracted" by the surroundings.这个想法是结合 POI 数据,这样代理就可以被周围的环境“分心”。

I've tried我试过了

ox.get_nearest_node()

but that only gets me the nearest node to those coordinates but not the list of immediate connected nodes但这只会让我得到离这些坐标最近的节点,而不是直接连接的节点列表

I'm not even sure how it works and why I have to give it a list of coordinates instead of a single coordinate我什至不确定它是如何工作的,以及为什么我必须给它一个坐标列表而不是单个坐标

Did you read the documentation ?你读过文档吗? It explains how it works and says that function returns "the graph nodes nearest to a list of points".它解释了它是如何工作的,并说该函数返回“最接近点列表的图形节点”。 Pretty straightforward.很简单。 You could use the get_nearest_node function instead for a single point ( docs ).您可以使用get_nearest_node函数代替单个点( docs )。

I'd encourage you read the OSMnx documentation and the usage examples to understand how to use the package.我鼓励您阅读OSMnx 文档使用示例以了解如何使用该包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM