-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathreturnBrain1.py
32 lines (26 loc) · 887 Bytes
/
returnBrain1.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
29
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 10 12:33:57 2020
@author: jingci
"""
import numpy as np
import pandas as pd
import pickle
from RLBrain import RLBrain
class ReturnQLearningTable1(RLBrain):
def __init__(self, actions, state):
self.actions = actions # a list
if state == "RAW":
#The q_table without previous knowledge
self.q_table = pd.DataFrame(columns=self.actions, dtype=np.float64)
elif state == "MAP":
#The q_table after map training
f = open(RLBrain.FILEPATH + 'Return_q_table1.txt', 'rb')
self.q_table = pickle.load(f)
f.close()
elif state == "PATH":
#The q_table after path training
f = open(RLBrain.FILEPATH + 'Return_q_table1.txt', 'rb')
self.q_table = pickle.load(f)
f.close()