Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

str() and repr() of DecisionEvent and Action added; notebook output u… #74

Merged
merged 1 commit into from
Sep 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions maro/simulator/scenarios/cim/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def __repr__(self):
return self.__str__()

def __str__(self):
return f'Action {{quantity: {self.quantity}, port: {self.port_idx}, vessel: {self.vessel_idx} }}'
return f'Action(port_idx={self.port_idx}, vessel_idx={self.vessel_idx}, quantity={self.quantity})'


class ActionScope:
Expand All @@ -115,7 +115,7 @@ def __repr__(self):
return self.__str__()

def __str__(self):
return f'ActionScope {{load: {self.load}, discharge: {self.discharge} }}'
return f'ActionScope(load={self.load}, discharge={self.discharge})'


class DecisionEvent:
Expand Down
8 changes: 7 additions & 1 deletion maro/simulator/scenarios/citi_bike/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __getstate__(self):
"action_scope": self.action_scope}

def __repr__(self):
return f"decision event {self.__getstate__()}"
return self.__str__()

def __str__(self):
return f'DecisionEvent(tick={self.tick}, station_idx={self.station_idx}, type={self.type}, action_scope={self.action_scope})'
Expand All @@ -63,6 +63,12 @@ def __init__(self, from_station_idx: int, to_station_idx: int, number: int):
self.to_station_idx = to_station_idx
self.number = number

def __repr__(self):
return self.__str__()

def __str__(self):
return f'Action(from_station_idx={self.from_station_idx}, to_station_idx={self.to_station_idx}, number={self.number})'


class ExtraCostMode(Enum):
Source = "source"
Expand Down
48 changes: 0 additions & 48 deletions maro/simulator/scenarios/citi_bike/topologies/train/config.yml

This file was deleted.

6 changes: 5 additions & 1 deletion maro/simulator/utils/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ def get_scenarios()->List[str]:
"""
try:
_, scenarios, _ = next(os.walk(scenarios_root_folder))
scenarios = sorted([s for s in scenarios if not s.startswith("__")])

except StopIteration:
return []

return [s for s in scenarios if not s.startswith("__")]
return scenarios

def get_topologies(scenario: str)-> List[str]:
"""Get topology list of built-in scenario
Expand All @@ -57,6 +59,8 @@ def get_topologies(scenario: str)-> List[str]:

try:
_, topologies, _ = next(os.walk(scenario_topology_root))
topologies = sorted(topologies)

except StopIteration:
return []

Expand Down
223 changes: 122 additions & 101 deletions notebooks/bike_repositioning/interact_with_simulator.ipynb

Large diffs are not rendered by default.

267 changes: 0 additions & 267 deletions notebooks/container_inventory_management/ECR_tutorial.ipynb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
]
},
{
"cell_type": "raw",
"cell_type": "markdown",
"metadata": {},
"source": [
"# Experience Shaper\n",
Expand Down
Loading