ARCLab-MIT / kspdg

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

Get Info in example_agent #4

Closed vrodriguezf closed 11 months ago

vrodriguezf commented 11 months ago

If I understand correctly, the evaluation is done with an AgentRunner class, like this:

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()

And the Agent class defines the get_action method like this:

class KSPDGBaseAgent(ABC):
    @abstractmethod
    def get_action(self, observation):
        raise NotImplementedError("Must be implemented by child class")

Therefore, the agent can only access the observation space (15 elements), but not the updated info of the environment nor the reward. However, in the hello_world example the agent is coded like this:

while not is_done:
    obs, rew, is_done, info = env.step(act)

So the call to step can return everything needed (obs, reeward, finished, and info).

How can you get everything that you get in the format of the hello_world, but encapsuled under the interface of KSPDGBaseAgent.get_action?

vrodriguezf commented 11 months ago

Asked in upstream. https://github.com/mit-ll/spacegym-kspdg/issues/4