You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ema-pe opened this issue
Jun 7, 2024
· 1 comment
· Fixed by #47880
Labels
bugSomething that is supposed to be working; but isn'tP1Issue that should be fixed within a few weeksrllibRLlib related issuesrllib-envrllib env related issues
Hi, I'm using the simplex space defined in RRLib as an action space for an environment. I want an action space that contains a single point with three coordinates whose values are between [0,1] and sum to 1. The Simplex constructor takes shape and concentration parameters:
I set shape to (1,3) (1 independent 3d Dirichlet)
I set the concentration to np.array([1, 1, 1]) (uniform).
The concentration is the default as calculated in the constructor. The problem is that I cannot initialize this environment because it throws an AssertionError exception from the Simplex constructor.
I think the problem is in simplex.py, in the __init__ function. Why is there an assertion concentration.shape == shape[:-1]? Why is there [:-1] in the assertion? For shape=(1,3) and concentration=np.array([1,1,1]):
The program crashes with the following stack trace:
(.env2.23) emanuele@fedora-t4:~/ray/test-simplex$ python main_ray.py
Traceback (most recent call last):
File "/home/emanuele/ray/test-simplex/main_ray.py", line 25, in <module>
main()
File "/home/emanuele/ray/test-simplex/main_ray.py", line 20, in main
env = SimplexTestEnv({})
File "/home/emanuele/ray/test-simplex/main_ray.py", line 9, in __init__
self.action_space = Simplex(shape=(1,3), concentration=np.array([1, 1, 1]))
File "/home/emanuele/ray/.env2.23/lib64/python3.10/site-packages/ray/rllib/utils/spaces/simplex.py", line 32, in __init__
concentration.shape == shape[:-1]
AssertionError: (3,) vs (1,)
(.env2.23) emanuele@fedora-t4:~/ray/test-simplex$
Issue Severity
High: It blocks me from completing my task.
The text was updated successfully, but these errors were encountered:
ema-pe
added
bug
Something that is supposed to be working; but isn't
triage
Needs triage (eg: priority, bug/not-bug, and owning component)
labels
Jun 7, 2024
@ema-pe Thanks for raising this issue and sorry that you bumped into it. I opened a PR that should fix it. Waiting for review by my colleague.
simonsays1980
added
P1
Issue that should be fixed within a few weeks
rllib-env
rllib env related issues
and removed
triage
Needs triage (eg: priority, bug/not-bug, and owning component)
labels
Oct 2, 2024
bugSomething that is supposed to be working; but isn'tP1Issue that should be fixed within a few weeksrllibRLlib related issuesrllib-envrllib env related issues
What happened + What you expected to happen
Hi, I'm using the simplex space defined in RRLib as an action space for an environment. I want an action space that contains a single point with three coordinates whose values are between [0,1] and sum to 1. The Simplex constructor takes shape and concentration parameters:
shape
to(1,3)
(1 independent 3d Dirichlet)concentration
tonp.array([1, 1, 1])
(uniform).The concentration is the default as calculated in the constructor. The problem is that I cannot initialize this environment because it throws an AssertionError exception from the Simplex constructor.
I think the problem is in simplex.py, in the
__init__
function. Why is there an assertionconcentration.shape == shape[:-1]
? Why is there[:-1]
in the assertion? Forshape=(1,3)
andconcentration=np.array([1,1,1])
:shape[:-1]
is(1,)
concentration.shape
is(3,)
And this throws the exception, but it should not.
ray/rllib/utils/spaces/simplex.py
Lines 8 to 36 in 0b3943b
Versions / Dependencies
Reproduction script
Run the following test script called
main_ray
and it will crash with anAssertionError
exception.The program crashes with the following stack trace:
Issue Severity
High: It blocks me from completing my task.
The text was updated successfully, but these errors were encountered: