简体   繁体   English

如何将坐标设置为 state 空间(范围)以用于 Q 表?

[英]How to set coordinates as a state space (range) for use in Q-table?

Suppose I have a class Player that i want to use as my agent.I want all the coordinates possible in my environment to be my state space In my environment, I want to use the coordinates of the player as my state.How should I go about setting my "stateSpace/ range" then? Suppose I have a class Player that i want to use as my agent.I want all the coordinates possible in my environment to be my state space In my environment, I want to use the coordinates of the player as my state.How should I go那么关于设置我的“stateSpace/range”呢?

self.stateSpaceX = a for a in range(int(GRIDWIDTH)))
self.stateSpaceY = b for b in range(int(GRIDHEIGHT)))
self.stateSpace = ???

OK, I've found the solution:好的,我找到了解决方案:

from itertools import product

initstate = 0
StateSpace = {coord: initstate for coord in product(range(int(GRIDWIDTH)), range(int(GRIDHEIGHT)))}

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

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