Commit ade5b95d authored by Sascha Dewes's avatar Sascha Dewes

removed multiplication and offset from DefaultNeutralizer and changed agent to...

removed multiplication and offset from DefaultNeutralizer and changed agent to produce json file with results in evaluation mode
parent 432c3b5f
Pipeline #393268 passed with stage
in 4 minutes and 47 seconds
target
__pycache__/
*.py[cod]
bin/dummysim/singlestep/results
bin/dummysim/multistep/results
bin/dummysim/singlestep/results/*
bin/dummysim/multistep/results/*
......@@ -50,7 +50,7 @@ if __name__ == "__main__":
verbose = options.verbose
sample_games = 100
connector = RosSimConnector(verbose)
connector = RosSimConnector(verbose, options.eval)
if mode == PLAY_MODE:
time.sleep(8)
......
......@@ -24,8 +24,9 @@ class RosSimConnector(object):
results_dirname = os.path.join(os.path.dirname(__file__), 'results')
results_filename = os.path.join(results_dirname, 'results-{}'.format(time.strftime('%Y%m%d-%H%M%S')))
def __init__(self, verbose=True):
def __init__(self, verbose=True, evaluate=False):
self.__verbose = verbose
self.__evaluate = evaluate
self.__env = MultiStepWrapper()
self.__last_game_score = 0
......@@ -156,12 +157,13 @@ class RosSimConnector(object):
self.__scores_counter += 1
self.__scores_counter %= 100
score_avg = np.average(self.__scores)
#self.__results['money'].append(money)
#self.__results['time'].append(simtime)
#self.__results['score'].append(self.__score)
#resultsfile = open(RosSimConnector.results_filename, 'w')
#json.dump(self.__results, resultsfile)
#resultsfile.close()
if self.__evaluate:
self.__results['money'].append(money)
self.__results['time'].append(simtime)
self.__results['score'].append(self.__score)
resultsfile = open(RosSimConnector.results_filename, 'w')
json.dump(self.__results, resultsfile)
resultsfile.close()
print('Game terminated. Money: {}, Time: {}, M/T: {}, Score: {}, Avg. score over last 100 episodes: {}, Steps: {}'.format(money, simtime, round(money/max(1,simtime),2), self.__score, score_avg, self.__steps))
self.__terminated = True
self.__last_game_score = self.__score
......
......@@ -50,7 +50,7 @@ if __name__ == "__main__":
verbose = options.verbose
sample_games = 100
connector = RosSimConnector(verbose)
connector = RosSimConnector(verbose, options.eval)
if mode == PLAY_MODE:
time.sleep(8)
......
......@@ -23,8 +23,9 @@ class RosSimConnector(object):
results_dirname = os.path.join(os.path.dirname(__file__), 'results')
results_filename = os.path.join(results_dirname, 'results-{}'.format(time.strftime('%Y%m%d-%H%M%S')))
def __init__(self, verbose=True):
def __init__(self, verbose=True, evaluate=False):
self.__verbose = verbose
self.__evaluate = evaluate
self.__env = SimEnv()
self.__last_game_score = 0
......@@ -155,12 +156,13 @@ class RosSimConnector(object):
self.__scores_counter += 1
self.__scores_counter %= 100
score_avg = np.average(self.__scores)
#self.__results['money'].append(money)
#self.__results['time'].append(simtime)
#self.__results['score'].append(self.__score)
#resultsfile = open(RosSimConnector.results_filename, 'w')
#json.dump(self.__results, resultsfile)
#resultsfile.close()
if self.__evaluate:
self.__results['money'].append(money)
self.__results['time'].append(simtime)
self.__results['score'].append(self.__score)
resultsfile = open(RosSimConnector.results_filename, 'w')
json.dump(self.__results, resultsfile)
resultsfile.close()
print('Game terminated. Money: {}, Time: {}, M/T: {}, Score: {}, Avg. score over last 100 episodes: {}, Steps: {}'.format(money, simtime, round(money/max(1,simtime),2), self.__score, score_avg, self.__steps))
self.__terminated = True
self.__last_game_score = self.__score
......
......@@ -7,7 +7,7 @@
},
{
"op": "null",
"name": "net_019803_dense0_weight",
"name": "net_036715_dense0_weight",
"attrs": {
"__dtype__": "0",
"__lr_mult__": "1.0",
......@@ -19,7 +19,7 @@
},
{
"op": "null",
"name": "net_019803_dense0_bias",
"name": "net_036715_dense0_bias",
"attrs": {
"__dtype__": "0",
"__init__": "zeros",
......@@ -32,7 +32,7 @@
},
{
"op": "FullyConnected",
"name": "net_019803_dense0_fwd",
"name": "net_036715_dense0_fwd",
"attrs": {
"flatten": "True",
"no_bias": "False",
......@@ -42,13 +42,13 @@
},
{
"op": "Activation",
"name": "net_019803_relu0_fwd",
"name": "net_036715_relu0_fwd",
"attrs": {"act_type": "relu"},
"inputs": [[3, 0, 0]]
},
{
"op": "null",
"name": "net_019803_dense1_weight",
"name": "net_036715_dense1_weight",
"attrs": {
"__dtype__": "0",
"__lr_mult__": "1.0",
......@@ -60,7 +60,7 @@
},
{
"op": "null",
"name": "net_019803_dense1_bias",
"name": "net_036715_dense1_bias",
"attrs": {
"__dtype__": "0",
"__init__": "zeros",
......@@ -73,7 +73,7 @@
},
{
"op": "FullyConnected",
"name": "net_019803_dense1_fwd",
"name": "net_036715_dense1_fwd",
"attrs": {
"flatten": "True",
"no_bias": "False",
......@@ -83,13 +83,13 @@
},
{
"op": "Activation",
"name": "net_019803_relu1_fwd",
"name": "net_036715_relu1_fwd",
"attrs": {"act_type": "relu"},
"inputs": [[7, 0, 0]]
},
{
"op": "null",
"name": "net_019803_dense2_weight",
"name": "net_036715_dense2_weight",
"attrs": {
"__dtype__": "0",
"__lr_mult__": "1.0",
......@@ -101,7 +101,7 @@
},
{
"op": "null",
"name": "net_019803_dense2_bias",
"name": "net_036715_dense2_bias",
"attrs": {
"__dtype__": "0",
"__init__": "zeros",
......@@ -114,7 +114,7 @@
},
{
"op": "FullyConnected",
"name": "net_019803_dense2_fwd",
"name": "net_036715_dense2_fwd",
"attrs": {
"flatten": "True",
"no_bias": "False",
......@@ -124,7 +124,7 @@
},
{
"op": "Activation",
"name": "net_019803_tanh0_fwd",
"name": "net_036715_tanh0_fwd",
"attrs": {"act_type": "tanh"},
"inputs": [[11, 0, 0]]
}
......
......@@ -14,7 +14,7 @@ component DefaultNeutralizer(Z nnstlen) {
if state(i) == -1 && i != 2 //exclude money, because money is always defined and can actually be negative
neutralized(i) = 0;
else
neutralized(i) = (state(i)-0.5)*4;
neutralized(i) = state(i);
end
end
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment