hubbs5 / or-gym

Environments for OR and RL Research
MIT License
373 stars 93 forks source link

Bug: state not updated when refusing an item in OnlineKP #22

Closed lbegnardi closed 2 years ago

lbegnardi commented 2 years ago

Hello, in the OnlineKnapsackEnv, when an item is refused (action is 0) the state is not updated. This means that the agent will be presented with the same item until it eventually accepts it or the episode ends because the step_limit is reached. I suppose this is not what should happen.

Adding self._update_state() at the end of the else statement in the _STEP() function (line 464 of knapsack.py) should fix the problem.

hubbs5 commented 2 years ago

Thanks for catching this! We'll issue a PR shortly.

osarwar commented 2 years ago

This has been fixed in the new version!