Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
bigprint
pyDecMCTS
Commits
27782e65
Commit
27782e65
authored
Jan 10, 2020
by
Jayant Khatkar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simulation with differect available actions function
parent
f9afb912
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
DecMCTS.py
DecMCTS.py
+6
-3
No files found.
DecMCTS.py
View file @
27782e65
...
...
@@ -90,6 +90,7 @@ class Tree:
avail_actions_func
,
state_store_func
,
sim_selection_func
,
sim_avail_actions_func
,
comm_n
,
robot_id
,
c_p
=
1
):
...
...
@@ -98,6 +99,7 @@ class Tree:
self
.
graph
=
nx
.
DiGraph
()
self
.
reward
=
reward_func
self
.
available_actions
=
avail_actions_func
self
.
sim_available_actions
=
sim_avail_actions_func
self
.
state_store
=
state_store_func
self
.
sim_selection_func
=
sim_selection_func
self
.
c_p
=
c_p
...
...
@@ -243,15 +245,16 @@ class Tree:
best_rollout
=
None
for
i
in
range
(
nsims
):
temp_state
=
self
.
graph
.
node
[
start_node
][
"state"
]
state
[
self
.
id
]
=
temp_state
d
=
0
# depth
while
d
<
depth
:
# also breaks at no available options
d
+=
1
# Get the available actions
options
=
self
.
available_actions
(
options
=
self
.
sim_
available_actions
(
self
.
data
,
temp_
state
,
state
,
self
.
id
)
...
...
@@ -265,9 +268,9 @@ class Tree:
# add that to the actions of the current robot
temp_state
=
self
.
state_store
(
self
.
data
,
temp_state
,
sim_action
,
self
.
id
)
state
[
self
.
id
]
=
temp_state
# calculate the reward at the end of simulation
state
[
self
.
id
]
=
temp_state
rew
=
self
.
reward
(
self
.
data
,
state
)
\
-
self
.
reward
(
self
.
data
,
self
.
_null_state
(
state
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment