dacbench.abstract_benchmark

Module Contents

Classes

AbstractBenchmark

Abstract template for benchmark classes

objdict

Modified dict to make config changes more flexible

class dacbench.abstract_benchmark.AbstractBenchmark(config_path=None, config: dacbench.abstract_benchmark.objdict = None)

Abstract template for benchmark classes

get_config(self)

Return current configuration

Returns

Current config

Return type

dict

serialize_config(self)

Save configuration to json

Parameters

path (str) – File to save config to

process_configspace(self, configuration_space)

This is largely the builting cs.json.write method, but doesn’t save the result directly If this is ever implemented in cs, we can replace this method

classmethod from_json(cls, json_config)
to_json(self)
save_config(self, path)
jsonify_wrappers(self)
dejson_wrappers(self, wrapper_list)
static __import_from(module: str, name: str)

Imports the class / function / … with name from module :param module: :param name:

Returns

Return type

the imported object

classmethod class_to_str(cls)
static __decorate_config_with_functions(conf: dict)

Replaced the stringified functions with the callable objects :param config:

static __stringify_functions(conf: dict) dict

Replaced all callables in the config with a triple (‘function’, module_name, function_name)

Parameters

config

Returns

Return type

modified dict

space_to_list(self, space)
list_to_space(self, space_list)
jsonify_dict_space(self, dict_space)
dictify_json(self, dict_list)
load_config(self, config: dacbench.abstract_benchmark.objdict)
read_config_file(self, path)

Read configuration from file

Parameters

path (str) – Path to config file

abstract get_environment(self)

Make benchmark environment

Returns

env – Benchmark environment

Return type

gym.Env

set_seed(self, seed)

Set environment seed

Parameters

seed (int) – New seed

set_action_space(self, kind, args)

Change action space

Parameters
  • kind (str) – Name of action space class

  • args (list) – List of arguments to pass to action space class

set_observation_space(self, kind, args, data_type)

Change observation_space

Parameters
  • kind (str) – Name of observation space class

  • args (list) – List of arguments to pass to observation space class

  • data_type (type) – Data type of observation space

register_wrapper(self, wrap_func)
__eq__(self, other)

Return self==value.

class dacbench.abstract_benchmark.objdict

Bases: dict

Modified dict to make config changes more flexible

__getattr__(self, name)
__setattr__(self, name, value)

Implement setattr(self, name, value).

__delattr__(self, name)

Implement delattr(self, name).

copy(self)

D.copy() -> a shallow copy of D

__eq__(self, other)
return isinstance(other, dict) and set(other.keys()) == set(self.keys()) and all(

np.array_equal(self[key], other[key]) if any(isinstance(obj[key], np.ndarray) for obj in (self, other)) else other[key] == self[key]

for key in self.keys()

)

__ne__(self, other)

Return self!=value.