Fido
 All Classes Namespaces Files Functions Variables Typedefs Macros Pages
Public Member Functions | Public Attributes | List of all members
rl::LSInterpolator Class Reference

A least squares wire fitted Interpolator. More...

#include <LSInterpolator.h>

Inherits rl::Interpolator.

Public Member Functions

 LSInterpolator ()
 Initializes a LSInterpolator with default parameters. More...
 
 LSInterpolator (double smoothingFactor_, double e_)
 Initializes a LSInterpolator with custom parameters. More...
 
bool initFromStream (std::ifstream *in)
 Initializes a LSInterpolator using the information from a file. More...
 
void store (std::ofstream *out)
 Stores the interpolator object in a file. More...
 
double getReward (const std::vector< Wire > &controlWires, const std::vector< double > &action)
 Uses the interpolator function to compute the reward of an action vector given a set of control wires. More...
 
double rewardDerivative (const std::vector< double > &action, const Wire &wire, const std::vector< Wire > &controlWires)
 Computes the partial derivative of the interpolator function with respect to the reward of a control wire. More...
 
double actionTermDerivative (double actionTerm, double wireActionTerm, const std::vector< double > &action, const Wire &wire, const std::vector< Wire > &controlWires)
 Computes the partial derivative of the interpolator function with respect to the value of one term of the action vector of a control wire. More...
 

Public Attributes

double smoothingFactor
 
double e
 

Additional Inherited Members

- Static Public Member Functions inherited from rl::Interpolator
static InterpolatorgetAnyInterpolatorFromFile (std::ifstream *in)
 Gets an interpolator from a file. More...
 

Detailed Description

A least squares wire fitted Interpolator.

Constructor & Destructor Documentation

LSInterpolator::LSInterpolator ( )

Initializes a LSInterpolator with default parameters.

PUBLIC METHODS.

The default smoothingFactor is 0, while the default e is 0.01.

LSInterpolator::LSInterpolator ( double  smoothingFactor_,
double  e_ 
)

Initializes a LSInterpolator with custom parameters.

Parameters
smoothingFactor_the smoothing factor for the interpolator
e_a small constant (less than 1)

Member Function Documentation

double LSInterpolator::actionTermDerivative ( double  actionTerm,
double  wireActionTerm,
const std::vector< double > &  action,
const Wire wire,
const std::vector< Wire > &  controlWires 
)
virtual

Computes the partial derivative of the interpolator function with respect to the value of one term of the action vector of a control wire.

Parameters
actionTermthe action term
wireActionTermthe wire action term
actionthe action vector
wirethe wire
controlWiresthe vector of control wires
Returns
the action term derivative

Implements rl::Interpolator.

double LSInterpolator::getReward ( const std::vector< Wire > &  controlWires,
const std::vector< double > &  action 
)
virtual

Uses the interpolator function to compute the reward of an action vector given a set of control wires.

Parameters
controlWiresthe input vector of control wires
actionthe action vector for which the reward is computed
Returns
the expected reward of the action vector

Implements rl::Interpolator.

bool LSInterpolator::initFromStream ( std::ifstream *  in)
virtual

Initializes a LSInterpolator using the information from a file.

Parameters
inthe file from which initialize the LSInterpolator
Returns
False if the interpolator stored in the file is not a LSInterpolator.

Implements rl::Interpolator.

double LSInterpolator::rewardDerivative ( const std::vector< double > &  action,
const Wire wire,
const std::vector< Wire > &  controlWires 
)
virtual

Computes the partial derivative of the interpolator function with respect to the reward of a control wire.

Parameters
actionthe action vector
wirethe wire
controlWiresthe control wires
Returns
the reward derivative

Implements rl::Interpolator.

void LSInterpolator::store ( std::ofstream *  out)
virtual

Stores the interpolator object in a file.

Parameters
outthe file to which to write the LSInterpolator

Implements rl::Interpolator.

Member Data Documentation

double rl::LSInterpolator::e
double rl::LSInterpolator::smoothingFactor

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