Closed shark939393 closed 2 years ago
Hi,
Can you include the code that raises this error?
UserWarning: WARN: Box bound precision lowered by casting to float32
"Box bound precision lowered by casting to {}".format(self.dtype)
Traceback (most recent call last):
File "lbforaging.py", line 57, in
26 for i, player in enumerate(env.players):
27 actions.append(env.action_space.sample())
28 nobs, nreward, ndone, _ = env.step(actions)
44 for episode in range(game_count):
45 _game_loop(env, render)
57 main(args.times, args.render)
my env is env = gym.make("Foraging-10x10-2p-5f-v1")
and init file is left the same as the one I downloaded from the repository
thanks for your reply.
You might be using an older version of lbforaging.py
..?
In the master branch, the step looks like:
actions = env.action_space.sample()
nobs, nreward, ndone, _ = env.step(actions)
...
Essentially you don't need the actions.append(
or the loop over the players. You just need to step using env.step(env.action_space.sample())
OK thank you very much, but so now it gives me error
UserWarning: WARN: Box bound precision lowered by casting to float32 "Box bound precision lowered by casting to {}".format(self.dtype) [0, 0.2857142857142857] [0, 0.2857142857142857]
and I don’t know what it’s about, thank you so much anyway
Looks like it's just a warning. Shouldn't cause any issues.
ok thank you so much
excuse another question, how do I start the simulation? I get a Gui with the apple? which file should I run?
You need an agent that can make actions given the environment observation. Training/making such an agent is outside the scope of this repo but we do our best to have a similar API to OpenAI's Gym. You'd just need to run env.step(_ACTIONS_)
and then env.render()
to see the simulation. But to find the actions you'd need something outside this repo (e.g. a DQN implementation?).
ah ok , I thought you could simulate and see agents in the environment as in the gif where agents eat apples
Yes, you actually can. You still need to select the actions though. I am not sure what the exact question is? :)
Have you tried python lbforaging.py --render
? lbforaging.py is in the root directory. It might be what you are looking for.
Oh yes, thank you for all
hello I am trying to execute the code , but when I compile it returns me this error raise ValueError("%r is not a valid %s" % (value, cls.name)) ValueError: (5, 4) is not a valid Action
my env is " env = gym.make("Foraging-10x10-2p-5f-v1") "
Did I set it wrong?
thank you for all