pulsatrix
Loading...
Searching...
No Matches
pulsatrix::Agent Class Referenceabstract

Base class for anything that maps an observation to an action. More...

#include <agent.hpp>

Inheritance diagram for pulsatrix::Agent:

Public Member Functions

virtual ~Agent ()=default
 
virtual Tensor act (const Tensor &observation)=0
 Chooses an action for the given observation.
 

Detailed Description

Base class for anything that maps an observation to an action.

Note
Exactly one method. There is deliberately no learn()/update() on this interface: training is algorithm-specific (DQN's replay-buffer TD update, REINFORCE/A2C/PPO's policy-gradient step, SAC's twin-critic update all have genuinely different signatures), so a common update() would either be a lowest-common-denominator lie or an unused pure-virtual every subclass stubs. Agent is the policy contract only; each later phase's algorithm owns its own training surface.
Not a Module subclass, for the same reason Environment isn't: an Agent may not be differentiable at all (a tabular or epsilon-greedy policy isn't), and typically owns Modules rather than being one.

Constructor & Destructor Documentation

◆ ~Agent()

virtual pulsatrix::Agent::~Agent ( )
virtualdefault

Member Function Documentation

◆ act()

virtual Tensor pulsatrix::Agent::act ( const Tensor &  observation)
pure virtual

Chooses an action for the given observation.

Parameters
observationObservation from an Environment, shape (1, observation_dim()).
Returns
The chosen action, in whatever encoding the target Environment expects – shape (1, 1) holding the action index as a float, for a discrete environment.
Note
Non-const: a stochastic policy advances its own internal generator state here, and an epsilon-greedy policy decays epsilon, so act() is genuinely a mutating operation for most real implementations.

Implemented in pulsatrix::CategoricalPolicyAgent, and pulsatrix::DQNAgent.


The documentation for this class was generated from the following file: