ARCLab-MIT / kspdg

ARCLab-MIT participation in the KSPDG challenge
MIT License
4 stars 0 forks source link

agent_kwargs? #5

Closed vrodriguezf closed 11 months ago

vrodriguezf commented 11 months ago

I see that the AgentEnvRunner constructor has a env_ argument to pass kwargs to the environment, but, how to do the same with Agents? I mean, this kwargs:

class NaivePursuitAgent(KSPDGBaseAgent):
    """An agent that naively burns directly toward it's target"""
    def __init__(self, **kwargs):
        super().__init__()

In the config file example_agent_cfg.yaml I see a way:

agent_module_path: "../src/kspdg/agent_api/example_agent.py"  # this must be relative to working directory when script is called
agent_cls: NaivePursuitAgent
kwargs:
  arg1: value1
  arg2: value2
  arg3: value3

but, afaik, that is supposed to be used only with the evaluation script.

vrodriguezf commented 11 months ago

Solved: they are just created in the main function before calling the AgentRunner:

if __name__ == "__main__":
    naive_agent = NaivePursuitAgent()    
    runner = AgentEnvRunner(
        agent=naive_agent, 
        env_cls=PE1_E1_I3_Env, 
        env_kwargs=None,
        runner_timeout=100,     # agent runner that will timeout after 100 seconds
        debug=True)
    runner.run()