def create_animal(num_actors=1, inference=True, config=None, seed=None): from animalai.envs.gym.environment import AnimalAIEnv from animalai.envs.arena_config import ArenaConfig import random from animalai_wrapper import AnimalWrapper, AnimalStack, AnimalSkip env_path = 'AnimalAI' worker_id = random.randint(1, 60000) arena_config_in = ArenaConfig( BASE_DIR + '/configs/learning/stage4/3-Food Moving.yaml') if config is None: config = arena_config_in else: config = ArenaConfig(config) if seed is None: seed = 0 #random.randint(0, 100500) env = AnimalAIEnv(environment_filename=env_path, worker_id=worker_id, n_arenas=num_actors, seed=seed, arenas_configurations=config, greyscale=False, docker_training=False, inference=inference, retro=False, resolution=84) env = AnimalSkip(env, skip=SKIP_FRAMES) env = AnimalWrapper(env) env = AnimalStack(env, VISUAL_FRAMES_COUNT, VEL_FRAMES_COUNT, greyscale=USE_GREYSCALE_OBSES) return env
def test_reset_arena_config(mock_communicator, mock_launcher, mock_byte_channel, mock_yaml): mock_communicator.return_value = MockCommunicator(discrete_action=True, visual_inputs=0, num_agents=2, vec_obs_size=2) arena_config = ArenaConfig(" ") env = AnimalAIEnvironment( file_name=" ", n_arenas=2, arenas_configurations=arena_config, ) mock_byte_channel.assert_called_once() bytes_arg = bytes( arena_config.to_proto().SerializeToString(deterministic=True)) # we cannot call assert_called_with mock_byte_channel.assert_called_with(bytes_arg) batched_step_result = env.get_step_result("RealFakeBrain") spec = env.get_agent_group_spec("RealFakeBrain") env.close() assert isinstance(batched_step_result, BatchedStepResult) assert len(spec.observation_shapes) == len(batched_step_result.obs) n_agents = batched_step_result.n_agents() for shape, obs in zip(spec.observation_shapes, batched_step_result.obs): assert (n_agents, ) + shape == obs.shape
def create_env_fn(num_actors=1, inference = True, config=None, seed=None): env_path = '../env/AnimalAI' #worker_id = random.randint(1, 60000) # base arena (If nothing is defined!!) arena_config_in = ArenaConfig('configs/1-Food.yaml') if config is None: config = arena_config_in else: config = ArenaConfig(config) if seed is None: seed = 0#random.randint(0, 100500) def env(): worker_id = random.randint(1, 60000) env = AnimalAIEnv(environment_filename=env_path, worker_id=worker_id, n_arenas=num_actors, seed = seed, arenas_configurations=config, greyscale = False, docker_training=False, inference = inference, retro=False, resolution=84 ) env = AnimalSkip(env, skip=SKIP_FRAMES) env = AnimalWrapper(env) env = AnimalStack(env,VISUAL_FRAMES_COUNT, VEL_FRAMES_COUNT, greyscale=USE_GREYSCALE_OBSES) return env return env
def test_arena_config(mock_yaml): arena_config = ArenaConfig(" ") assert len(arena_config.arenas) == 3 arena_config_proto = arena_config.to_proto() assert len(arena_config_proto.arenas) == 3
def train(args=None): if args is None: args = sys.argv[1:] args = parse_args(args) # ML-agents parameters for training env_path = '../../../AnimalAI-Olympics/env/AnimalAI' worker_id = random.randint(1, 100) seed = 10 base_port = 5005 sub_id = 1 if args.verbose_id: run_id = '%s_%ienv_%iarenas' % ( os.path.basename(os.path.dirname(os.path.dirname(args.trainer_config_path))), args.n_envs, args.n_arenas) else: run_id = os.path.basename(os.path.dirname(os.path.dirname(args.trainer_config_path))) if args.suffix: run_id += '_%s' % args.suffix save_freq = args.save_freq curriculum_file = None train_model = True keep_checkpoints = args.keep_checkpoints lesson = 0 run_seed = 1 docker_target_name = None no_graphics = False # model_path = '%s/%s' % (os.path.dirname(args.trainer_config_path), run_id) model_path = './models/%s' % (run_id) summaries_dir = './summaries' maybe_meta_curriculum = None if os.path.isdir(args.arena_config): arena_config_paths = glob.glob(os.path.join(args.arena_config, '*.yaml')) arena_config_in = [ArenaConfig(arena_config_path) for arena_config_path in tqdm(arena_config_paths, desc='loading arenas config')] else: arena_config_in = ArenaConfig(args.arena_config) trainer_config = load_config(args.trainer_config_path) trainer_config['Learner']['reset_steps'] = args.reset_steps if args.n_envs > 1: env_factory = partial( init_environment, docker_target_name=docker_target_name, no_graphics=no_graphics, env_path=env_path, n_arenas=args.n_arenas, trainer_config=trainer_config) env = SubprocessUnityEnvironment(env_factory, args.n_envs) else: env = init_environment(worker_id, env_path, docker_target_name, no_graphics, n_arenas=args.n_arenas, trainer_config=trainer_config) env.reset(arena_config_in) time.sleep(1) t0 = time.time() for _ in tqdm(range(2000)): env.step(np.random.randint(0, 3, size=(args.n_envs*args.n_arenas, 2))) print('Elapsed time: %.2f' % (time.time() - t0)) env.close()
def create_death_zone_arena_config(n_arenas=16, t=250): arena_config = ArenaConfig() for i in range(n_arenas): # サイズを指定: オリジナルは(1,0,1) - (40,0,40) sx = np.random.randint(1, 35) # 1~34まで sz = np.random.randint(1, 35) # 1~34まで size = Vector3(x=sx, y=0, z=sz) arena = create_death_zone_arena(size, t) arena_config.arenas[i] = arena return arena_config
def main(): parser = argparse.ArgumentParser() parser.add_argument("--seed", type=int, default=0) parser.add_argument("--step_size", help="Training step size", type=int, default=300000) # 以前は150000 args = parser.parse_args() step_size = args.step_size model_path = './models/run_lidar0/Leaner/' arena_config_path = './configs/lidar/obstacle-w-t-wt-tt-cb-ulo-rm.yaml' trainer_config_path = './configs/lidar/trainer_config_lidar.yaml' env_path = '../env/AnimalAIScan' agent = init_agent(trainer_config_path, model_path) env = init_env(env_path, args.seed) arena_config_in = ArenaConfig(arena_config_path) agent.reset(t=arena_config_in.arenas[0].t) env.reset(arenas_configurations=arena_config_in) collect(env, agent, step_size) generate(step_size)
def __init__(self, args, rank=0, save_img=False): self.total_step = 0 self.rank = rank self.img = [] self.save_img = save_img self.args = args self.grid = 3 self.env_path = '../env/AnimalAI' self.worker_id = random.randint(1, 100) self.arena_config_in = ArenaConfig('configs/3-Obstacles_my.yaml') self.base_dir = 'models/dopamine' self.gin_files = ['configs/rainbow.gin'] self.env = self.create_env_fn() self.previous_velocity = [1, 1] self.observation_space = self.env.observation_space self.theta = 3.1415926 / 2 self.pi = 3.1415926 self.rotation = 40 self.convex_hull = None self.points = [np.array([0, 0])] self.point = np.array([0, 0]) self.turned = 0 self.velocity = { 0: [1, 0], 1: [-1, 0], 2: [0, 1], 3: [0, -1], 4: [0.7, 0.7], 5: [-0.7, 0.7], 6: [-0.7, -0.7], 7: [0.7, -0.7], }
def main(): arenas_configurations = ArenaConfig( "configurations/arena_configurations/train_ml_agents_arenas.yml") env = AnimalAIGym( environment_filename="env/AnimalAI", worker_id=0, flatten_branched=True, uint8_visual=True, arenas_configurations=arenas_configurations, ) logger.configure("./logs") # Çhange to log in a different directory act = deepq.learn( env, "cnn", # conv_only is also a good choice for GridWorld lr=2.5e-4, total_timesteps=1000000, buffer_size=50000, exploration_fraction=0.05, exploration_final_eps=0.1, print_freq=20, train_freq=5, learning_starts=20000, target_network_update_freq=50, gamma=0.99, prioritized_replay=False, checkpoint_freq=1000, checkpoint_path= "./logs", # Change to save model in a different directory dueling=True, ) print("Saving model to unity_model.pkl") act.save("unity_model.pkl")
def main(): parser = argparse.ArgumentParser() parser.add_argument("--seed", type=int, default=0) parser.add_argument("--step_size", help="Training step size", type=int, default=150000) args = parser.parse_args() step_size = args.step_size model_path = './models/run_005/Learner' arena_config_path = './configs/3-Obstacles-short.yaml' trainer_config_path = './configs/trainer_config.yaml' env_path = '../env/AnimalAICustom' agent = init_agent(trainer_config_path, model_path) env = init_env(env_path, args.seed) arena_config_in = ArenaConfig(arena_config_path) agent.reset(t=arena_config_in.arenas[0].t) env.reset(arenas_configurations=arena_config_in) collect(env, agent, step_size) generate(step_size)
def load_config_and_play(configuration_file: str) -> None: """ Loads a configuration file for a single arena and lets you play manually :param configuration_file: str path to the yaml configuration :return: None """ env_path = "env/AnimalAI" port = 5005 + random.randint( 0, 100) # use a random port to allow relaunching the script rapidly configuration = ArenaConfig(configuration_file) environment = AnimalAIEnvironment( file_name=env_path, base_port=port, arenas_configurations=configuration, play=True, ) try: while environment.proc1: continue except KeyboardInterrupt: pass finally: environment.close()
def create_env_fn(): env = AnimalAIEnv(environment_filename=ENV_PATH, worker_id=WORKER_ID, n_arenas=1, arenas_configurations=ArenaConfig(args.arena_config), docker_training=False, retro=False) return env
def __init__(self, location, yaml_files): """ Initializes a Curriculum object. :param location: Path to JSON defining curriculum. :param yaml_files: A list of configuration files for each lesson """ self.max_lesson_num = 0 self.measure = None self._lesson_num = 0 # The name of the brain should be the basename of the file without the # extension. self._brain_name = os.path.basename(location).split('.')[0] try: with open(location) as data_file: self.data = json.load(data_file) except IOError: raise CurriculumError( 'The file {0} could not be found.'.format(location)) except UnicodeDecodeError: raise CurriculumError( 'There was an error decoding {}'.format(location)) self.smoothing_value = 0 for key in [ 'configuration_files', 'measure', 'thresholds', 'min_lesson_length', 'signal_smoothing' ]: if key not in self.data: raise CurriculumError("{0} does not contain a " "{1} field.".format(location, key)) self.smoothing_value = 0 self.measure = self.data['measure'] self.min_lesson_length = self.data['min_lesson_length'] self.max_lesson_num = len(self.data['thresholds']) configuration_files = self.data['configuration_files'] # for key in configuration_files: # if key not in default_reset_parameters: # raise CurriculumError( # 'The parameter {0} in Curriculum {1} is not present in ' # 'the Environment'.format(key, location)) if len(configuration_files) != self.max_lesson_num + 1: raise CurriculumError( 'The parameter {0} in Curriculum {1} must have {2} values ' 'but {3} were found'.format(key, location, self.max_lesson_num + 1, len(configuration_files))) folder = os.path.dirname(location) folder_yaml_files = os.listdir(folder) if not all([file in folder_yaml_files for file in configuration_files]): raise Curriculum( 'One or more configuration file(s) in curriculum {0} could not be found' .format(location)) self.configurations = [ ArenaConfig(os.path.join(folder, file)) for file in configuration_files ]
def main(): # Load the agent from the submission print('Loading your agent') try: spec = importlib.util.spec_from_file_location('agent_module', '/aaio/agent.py') agent_module = importlib.util.module_from_spec(spec) spec.loader.exec_module(agent_module) submitted_agent = agent_module.Agent() except Exception as e: print( 'Your agent could not be loaded, make sure all the paths are absolute, error thrown:' ) raise e print('Agent successfully loaded') arena_config_in = ArenaConfig('/aaio/test/1-Food.yaml') print('Resetting your agent') try: submitted_agent.reset(t=arena_config_in.arenas[0].t) except Exception as e: print('Your agent could not be reset:') raise e env = AnimalAIEnv( environment_filename='/aaio/test/env/AnimalAI', # seed=0, retro=False, n_arenas=1, worker_id=1, docker_training=True, ) env.reset(arenas_configurations=arena_config_in) obs, reward, done, info = env.step([0, 0]) print('Running 5 episodes') for k in range(5): cumulated_reward = 0 print('Episode {} starting'.format(k)) try: for i in range(arena_config_in.arenas[0].t): action = submitted_agent.step(obs, reward, done, info) obs, reward, done, info = env.step(action) cumulated_reward += reward if done: break except Exception as e: print('Episode {} failed'.format(k)) raise e print('Episode {0} completed, reward {1}'.format(k, cumulated_reward)) print('SUCCESS')
def main(): arenas_configurations = ArenaConfig( "configurations/arena_configurations/train_ml_agents_arenas.yml") env = make_aai_env("env/AnimalAI", 2, arenas_configurations) ppo2.learn( network="cnn", env=env, total_timesteps=100000, lr=1e-3, )
def __init__(self, run_id, trainer_config_path, arena_config_path, num_agents, new_model=False, watch=False, curriculum_type=None): self.run_id = run_id self.trainer_config = self.load_config(trainer_config_path) self.arena_config = ArenaConfig(arena_config_path) self.load_model = not new_model self.watch = watch self.number_arenas = 1 if watch else num_agents self.maybe_meta_curriculum = None if curriculum_type is None else MetaCurriculum(f'./configs/curriculums/{curriculum_type}/') self.model_path = f'./models/{run_id}'
def __init__(self, brain_name: str, curriculum_file: str): """ Initializes a Curriculum object. :param brain_name: Name of the brain this Curriculum is associated with :param config: Dictionary of fields needed to configure the Curriculum """ self.max_lesson_num = 0 self.measure = None self._lesson_num = 0 self.brain_name = brain_name try: with open(curriculum_file) as data_file: self.config = json.load(data_file) except IOError: raise CurriculumError( "The file {0} could not be found.".format(curriculum_file)) self.smoothing_value = 0.0 for key in [ "configuration_files", "measure", "thresholds", "min_lesson_length", "signal_smoothing", ]: if key not in self.config: raise CurriculumConfigError( f"{brain_name} curriculum config does not contain a {key} field." ) self.smoothing_value = 0 self.measure = self.config["measure"] self.min_lesson_length = self.config["min_lesson_length"] self.max_lesson_num = len(self.config["thresholds"]) configuration_files = self.config["configuration_files"] if len(configuration_files) != self.max_lesson_num + 1: raise CurriculumError( "The parameter {0} in the Curriculum must have {1} values " "but {2} were found".format(key, self.max_lesson_num + 1, len(configuration_files))) folder = os.path.dirname(curriculum_file) folder_yaml_files = os.listdir(folder) if not all([file in folder_yaml_files for file in configuration_files]): raise CurriculumError( "One or more configuration file(s) in the curriculum could not be found" ) self.configurations = [ ArenaConfig(os.path.join(folder, file)) for file in configuration_files ]
def reset(self, arenas_configurations: ArenaConfig = None) -> None: if arenas_configurations: arenas_configurations_proto = arenas_configurations.to_proto() arenas_configurations_proto_string = arenas_configurations_proto.SerializeToString( deterministic=True) self.arenas_parameters_side_channel.send_raw_data( bytearray(arenas_configurations_proto_string)) try: super().reset() except UnityTimeOutException as timeoutException: if self.play: pass else: raise timeoutException
def main(): model_path = './models/run_005/Learner' arena_config_path = './configs/3-Obstacles-short.yaml' trainer_config_path = './configs/trainer_config.yaml' env_path = '../env/AnimalAICustom' agent = init_agent(trainer_config_path, model_path) seed = 0 env = init_env(env_path, seed) arena_config_in = ArenaConfig(arena_config_path) agent.reset(t=arena_config_in.arenas[0].t) env.reset(arenas_configurations=arena_config_in) collect(env, agent, 1000)
def create_death_zone_arena(size, t): arena_config = ArenaConfig() # Put green reward item_goal = Item(name="GoodGoal", positions=None, rotations=None, sizes=[Vector3(x=1, y=1, z=1)], colors=None) # Put Death Zone item_death_zone = Item(name="DeathZone", positions=None, rotations=None, sizes=[size], colors=None) items = [] items.append(item_goal) items.append(item_death_zone) arena = Arena(t=t, items=items, blackouts=None) return arena
def load_config_and_play(configurations: List[str]) -> None: """ Loads a configuration file for a single arena and lets you play manually :param configuration_file: str path to the yaml configuration :return: None """ env_path = "env/AnimalAI" # for configuration in configurations: port = 5005 + random.randint(0, 10) new_configurations = [] for conf in configurations: with open(conf, 'r') as f: if 'Cardbox' in f.read(): new_configurations.append(conf) # for cat in range(10,11): # for exp in range(18,31): for configuration in new_configurations: try: port += random.randint( 0, 10 ) # use a random port to allow relaunching the script rapidly # configuration = ArenaConfig(configuration_file) competition_folder = "../competition_configurations/" # configuration = competition_folder+f'{cat}-{exp}-1.yml' environment = AnimalAIEnvironment( file_name=env_path, base_port=port, arenas_configurations=ArenaConfig(configuration), play=True, ) # print(f'{cat}-{exp}-1.yml') print(configuration) input() environment.close() except AttributeError: pass
def _create_environment(config_filepath): worker_id = 0 while worker_id < 10: try: env = UnityEnvironment( file_name=ENVIRONMENT_FILEPATH, # Path to the environment worker_id= worker_id, # Unique ID for running the environment (used for connection) seed=int(os.getenv('ENV_SEED', 0)), # The random seed docker_training= False, # Whether or not you are training inside a docker n_arenas=1, # Number of arenas in your environment play=False, # Set to False for training inference=False, # Set to true to watch your agent in action resolution= None # Int: resolution of the agent's square camera (in [4,512], default 84) ) break except UnityWorkerInUseException: worker_id += 1 print('Increasing worker_id: %i' % worker_id) arena_config = ArenaConfig(config_filepath) env.reset(arenas_configurations=arena_config, train_mode=True) return env, arena_config
def generate_arena_config(t, n): """ Creates an ArenaConfig object Parameters ---------- t : int Max number of steps on the level n : int Controls the size of the generated arena, the bigger n the bigger the number of arenas """ _summarize_funcs_weights() arena_config = ArenaConfig() _add_arenas_using_functions_and_weights(arena_config, FOOD_FUNC_WEIGHTS, t, n) _add_arenas_using_functions_and_weights(arena_config, PREFERENCES_FUNC_WEIGHTS, t, n) _add_arenas_using_functions_and_weights(arena_config, OBSTACLES_FUNC_WEIGHTS, t, n) _add_arenas_using_functions_and_weights(arena_config, AVOIDANCE_FUNC_WEIGHTS, t, n) _add_arenas_using_functions_and_weights(arena_config, SPATIAL_REASONING_FUNC_WEIGHTS, t, n) _add_arenas_using_functions_and_weights(arena_config, GENERALIZATION_FUNC_WEIGHTS, t, n, remove_color=True) _add_arenas_using_functions_and_weights(arena_config, INTERNAL_MODELS_FUNC_WEIGHTS, t, n, add_blackouts=True) _shuffle_arenas(arena_config) return arena_config
def main(args): docker_training = docker_target_name is not None env = UnityEnvironment( n_arenas=args.n_arenas, file_name=env_path, worker_id=worker_id, seed=seed, docker_training=docker_training, play=False, resolution=resolution ) arena_config_in = ArenaConfig('configs/3-Obstacles.yaml') env.reset(arenas_configurations=arena_config_in) start_time = time.time() for i in range(args.frames): res = env.step(np.random.randint(0, 3, size=2 * args.n_arenas)) elapsed_time = time.time() - start_time fps = float(args.frames) / elapsed_time print("n_arenas={0}, fps={1:.3f}".format(args.n_arenas, fps)) env.close()
from animalai.envs.gym.environment import AnimalAIEnv from animalai.envs.arena_config import ArenaConfig import numpy as np import random import cv2 env_path = '../env/AnimalAI' worker_id = random.randint(1, 100) arena_config_in = ArenaConfig('ordered_configs/avoid_red/1-25-1.yml') env = AnimalAIEnv(environment_filename=env_path, worker_id=worker_id, n_arenas=1, arenas_configurations=arena_config_in, docker_training=False, retro=False) done = False number_of_episodes = 10 i = 0 SKIPPED_FRAMES = 10 state = env.reset() print(state[0].shape) print(state[0].ndim) print(env.action_space.sample()) numpy_image = state[0] * 255 numpy_image = numpy_image.astype('uint8') cv_image = cv2.cvtColor(numpy_image, cv2.COLOR_BGR2RGB) resized = cv2.resize(cv_image, (300, 300), interpolation = cv2.INTER_AREA) cv2.imwrite('kk.png', resized)
.replace('.x86', '')) docker_training = docker_target_name is not None return UnityEnvironment( n_arenas=1, file_name=env_path, worker_id=worker_id, seed=seed, docker_training=docker_training, play=True ) # If no configuration file is provided we default to all objects placed randomly if len(sys.argv) > 1: arena_config_in = ArenaConfig(sys.argv[1]) else: arena_config_in = ArenaConfig('configs/allObjectsRandom.yaml') arena_config_in.shuffle_arenas() env = init_environment(env_path, docker_target_name, no_graphics, worker_id, run_seed) # We can pass a different configuration at each env.reset() call. You can therefore load different YAML files between # episodes or directly amend the arena_config_in which contains a dictionary of configurations for all arenas. # See animalai/envs/arena_config.py for the syntax env.reset(arenas_configurations =arena_config_in) try: while True: continue except KeyboardInterrupt: env.close()
from animalai.envs.gym.environment import AnimalAIEnv from animalai.envs.arena_config import ArenaConfig from dopamine.agents.rainbow import rainbow_agent from dopamine.discrete_domains import run_experiment import random env_path = '../env/AnimalAI' worker_id = random.randint(1, 100) arena_config_in = ArenaConfig('configs/arenas/baseline_arena.yaml') base_dir = 'models/dopamine' watch = False def create_env_fn(): env = AnimalAIEnv(environment_filename=env_path, worker_id=worker_id, n_arenas=1, arenas_configurations=arena_config_in, docker_training=False, retro=True, inference=watch) return env def create_agent_fn(sess, env, summary_writer): return rainbow_agent.RainbowAgent(sess=sess, num_actions=env.action_space.n, summary_writer=summary_writer)
import gym from animalai.envs.gym.environment import AnimalAIEnv from animalai.envs.arena_config import ArenaConfig from stable_baselines.common.policies import MlpPolicy from stable_baselines.common.vec_env import DummyVecEnv from stable_baselines.common import make_vec_env from stable_baselines import PPO2 import random env_path = '../env/AnimalAI' worker_id = random.randint(1, 100) arena_config_in = ArenaConfig('configs/1-Food.yaml') def create_env_fn(): env = AnimalAIEnv(environment_filename=env_path, worker_id=worker_id, n_arenas=1, arenas_configurations=arena_config_in, docker_training=False, retro=True) return env env = make_vec_env(create_env_fn, n_envs=1) model = PPO2(MlpPolicy, env, verbose=0) model.learn(total_timesteps=int(1e6)) print('\n\n\n\nDone learning!\n\n\n\n') model.save("ppo_v0.0")
.replace('.app', '') .replace('.exe', '') .replace('.x86_64', '') .replace('.x86', '')) docker_training = docker_target_name is not None env = UnityEnvironment( n_arenas=n_arenas, file_name=env_path, worker_id=worker_id, seed=seed, docker_training=docker_training, play=False ) arena_config_in = ArenaConfig('configs/lightsOff.yaml') env.reset(arenas_configurations_input=arena_config_in) fig, axes = plt.subplots(2, 2) imshows = [] for i in range(2): for j in range(2): axes[i, j].set_title('Arena ' + str(i * 2 + j)) axes[i, j].axis('off') imshows.append(axes[i, j].imshow(np.zeros((84, 84, 3)))) def initialize_animation(): for i in range(4): imshows[i].set_data(np.zeros((84, 84, 3)))
'.exe', '').replace('.x86_64', '').replace('.x86', '')) docker_training = docker_target_name is not None return UnityEnvironment( n_arenas=4, file_name=env_path, worker_id=worker_id, seed=seed, docker_training=docker_training, play=True, ) # If no configuration file is provided we default to all objects placed randomly if len(sys.argv) > 1: arena_config_in = ArenaConfig(sys.argv[1]) else: arena_config_in = ArenaConfig('configs/7-InternalMemory.yaml') env = init_environment(env_path, docker_target_name, no_graphics, worker_id, run_seed) # We can pass a different configuration at each env.reset() call. You can therefore load different YAML files between # episodes or directly amend the arena_config_in which contains a dictionary of configurations for all arenas. # See animalai/envs/arena_config.py for the syntax env.reset(arenas_configurations=arena_config_in) try: while True: print("x" * 20) print(env._get_state())