Skip to content

Commit 05aec15

Browse files
authored
Merge pull request #53 from bmielnicki/python_state_visualization
Python native state visualization
2 parents 242c24d + 6f67fa0 commit 05aec15

File tree

70 files changed

+3875
-16
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+3875
-16
lines changed

.github/workflows/pythontests.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ jobs:
1212
- name: Install dependencies
1313
run: python -m pip install --upgrade pip
1414
- name: Setup
15-
run: pip install .
15+
run: pip install -e .
1616
- name: Run tests
1717
run: |
1818
python -m unittest discover -s testing/ -p "*_test.py"
19-
2019
ubuntu_mdp_tests:
2120
runs-on: ubuntu-latest
2221
steps:
@@ -34,8 +33,7 @@ jobs:
3433
run: pip install -e .
3534
- name: Run tests and generate coverage report
3635
run: |
37-
coverage run -m unittest discover -s testing/ -p "*_test.py"
38-
coverage report
36+
python -m unittest discover -s testing/ -p "*_test.py"
3937
- name: Upload coverage to Codecov
4038
uses: codecov/codecov-action@v1
4139
with:

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
'numpy',
2525
'tqdm',
2626
'gym',
27-
'ipython'
27+
'ipython',
28+
'pygame',
29+
"ipywidgets"
2830
]
2931
)

src/overcooked_ai_py/agents/agent.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,20 @@ def ml_action(self, state):
458458

459459
return motion_goals
460460

461+
class SampleAgent(Agent):
462+
""" Agent that samples action using the average action_probs across multiple agents
463+
"""
464+
def __init__(self, agents):
465+
self.agents = agents
461466

467+
def action(self, state):
468+
action_probs = np.zeros(Action.NUM_ACTIONS)
469+
for agent in self.agents:
470+
action_probs += agent.action(state)[1]["action_probs"]
471+
action_probs = action_probs/len(self.agents)
472+
return Action.sample(action_probs), {"action_probs": action_probs}
473+
"""
474+
"""
462475
# Deprecated. Need to fix Heuristic to work with the new MDP to reactivate Planning
463476
# class CoupledPlanningAgent(Agent):
464477
# """
Binary file not shown.
1.82 KB
Loading

0 commit comments

Comments
 (0)