def end(self,x):
		reward = self.reward
		print 'episode finished: REWARD %.1f / EPSILON %.5f' % (reward, self.epsilon)

		# Learning Phase
		if self.policyFrozen is False:  # Learning ON/OFF
			self.func.stock_experience(self.time, self.last_state, self.lastAction, reward, self.last_state,
										True)
			self.func.experience_replay(self.time)

		# Target model update
		if self.func.initial_exploration < self.time and np.mod(self.time, self.func.target_model_update_freq) == 0:
			print 'Model Updated'
			self.func.target_model_update()

		# Time count
		if self.policyFrozen is False:
			self.time += 1

		self.age += 1
		if self.age % 10 ==0:
			self.save('dqn%04d.pkl'%self.age)
dataset/ETHPy150Open uei/deel/deel/network/dqn.py/DQN.end/original