HumanCompatibleAI / overcooked_ai

A benchmark environment for fully cooperative human-AI performance.
https://arxiv.org/abs/1910.05789
MIT License
707 stars 148 forks source link

Invalid Value (NaNs) in Overcooked Class #85

Closed mmcelikok closed 2 years ago

mmcelikok commented 2 years ago

https://github.com/HumanCompatibleAI/overcooked_ai/blob/bdbf0232adde1412db87975d0ec2357093775ef4/src/overcooked_ai_py/mdp/overcooked_env.py#L549

This line was added to fix the "soup_cooking_time" issue. But now it returns: "RuntimeWarning: invalid value encountered in multiply gym.spaces.Box(high * 0, high, dtype=np.float32)".

Simple printing shows that variable high is an array of Infs, and thus high * 0 becomes an array of NaNs.

micahcarroll commented 2 years ago

Thanks for reaching out!

As a temporary solution, I've changed the value to a large number. We'll figure a better solution for this soon.

mmcelikok commented 2 years ago

Thanks for reaching out!

As a temporary solution, I've changed the value to a large number. We'll figure a better solution for this soon.

It actually has a simpler solution than I thought. The issue is due to the next line actually: return gym.spaces.Box(high * 0, high, dtype=np.float32)

The 0*high is the problem. This solves it:

high = np.ones(obs_shape) * float("inf")
low = np.zeros(obs_shape)
return gym.spaces.Box(low, high, dtype=np.float32)
micahcarroll commented 2 years ago

Ah, I see, you're right that this is much nicer 😅 Thanks so much for your response!