-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcount_experiences.py
72 lines (61 loc) · 2.91 KB
/
count_experiences.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env python
# The MIT License (MIT)
# Copyright (c) 2017 Riccardo Polvara
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
# PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
# FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
# DQN tensorflow implementation for achieving autonomous landing.
import numpy as np
import sys
from experience_replay_buffer import ExperienceReplayBuffer
import Image
import datetime
import time
import os.path
import cv2
def main():
replay_memory_size = 400000
replay_buffer_path = "/home/pulver/Desktop/buffers_comparison/replay_buffer_shared.pickle"
replay_buffer_positive_path = "/home/pulver/Desktop/buffers_comparison/replay_buffer_positive.pickle"
replay_buffer_negative_path = "/home/pulver/Desktop/buffers_comparison/replay_buffer_negative.pickle"
replay_buffer_neutral_path = "/home/pulver/Desktop/buffers_comparison/replay_buffer_neutral.pickle"
#replay_buffer_path = "./replay_buffer.pickle"
replay_buffer = ExperienceReplayBuffer(capacity=replay_memory_size)
replay_buffer_positive = ExperienceReplayBuffer(capacity=replay_memory_size)
replay_buffer_negative = ExperienceReplayBuffer(capacity=replay_memory_size)
replay_buffer_neutral = ExperienceReplayBuffer(capacity=replay_memory_size)
timer_start = time.time()
# Load the Replay buffer from file or accumulate experiences
replay_buffer.load(replay_buffer_path)
replay_buffer_positive.load(replay_buffer_positive_path)
replay_buffer_negative.load(replay_buffer_negative_path)
replay_buffer_neutral.load(replay_buffer_neutral_path)
timer_stop = time.time()
print "Time episode: " + str(timer_stop - timer_start) + " seconds"
print "Time episode: " + str((timer_stop - timer_start) / 60) + " minutes"
print "Size shared buffer: " + str(replay_buffer.return_size())
print "Size positive buffer: " + str(replay_buffer_positive.return_size())
print "Size negative buffer: " + str(replay_buffer_negative.return_size())
print "Size neutral buffer: " + str(replay_buffer_neutral.return_size())
print("")
#----------------- PRINT EXPERIENCE COUNTER -----------------
print "Shared buffer"
replay_buffer.count_experience()
print ""
print "Positive buffer"
replay_buffer_positive.count_experience()
print ""
print "Negative buffer"
replay_buffer_negative.count_experience()
print ""
print "Neutral buffer"
replay_buffer_neutral.count_experience()
print ""
#----------------------------------------------------------------
if __name__ == "__main__":
main()