nazaruka / gym-http-api

NSGA2-based Sonic agent + experimental code
MIT License
1 stars 1 forks source link

Simplified behavior vector #34

Closed schrum2 closed 5 years ago

schrum2 commented 5 years ago

Make command line params for different types of behavior vectors. Currently, we are using what I would call "complete" since it tracks the whole trajectory during evaluation. We should also have an option called "final" which only logs the final point that Sonic reaches. This is similar to the original Novelty Search experiments in the maze domain, and should be easier to troubleshoot and understand even though it likely has limitations.

First set up the command line parameter, then add code to the behavior characterization tracker so that when "final" is used it keeps replacing the point with the current x/y values rather than appending them.

nazaruka commented 5 years ago

This issue was easy to fix and merely involved files being manipulated to support the new --final-pt command line parameter. The most considerable change lies in adding if-statements to evaluation.py in such a manner that certain conditions are different depending on the truth value of final_pt (set to True when --final-pt is written in the command line)

info = infos[0] 
xpos = info['x']
ypos = info['y']
if args.final_pt:
    if done:
        behaviors.extend([xpos, ypos])
else:
    behaviors.extend([xpos, ypos])

if xpos == last_x:
    steps_without_change_in_x += 1
    if steps_without_change_in_x >= args.eval_progress_fail_time:
        if args.final_pt:
            behaviors.extend([xpos, ypos])
        print("End Early, stuck at {} for {} steps.".format(xpos, steps_without_change_in_x), end=" ")
        ...