-
Notifications
You must be signed in to change notification settings - Fork 29
/
show.py
executable file
·50 lines (43 loc) · 1.56 KB
/
show.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# +-----------------------------------------------+
# | RL-ROBOT. Reinforcement Learning for Robotics |
# | Angel Martinez-Tenor |
# | MAPIR. University of Malaga. 2016 |
# +-----------------------------------------------+
""" Print custom messages """
import exp
import lp
def process_count(caption, rep, epi, episodic):
"""print current repetition and episode"""
print("-" * 50)
print(caption)
if exp.N_REPETITIONS > 1:
print(f"repetition \t{rep + 1} of {exp.N_REPETITIONS}")
if episodic:
print(f"episode \t{epi + 1} of {exp.N_EPISODES}")
print("-" * 50)
def process_remaining(rep, epi):
"""print remaining processes"""
if rep < exp.N_REPETITIONS - 1:
remaining_processes = (
exp.N_REPETITIONS * exp.N_EPISODES - rep * exp.N_EPISODES + epi + 1
)
remaining_time = remaining_processes * lp.elapsed_time
print(
"Remaining time: \t {:.2f}m ({:.2f}h)".format(
remaining_time / 60.0, remaining_time / 3600.0
),
"\n",
)
def process_summary():
"""print process summary"""
print("-" * 22, "END", "-" * 23)
print("Number of steps: \t", str(lp.step + 1))
print("Actual Step Time: \t %.6f" % lp.actual_step_time + "s")
print(
"Elapsed Time:\t\t %.2f" % lp.elapsed_time,
"s ( %.2f" % (lp.elapsed_time / 60),
"m %.2f" % (lp.elapsed_time / 60 / 60),
"h )",
)
print("Average Reward: \t %.2f" % lp.final_average_reward)
print("-" * 50, "\n")