#include <OMPartial.h>
Public Types | |
typedef std::vector< unsigned int > | IndexList |
Public Member Functions | |
OMPartial (ObservationModel *wrapped, IndexList indices, bool exclude=false) | |
OMPartial (ObservationModel *wrapped, IndexList stateIndices, IndexList velocityIndices, bool exclude=false) | |
virtual | ~OMPartial () |
OMPartial (const OMPartial &)=delete | |
OMPartial & | operator= (const OMPartial &)=delete |
OMPartial (OMPartial &&)=delete | |
OMPartial & | operator= (OMPartial &&)=delete |
virtual unsigned int | getStateDim () const |
virtual unsigned int | getVelocityDim () const |
virtual void | computeObservation (double *state, double *velocity, const MatNd *currentAction, double dt) const |
virtual void | getLimits (double *minState, double *maxState, double *maxVelocity) const |
virtual std::vector< std::string > | getStateNames () const |
virtual std::vector< std::string > | getVelocityNames () const |
virtual void | reset () |
virtual std::vector< ObservationModel * > | getNested () const |
![]() | |
virtual | ~ObservationModel () |
MatNd * | computeObservation (const MatNd *currentAction, double dt) const |
void | computeObservation (MatNd *observation, const MatNd *currentAction, double dt) const |
virtual void | getMinMax (double *min, double *max) const final |
virtual unsigned int | getDim () const final |
virtual std::vector< std::string > | getNames () const final |
template<typename OM > | |
OM * | findModel () |
template<typename OM > | |
Offsets | findOffsets () |
![]() | |
BoxSpaceProvider () | |
virtual | ~BoxSpaceProvider () |
BoxSpaceProvider (const BoxSpaceProvider &)=delete | |
BoxSpaceProvider & | operator= (const BoxSpaceProvider &)=delete |
BoxSpaceProvider (BoxSpaceProvider &&)=delete | |
BoxSpaceProvider & | operator= (BoxSpaceProvider &&)=delete |
const BoxSpace * | getSpace () const |
Static Public Member Functions | |
static OMPartial * | fromMask (ObservationModel *wrapped, const std::vector< bool > &mask, bool exclude=false) |
static OMPartial * | fromMask (ObservationModel *wrapped, const std::vector< bool > &stateMask, const std::vector< bool > &velocityMask, bool exclude=false) |
static OMPartial * | fromNames (ObservationModel *wrapped, const std::vector< std::string > &names, bool exclude=false, bool autoSelectVelocity=false) |
Private Attributes | |
ObservationModel * | wrapped |
IndexList | keptStateIndices |
IndexList | keptVelocityIndices |
Applies partial observability by masking out certain state variables.
Definition at line 42 of file OMPartial.h.
typedef std::vector<unsigned int> Rcs::OMPartial::IndexList |
Definition at line 45 of file OMPartial.h.
Rcs::OMPartial::OMPartial | ( | ObservationModel * | wrapped, |
IndexList | indices, | ||
bool | exclude = false |
||
) |
Create a partial observation model using only the specified indices.
wrapped | wrapped observation model. takes ownership. |
indices | selected indices. Applied to both state and velocity, assuming their dimensions are equal. |
exclude | set to true to invert the mask and keep only observations not in indices. |
Definition at line 92 of file OMPartial.cpp.
Rcs::OMPartial::OMPartial | ( | ObservationModel * | wrapped, |
IndexList | stateIndices, | ||
IndexList | velocityIndices, | ||
bool | exclude = false |
||
) |
Create a partial observation model using only the specified indices.
wrapped | wrapped observation model. takes ownership. |
stateIndices | selected indices for state. |
velocityIndices | selected indices for velocity. |
exclude | set to true to invert the mask and keep only observations not in indices. |
Definition at line 109 of file OMPartial.cpp.
|
virtual |
Definition at line 174 of file OMPartial.cpp.
|
delete |
|
delete |
|
virtual |
Implement to fill the observation vector with the observed values.
[out] | state | state observation vector to fill, has getStateDim() elements. |
[out] | velocity | velocity observation vector to fill, has getVelocityDim() elements. |
[in] | currentAction | action in current step. May be NULL if not available. |
[in] | dt | time step since the last observation has been taken |
Implements Rcs::ObservationModel.
Definition at line 199 of file OMPartial.cpp.
|
static |
Create a partial observation model using a boolean mask. The mask is applied to both state and velocity, assuming their dimensions are equal.
wrapped | wrapped observation model. takes ownership. |
mask | true entries will be kept. |
exclude | set to true to invert the mask |
Definition at line 116 of file OMPartial.cpp.
|
static |
Create a partial observation model using a boolean mask.
wrapped | wrapped observation model. takes ownership. |
stateMask | mask for state. Length must match wrapped->getStateDim(). |
velocityMask | mask for velocity. Length must match wrapped->getVelocityDim(). |
exclude | set to true to invert the mask |
Definition at line 124 of file OMPartial.cpp.
|
static |
Create a partial observation model using a boolean mask.
wrapped | wrapped observation model. takes ownership. |
names | selected entry names |
exclude | set to true to invert the mask |
autoSelectVelocity | set to true to automatically exclude the velocity corresponding to a state name |
Definition at line 133 of file OMPartial.cpp.
|
virtual |
Provides the minimum and maximum observable values. Since the velocity is symmetric, only the maximum needs to be provided. The default implementation uses -inf and inf.
[out] | minState | minimum state vector to fill, has getStateDim() elements. |
[out] | maxState | maximum state vector to fill, has getStateDim() elements. |
[out] | maxVelocity | maximum velocity vector to fill, has getVelocityDim() elements. |
Reimplemented from Rcs::ObservationModel.
Definition at line 220 of file OMPartial.cpp.
|
virtual |
List directly nested observation models. The default implementation returns an empty list, since there are no nested models.
Reimplemented from Rcs::ObservationModel.
Definition at line 267 of file OMPartial.cpp.
|
virtual |
The number of state variables.
Implements Rcs::ObservationModel.
Definition at line 189 of file OMPartial.cpp.
|
virtual |
Provides names for each state entry.
Reimplemented from Rcs::ObservationModel.
Definition at line 246 of file OMPartial.cpp.
|
virtual |
The number of velocity variables. The default implementation assumes that for each state there is a velocity.
Reimplemented from Rcs::ObservationModel.
Definition at line 194 of file OMPartial.cpp.
|
virtual |
Provides names for each velocity entry. The default implementation derives the names from getStateNames(), appending a 'd' to each name.
Reimplemented from Rcs::ObservationModel.
Definition at line 254 of file OMPartial.cpp.
|
virtual |
Reset any internal state. This is called to begin a new episode. It should also reset values depending on modifiable physics parameters. This is an optional operation, so the default implementation does nothing.
Reimplemented from Rcs::ObservationModel.
Definition at line 262 of file OMPartial.cpp.
|
private |
Definition at line 126 of file OMPartial.h.
|
private |
Definition at line 127 of file OMPartial.h.
|
private |
Definition at line 123 of file OMPartial.h.