if __name__ == '__main__': global world rospy.init_node('ddpg') pub_result = rospy.Publisher('result', String, queue_size=5) ep_0 = rospy.get_param('~ep_number') world = rospy.get_param('~file_path') MAX_STEPS = rospy.get_param('~max_steps') # MAX_STEPS = 50 if (ep_0 != 0): trainer.load_models(ep_0) rospy.loginfo("Starting at episode: %s ", str(ep_0)) result = Float32() env = Env(action_dim=ACTION_DIMENSION) before_training = 4 past_action = np.zeros(ACTION_DIMENSION) for ep in range(ep_0, MAX_EPISODES): done = False state = env.reset() if is_training and not ep % 10 == 0 and len( replay_buffer) >= before_training * BATCH_SIZE: rospy.loginfo("---------------------------------") rospy.loginfo("Episode: %s training", str(ep)) rospy.loginfo("---------------------------------") else: if len(replay_buffer) >= before_training * BATCH_SIZE: rospy.loginfo("---------------------------------") rospy.loginfo("Episode: %s evaluating", str(ep))
if __name__ == '__main__': global world rospy.init_node('sac') pub_result = rospy.Publisher('result', String, queue_size=5) ep_0 = rospy.get_param('~ep_number') world = rospy.get_param('~file_path') max_steps = rospy.get_param('~max_steps') if (ep_0 != 0): agent.load_models(ep_0) rospy.loginfo("Starting at episode: %s ", str(ep_0)) result = Float32() env = Env() before_training = 4 past_action = np.array([0.,0.]) for ep in range(ep_0, max_episodes): done = False state = env.reset() if is_training and not ep%10 == 0 and len(replay_buffer) > before_training*batch_size: rospy.loginfo("---------------------------------") rospy.loginfo("Episode: %s training", str(ep)) rospy.loginfo("---------------------------------") else: if len(replay_buffer) > before_training*batch_size: rospy.loginfo("---------------------------------") rospy.loginfo("Episode: %s evaluating", str(ep)) rospy.loginfo("---------------------------------")