generated from rochacbruno/python-project-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
54 changed files
with
551 additions
and
339 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
from .machine import * | ||
from .workcenter import * | ||
from .utils.phase import * | ||
from .workcenter import WorkCenter, WorkCenterInput, from_cli as work_center_from_cli | ||
from .machine import Machine, MachineInput, from_cli as machine_from_cli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,15 @@ | ||
|
||
from .utils import Input as MachineInput | ||
from .machine import Machine | ||
from .machine import Machine | ||
from .static import StaticMachine | ||
|
||
|
||
key_to_class = { | ||
"static": StaticMachine | ||
} | ||
|
||
|
||
def from_cli(parameters) -> Machine: | ||
cls = key_to_class[parameters['kind']] | ||
|
||
return cls.from_cli(parameters['parameters']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,9 @@ | ||
|
||
from abc import ABCMeta | ||
from typing import TypeVar | ||
|
||
from agents.base.agent import Agent | ||
from .model import MachineModel | ||
from .state import StateEncoder | ||
|
||
MachineStateEncoder = TypeVar('MachineStateEncoder', bound=StateEncoder) | ||
Model = TypeVar('Model', bound=MachineModel) | ||
|
||
|
||
class Machine(Agent[MachineStateEncoder, Model], metaclass=ABCMeta): | ||
class Machine(Agent, metaclass=ABCMeta): | ||
|
||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
|
||
from .encoder import StateEncoder | ||
from .plain import PlainEncoder | ||
|
||
|
||
key_to_class = { | ||
"plain": PlainEncoder | ||
} | ||
|
||
|
||
def from_cli(parameters) -> StateEncoder: | ||
cls = key_to_class[parameters['kind']] | ||
|
||
return cls.from_cli(parameters.get('parameters', {})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
|
||
|
||
from .machine import Machine | ||
from .model import StaticMachineModel, SchedulingRule | ||
from .state import PlainEncoder | ||
from .model import MachineModel, from_cli as model_from_cli | ||
from .state import StateEncoder, from_cli as state_encoder_from_cli | ||
from typing import Dict | ||
|
||
|
||
class StaticMachine(Machine[StaticMachineModel, PlainEncoder]): | ||
class StaticMachine(Machine): | ||
|
||
def __init__(self, rule: SchedulingRule): | ||
super().__init__(model=StaticMachineModel(rule), state_encoder=PlainEncoder(), memory=None) | ||
def __init__(self, model: MachineModel, state_encoder: StateEncoder): | ||
super().__init__(model=model, state_encoder=state_encoder, memory=None) | ||
|
||
@property | ||
def is_trainable(self): | ||
return False | ||
|
||
def train_step(self): | ||
pass | ||
|
||
@staticmethod | ||
def from_cli(parameters: Dict): | ||
model = model_from_cli(parameters['model']) | ||
encoder = state_encoder_from_cli(parameters['encoder']) | ||
|
||
return StaticMachine(model=model, state_encoder=encoder) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,15 @@ | ||
|
||
from .utils import Input as WorkCenterInput | ||
from .work_center import WorkCenter | ||
from .work_center import WorkCenter | ||
from .static import StaticWorkCenter | ||
|
||
|
||
key_to_class = { | ||
"static": StaticWorkCenter | ||
} | ||
|
||
|
||
def from_cli(parameters) -> WorkCenter: | ||
cls = key_to_class[parameters['kind']] | ||
|
||
return cls.from_cli(parameters['parameters']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
from .model import WorkCenterModel | ||
from .static import StaticModel as StaticWorkCenterModel | ||
from .rule import RoutingRule | ||
|
||
key_to_class = { | ||
"static": StaticWorkCenterModel | ||
} | ||
|
||
|
||
def from_cli(parameters) -> WorkCenterModel: | ||
cls = key_to_class[parameters['kind']] | ||
|
||
return cls.from_cli(parameters['parameters']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|
||
from routing_rule import * | ||
from .routing_rule import * | ||
|
||
|
||
class CTRoutingRule(RoutingRule): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from routing_rule import * | ||
from .routing_rule import * | ||
|
||
|
||
class EARoutingRule(RoutingRule): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from routing_rule import * | ||
from .routing_rule import * | ||
|
||
|
||
class ETRoutingRule(RoutingRule): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from routing_rule import * | ||
from .routing_rule import * | ||
|
||
|
||
class RandomRoutingRule(RoutingRule): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from routing_rule import * | ||
from .routing_rule import * | ||
|
||
|
||
class SQRoutingRule(RoutingRule): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from routing_rule import * | ||
from .routing_rule import * | ||
|
||
|
||
class TTRoutingRule(RoutingRule): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from routing_rule import * | ||
from .routing_rule import * | ||
|
||
|
||
class UTRoutingRule(RoutingRule): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
from .plain import PlainEncoder | ||
from .encoder import StateEncoder | ||
from .plain import PlainEncoder | ||
|
||
|
||
key_to_class = { | ||
"plain": PlainEncoder | ||
} | ||
|
||
|
||
def from_cli(parameters) -> StateEncoder: | ||
cls = key_to_class[parameters['kind']] | ||
|
||
return cls.from_cli(parameters.get('parameters', {})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,27 @@ | ||
|
||
|
||
from .work_center import WorkCenter | ||
from .model import StaticWorkCenterModel, RoutingRule | ||
from .state import PlainEncoder | ||
from .model import StaticWorkCenterModel, from_cli as model_from_cli | ||
from .state import StateEncoder, from_cli as state_encoder_from_cli | ||
from typing import Dict | ||
|
||
|
||
class StaticMachine(WorkCenter[StaticWorkCenterModel, PlainEncoder]): | ||
class StaticWorkCenter(WorkCenter): | ||
|
||
def __init__(self, rule: RoutingRule): | ||
super().__init__(model=StaticWorkCenterModel(rule), state_encoder=PlainEncoder(), memory=None) | ||
def __init__(self, model: StaticWorkCenterModel, state_encoder: StateEncoder): | ||
super().__init__(model=model, state_encoder=state_encoder, memory=None) | ||
|
||
@property | ||
def is_trainable(self): | ||
return False | ||
|
||
def train_step(self): | ||
pass | ||
|
||
@staticmethod | ||
def from_cli(parameters: Dict): | ||
model = model_from_cli(parameters['model']) | ||
encoder = state_encoder_from_cli(parameters['encoder']) | ||
|
||
return StaticWorkCenter(model=model, state_encoder=encoder) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,8 @@ | ||
|
||
from abc import ABCMeta | ||
from typing import TypeVar | ||
|
||
from agents.base.agent import Agent | ||
from .model import WorkCenterModel | ||
from .state import StateEncoder | ||
|
||
WorkCenterStateEncoder = TypeVar('WorkCenterStateEncoder', bound=StateEncoder) | ||
Model = TypeVar('Model', bound=WorkCenterModel) | ||
|
||
|
||
class WorkCenter(Agent[WorkCenterStateEncoder, Model], metaclass=ABCMeta): | ||
|
||
class WorkCenter(Agent, metaclass=ABCMeta): | ||
pass |
Oops, something went wrong.