-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexecute_ac_f18_plasma.py
48 lines (38 loc) · 1.19 KB
/
execute_ac_f18_plasma.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
"""
Original code from John Schulman for CS294 Deep Reinforcement Learning Spring 2017
Adapted for CS294-112 Fall 2017 by Abhishek Gupta and Joshua Achiam
Adapted for CS294-112 Fall 2018 by Soroush Nasiriany, Sid Reddy, and Greg Kahn
Modifed for CS294-112 Fall2018 by Matthew Witman to implement solutions
and add additional functionality for testing plasma jet control model
"""
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
import gym
import logz
import os, sys
import time
import inspect
from multiprocessing import Process
import threading
from plasma import PlasmaModel as pm
NPY_SQRT1_2 = 1/(2**0.5)
def background():
while True:
time.sleep(3)
print('disarm me by typing disarm')
def save_state():
print('Saving current state...\nQuitting Plutus. Goodbye!')
# now threading1 runs regardless of user input
threading1 = threading.Thread(target=background)
threading1.daemon = True
threading1.start()
with tf.Session() as session:
saver = tf.train.Saver()
#saver.restore(session,
while True:
if input().lower() == 'quit':
save_state()
sys.exit()
else:
print('not disarmed')