AIToolbox
A library that offers tools for AI problem solving.
|
This class represents a factored vector. More...
#include <AIToolbox/Factored/Utils/FactoredMatrix.hpp>
Public Member Functions | |
double | getValue (const Factors &space, const Factors &value) const |
This function returns the value of the FactoredVector at the specified point. More... | |
double | getValue (const Factors &space, const Factors &value, const Vector &weights) const |
This function returns the value of the FactoredVector multiplied by the input weights. More... | |
FactoredVector & | operator*= (const Vector &w) |
This function multiplies each basis function with a weight. More... | |
FactoredVector & | operator*= (const double v) |
This function multiplies all bases with a scalar. More... | |
Public Attributes | |
std::vector< BasisFunction > | bases |
This class represents a factored vector.
A factored vector is a function over the whole factor space, resulting from the sum of a set of BasisFunctions. This representation turns out to be convenient as it allows to do many operations much more efficiently than if we had to represent the function explicitly.
This representation is used, for example, to represent each Qa, or Ra in factored MDPs.
Note that, in most cases, one should try to avoid duplicate BasisFunctions in here; i.e. BasisFunctions with equal tag, or where the tag of one is a strict superset of another. Such BasisFunctions can simply be merged, thus keeping the representation as simple as possible.
At the same time, sometimes duplicates are needed: for example when specifying the BasisFunctions of a factored ValueFunction. This is because usually a factored ValueFunction is composed of two components: the BasisFunctions, and a set of weight. Being able to assign separate weights to two different BasisFunctions, even if defined over the same tag, is important, so we don't completely forbid duplicates.
double AIToolbox::Factored::FactoredVector::getValue | ( | const Factors & | space, |
const Factors & | value | ||
) | const |
This function returns the value of the FactoredVector at the specified point.
space | The factor space to use. |
value | The value of the factor space to compute the value for. |
double AIToolbox::Factored::FactoredVector::getValue | ( | const Factors & | space, |
const Factors & | value, | ||
const Vector & | weights | ||
) | const |
This function returns the value of the FactoredVector multiplied by the input weights.
Note that if the weights contain an additional element, it will be added to the value as a constant basis.
space | The factor space to use. |
value | The value of the factor space to compute the value for. |
weights | The weights to multiply the bases with, with an optional constant basis. |
FactoredVector& AIToolbox::Factored::FactoredVector::operator*= | ( | const double | v | ) |
This function multiplies all bases with a scalar.
v | The scalar to multiply with. |
FactoredVector& AIToolbox::Factored::FactoredVector::operator*= | ( | const Vector & | w | ) |
This function multiplies each basis function with a weight.
The input Vector must have the same number of elements as the number of bases in this FactoredVector, or one optional more.
Each basis is multiplied by its respective scalar. If an additional weight is present in the input, it is divided by the number of bases and added to each of them. Note that if the FactoredVector contains duplicate tags this is probably not what you want!!
w | The weights to multiply with. |
std::vector<BasisFunction> AIToolbox::Factored::FactoredVector::bases |