Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
208 changes: 191 additions & 17 deletions .ipynb_checkpoints/run-checkpoint.ipynb

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions MCTS.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ def moveToLeaf(self):

Q = edge.stats['Q']

lg.logger_mcts.info('action: %d (%d)... N = %d, P = %f, nu = %f, adjP = %f, W = %f, Q = %f, U = %f, Q+U = %f'
, action, action % 7, edge.stats['N'], np.round(edge.stats['P'],6), np.round(nu[idx],6), ((1-epsilon) * edge.stats['P'] + epsilon * nu[idx] )
, np.round(edge.stats['W'],6), np.round(Q,6), np.round(U,6), np.round(Q+U,6))
# lg.logger_mcts.info('action: %d (%d)... N = %d, P = %f, nu = %f, adjP = %f, W = %f, Q = %f, U = %f, Q+U = %f'
# , action, action % 7, edge.stats['N'], np.round(edge.stats['P'],6), np.round(nu[idx],6), ((1-epsilon) * edge.stats['P'] + epsilon * nu[idx] )
# , np.round(edge.stats['W'],6), np.round(Q,6), np.round(U,6), np.round(Q+U,6))

if Q + U > maxQU:
maxQU = Q + U
Expand Down
5 changes: 4 additions & 1 deletion agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def __init__(self, name, state_size, action_size):
self.action_size = action_size

def act(self, state, tau):
action = input('Enter your chosen action: ')
print(tau)
action = int(input('Enter your chosen action: '))
pi = np.zeros(self.action_size)
pi[action] = 1
value = None
Expand Down Expand Up @@ -91,6 +92,8 @@ def act(self, state, tau):
####pick the action
action, value = self.chooseAction(pi, values, tau)

print("action:"+str(action))

nextState, _, _ = state.takeAction(action)

NN_value = -self.get_preds(nextState)[0]
Expand Down
Loading