def create( height, width, mean, cov, scheme = 'none', count = 20, *args ): """ @spec - Specification (size, endpoints, barriers); either exactly specified in a file, or with numeric values in a list @option_scheme - none|manual|optimal|small-world|random|ozgur's betweenness|ozgur's randomness|2-small-world|end @n_actions - Number of steps that need to taken comment : optimal(shortest path to destination)??|random|ozgur's betweenness|ozgur's randomness """ env = Mineworld.create(height, width, mean, cov) # Percentage if isinstance(count,str): count = int(count[:-1]) count = count*env.S/100 # Add options for all the optimal states O = [] if scheme == "none": pass elif scheme == "random-node": O = OptionGenerator.optimal_options_from_random_nodes( env, count, *args ) elif scheme == "random-path": O = OptionGenerator.optimal_options_from_random_paths( env, count, *args ) elif scheme == "betweenness": O = OptionGenerator.optimal_options_from_betweenness( env, count, *args ) elif scheme == "small-world": O = OptionGenerator.optimal_options_from_small_world( env, count, *args ) elif scheme == "ultra-small-world": O = OptionGenerator.optimal_options_from_ultra_small_world( env, count, *args ) elif scheme == "2-small-world": #Actually adds twice count percent options O = OptionGenerator.optimal_options_from_small_world( env, count, *args ) O += OptionGenerator.optimal_options_from_small_world( env, count, *args ) elif scheme == "betweenness+small-world": O = OptionEnvironment.optimal_options_from_betweenness( env, count ) count_ = count - len( O ) O += OptionEnvironment.optimal_options_from_small_world( env, count_, *args ) elif scheme == "load": O = OptionGenerator.options_from_file( *args )[:count] else: raise NotImplemented() return OptionEnvironment( MineworldOptions, env.S, env.A, env.P, env.R, env.R_bias, env.start_set, env.end_set, O )
def reset_rewards( env, height, width, mean, cov, scheme = 'none', count = 20, *args): O = env.O env = Mineworld.reset_rewards( env, height, width, mean, cov) return OptionEnvironment( MineworldOptions, env.S, env.A, env.P, env.R, env.R_bias, env.start_set, env.end_set, O )