class_docstr: Controller.`
  Keep Track of each ship and shipyard
docstr: Train ship agent
  Return:
      v_loss (float) : td error
      a_loss (float) : loss of actor network
      ent (float) : entropy
docstr_tok: ["Train","ship","agent","Return",":","v_loss","(","float",")",":","td","error","a_loss","(","float",")",":","loss","of","actor","network","ent","(","float",")",":","entropy"]
code: def train_ship_agent(self):
      """Train ship agent
      Return:
          v_loss (float) : td error
          a_loss (float) : loss of actor network
          ent (float) : entropy
      """
      v_loss, a_loss, ent = [], [], []
      buf_len = self.ship_buffer.size()
      batch_size = int(config["batch_size"])
      train_times = int(config["train_times"])
  
      for _ in range(max(1, int(buf_len * train_times / batch_size))):
          (
              obs,
              action,
              value,
              returns,
              log_prob,
              adv,
          ) = self.ship_buffer.sample_batch(batch_size)
          value_loss, action_loss, entropy = self.ship_agent.learn(
              obs, action, value, returns, log_prob, adv
          )
          v_loss.append(value_loss)
          a_loss.append(action_loss)
          ent.append(entropy)
  
      # reset the buffer to store new data
      self.ship_buffer.reset()
  
      return np.mean(v_loss), np.mean(a_loss), np.mean(ent)
  
imports: import numpy
  from config import config
  from zerosum_env.envs.halite.helpers import *
  from .agent import Agent
  from .model import Model
  from .algorithm import PPO
  from .obs_parser import get_ship_feature
  from .replay_memory import ReplayMemory
  from .utils import is_alive, check_nearby_ship, nearest_shipyard_position, mahattan_distance
  from .policy import do_nothing_policy, move_up_policy, move_down_policy, move_left_policy, move_right_policy, spawn_policy, return_to_base_policy, mine_policy, convert_policy
label_desc: Use image node_id 11 for calling the Controller obj's underlying member method code with example usage: obj.train_ship_agent() and returns: np,  np,  np