Commit 79edf57b authored by nilabha's avatar nilabha

Changes to save experiences for new flatland vesion, path changes,..

parent d1d6519d
......@@ -31,6 +31,11 @@ from ray.rllib.offline.json_writer import JsonWriter
imitate = True
## Legacy Code for the correct expert actions
# change below line in method malfunction_from_file in the file flatland.envs.malfunction_generators.py
# mean_malfunction_rate = 1/oMPD.malfunction_rate
def main(args):
try:
opts, args = getopt.getopt(args, "", ["sleep-for-animation=", ""])
......@@ -57,7 +62,7 @@ def main(args):
max_depth = 30
tree_depth = 2
trial_start = 100
n_trials = 898
n_trials = 999
start = 0
columns = ['Agents', 'X_DIM', 'Y_DIM', 'TRIAL_NO',
......@@ -67,11 +72,11 @@ def main(args):
for trials in range(trial_start, n_trials + 1):
env_file = f"/Users/flaurent/Sites/flatland/flatland-neurips/envs-100-999/envs/Level_{trials}.pkl"
env_file = f"envs-100-999/envs/Level_{trials}.pkl"
# env_file = f"../env_configs/test-envs-small/Test_0/Level_{trials}.mpk"
# file = f"../env_configs/actions-small/Test_0/Level_{trials}.mpk"
file = f"/Users/flaurent/Sites/flatland/flatland-neurips/envs-100-999/actions/envs/Level_{trials}.json"
file = f"envs-100-999/actions/envs/Level_{trials}.json"
if not os.path.isfile(env_file) or not os.path.isfile(file):
print("Missing file!", env_file, file)
......
......@@ -26,7 +26,7 @@ from flatland.envs.schedule_generators import schedule_from_file
from flatland.envs.agent_utils import RailAgentStatus
from observation_utils import normalize_observation # noqa
from utils.observation_utils import normalize_observation # noqa
# from gen_envs import *
import json
......@@ -37,15 +37,20 @@ from ray.rllib.offline.json_writer import JsonWriter
from tensorflow.python.framework.ops import enable_eager_execution
enable_eager_execution()
parser = argparse.ArgumentParser(description="Approximate digits of Pi using Monte Carlo simulation.")
parser = argparse.ArgumentParser(description="Flatland Saving Experiences Parallel.")
parser.add_argument("--single", default=False, action="store_true")
parser.add_argument("--visual", default=False, action="store_true")
parser.add_argument("--globalobs", default=False, action="store_true")
extract = False
## Legacy Code for the correct expert actions
# change below line in method malfunction_from_file in the file flatland.envs.malfunction_generators.py
# mean_malfunction_rate = 1/oMPD.malfunction_rate
extract = True
if extract:
env_path = "medium2-100.tgz"
env_path = "envs-100-999.tgz"
env_names = env_path.split(".")[0]
if not os.path.isdir(env_names):
......@@ -120,9 +125,9 @@ def preprocess_obs(obs):
def generate_experiences(trials,start=0, tree_depth=2, max_depth = 30,obs_type = "tree",batch_builder = None, writer=None):
# env_file = f"/Users/flaurent/Sites/flatland/flatland-neurips/envs-100-999/envs/Level_{trials}.pkl"
env_file = f"envs-100-999/envs/Level_{trials}.pkl"
env_file = f"../env_configs/test-envs-small/Test_0/Level_{trials}.mpk"
# env_file = f"../env_configs/test-envs-small/Test_0/Level_{trials}.mpk"
pad_name = False
if pad_name:
......@@ -133,8 +138,8 @@ def generate_experiences(trials,start=0, tree_depth=2, max_depth = 30,obs_type =
# env_file = f"./{env_names}/envs/Level_{trials}.pkl"
file = f"../env_configs/actions-small/Test_0/Level_{trials}.mpk"
# file = f"/Users/flaurent/Sites/flatland/flatland-neurips/envs-100-999/actions/envs/Level_{trials}.json"
# file = f"../env_configs/actions-small/Test_0/Level_{trials}.mpk"
file = f"envs-100-999/actions/envs/Level_{trials}.json"
# file = f"./{env_names}/actions/envs/Level_{trials}.json"
if not os.path.isfile(env_file) or not os.path.isfile(file):
......@@ -349,8 +354,8 @@ def main():
max_depth = 30
tree_depth = 2
trial_start = 0
n_trials = 97
trial_start = 100
n_trials = 999
start = 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment