Fix _STEP and _RESET for TempVMPackingEnv (fixes #36) #42
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes several changes to the
TempVMPackingEnv
defined inor_gym/envs/classic_or/vmpacking.py
that fixes #36or_gym/envs/classic_or/vmpacking.py
: Renamedstep
method to_STEP
so that customized logic is used. In current implementation steps use the_STEP
from the parent classVMPackingEnv
.or_gym/envs/classic_or/vmpacking.py
: Updatedpm_state
array operations in_STEP
to exclude the first element of the demand array and addressed rounding issues by setting values less thanself.tol
to 0.or_gym/envs/classic_or/vmpacking.py
: Modifiedupdate_state
method to usenp.float32
fordata_center
andnp.uint8
foraction_mask
andavail_actions
to ensure proper data types. This ensures that the tests pass, because they include a check against theobservation_space
which uses these types.or_gym/envs/classic_or/vmpacking.py
: Updated_RESET
method to initializestate
with dictionaries containingnp.uint8
andnp.float32
data types foraction_mask
,avail_actions
, andstate
._RESET
method previously gave an error because the default state was a NumPy array butupdate_state
tries to set values using dictionary keys.This pull request addresses the default setting where
self.mask=True
, but does not make edits to ensure that, if the user setsself.mask=False
, the state consists of just the NumPy array (vs dictionary containing arrays for action mask, available action, and the state).