Skip to content

Commit

Permalink
Dependencies (#3)
Browse files Browse the repository at this point in the history
TL;DR: added tests, made minor adjustments to pass tests

* added .gitignore and .github/workflows

* updated dependencies

* dependency typo

* testing out using caribou dependencies

* adding dependencies back in

* adding dependencies back in

* adding dependencies back in

* float32 observation outputs for IPM_v2
  • Loading branch information
felimomo authored Feb 20, 2024
1 parent c344457 commit 8c55f8c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
12 changes: 11 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,14 @@ name = "rl4greencrab" # rename this if you plan to publish to test PyPI
# You will learn how to setup dynamic versioning in a followup tutorial.
version = "1.0.0"

dependencies = ["gymnasium", "numpy", "scipy", "stable-baselines3", "sb3-contrib", "yaml"]
# dependencies = ["gymnasium", "numpy", "scipy", "stable-baselines3", "sb3-contrib", "pyyaml"]
dependencies = ["gymnasium",
"numpy",
"pandas",
"scipy",
"matplotlib",
"typing",
"pyyaml"]

[project.optional-dependencies]
tests = ["pytest", "pytest-cov", "stable_baselines3", "sb3-contrib"]
5 changes: 3 additions & 2 deletions src/rl4greencrab/invasive_ipm.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,14 @@ def step(self, action):
np.float32(scaled_action)
)
normalized_cpue = 2 * self.cpue_2(obs, scaled_action) - 1
return np.append(normalized_cpue, action), rew, term, trunc, info
observation = np.float32(np.append(normalized_cpue, action))
return observation, rew, term, trunc, info

def reset(self, seed=42, options=None):
_, info = super().reset(seed=seed, options=options)

# completely new obs
return - np.ones(shape=self.observation_space.shape), info
return - np.ones(shape=self.observation_space.shape, dtype=np.float32), info

def cpue_2(self, obs, scaled_action):
if any(scaled_action <= 0):
Expand Down

0 comments on commit 8c55f8c

Please sign in to comment.