forked from intelligent-environments-lab/CityLearn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
agent.py
28 lines (16 loc) · 1.33 KB
/
agent.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
### Feel free to edit this file at will, but make sure it runs properly when we execute the main.py or main.ipynb file that is provided. You can't change the main file, only to the submission files.
'''Import any packages here'''
import json
import torch
class Agent:
def __init__(self, building_ids, buildings_states_actions, building_info):
with open(buildings_states_actions) as json_file:
self.buildings_states_actions = json.load(json_file)
'''Initialize the class and define any hyperparameters of the controller'''
def select_action(self, states):
'''Action selection algorithm. You can set coordination_vars = None if you do not want to use this variable '''
return actions, coordination_vars
def add_to_buffer(self, states, actions, rewards, next_states, done, coordination_vars=None, coordination_vars_next=None):
'''Make any updates to your policy, you don't have to use all the variables above (you can leave the coordination
variables empty if you wish, or use them to share information among your different agents). You can add a counter
within this function to compute the time-step of the simulation, since it will be called once per time-step'''