mirror of
https://github.com/illiumst/marl-factory-grid.git
synced 2025-07-05 17:11:35 +02:00
added test hooks (like rules)
This commit is contained in:
@ -38,5 +38,6 @@ class Test(abc.ABC):
|
|||||||
class FirstTest(Test):
|
class FirstTest(Test):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
print("firstTest")
|
||||||
super().__init__()
|
super().__init__()
|
||||||
pass
|
pass
|
||||||
|
@ -22,26 +22,41 @@ Agents:
|
|||||||
- Inventory
|
- Inventory
|
||||||
- DropOffLocations
|
- DropOffLocations
|
||||||
- Maintainers
|
- Maintainers
|
||||||
|
# This is special for agents, as each one is different and can act as an adversary e.g.
|
||||||
|
Positions:
|
||||||
|
- (16, 7)
|
||||||
|
- (16, 6)
|
||||||
|
- (16, 3)
|
||||||
|
- (16, 4)
|
||||||
|
- (16, 5)
|
||||||
Entities:
|
Entities:
|
||||||
Batteries:
|
Batteries:
|
||||||
initial_charge: 0.8
|
initial_charge: 0.8
|
||||||
per_action_costs: 0.02
|
per_action_costs: 0.02
|
||||||
ChargePods: {}
|
ChargePods:
|
||||||
Destinations: {}
|
coords_or_quantity: 2
|
||||||
|
Destinations:
|
||||||
|
coords_or_quantity: 1
|
||||||
|
spawn_mode: GROUPED
|
||||||
DirtPiles:
|
DirtPiles:
|
||||||
|
coords_or_quantity: 10
|
||||||
|
initial_amount: 2
|
||||||
clean_amount: 1
|
clean_amount: 1
|
||||||
dirt_spawn_r_var: 0.1
|
dirt_spawn_r_var: 0.1
|
||||||
initial_amount: 2
|
|
||||||
initial_dirt_ratio: 0.05
|
|
||||||
max_global_amount: 20
|
max_global_amount: 20
|
||||||
max_local_amount: 5
|
max_local_amount: 5
|
||||||
Doors: {}
|
Doors:
|
||||||
DropOffLocations: {}
|
DropOffLocations:
|
||||||
|
coords_or_quantity: 1
|
||||||
|
max_dropoff_storage_size: 0
|
||||||
GlobalPositions: {}
|
GlobalPositions: {}
|
||||||
Inventories: {}
|
Inventories: {}
|
||||||
Items: {}
|
Items:
|
||||||
Machines: {}
|
coords_or_quantity: 5
|
||||||
Maintainers: {}
|
Machines:
|
||||||
|
coords_or_quantity: 2
|
||||||
|
Maintainers:
|
||||||
|
coords_or_quantity: 1
|
||||||
Zones: {}
|
Zones: {}
|
||||||
|
|
||||||
General:
|
General:
|
||||||
@ -49,33 +64,34 @@ General:
|
|||||||
individual_rewards: true
|
individual_rewards: true
|
||||||
level_name: large
|
level_name: large
|
||||||
pomdp_r: 3
|
pomdp_r: 3
|
||||||
verbose: false
|
verbose: True
|
||||||
tests: true
|
tests: false
|
||||||
|
|
||||||
Rules:
|
Rules:
|
||||||
SpawnAgents: {}
|
# Environment Dynamics
|
||||||
DoneAtBatteryDischarge: {}
|
|
||||||
Collision:
|
|
||||||
done_at_collisions: false
|
|
||||||
AssignGlobalPositions: {}
|
|
||||||
DoneAtDestinationReachAny: {}
|
|
||||||
DestinationReachReward: {}
|
|
||||||
SpawnDestinations:
|
|
||||||
n_dests: 1
|
|
||||||
spawn_mode: GROUPED
|
|
||||||
DoneOnAllDirtCleaned: {}
|
|
||||||
SpawnDirt:
|
|
||||||
spawn_freq: 15
|
|
||||||
EntitiesSmearDirtOnMove:
|
EntitiesSmearDirtOnMove:
|
||||||
smear_ratio: 0.2
|
smear_ratio: 0.2
|
||||||
DoorAutoClose:
|
DoorAutoClose:
|
||||||
close_frequency: 10
|
close_frequency: 10
|
||||||
ItemRules:
|
MoveMaintainers:
|
||||||
max_dropoff_storage_size: 0
|
|
||||||
n_items: 5
|
# Respawn Stuff
|
||||||
n_locations: 5
|
RespawnDirt:
|
||||||
spawn_frequency: 15
|
respawn_freq: 15
|
||||||
MaxStepsReached:
|
RespawnItems:
|
||||||
max_steps: 10
|
respawn_freq: 15
|
||||||
# AgentSingleZonePlacement:
|
|
||||||
# n_zones: 4
|
# Utilities
|
||||||
|
WatchCollisions:
|
||||||
|
done_at_collisions: false
|
||||||
|
|
||||||
|
# Done Conditions
|
||||||
|
DoneAtDestinationReachAny:
|
||||||
|
DoneOnAllDirtCleaned:
|
||||||
|
DoneAtBatteryDischarge:
|
||||||
|
DoneAtMaintainerCollision:
|
||||||
|
DoneAtMaxStepsReached:
|
||||||
|
max_steps: 500
|
||||||
|
|
||||||
|
Tests:
|
||||||
|
FirstTest: {}
|
@ -7,7 +7,7 @@ from marl_factory_grid.environment.factory import Factory
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# Render at each step?
|
# Render at each step?
|
||||||
render = True
|
render = False
|
||||||
|
|
||||||
# Path to config File
|
# Path to config File
|
||||||
path = Path('test_config.yaml')
|
path = Path('test_config.yaml')
|
||||||
|
@ -161,8 +161,8 @@ class FactoryConfigParser(object):
|
|||||||
|
|
||||||
return self._load_smth(rules, Rule)
|
return self._load_smth(rules, Rule)
|
||||||
|
|
||||||
def load_env_tests(self) -> List[Rule]:
|
def load_env_tests(self) -> List[Test]:
|
||||||
return self._load_smth(self.tests, None) # Test
|
return self._load_smth(self.tests, Test)
|
||||||
|
|
||||||
def _load_smth(self, config, class_obj):
|
def _load_smth(self, config, class_obj):
|
||||||
rules = list()
|
rules = list()
|
||||||
|
Reference in New Issue
Block a user