void ImageExperiment::processGroup(shared_ptr<NEAT::GeneticGeneration> generation) { NEAT::FastNetwork<float> network = group[0]->spawnFastPhenotypeStack<float>(); double reward = calculate_reward( network ); group[0]->reward(reward); }
void ImageExperiment::processIndividualPostHoc(shared_ptr<NEAT::GeneticIndividual> individual) { NEAT::FastNetwork<float> network = individual->spawnFastPhenotypeStack<float>(); double reward = calculate_reward( network ); const double max_reward = 8*8 + 10.0 + 9.0; cout << "POST HOC ANALYSIS: " << reward << "/" << max_reward << endl; }
const reward_observation_terminal_t *env_step(const action_t *this_action) { /* Make sure the action is valid */ assert(this_action->numInts==1); assert(this_action->intArray[0]>=0); assert(this_action->intArray[0]<4); updatePosition(&the_world,this_action->intArray[0]); this_reward_observation.observation->intArray[0] = calculate_flat_state(the_world); this_reward_observation.reward = calculate_reward(the_world); this_reward_observation.terminal = check_terminal(the_world.agentRow,the_world.agentCol); return &this_reward_observation; }