Skip to content

Commit

Permalink
[ADD]Advanced kl
Browse files Browse the repository at this point in the history
  • Loading branch information
elphinkuo committed Mar 12, 2019
1 parent b484852 commit 4095aa3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions nsm/env_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def step(self, action, debug=False):
# Only when the proram is finished and it doesn't have
# extra work or we don't care, its result will be
# scored, and the score will be used as reward.
reward_compile = 0.0
reward_compile = 1.0
if self.done and not (self.punish_extra_work and self.interpreter.has_extra_work()):
reward = self.score_fn(self.interpreter.result, self.answer)
else:
Expand All @@ -173,7 +173,6 @@ def step(self, action, debug=False):
if self.done:
if self.interpreter.result is None:
self.error = True
print('isNone')
else:
if len(self.interpreter.result) == 0:
self.error = True
Expand Down Expand Up @@ -208,9 +207,9 @@ def step(self, action, debug=False):
self.error = True

if self.error == True:
reward_compile = -10.0
reward_compile = 0.0

reward = reward + reward_compile
reward = reward * reward_compile
self.rewards.append(reward)
ob = (tf_utils.MemoryInputTuple(
read_ind=mapped_action, write_ind=new_var_id, valid_indices=self.valid_actions),
Expand Down

0 comments on commit 4095aa3

Please sign in to comment.