How severe does this issue affect your experience of using Ray?
- Medium: It contributes to significant difficulty to complete my task, but I can work around it.
So I have a somewhat common problem, but I could not find a solution that works.
Here is the error:
"""
ValueError: The two structures don't have the same nested structure.
First structure: type=ndarray str=[...]
Second structure: type=OrderedDict str=OrderedDict([('x', array([...])),
('y', array([...]))])
More specifically: Substructure "type=OrderedDict str=OrderedDict([('x', array([...])),
('y', array([...]))])" is a sequence, while substructure "type=ndarray str=[...]" is not
Entire first structure:
.
Entire second structure:
OrderedDict([('x', .), ('y', .)])
"""
The observation space is defined as follows:
obs = spaces.Box(low = -10_000, high = 200_000, shape = (self.n_states,), dtype = np.int32)
obs.seed(0)
self.observation_space = spaces.Dict({
agent_names[0]: obs, #spaces.Box(low = -10_000, high = 200_000, shape = (self.n_states,), dtype = np.int32),
agent_names[1]: obs, #spaces.Box(low = -10_000, high = 200_000, shape = (self.n_states,), dtype = np.int32)
})
I tried both, predefined and row-wise, as you can see… always the same error.
Here is the state:
def _get_state(self, return_len=False):
curr_state = self._get_one_state()
dict_state = { # OrderedDict(
agent_names[0]: curr_state,
agent_names[1]: curr_state,
}#)
if return_len:
return dict_state, len(curr_state)
else:
return dict_state
Where self._get_one_state()
gives me the needed array. I tried with OrderDict
too, did not work out…
I can see that “first structure” is an np.array, but I do not understand where it comes from… I also managed to get the single agent environment working easily, but multi-agent might help for the scaling in the near future - so there is a workaround but it would be nice to know where I make the mistake.
P.S. If needed - I can share the whole environment