Skip to content

Commit

Permalink
multiple days
Browse files Browse the repository at this point in the history
  • Loading branch information
AnastasiaPsarou committed Nov 18, 2024
1 parent daed035 commit fc88c55
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
8 changes: 5 additions & 3 deletions RouteRL/environment/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ def __init__(self,
self.phase_names = self.training_params[kc.PHASE_NAMES]
self.frequent_progressbar = self.training_params[kc.FREQUENT_PROGRESSBAR_UPDATE]
self.remember_every = self.training_params[kc.REMEMBER_EVERY]

self.number_of_days = environment_params[kc.NUMBER_OF_DAYS]

""" recorder attributes """
self.remember_episodes = [ep for ep in range(self.remember_every, self.num_episodes+1, self.remember_every)]
Expand Down Expand Up @@ -233,11 +235,11 @@ def step(self, machine_action: int = None) -> None:

# The episode ends when we complete episode_length days
self.truncations = {
agent: True for agent in self.agents
agent: not (self.day % self.number_of_days) for agent in self.agents
}

self.terminations = {
agent: True for agent in self.agents
agent: not (self.day % self.number_of_days) for agent in self.agents
}

self.info = {
Expand Down
1 change: 1 addition & 0 deletions RouteRL/keychain.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class Keychain:
FREQUENT_PROGRESSBAR_UPDATE = "frequent_progressbar_update"

### Environment
NUMBER_OF_DAYS = "number_of_days"

### Simulator
SUMO_TYPE = "sumo_type"
Expand Down
3 changes: 2 additions & 1 deletion tutorials/MLinPL/params.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@

"environment_parameters":
{
"action_space_size" : "${path_generation_parameters.number_of_paths}"
"action_space_size" : "${path_generation_parameters.number_of_paths}",
"number_of_days" : 1
},


Expand Down
3 changes: 2 additions & 1 deletion tutorials/MarlAlgorithms/params.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@

"environment_parameters":
{
"action_space_size" : "${path_generation_parameters.number_of_paths}"
"action_space_size" : "${path_generation_parameters.number_of_paths}",
"number_of_days" : 1
},


Expand Down
3 changes: 2 additions & 1 deletion tutorials/PettingZooEnv/params_main.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@

"environment_parameters":
{
"action_space_size" : "${path_generation_parameters.number_of_paths}"
"action_space_size" : "${path_generation_parameters.number_of_paths}",
"number_of_days" : 1
},


Expand Down

0 comments on commit fc88c55

Please sign in to comment.