checked out action_shaping from dev branch

This commit is contained in:
kaiqli 2020-01-16 16:49:28 +08:00
Родитель c0df708f0a
Коммит b04aea8ebf
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -9,7 +9,6 @@ from typing import Tuple
from maro.simulator.scenarios.ecr.common import ActionScope
from maro.utils import Logger, LogFormat
class DiscreteActionShaping():
def __init__(self, action_space: [float]):
'''
@ -41,7 +40,11 @@ class DiscreteActionShaping():
return max(round(self._action_space[action_index] * port_empty), -vessel_remaining_space)
if action_index > self._zero_action_index:
return round(self._action_space[action_index] * scope.discharge)
plan_action = self._action_space[action_index] * (scope.discharge + early_discharge) - early_discharge
if plan_action > 0:
return round(plan_action)
else:
return round(self._action_space[action_index] * scope.discharge)
return 0