refactoring and init.py

This commit is contained in:
Steffen Illium 2023-06-20 18:21:43 +02:00
parent 1332cee7e1
commit c7d77acbbe
138 changed files with 328 additions and 320 deletions

2
.gitignore vendored
View File

@ -553,7 +553,7 @@ celerybeat.pid
*.sage.py
# Environments
# .env
# .environment
.env/
.venv/
env/

View File

@ -80,36 +80,35 @@ General:
level_name: rooms # 'double', 'large', 'simple', ...
```
... or create your own , maybe with the help of [asciiflow.com](https://asciiflow.com/#/).
Be sure to use '#' as Walls, '-' as free (walkable) Floor-Tiles, 'D' for Doors.
Custom Entites (define you own) may bring their own "Symbol"
Make sure to use `#` as [Walls](mfg_package/environment/entity/wall_floor.py), `-` as free (walkable) [Floor](mfg_package/environment/entity/wall_floor.py)-Tiles, `D` for [Walls](./modules/doors/entities.py).
Other Entites (define you own) may bring their own `Symbols`
#### Entites
Entites are either [Objects](./environment/entity/object.py) for tracking stats or env. [Entity](./environment/entity/entity.py) which can interact.
Entites, either [Objects](mfg_package/environment/entity/object.py) for tracking stats
or env. [Entity](mfg_package/environment/entity/entity.py) which can interact.
Abstract Entities are provided.
#### Groups
[Groups](./environment/groups/objects.py) are entity Sets that provide administrative access to all group members.
All [Entites](./environment/entity/global_entities.py) are available at runtime as EnvState property.
[Groups](mfg_package/environment/groups/objects.py) are entity Sets that provide administrative access to all group members.
All [Entites](mfg_package/environment/entity/global_entities.py) are available at runtime as EnvState property.
#### Rules
[Rules](./environment/entity/object.py) define how the environment behaves on micro-scale.
Each of the hookes ('on_init', 'pre-step', 'on_step', 'post_step', 'on_done')
[Rules](mfg_package/environment/entity/object.py) define how the environment behaves on micro-scale.
Each of the hookes (`on_init`, `pre_step`, `on_step`, '`post_step`', `on_done`)
provide env-access to implement customn logic, calculate rewards, or gather information.
![Hooks](./images/Hooks_FIKS.png)
[Results](./environment/entity/object.py) provide a way to return 'rule' evaluations such as rewards and state reports
[Results](mfg_package/environment/entity/object.py) provide a way to return `rule` evaluations such as rewards and state reports
back to the environment.
#### Assets
Make sure to bring your own assets for each Entity, that is living in the Gridworld, the 'Renderer' relies on it.
Make sure to bring your own assets for each Entity living in the Gridworl as the `Renderer` relies on it.
PNG-files (transparent background) of square aspect-ratio should do the job, in general.
<div style="margin:0 auto;">
<img src=".\environment\assets\wall.png" width="10%"> | <img src=".\environment\assets\agent\agent.png" width="10%">
</div>
<img src=".\environment\assets\wall.png" width="5%">
&nbsp&nbsp&nbsp&nbsp
<img src=".\environment\assets\agent\agent.png" width="5%">

View File

@ -1,6 +0,0 @@
from algorithms.marl.base_ac import BaseActorCritic
from algorithms.marl.iac import LoopIAC
from algorithms.marl.snac import LoopSNAC
from algorithms.marl.seac import LoopSEAC
from algorithms.marl.mappo import LoopMAPPO
from algorithms.marl.memory import MARLActorCriticMemory

BIN
images/Hooks_FIKS.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 KiB

View File

@ -0,0 +1 @@
from mfg_package.algorithms.marl.memory import MARLActorCriticMemory

View File

@ -2,8 +2,8 @@ import torch
from typing import Union, List, Dict
import numpy as np
from torch.distributions import Categorical
from algorithms.marl.memory import MARLActorCriticMemory
from algorithms.utils import add_env_props, instantiate_class
from mfg_package.algorithms.marl.memory import MARLActorCriticMemory
from mfg_package.algorithms.utils import add_env_props, instantiate_class
from pathlib import Path
import pandas as pd
from collections import deque
@ -18,7 +18,7 @@ class Names:
HIDDEN_ACTOR = 'hidden_actor'
HIDDEN_CRITIC = 'hidden_critic'
AGENT = 'agent'
ENV = 'env'
ENV = 'environment'
N_AGENTS = 'n_agents'
ALGORITHM = 'algorithm'
MAX_STEPS = 'max_steps'
@ -172,7 +172,7 @@ class BaseActorCritic:
eps_rew += torch.tensor(reward)
results.append(eps_rew.tolist() + [sum(eps_rew).item()] + [episode])
episode += 1
agent_columns = [f'agent#{i}' for i in range(self.cfg['env']['n_agents'])]
agent_columns = [f'agent#{i}' for i in range(self.cfg['environment']['n_agents'])]
results = pd.DataFrame(results, columns=agent_columns + ['sum', 'episode'])
results = pd.melt(results, id_vars=['episode'], value_vars=agent_columns + ['sum'], value_name='reward', var_name='agent')
return results

View File

@ -1,9 +1,9 @@
import torch
from algorithms.marl.base_ac import BaseActorCritic, nms
from algorithms.utils import instantiate_class
from mfg_package.algorithms.marl.base_ac import BaseActorCritic, nms
from mfg_package.algorithms.utils import instantiate_class
from pathlib import Path
from natsort import natsorted
from algorithms.marl.memory import MARLActorCriticMemory
from mfg_package.algorithms.marl.memory import MARLActorCriticMemory
class LoopIAC(BaseActorCritic):

View File

@ -1,10 +1,9 @@
from algorithms.marl.base_ac import Names as nms
from algorithms.marl import LoopSNAC
from algorithms.marl.memory import MARLActorCriticMemory
import random
from mfg_package.algorithms.marl.base_ac import Names as nms
from mfg_package.algorithms.marl.snac import LoopSNAC
from mfg_package.algorithms.marl.memory import MARLActorCriticMemory
import torch
from torch.distributions import Categorical
from algorithms.utils import instantiate_class
from mfg_package.algorithms.utils import instantiate_class
class LoopMAPPO(LoopSNAC):

View File

@ -1,8 +1,8 @@
import torch
from torch.distributions import Categorical
from algorithms.marl.iac import LoopIAC
from algorithms.marl.base_ac import nms
from algorithms.marl.memory import MARLActorCriticMemory
from mfg_package.algorithms.marl.iac import LoopIAC
from mfg_package.algorithms.marl.base_ac import nms
from mfg_package.algorithms.marl.memory import MARLActorCriticMemory
class LoopSEAC(LoopIAC):

View File

@ -1,5 +1,5 @@
from algorithms.marl.base_ac import BaseActorCritic
from algorithms.marl.base_ac import nms
from mfg_package.algorithms.marl.base_ac import BaseActorCritic
from mfg_package.algorithms.marl.base_ac import nms
import torch
from torch.distributions import Categorical
from pathlib import Path

View File

@ -6,10 +6,9 @@ import numpy as np
import networkx as nx
from networkx.algorithms.approximation import traveling_salesman as tsp
from modules.doors import constants as do
from environment import constants as c
from environment.utils.helpers import MOVEMAP
from mfg_package.modules.doors import constants as do
from mfg_package.environment import constants as c
from mfg_package.utils.helpers import MOVEMAP
from abc import abstractmethod, ABC

View File

@ -1,6 +1,6 @@
from algorithms.static.TSP_base_agent import TSPBaseAgent
from mfg_package.algorithms.static.TSP_base_agent import TSPBaseAgent
from modules.clean_up import constants as di
from mfg_package.modules.clean_up import constants as di
future_planning = 7

View File

@ -1,8 +1,8 @@
import numpy as np
from algorithms.static.TSP_base_agent import TSPBaseAgent
from mfg_package.algorithms.static.TSP_base_agent import TSPBaseAgent
from modules.items import constants as i
from mfg_package.modules.items import constants as i
future_planning = 7
inventory_size = 3

View File

@ -1,7 +1,7 @@
from algorithms.static.TSP_base_agent import TSPBaseAgent
from mfg_package.algorithms.static.TSP_base_agent import TSPBaseAgent
from modules.destinations import constants as d
from modules.doors import constants as do
from mfg_package.modules.destinations import constants as d
from mfg_package.modules.doors import constants as do
future_planning = 7

View File

@ -1,6 +1,6 @@
from random import randint
from algorithms.static.TSP_base_agent import TSPBaseAgent
from mfg_package.algorithms.static.TSP_base_agent import TSPBaseAgent
future_planning = 7

View File

@ -56,7 +56,7 @@ def load_yaml_file(path: Path):
def add_env_props(cfg):
env = instantiate_class(cfg['env'].copy())
env = instantiate_class(cfg['environment'].copy())
cfg['agent'].update(dict(observation_size=list(env.observation_space.shape),
n_actions=env.action_space.n))

View File

@ -1,10 +1,9 @@
import abc
from typing import Union
from environment import rewards as r
from environment import constants as c
from environment.utils.helpers import MOVEMAP
from environment.utils.results import ActionResult
from mfg_package.environment import rewards as r, constants as c
from mfg_package.utils.helpers import MOVEMAP
from mfg_package.utils.results import ActionResult
class Action(abc.ABC):

View File

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -1,12 +1,12 @@
from typing import List, Union
from environment import constants as c
from environment.actions import Action
from environment.entity.entity import Entity
from environment.utils.render import RenderEntity
from environment.utils import renderer
from environment.utils.helpers import is_move
from environment.utils.results import ActionResult, Result
from mfg_package.environment import constants as c
from mfg_package.environment.actions import Action
from mfg_package.environment.entity.entity import Entity
from mfg_package.utils.render import RenderEntity
from mfg_package.utils import renderer
from mfg_package.utils.helpers import is_move
from mfg_package.utils.results import ActionResult, Result
class Agent(Entity):

View File

@ -1,12 +1,12 @@
import abc
from environment import constants as c
from environment.entity.object import EnvObject
from environment.utils.render import RenderEntity
from mfg_package.environment import constants as c
from mfg_package.environment.entity.object import EnvObject
from mfg_package.utils.render import RenderEntity
class Entity(EnvObject, abc.ABC):
"""Full Env Entity that lives on the env Grid. Doors, Items, DirtPile etc..."""
"""Full Env Entity that lives on the environment Grid. Doors, Items, DirtPile etc..."""
@property
def has_position(self):

View File

@ -1,8 +1,7 @@
from abc import ABC, abstractmethod
from collections import defaultdict
from typing import Union
from environment import constants as c
from mfg_package.environment import constants as c
class Object:
@ -67,7 +66,7 @@ class Object:
class EnvObject(Object):
"""Objects that hold Information that are observable, but have no position on the env grid. Inventories etc..."""
"""Objects that hold Information that are observable, but have no position on the environment grid. Inventories etc..."""
_u_idx = defaultdict(lambda: 0)

View File

@ -2,8 +2,8 @@ import math
import numpy as np
from environment.entity.mixin import BoundEntityMixin
from environment.entity.object import Object, EnvObject
from mfg_package.environment.entity.mixin import BoundEntityMixin
from mfg_package.environment.entity.object import Object, EnvObject
##########################################################################

View File

@ -2,10 +2,10 @@ from typing import List
import numpy as np
from environment import constants as c
from environment.entity.object import EnvObject
from environment.utils.render import RenderEntity
from environment.utils import helpers as h
from mfg_package.environment import constants as c
from mfg_package.environment.entity.object import EnvObject
from mfg_package.utils.render import RenderEntity
from mfg_package.utils import helpers as h
class Floor(EnvObject):

View File

@ -8,13 +8,13 @@ from typing import Union
import gymnasium as gym
from environment.utils.level_parser import LevelParser
from environment.utils.observation_builder import OBSBuilder
from environment.utils.config_parser import FactoryConfigParser
from environment.utils import helpers as h
import environment.constants as c
from mfg_package.utils.level_parser import LevelParser
from mfg_package.utils.observation_builder import OBSBuilder
from mfg_package.utils.config_parser import FactoryConfigParser
from mfg_package.utils import helpers as h
import mfg_package.environment.constants as c
from environment.utils.states import Gamestate
from mfg_package.utils.states import Gamestate
REC_TAC = 'rec_'
@ -126,7 +126,7 @@ class BaseFactory(gym.Env):
# Returns: Reward, Info
rewards = defaultdict(lambda: 0.0)
# Gather per agent env rewards and
# Gather per agent environment rewards and
# Combine Info dicts into a global one
combined_info_dict = defaultdict(lambda: 0.0)
for result in chain(tick_results, done_check_results):
@ -171,7 +171,7 @@ class BaseFactory(gym.Env):
# noinspection PyGlobalUndefined
def render(self, mode='human'):
if not self._renderer: # lazy init
from environment.utils.renderer import Renderer
from mfg_package.utils.renderer import Renderer
global Renderer
self._renderer = Renderer(self.map.level_shape, view_radius=self.conf.pomdp_r, fps=10)

View File

@ -1,7 +1,6 @@
from environment.groups.env_objects import EnvObjects
from environment.groups.mixins import PositionMixin
from environment.entity.agent import Agent
import environment.constants as c
from mfg_package.environment.groups.env_objects import EnvObjects
from mfg_package.environment.groups.mixins import PositionMixin
from mfg_package.environment.entity.agent import Agent
class Agents(PositionMixin, EnvObjects):

View File

@ -1,5 +1,5 @@
from environment.groups.objects import Objects
from environment.entity.object import EnvObject
from mfg_package.environment.groups.objects import Objects
from mfg_package.environment.entity.object import EnvObject
class EnvObjects(Objects):

View File

@ -2,9 +2,8 @@ from collections import defaultdict
from operator import itemgetter
from typing import Dict
from environment.groups.objects import Objects
from environment.entity.entity import Entity
from environment.utils.helpers import POS_MASK
from mfg_package.environment.groups.objects import Objects
from mfg_package.utils.helpers import POS_MASK
class Entities(Objects):

View File

@ -1,11 +1,6 @@
from abc import ABC
from typing import Tuple
from mfg_package.environment import constants as c
import numpy as np
from environment import constants as c
from environment.entity.entity import Entity
from mfg_package.environment.entity.entity import Entity
# noinspection PyUnresolvedReferences,PyTypeChecker,PyArgumentList

View File

@ -3,7 +3,7 @@ from typing import List
import numpy as np
from environment.entity.object import Object
from mfg_package.environment.entity.object import Object
class Objects:

View File

@ -1,14 +1,13 @@
import numbers
from typing import List, Union, Dict
from typing import List, Union
import numpy as np
from environment.groups.env_objects import EnvObjects
from environment.groups.objects import Objects
from environment.groups.mixins import HasBoundedMixin, PositionMixin
from environment.entity.util import PlaceHolder, GlobalPosition
from environment.utils import helpers as h
from environment import constants as c
from mfg_package.environment.groups.env_objects import EnvObjects
from mfg_package.environment.groups.objects import Objects
from mfg_package.environment.groups.mixins import HasBoundedMixin, PositionMixin
from mfg_package.environment.entity.util import GlobalPosition
from mfg_package.utils import helpers as h
from mfg_package.environment import constants as c
class Combined(PositionMixin, EnvObjects):

View File

@ -1,12 +1,10 @@
import random
from typing import List
import numpy as np
from environment import constants as c
from environment.groups.env_objects import EnvObjects
from environment.groups.mixins import PositionMixin
from environment.entity.wall_floor import Wall, Floor
from mfg_package.environment import constants as c
from mfg_package.environment.groups.env_objects import EnvObjects
from mfg_package.environment.groups.mixins import PositionMixin
from mfg_package.environment.entity.wall_floor import Wall, Floor
class Walls(PositionMixin, EnvObjects):

View File

@ -1,9 +1,8 @@
import abc
from typing import Union, List
from typing import List
from environment.utils.results import Result, TickResult, DoneResult, ActionResult
from environment import constants as c
from environment import rewards as r
from mfg_package.utils.results import TickResult, DoneResult
from mfg_package.environment import rewards as r, constants as c
class Rule(abc.ABC):

View File

@ -5,12 +5,12 @@ from typing import Union
from gymnasium import Wrapper
from environment.utils.helpers import IGNORED_DF_COLUMNS
from environment.factory import REC_TAC
from mfg_package.utils.helpers import IGNORED_DF_COLUMNS
from mfg_package.environment.factory import REC_TAC
import pandas as pd
from plotting.compare_runs import plot_single_run
from mfg_package.plotting.compare_runs import plot_single_run
class EnvMonitor(Wrapper):

View File

@ -4,13 +4,13 @@ from os import PathLike
from pathlib import Path
from typing import Union
import yaml
from gymnasium import Wrapper
import numpy as np
import pandas as pd
import simplejson
from environment.factory import REC_TAC
from mfg_package.environment.factory import REC_TAC
class EnvRecorder(Wrapper):
@ -81,7 +81,7 @@ class EnvRecorder(Wrapper):
# cls.out_file.unlink(missing_ok=True)
with filepath.open('w') as f:
if only_deltas:
from deepdiff import DeepDiff, Delta
from deepdiff import DeepDiff
diff_dict = [DeepDiff(t1,t2, ignore_order=True)
for t1, t2 in zip(self._recorder_out_list, self._recorder_out_list[1:])
]
@ -95,7 +95,7 @@ class EnvRecorder(Wrapper):
'header': self.env.summarize_header
})
try:
simplejson.dump(out_dict, f, indent=4)
yaml.dump(out_dict, f, indent=4)
except TypeError:
print('Shit')

View File

@ -1,6 +1,6 @@
from typing import List
from environment.rules import Rule
from environment.utils.results import TickResult, DoneResult
from mfg_package.environment.rules import Rule
from mfg_package.utils.results import TickResult, DoneResult
class TemplateRule(Rule):

View File

@ -1,10 +1,10 @@
from typing import Union
from environment.actions import Action
from environment.utils.results import ActionResult
from mfg_package.environment.actions import Action
from mfg_package.utils.results import ActionResult
from modules.batteries import constants as b, rewards as r
from environment import constants as c
from mfg_package.modules.batteries import constants as b, rewards as r
from mfg_package.environment import constants as c
class BtryCharge(Action):

View File

@ -1,10 +1,10 @@
from environment.entity.mixin import BoundEntityMixin
from environment.entity.object import EnvObject
from environment.entity.entity import Entity
from environment import constants as c
from environment.utils.render import RenderEntity
from mfg_package.environment.entity.mixin import BoundEntityMixin
from mfg_package.environment.entity.object import EnvObject
from mfg_package.environment.entity.entity import Entity
from mfg_package.environment import constants as c
from mfg_package.utils.render import RenderEntity
from modules.batteries import constants as b
from mfg_package.modules.batteries import constants as b
class Battery(BoundEntityMixin, EnvObject):

View File

@ -1,6 +1,6 @@
from environment.groups.env_objects import EnvObjects
from environment.groups.mixins import PositionMixin, HasBoundedMixin
from modules.batteries.entitites import ChargePod, Battery
from mfg_package.environment.groups.env_objects import EnvObjects
from mfg_package.environment.groups.mixins import PositionMixin, HasBoundedMixin
from mfg_package.modules.batteries.entitites import ChargePod, Battery
class Batteries(HasBoundedMixin, EnvObjects):

View File

@ -1,9 +1,9 @@
from typing import List, Union
from environment.rules import Rule
from environment.utils.results import TickResult, DoneResult
from mfg_package.environment.rules import Rule
from mfg_package.utils.results import TickResult, DoneResult
from environment import constants as c
from modules.batteries import constants as b, rewards as r
from mfg_package.environment import constants as c
from mfg_package.modules.batteries import constants as b, rewards as r
class Btry(Rule):

View File

@ -1,11 +1,11 @@
from typing import Union
from environment.actions import Action
from environment.utils.results import ActionResult
from mfg_package.environment.actions import Action
from mfg_package.utils.results import ActionResult
from modules.clean_up import constants as d, rewards as r
from mfg_package.modules.clean_up import constants as d, rewards as r
from environment import constants as c
from mfg_package.environment import constants as c
class CleanUp(Action):

View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

@ -1,8 +1,8 @@
from numpy import random
from environment.entity.entity import Entity
from environment.utils.render import RenderEntity
from modules.clean_up import constants as d
from mfg_package.environment.entity.entity import Entity
from mfg_package.utils.render import RenderEntity
from mfg_package.modules.clean_up import constants as d
class DirtPile(Entity):

View File

@ -1,9 +1,9 @@
from environment.groups.env_objects import EnvObjects
from environment.groups.mixins import PositionMixin
from environment.entity.wall_floor import Floor
from modules.clean_up.entitites import DirtPile
from mfg_package.environment.groups.env_objects import EnvObjects
from mfg_package.environment.groups.mixins import PositionMixin
from mfg_package.environment.entity.wall_floor import Floor
from mfg_package.modules.clean_up.entitites import DirtPile
from environment import constants as c
from mfg_package.environment import constants as c
class DirtPiles(PositionMixin, EnvObjects):

View File

@ -1,7 +1,7 @@
from environment import constants as c
from environment.rules import Rule
from environment.utils.results import DoneResult
from modules.clean_up import constants as d, rewards as r
from mfg_package.environment import constants as c
from mfg_package.environment.rules import Rule
from mfg_package.utils.results import DoneResult
from mfg_package.modules.clean_up import constants as d, rewards as r
class DirtAllCleanDone(Rule):

View File

@ -1,7 +1,7 @@
from environment.rules import Rule
from environment.utils.results import TickResult
from mfg_package.environment.rules import Rule
from mfg_package.utils.results import TickResult
from modules.clean_up import constants as d
from mfg_package.modules.clean_up import constants as d
class DirtRespawnRule(Rule):

View File

@ -1,9 +1,9 @@
from environment.rules import Rule
from environment.utils.helpers import is_move
from environment.utils.results import TickResult
from mfg_package.environment.rules import Rule
from mfg_package.utils.helpers import is_move
from mfg_package.utils.results import TickResult
from environment import constants as c
from modules.clean_up import constants as d
from mfg_package.environment import constants as c
from mfg_package.modules.clean_up import constants as d
class DirtSmearOnMove(Rule):

View File

@ -1,10 +1,10 @@
from typing import Union
from environment.actions import Action
from environment.utils.results import ActionResult
from mfg_package.environment.actions import Action
from mfg_package.utils.results import ActionResult
from modules.destinations import constants as d, rewards as r
from environment import constants as c
from mfg_package.modules.destinations import constants as d, rewards as r
from mfg_package.environment import constants as c
class DestAction(Action):

View File

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

@ -1,10 +1,10 @@
from collections import defaultdict
from environment.entity.agent import Agent
from environment.entity.entity import Entity
from environment import constants as c
from environment.utils.render import RenderEntity
from modules.destinations import constants as d
from mfg_package.environment.entity.agent import Agent
from mfg_package.environment.entity.entity import Entity
from mfg_package.environment import constants as c
from mfg_package.utils.render import RenderEntity
from mfg_package.modules.destinations import constants as d
class Destination(Entity):

View File

@ -1,6 +1,6 @@
from environment.groups.env_objects import EnvObjects
from environment.groups.mixins import PositionMixin
from modules.destinations.entitites import Destination
from mfg_package.environment.groups.env_objects import EnvObjects
from mfg_package.environment.groups.mixins import PositionMixin
from mfg_package.modules.destinations.entitites import Destination
class Destinations(PositionMixin, EnvObjects):

View File

@ -1,10 +1,10 @@
from typing import List, Union
from environment.rules import Rule
from environment.utils.results import TickResult, DoneResult
from environment import constants as c
from mfg_package.environment.rules import Rule
from mfg_package.utils.results import TickResult, DoneResult
from mfg_package.environment import constants as c
from modules.destinations import constants as d, rewards as r
from modules.destinations.entitites import Destination
from mfg_package.modules.destinations import constants as d, rewards as r
from mfg_package.modules.destinations.entitites import Destination
class DestinationReach(Rule):

View File

@ -1,10 +1,10 @@
from typing import Union
from environment.actions import Action
from environment.utils.results import ActionResult
from mfg_package.environment.actions import Action
from mfg_package.utils.results import ActionResult
from modules.doors import constants as d, rewards as r
from environment import constants as c
from mfg_package.modules.doors import constants as d, rewards as r
from mfg_package.environment import constants as c
class DoorUse(Action):

View File

Before

Width:  |  Height:  |  Size: 699 B

After

Width:  |  Height:  |  Size: 699 B

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -1,8 +1,8 @@
from environment.entity.entity import Entity
from environment.utils.render import RenderEntity
from environment import constants as c
from mfg_package.environment.entity.entity import Entity
from mfg_package.utils.render import RenderEntity
from mfg_package.environment import constants as c
from modules.doors import constants as d
from mfg_package.modules.doors import constants as d
class DoorIndicator(Entity):

View File

@ -1,9 +1,9 @@
from typing import Union
from environment.groups.env_objects import EnvObjects
from environment.groups.mixins import PositionMixin
from modules.doors import constants as d
from modules.doors.entitites import Door
from mfg_package.environment.groups.env_objects import EnvObjects
from mfg_package.environment.groups.mixins import PositionMixin
from mfg_package.modules.doors import constants as d
from mfg_package.modules.doors.entitites import Door
class Doors(PositionMixin, EnvObjects):

View File

@ -1,7 +1,7 @@
from environment.rules import Rule
from environment import constants as c
from environment.utils.results import TickResult
from modules.doors import constants as d
from mfg_package.environment.rules import Rule
from mfg_package.environment import constants as c
from mfg_package.utils.results import TickResult
from mfg_package.modules.doors import constants as d
class DoorAutoClose(Rule):

View File

@ -1,10 +1,10 @@
from typing import Union
from environment.actions import Action
from environment.utils.results import ActionResult
from mfg_package.environment.actions import Action
from mfg_package.utils.results import ActionResult
from modules.items import constants as i, rewards as r
from environment import constants as c
from mfg_package.modules.items import constants as i, rewards as r
from mfg_package.environment import constants as c
class ItemAction(Action):

View File

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Some files were not shown because too many files have changed in this diff Show More