sustaindc_env module¶
- class sustaindc_env.EnvConfig(raw_config)[source]¶
Bases:
dict
- DEFAULT_CONFIG = {'actions_are_logits': False, 'agents': ['agent_ls', 'agent_dc', 'agent_bat'], 'bat_reward': 'default_bat_reward', 'cintensity_file': 'NYIS_NG_&_avgCI.csv', 'datacenter_capacity_mw': 1, 'days_per_episode': 30, 'dc_config_file': 'dc_config.json', 'dc_reward': 'default_dc_reward', 'evaluation': False, 'flexible_load': 0.1, 'individual_reward_weight': 0.8, 'location': 'ny', 'ls_reward': 'default_ls_reward', 'max_bat_cap_Mw': 2, 'timezone_shift': 0, 'weather_file': 'USA_NY_New.York-Kennedy.epw', 'workload_file': 'Alibaba_CPU_Data_Hourly_1.csv'}¶
- class sustaindc_env.SustainDC(env_config)[source]¶
Bases:
Env
- calculate_reward(params)[source]¶
Calculate the individual reward for each agent.
- Parameters:
params (dict) – Dictionary of parameters to calculate the reward.
- Returns:
Individual reward for the load shifting agent. dc_reward (float): Individual reward for the data center agent. bat_reward (float): Individual reward for the battery agent.
- Return type:
ls_reward (float)
- get_avail_actions()[source]¶
Get the available actions for the agents.
- Returns:
List of available actions for each agent.
- Return type:
list
- get_avail_agent_actions(agent_id)[source]¶
Get the available actions for a specific agent.
- Parameters:
agent_id (int) – Agent ID.
- Returns:
List of available actions for the agent.
- Return type:
list
- reset()[source]¶
Reset the environment.
- Parameters:
seed (int, optional) – Random seed.
options (dict, optional) – Environment options.
- Returns:
Dictionary of states. infos (dict): Dictionary of infos.
- Return type:
states (dict)
- seed(seed=None)[source]¶
Set the random seed for the environment.
- Parameters:
seed (int, optional) – Random seed.
- state()[source]¶
Get the state of the environment.
- Returns:
State of the environment.
- Return type:
np.ndarray
- step(action_dict)[source]¶
Step the environment.
- Parameters:
action_dict – Dictionary of actions of each agent defined in self.agents.
- Returns:
Dictionary of observations/states. rews (dict): Dictionary of rewards. terminated (dict): Dictionary of terminated flags. truncated (dict): Dictionary of truncated flags. infos (dict): Dictionary of infos.
- Return type:
obs (dict)