mirror of
https://github.com/illiumst/marl-factory-grid.git
synced 2025-05-22 14:56:43 +02:00
Fixed agent observation and inventory init
This commit is contained in:
parent
467cc3f793
commit
604c0c6f57
5
.gitignore
vendored
5
.gitignore
vendored
@ -81,7 +81,7 @@ acs-*.bib
|
||||
# endnotes
|
||||
*.ent
|
||||
|
||||
# fixme
|
||||
# f i x m e
|
||||
*.lox
|
||||
|
||||
# feynmf/feynmp
|
||||
@ -143,7 +143,6 @@ acs-*.bib
|
||||
|
||||
# knitr
|
||||
*-concordance.tex
|
||||
# TODO Comment the next line if you want to keep your tikz graphics files
|
||||
*.tikz
|
||||
*-tikzDictionary
|
||||
|
||||
@ -225,7 +224,7 @@ pythontex-files-*/
|
||||
*.hst
|
||||
*.ver
|
||||
|
||||
# easy-todo
|
||||
# easy-t o d o
|
||||
*.lod
|
||||
|
||||
# xcolor
|
||||
|
73
marl_factory_grid/configs/clean_and_bring.yaml
Normal file
73
marl_factory_grid/configs/clean_and_bring.yaml
Normal file
@ -0,0 +1,73 @@
|
||||
Agents:
|
||||
Wolfgang:
|
||||
Actions:
|
||||
- Move8
|
||||
- DoorUse
|
||||
- Clean
|
||||
- Noop
|
||||
Observations:
|
||||
- Walls
|
||||
- Doors
|
||||
- Other
|
||||
- DirtPiles
|
||||
|
||||
Juergen:
|
||||
Actions:
|
||||
- Move8
|
||||
- DoorUse
|
||||
- ItemAction
|
||||
- Noop
|
||||
Observations:
|
||||
- Walls
|
||||
- Doors
|
||||
- Other
|
||||
- Items
|
||||
- DropOffLocations
|
||||
- Inventory
|
||||
|
||||
Entities:
|
||||
DirtPiles:
|
||||
coords_or_quantity: 10
|
||||
initial_amount: 2
|
||||
clean_amount: 1
|
||||
dirt_spawn_r_var: 0.1
|
||||
max_global_amount: 20
|
||||
max_local_amount: 5
|
||||
Doors:
|
||||
DropOffLocations:
|
||||
coords_or_quantity: 1
|
||||
max_dropoff_storage_size: 0
|
||||
Inventories: {}
|
||||
Items:
|
||||
coords_or_quantity: 5
|
||||
|
||||
|
||||
General:
|
||||
env_seed: 69
|
||||
individual_rewards: true
|
||||
level_name: rooms
|
||||
pomdp_r: 3
|
||||
verbose: True
|
||||
tests: false
|
||||
|
||||
Rules:
|
||||
# Environment Dynamics
|
||||
EntitiesSmearDirtOnMove:
|
||||
smear_ratio: 0.2
|
||||
DoorAutoClose:
|
||||
close_frequency: 7
|
||||
|
||||
# Respawn Stuff
|
||||
RespawnDirt:
|
||||
respawn_freq: 30
|
||||
RespawnItems:
|
||||
respawn_freq: 50
|
||||
|
||||
# Utilities
|
||||
WatchCollisions:
|
||||
done_at_collisions: false
|
||||
|
||||
# Done Conditions
|
||||
DoneOnAllDirtCleaned:
|
||||
DoneAtMaxStepsReached:
|
||||
max_steps: 500
|
@ -3,7 +3,7 @@ Agents:
|
||||
Actions:
|
||||
- Noop
|
||||
- Charge
|
||||
- CleanUp
|
||||
- Clean
|
||||
- DestAction
|
||||
- DoorUse
|
||||
- ItemAction
|
||||
|
@ -5,6 +5,12 @@ from marl_factory_grid.environment.groups.collection import Collection
|
||||
class Agents(Collection):
|
||||
_entity = Agent
|
||||
|
||||
@property
|
||||
def obs_pairs(self):
|
||||
pair_list = [(self.name, self)]
|
||||
pair_list.extend([(a.name, a) for a in self])
|
||||
return pair_list
|
||||
|
||||
@property
|
||||
def spawn_rule(self):
|
||||
return {}
|
||||
|
@ -1,4 +1,4 @@
|
||||
from .actions import CleanUp
|
||||
from .actions import Clean
|
||||
from .entitites import DirtPile
|
||||
from .groups import DirtPiles
|
||||
from .rules import EntitiesSmearDirtOnMove, DoneOnAllDirtCleaned
|
||||
|
@ -8,7 +8,7 @@ from marl_factory_grid.modules.clean_up import constants as d, rewards as r
|
||||
from marl_factory_grid.environment import constants as c
|
||||
|
||||
|
||||
class CleanUp(Action):
|
||||
class Clean(Action):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(d.CLEAN_UP, r.CLEAN_UP_VALID, r.CLEAN_UP_FAIL)
|
||||
|
@ -51,6 +51,10 @@ class Inventory(IsBoundMixin, Collection):
|
||||
def obs_tag(self):
|
||||
return self.name
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return f'{self.__class__.__name__}[{self._bound_entity.name}]'
|
||||
|
||||
def __init__(self, agent: Agent, *args, **kwargs):
|
||||
super(Inventory, self).__init__(*args, **kwargs)
|
||||
self._collection = None
|
||||
|
@ -29,7 +29,7 @@ if __name__ == '__main__':
|
||||
ce.save_all(run_path / 'all_out.yaml')
|
||||
|
||||
# Path to config File
|
||||
path = Path('marl_factory_grid/configs/default_config.yaml')
|
||||
path = Path('marl_factory_grid/configs/clean_and_bring.yaml')
|
||||
|
||||
# Env Init
|
||||
factory = Factory(path)
|
||||
|
Loading…
x
Reference in New Issue
Block a user