I'm new to the world of AI and have been primarily reading through the documentation for OpenAI's Gym/Gymnasium in hopes of training an AI to play a board game. One piece of information I haven't been able to find is the best way to define an action space when the number of possible actions is countably infinite.
For instance, I've seen several examples of simple games where the player must choose a card to play from their hand. In all of these, the hand has a maximum size, and the action space is discrete with its cardinality being the largest possible hand size. But what if there is no theoretical limit to the size of the player's hand? Let's say a player starts with a hand of seven cards, but the number of cards in their hand could grow (or shrink) to any natural number throughout the course of the game. How would one go about defining the action space in this scenario?
I've thought of four potential ways to handle this:
- Define one action for every possible card and mask the action space so that only cards in the player's hand are legal actions. This would mean 52 actions for a standard deck of playing cards, which doesn't seem so bad. But for certain games, there could be many more kinds of unique cards (potentially thousands in the case of trading card games), and I could see the action space becoming unwieldy in those situations.
- Define a continuous action space on the interval [0,1] and partition it equally into however many cards are in the player's hand. For example, if there are 10 cards in the hand, an action in [0,0.1) would play the first card, one in [0.1,0.2) would play the second, and so on. I'm unsure if this would be a wise setup since "nearby" actions like 0.09 and 0.11 wouldn't necessarily correspond to similar results because cards 1 and 2 aren't ordered in a meaningful way.
- Define two actions: one for playing a card and the other for passing. Loop through each card in the hand and apply the action to each one until the "play" action is used. In this case, I'm not sure if the AI would be able to "look ahead" to know that a better card is coming up so therefore it should pass on the current card.
- Pick an arbitrarily large hand limit that a player would never reach in practice and define a discrete number of actions up to that limit.
Would any of these approaches work? Are any favored over the others? Are there other ways of approaching this that I haven't thought of?