def trial(gene): field = Field() for i in range(PREY_NUM): field.add_prey() weights_ih, weights_ho = decoder(gene) field.set_agent(BaselineAgent(10, 10, weights_ih, weights_ho)) for i in range(400): field.one_step_action() return field.agent.total_reword
def TestAuto(): field = Field() for i in range(PREY_NUM): field.add_prey() field.set_agent(BaselineAgent(10, 10)) for i in range(400): os.system('clear') draw(field) field.one_step_action() print(field.agent.total_reword)
def TestManual(): field = Field() for i in range(PREY_NUM): field.add_prey() field.set_agent(BaselineAgent(10, 10)) while (True): os.system('clear') draw(field) input_vector = field.give_input_vector() print(input_vector) c = input('action: ') if c == 'g': action_no = 0 elif c == 'j': action_no = 1 elif c == 'r': action_no = 2 elif c == 'l': action_no = 3 field.position_update(action_no)
def trial(gene): #learning_process(don't use reword) toy_field = ToyField() for i in range(PREY_NUM): toy_field.add_prey() weights_ih, weights_ho, weights_im, weights_mh, weights_em = decoder( gene) #need to fix toy_field.set_agent( MainAgent(10, 10, weights_ih, weights_ho, weights_im, weights_mh, weights_em)) for i in range(800): toy_field.one_step_action() #trial_process(use reword) field = Field() for i in range(PREY_NUM): field.add_prey() field.set_agent(toy_field.hand_over_agent()) for i in range(400): field.one_step_action() return field.agent.total_reword