コード例 #1
0
def main( epoch_budget, count, gen_type, gen_args, agent_type, agent_args, env_type, env_args, file_prefix ):
    """
    @arg epochs: Maximum number of epochs to use
    @arg count: Number of options to learn
    @arg agent_type: String name of agent
    @arg agent_args: Arguments to the agent constructor
    @arg env_type: String name of environment
    @arg env_args: Arguments to the environment constructor
    """

    env = env_type.create( *env_args )

    if gen_type == "betweenness":
        options = OptionGenerator.learn_options_from_betweenness( epoch_budget, count, env, env_args, agent_type, agent_args )
    elif gen_type == "optimal-betweenness":
        options = OptionGenerator.optimal_options_from_betweenness( env, count )
    elif gen_type == "small-world":
        options = OptionGenerator.learn_options_from_small_world( epoch_budget, count, env, env_args, agent_type, agent_args, *gen_args )
    elif gen_type == "optimal-small-world":
        options = OptionGenerator.optimal_options_from_small_world( env, count, *gen_args )
    else:
        raise NotImplemented()

    # Save options
    f = open("%s.options"%( file_prefix ), "w")
    pickle.dump( options, f )
    f.close()