mirror of
https://github.com/illiumst/marl-factory-grid.git
synced 2025-06-19 02:52:52 +02:00
Fixed agent observation and inventory init
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@ -81,7 +81,7 @@ acs-*.bib
|
|||||||
# endnotes
|
# endnotes
|
||||||
*.ent
|
*.ent
|
||||||
|
|
||||||
# fixme
|
# f i x m e
|
||||||
*.lox
|
*.lox
|
||||||
|
|
||||||
# feynmf/feynmp
|
# feynmf/feynmp
|
||||||
@ -143,7 +143,6 @@ acs-*.bib
|
|||||||
|
|
||||||
# knitr
|
# knitr
|
||||||
*-concordance.tex
|
*-concordance.tex
|
||||||
# TODO Comment the next line if you want to keep your tikz graphics files
|
|
||||||
*.tikz
|
*.tikz
|
||||||
*-tikzDictionary
|
*-tikzDictionary
|
||||||
|
|
||||||
@ -225,7 +224,7 @@ pythontex-files-*/
|
|||||||
*.hst
|
*.hst
|
||||||
*.ver
|
*.ver
|
||||||
|
|
||||||
# easy-todo
|
# easy-t o d o
|
||||||
*.lod
|
*.lod
|
||||||
|
|
||||||
# xcolor
|
# 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:
|
Actions:
|
||||||
- Noop
|
- Noop
|
||||||
- Charge
|
- Charge
|
||||||
- CleanUp
|
- Clean
|
||||||
- DestAction
|
- DestAction
|
||||||
- DoorUse
|
- DoorUse
|
||||||
- ItemAction
|
- ItemAction
|
||||||
|
@ -5,6 +5,12 @@ from marl_factory_grid.environment.groups.collection import Collection
|
|||||||
class Agents(Collection):
|
class Agents(Collection):
|
||||||
_entity = Agent
|
_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
|
@property
|
||||||
def spawn_rule(self):
|
def spawn_rule(self):
|
||||||
return {}
|
return {}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from .actions import CleanUp
|
from .actions import Clean
|
||||||
from .entitites import DirtPile
|
from .entitites import DirtPile
|
||||||
from .groups import DirtPiles
|
from .groups import DirtPiles
|
||||||
from .rules import EntitiesSmearDirtOnMove, DoneOnAllDirtCleaned
|
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
|
from marl_factory_grid.environment import constants as c
|
||||||
|
|
||||||
|
|
||||||
class CleanUp(Action):
|
class Clean(Action):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(d.CLEAN_UP, r.CLEAN_UP_VALID, r.CLEAN_UP_FAIL)
|
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):
|
def obs_tag(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
@property
|
||||||
|
def name(self):
|
||||||
|
return f'{self.__class__.__name__}[{self._bound_entity.name}]'
|
||||||
|
|
||||||
def __init__(self, agent: Agent, *args, **kwargs):
|
def __init__(self, agent: Agent, *args, **kwargs):
|
||||||
super(Inventory, self).__init__(*args, **kwargs)
|
super(Inventory, self).__init__(*args, **kwargs)
|
||||||
self._collection = None
|
self._collection = None
|
||||||
|
@ -29,7 +29,7 @@ if __name__ == '__main__':
|
|||||||
ce.save_all(run_path / 'all_out.yaml')
|
ce.save_all(run_path / 'all_out.yaml')
|
||||||
|
|
||||||
# Path to config File
|
# 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
|
# Env Init
|
||||||
factory = Factory(path)
|
factory = Factory(path)
|
||||||
|
Reference in New Issue
Block a user