Skip to content

Commit 2e61d7d

Browse files
committed
cleanup
1 parent 6380029 commit 2e61d7d

23 files changed

+51
-8773
lines changed

.pre-commit-config.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.0.1
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- repo: https://github.com/psf/black
9+
rev: 23.7.0
10+
hooks:
11+
- id: black

pettingzoo/predpreygrass/api_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# passed API test for predpreygrass
22
from pettingzoo.test import api_test
3-
import environments.predpreygrass_available_energy_transfer as predpreygrass
3+
import environments.predpreygrass_default as predpreygrass
44

55
env = predpreygrass.raw_env()
66
api_test(env, num_cycles=1000, verbose_progress=False)

pettingzoo/predpreygrass/archive/optuna_test_20240531.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import environments.predpreygrass_variable_energy_transfer as predpreygrass
22

3-
from config.config_pettingzoo import (
3+
from pettingzoo.predpreygrass.config.config_predpreygrass_default import (
44
env_kwargs,
55
training_steps_string,
66
local_output_directory,
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
### Configurations
22

3-
Configurations and their consequences emergent behaviors are [discussed on our website](https://www.behaviorpatterns.info/predator-prey-grass-project/).
3+
Configurations and their consequentialy emergent behaviors are [discussed on our website](https://www.behaviorpatterns.info/predator-prey-grass-project/).

pettingzoo/predpreygrass/config/config_pettingzoo_walls.py

-75
This file was deleted.

pettingzoo/predpreygrass/config/config_pettingzoo.py pettingzoo/predpreygrass/config/config_predpreygrass_default.py

+12-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
# put in here your own directory to the output folder
22
local_output_directory = "/home/doesburg/Dropbox/02_marl_results/predpreygras_results/"
33

4-
training_steps_string = "30_000_000"
4+
training_steps_string = "10_000_000"
5+
6+
x_grid_size = 25
7+
y_grid_size = 25
58

69
env_kwargs = dict(
710
# environment parameters
811
max_cycles=5000,
9-
x_grid_size=25,
10-
y_grid_size=25,
12+
x_grid_size=x_grid_size,
13+
y_grid_size=y_grid_size,
1114
# agent parameters
1215
n_possible_predator=18, # maximum number of predators during runtime
1316
n_possible_prey=24,
@@ -19,7 +22,7 @@
1922
obs_range_predator=7,
2023
obs_range_prey=9,
2124
# energy parameters
22-
energy_gain_per_step_predator = -0.15, # optimized by parameter variation [-0.3,-0.25,-0.20,-0.15,-0.10]
25+
energy_gain_per_step_predator = -0.15, # optimized by parameter variation [-0.3,-0.25,-0.20,-0.15,-0.10]
2326
energy_gain_per_step_prey = -0.05,
2427
energy_gain_per_step_grass = 0.2,
2528
catch_prey_energy = 0.0,
@@ -52,22 +55,21 @@
5255
spawning_area_predator = dict({
5356
"x_begin": 0,
5457
"y_begin": 0,
55-
"x_end": 24,
56-
"y_end": 24,
58+
"x_end": x_grid_size-1,
59+
"y_end": y_grid_size-1,
5760
}),
5861
spawning_area_prey = dict({
5962
"x_begin": 0,
6063
"y_begin": 0,
61-
"x_end": 24,
62-
"y_end": 24,
64+
"x_end": x_grid_size-1,
65+
"y_end": y_grid_size-1,
6366
}),
6467
spawning_area_grass = dict({
6568
"x_begin": 12,
6669
"y_begin": 0,
6770
"x_end": 13,
68-
"y_end": 24,
71+
"y_end": y_grid_size-1,
6972
}),
7073

7174

72-
7375
)

pettingzoo/predpreygrass/continue_training_saved_model.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
1313
"""
1414
# Continue training for X steps and log the results to TensorBoard
15-
import environments.predpreygrass_available_energy_transfer as predpreygrass
16-
from config.config_pettingzoo import env_kwargs, training_steps_string
15+
import environments.predpreygrass_default as predpreygrass
16+
from config.config_predpreygrass_default import env_kwargs, training_steps_string
1717

1818
import os
1919

pettingzoo/predpreygrass/environments/README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,5 @@ Learning agents (Predators and Prey) receive fixed pre determined energy and rew
1111
The removal or creation of Predators or Prey is handeled by the `is_active` boolean of the agents.
1212
At `reset`,`n_possible_predator` and `n_possible_prey` are initialized. However, a portion of agents is intialized at `is_active` = `False`, this will give room for creation of agents during runtime. Conversely, removal of agents during runtime is handled by setting the attribute `is_active` from `True` to `False`. The rewards and observations of non active agents are zeros, comparable with SuperSuit's Black Death wrapper.
1313

14-
`predatorpreygrass_available_energy_transfer.py`: A generalization of 'predatorpreygrass_fixed_energy_transfer.py'. Rather than receiving fixed predeterimined energy quantities, agents exchange energy depending on the energy available from the eaten agents. The observation channels consists of the energy levels of agents, rather than just one's or zero's in 'predatorpreygrass_fixed_energy_transfer.py'. The purpose of this generalization is to gauge wether agents maken energy-efficiency choices. So, if they go after a resource which has higher energetic value than antother within their observation range.
14+
`predatorpreygrass.py`: The default environment. A generalization of 'predatorpreygrass_fixed_energy_transfer.py'. Rather than receiving fixed predeterimined energy quantities, agents exchange energy depending on the energy available from the eaten agents. The observation channels consists of the energy levels of agents, rather than just one's or zero's in 'predatorpreygrass_fixed_energy_transfer.py'. The purpose of this generalization is to gauge wether agents maken energy-efficiency choices. So, if they go after a resource which has higher energetic value than antother within their observation range.
1515

16-
17-
`predatorpreygrass_available_energy_transfer_walls.py`: The action space is extended where Predators as well as Prey can build obstacles or walls in the grid world environment at the expense of a certain amount of energy for the agent. So the action space for learning agents is ['MOVE UP', 'MOVE DOWN', 'MOVE LEFT', 'MOVE RIGHT', 'STAY', 'BUILD WALL']

0 commit comments

Comments
 (0)