Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Чекпоинты для временной информации #117

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
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
8 changes: 5 additions & 3 deletions app/app_graph.py → app/altenative_app_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import mcts
from mcts_run_setup import config_with_standard_graph

from rostok.graph_generators.mcts_helper import (make_mcts_step, prepare_mcts_state_and_helper)
from rostok.graph_generators.mcts_helper import (make_mcts_step, prepare_mcts_state_and_helper, CheckpointMCTS)
from rostok.graph_grammar.node import GraphGrammar
from rostok.library.obj_grasp.objects import get_object_parametrized_sphere, get_object_parametrized_tilt_ellipsoid
from rostok.library.rule_sets.ruleset_old_style_graph import create_rules
Expand All @@ -32,14 +32,16 @@
# the constant that determines how we reduce the number of iterations in the MCTS search
iteration_reduction_rate = hp.ITERATION_REDUCTION_TIME


checkpointer = CheckpointMCTS(mcts_helper.report, "AppGraphSphere", rewrite=False)
start = time.time()
finish = False
n_steps = 0
while not finish:
iteration_limit = base_iteration_limit - int(graph_env.counter_action / max_numbers_rules *
(base_iteration_limit * iteration_reduction_rate))
searcher = mcts.mcts(iterationLimit=iteration_limit)
finish, graph_env = make_mcts_step(searcher, graph_env, n_steps)
finish, graph_env = make_mcts_step(searcher, graph_env, n_steps, checkpointer)
n_steps += 1
print(f"number iteration: {n_steps}, counter actions: {graph_env.counter_action} " +
f"reward: {mcts_helper.report.get_best_info()[1]}")
Expand Down Expand Up @@ -74,7 +76,7 @@
sys.stdout = original_stdout

simulation_rewarder = control_optimizer.rewarder
simulation_manager = control_optimizer.simulation_control
simulation_manager = control_optimizer.simulation_scenario
# visualisation in the end of the search
best_graph, reward, best_control = mcts_helper.report.get_best_info()
data = {"initial_value": best_control}
Expand Down
2 changes: 1 addition & 1 deletion app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
sys.stdout = original_stdout

simulation_rewarder = control_optimizer.rewarder
simulation_manager = control_optimizer.simulation_control
simulation_manager = control_optimizer.simulation_scenario
# visualisation in the end of the search
best_graph, reward, best_control = mcts_helper.report.get_best_info()
data = {"initial_value": best_control}
Expand Down
2 changes: 1 addition & 1 deletion app/app_graph_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
sys.stdout = original_stdout

simulation_rewarder = control_optimizer.rewarder
simulation_manager = control_optimizer.simulation_control
simulation_manager = control_optimizer.simulation_scenario
# visualisation in the end of the search
best_graph, reward, best_control = mcts_helper.report.get_best_info()
data = {"initial_value": best_control}
Expand Down
2 changes: 1 addition & 1 deletion app/app_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
sys.stdout = original_stdout

simulation_rewarder = control_optimizer.rewarder
simulation_manager = control_optimizer.simulation_control
simulation_manager = control_optimizer.simulation_scenario
# visualisation in the end of the search
best_graph, reward, best_control = mcts_helper.report.get_best_info()
data = {"initial_value": best_control}
Expand Down
2 changes: 1 addition & 1 deletion app/app_new_multiobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
sys.stdout = original_stdout

simulation_rewarder = control_optimizer.rewarder
simulation_manager = control_optimizer.simulation_control[0]
simulation_manager = control_optimizer.simulation_scenario[0]
# visualisation in the end of the search
best_graph, reward, best_control = mcts_helper.report.get_best_info()
data = control_optimizer.optim_parameters2data_control(best_control)
Expand Down
Binary file added app/checkpoint/AppGraphSphere_1/MCTS_data.pickle
Binary file not shown.
18 changes: 18 additions & 0 deletions app/checkpoint/AppGraphSphere_1/log-file.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
MCTS Iteration: 0, Iteration time: 1.5279135704040527
main_result:
rules: Init
control:
reward: 0

best_result:
rules: Init
control:
reward: 0

max number of non-terminal rules: 20 search parameter: 3

Number of unique mechanisms tested in current MCTS run: 3
Number of states 3

----------------------------------

Binary file not shown.
Binary file not shown.
Binary file not shown.
126 changes: 126 additions & 0 deletions app/checkpoint/AppGraphSphere_10/log-file.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
MCTS Iteration: 0, Iteration time: 2.387392282485962
main_result:
rules: Init
control:
reward: 0

best_result:
rules: Init
control:
reward: 0

max number of non-terminal rules: 20 search parameter: 3

Number of unique mechanisms tested in current MCTS run: 3
Number of states 3

----------------------------------

MCTS Iteration: 2, Iteration time: 2.043215036392212
main_result:
rules: Init AddFinger_RN Terminal_Negative_Translate2
control:
reward: 0

best_result:
rules: Init AddFinger_RN Terminal_Negative_Translate2
control:
reward: 0

max number of non-terminal rules: 20 search parameter: 3

Number of unique mechanisms tested in current MCTS run: 9
Number of states 9

----------------------------------

MCTS Iteration: 4, Iteration time: 1.625321865081787
main_result:
rules: Init AddFinger_RN Terminal_Negative_Translate2 RemoveFinger_N AddFinger_R
control:
reward: 0

best_result:
rules: Init AddFinger_RN Terminal_Negative_Translate2 RemoveFinger_N AddFinger_R
control:
reward: 0

max number of non-terminal rules: 20 search parameter: 3

Number of unique mechanisms tested in current MCTS run: 15
Number of states 15

----------------------------------

MCTS Iteration: 6, Iteration time: 1.576897144317627
main_result:
rules: Init AddFinger_RN Terminal_Negative_Translate2 RemoveFinger_N AddFinger_R RemoveFinger RemoveFinger_RP
control:
reward: 0

best_result:
rules: Init AddFinger_RN Terminal_Negative_Translate2 RemoveFinger_N AddFinger_R RemoveFinger RemoveFinger_RP
control:
reward: 0

max number of non-terminal rules: 20 search parameter: 3

Number of unique mechanisms tested in current MCTS run: 21
Number of states 21

----------------------------------

MCTS Iteration: 8, Iteration time: 0.7679116725921631
main_result:
rules: Init AddFinger_RN Terminal_Negative_Translate2 RemoveFinger_N AddFinger_R RemoveFinger RemoveFinger_RP AddFinger_PT Remove_FG
control:
reward: 0

best_result:
rules: Init AddFinger_RN Terminal_Negative_Translate2 RemoveFinger_N AddFinger_R RemoveFinger RemoveFinger_RP AddFinger_PT Remove_FG
control:
reward: 0

max number of non-terminal rules: 20 search parameter: 3

Number of unique mechanisms tested in current MCTS run: 27
Number of states 27

----------------------------------

MCTS Iteration: 10, Iteration time: 0.5185501575469971
main_result:
rules: Init AddFinger_RN Terminal_Negative_Translate2 RemoveFinger_N AddFinger_R RemoveFinger RemoveFinger_RP AddFinger_PT Remove_FG Remove_FG Terminal_Radial_Translate2
control:
reward: 0

best_result:
rules: Init AddFinger_RN Terminal_Negative_Translate2 RemoveFinger_N AddFinger_R RemoveFinger RemoveFinger_RP AddFinger_PT Remove_FG Remove_FG Terminal_Radial_Translate2
control:
reward: 0

max number of non-terminal rules: 20 search parameter: 3

Number of unique mechanisms tested in current MCTS run: 33
Number of states 33

----------------------------------

MCTS Iteration: 12, Iteration time: 0.1713728904724121
main_result:
rules: Init AddFinger_RN Terminal_Negative_Translate2 RemoveFinger_N AddFinger_R RemoveFinger RemoveFinger_RP AddFinger_PT Remove_FG Remove_FG Terminal_Radial_Translate2 Remove_FG Terminal_Radial_Translate2
control:
reward: 0

best_result:
rules: Init AddFinger_RN Terminal_Negative_Translate2 RemoveFinger_N AddFinger_R RemoveFinger RemoveFinger_RP AddFinger_PT Remove_FG Remove_FG Terminal_Radial_Translate2 Remove_FG Terminal_Radial_Translate2
control:
reward: 0

max number of non-terminal rules: 20 search parameter: 3

Number of unique mechanisms tested in current MCTS run: 35
Number of states 39

----------------------------------

Binary file not shown.
Binary file not shown.
Binary file added app/checkpoint/AppGraphSphere_2/MCTS_data.pickle
Binary file not shown.
18 changes: 18 additions & 0 deletions app/checkpoint/AppGraphSphere_2/log-file.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
MCTS Iteration: 0, Iteration time: 1.9557695388793945
main_result:
rules: Init
control:
reward: 0

best_result:
rules: Init
control:
reward: 0

max number of non-terminal rules: 20 search parameter: 3

Number of unique mechanisms tested in current MCTS run: 3
Number of states 3

----------------------------------

Binary file not shown.
Binary file not shown.
Binary file added app/checkpoint/AppGraphSphere_3/MCTS_data.pickle
Binary file not shown.
18 changes: 18 additions & 0 deletions app/checkpoint/AppGraphSphere_3/log-file.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
MCTS Iteration: 0, Iteration time: 2.1372127532958984
main_result:
rules: Init
control:
reward: 0

best_result:
rules: Init
control:
reward: 0

max number of non-terminal rules: 20 search parameter: 3

Number of unique mechanisms tested in current MCTS run: 3
Number of states 3

----------------------------------

Binary file not shown.
Binary file not shown.
Binary file added app/checkpoint/AppGraphSphere_4/MCTS_data.pickle
Binary file not shown.
18 changes: 18 additions & 0 deletions app/checkpoint/AppGraphSphere_4/log-file.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
MCTS Iteration: 0, Iteration time: 1.5798587799072266
main_result:
rules: Init
control:
reward: 0

best_result:
rules: Init
control:
reward: 0

max number of non-terminal rules: 20 search parameter: 3

Number of unique mechanisms tested in current MCTS run: 3
Number of states 3

----------------------------------

Binary file not shown.
Binary file not shown.
Binary file added app/checkpoint/AppGraphSphere_5/MCTS_data.pickle
Binary file not shown.
18 changes: 18 additions & 0 deletions app/checkpoint/AppGraphSphere_5/log-file.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
MCTS Iteration: 0, Iteration time: 1.234072208404541
main_result:
rules: Init
control:
reward: 0

best_result:
rules: Init
control:
reward: 0

max number of non-terminal rules: 20 search parameter: 3

Number of unique mechanisms tested in current MCTS run: 3
Number of states 3

----------------------------------

Binary file not shown.
Binary file not shown.
Binary file added app/checkpoint/AppGraphSphere_6/MCTS_data.pickle
Binary file not shown.
18 changes: 18 additions & 0 deletions app/checkpoint/AppGraphSphere_6/log-file.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
MCTS Iteration: 0, Iteration time: 3.1061370372772217
main_result:
rules: Init
control:
reward: 0

best_result:
rules: Init
control:
reward: 0

max number of non-terminal rules: 20 search parameter: 3

Number of unique mechanisms tested in current MCTS run: 3
Number of states 3

----------------------------------

Binary file not shown.
Binary file not shown.
Binary file added app/checkpoint/AppGraphSphere_7/MCTS_data.pickle
Binary file not shown.
18 changes: 18 additions & 0 deletions app/checkpoint/AppGraphSphere_7/log-file.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
MCTS Iteration: 0, Iteration time: 1.6669328212738037
main_result:
rules: Init
control:
reward: 0

best_result:
rules: Init
control:
reward: 0

max number of non-terminal rules: 20 search parameter: 3

Number of unique mechanisms tested in current MCTS run: 3
Number of states 3

----------------------------------

Binary file not shown.
Binary file not shown.
Binary file not shown.
18 changes: 18 additions & 0 deletions app/checkpoint/AppGraphSphere_8/log-file.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
MCTS Iteration: 0, Iteration time: 1.877546787261963
main_result:
rules: Init
control:
reward: 0

best_result:
rules: Init
control:
reward: 0

max number of non-terminal rules: 20 search parameter: 3

Number of unique mechanisms tested in current MCTS run: 3
Number of states 3

----------------------------------

Binary file not shown.
Binary file not shown.
Binary file added app/checkpoint/AppGraphSphere_9/MCTS_data.pickle
Binary file not shown.
18 changes: 18 additions & 0 deletions app/checkpoint/AppGraphSphere_9/log-file.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
MCTS Iteration: 0, Iteration time: 1.2005963325500488
main_result:
rules: Init
control:
reward: 0

best_result:
rules: Init
control:
reward: 0

max number of non-terminal rules: 20 search parameter: 3

Number of unique mechanisms tested in current MCTS run: 3
Number of states 3

----------------------------------

Binary file not shown.
Binary file not shown.
5 changes: 3 additions & 2 deletions app/hyperparameters.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
MAX_NUMBER_RULES = 10

BASE_ITERATION_LIMIT = 20
BASE_ITERATION_LIMIT_GRAPH = 200
BASE_ITERATION_LIMIT = 30
BASE_ITERATION_LIMIT_GRAPH = 3
BASE_ITERATION_LIMIT_TENDON = 3

ITERATION_REDUCTION_TIME = 0.7

Expand Down
Loading