mirror of
https://github.com/illiumst/marl-factory-grid.git
synced 2025-06-23 20:11:34 +02:00
fix mismatching signatures of spawn
This commit is contained in:
@ -1,9 +1,10 @@
|
||||
from typing import Union, List, Tuple
|
||||
|
||||
from marl_factory_grid.environment.groups.collection import Collection
|
||||
from marl_factory_grid.modules.batteries.entitites import Pod, Battery
|
||||
|
||||
|
||||
class Batteries(Collection):
|
||||
|
||||
_entity = Battery
|
||||
|
||||
@property
|
||||
@ -33,9 +34,14 @@ class Batteries(Collection):
|
||||
batteries = [self._entity(initial_charge_level, agent) for _, agent in enumerate(agents)]
|
||||
self.add_items(batteries)
|
||||
|
||||
# def spawn(self, coords_or_quantity: Union[int, List[Tuple[(int, int)]]], *entity_args): hat keine pos
|
||||
# agents = entity_args[0]
|
||||
# initial_charge_level = entity_args[1]
|
||||
# batteries = [self._entity(initial_charge_level, agent) for _, agent in enumerate(agents)]
|
||||
# self.add_items(batteries)
|
||||
|
||||
|
||||
class ChargePods(Collection):
|
||||
|
||||
_entity = Pod
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -49,7 +49,7 @@ class BatteryDecharge(Rule):
|
||||
self.per_action_costs = per_action_costs
|
||||
self.initial_charge = initial_charge
|
||||
|
||||
def on_init(self, state, lvl_map):
|
||||
def on_init(self, state, lvl_map): # on reset?
|
||||
assert len(state[c.AGENT]), "There are no agents, did you already spawn them?"
|
||||
state[b.BATTERIES].spawn(state[c.AGENT], self.initial_charge)
|
||||
|
||||
|
Reference in New Issue
Block a user