mirror of
https://github.com/illiumst/marl-factory-grid.git
synced 2025-06-26 05:01:36 +02:00
Remove BoundDestination Object
New Variable 'var_can_be_bound' Observations adjusted accordingly
This commit is contained in:
@ -11,10 +11,6 @@ class Agents(PositionMixin, EnvObjects):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
@property
|
||||
def obs_pairs(self):
|
||||
return [(a.name, a) for a in self]
|
||||
|
||||
@property
|
||||
def action_space(self):
|
||||
from gymnasium import spaces
|
||||
|
@ -9,6 +9,7 @@ class EnvObjects(Objects):
|
||||
var_can_collide: bool = False
|
||||
var_has_position: bool = False
|
||||
var_can_move: bool = False
|
||||
var_can_be_bound: bool = False
|
||||
|
||||
@property
|
||||
def encodings(self):
|
||||
|
@ -92,11 +92,11 @@ class HasBoundMixin:
|
||||
def by_entity(self, entity):
|
||||
try:
|
||||
return next((x for x in self if x.belongs_to_entity(entity)))
|
||||
except StopIteration:
|
||||
except (StopIteration, AttributeError):
|
||||
return None
|
||||
|
||||
def idx_by_entity(self, entity):
|
||||
try:
|
||||
return next((idx for idx, x in enumerate(self) if x.belongs_to_entity(entity)))
|
||||
except StopIteration:
|
||||
except (StopIteration, AttributeError):
|
||||
return None
|
||||
|
@ -24,7 +24,9 @@ class Objects:
|
||||
|
||||
@property
|
||||
def obs_pairs(self):
|
||||
return [(self.name, self)]
|
||||
pair_list = [(self.name, self)]
|
||||
pair_list.extend([(a.name, a) for a in self])
|
||||
return pair_list
|
||||
|
||||
@property
|
||||
def names(self):
|
||||
|
Reference in New Issue
Block a user