forked from MAPIRlab/rlrobot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshow.py
executable file
·43 lines (36 loc) · 1.55 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
# -*- coding: utf-8 -*-
# +-----------------------------------------------+
# | 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('repetition \t{0} of {1}'.format(rep + 1, exp.N_REPETITIONS))
if episodic:
print('episode \t{0} of {1}'.format(epi + 1, 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 {0:.2f}m ({1:.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")