Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OSCAR::Perturbation Class Reference
[DecisionMaking]

Perturbation can be called to generate patterned perturbations for Vector and RRJointVector. More...

#include <Perturbation.h>

Inheritance diagram for OSCAR::Perturbation:

Inheritance graph
[legend]
List of all members.

Public Types

enum  SearchPattern { Simple, Factorial, Simfact, Exhaustive }

Public Methods

 Perturbation (unsigned int size, SearchPattern pattern=Simple, double delta=1.0)
 Perturbation (const Perturbation &rhs)
Perturbation & operator= (const Perturbation &rhs)
virtual ~Perturbation ()
unsigned int SetSearchPattern (SearchPattern pattern)
SearchPattern GetSearchPattern () const
int SetInput (const Vector &inputVector)
int SetInput (const CoordinateVector &inputCoordinateVector)
unsigned int GetNoOfOptions () const
bool SetPerturbedValues (double delta)
bool SetPerturbedValues (const Vector &_deltas)
bool GetOptions (VectorArray &outputs)
bool GetNextOption (Vector &output)
void Reset ()

Protected Methods

void calculateNoOfOptions ()
bool simpleSearch (VectorArray &outputs)
bool factorialSearch (VectorArray &outputs)
bool simfactSearch (VectorArray &outputs)
bool exhaustiveSearch (VectorArray &outputs)
bool simpleSearch (unsigned int count, Vector &output)
bool factorialSearch (unsigned int count, Vector &output)
bool simfactSearch (unsigned int count, Vector &output)
bool exhaustiveSearch (unsigned int count, Vector &output)
void updateActivePerturbedValues ()
void reallocateObjects ()

Protected Attributes

unsigned int size
unsigned int noOfOptions
SearchPattern pattern
Vector initialInput
Vector perturbedValues
BoolArray perturbedJoints
VectoractivePerturbedValues
unsigned int count
VectorplaceHolder
Vectorprevious
Vector fullPrevious
unsigned int perturbationSize

Detailed Description

Author:
Chalongrath Pholsiri

Generates patterned perturbations for Vector and RRJointVector, to be used primarily in GenerateOptions and GenerateManifold algorithms. But can also be used for other things that need perturbations too. Four search patterns are available: Simple, Factorial, Simfact, and Exhaustive. See Richard Hooper's for descriptions of these pattern. Simfact, however, is a new one and it is the combination of Simple and Factorial. If you need partial perturbations (i.e. only some elements are perturbed), use RRJointVector and set the elements that you want perturbed to 'Active'. Use of Vector will result in full perturbations.


Member Enumeration Documentation

enum OSCAR::Perturbation::SearchPattern
 

Enumeration values:
Simple 
Factorial 
Simfact 
Exhaustive 


Constructor & Destructor Documentation

OSCAR::Perturbation::Perturbation unsigned int    size,
SearchPattern    pattern = Simple,
double    delta = 1.0
 

Constructor.

This is the Constructor for an object of type Perturbation. Use this to construct an Perturbation object with specified parameters, or with the default ones.

Parameters:
size Specifies the size of the vector to be perturbed.
pattern Specifies the search pattern. Must be one of the followings: Simple, Factorial, Simfact, and Exhaustive The default is Simple. See Richard Hooper's dissertation for description of these search patterns. Simfact search pattern is a combination of Simple and Factorial patterns.
delta Specifies the perturbation size for all elements of the vector. Default to 1.0

OSCAR::Perturbation::Perturbation const Perturbation &    rhs
 

Copy constructor.

Parameters:
rhs A Perturbation from which will be copied.

virtual OSCAR::Perturbation::~Perturbation   [virtual]
 

Virtual Destructor.

This is the Destructor for an object of type Perturbation.


Member Function Documentation

void OSCAR::Perturbation::calculateNoOfOptions   [protected]
 

bool OSCAR::Perturbation::exhaustiveSearch unsigned int    count,
Vector   output
[protected]
 

bool OSCAR::Perturbation::exhaustiveSearch VectorArray   outputs [protected]
 

bool OSCAR::Perturbation::factorialSearch unsigned int    count,
Vector   output
[protected]
 

bool OSCAR::Perturbation::factorialSearch VectorArray   outputs [protected]
 

bool OSCAR::Perturbation::GetNextOption Vector   output
 

Get the next output of perturbation process (option) one at a time.

This method performs next perturbation and store the result in the parameter.

Parameters:
output A constant Vector reference that will store the perturbation result.
Returns:
false if the size of output does not math the size specified in the contructor or if there is no more option to be generated for the specified search pattern and true otherwise.
Exceptions:
vectorSizeMismatch vectorSizeMismatch
See also:
GetOptions(VectorArray& outputs)

Reset()

unsigned int OSCAR::Perturbation::GetNoOfOptions   const
 

Get the total number of options that the object will generate.

This constant method returns the total number of options that the object will generate. Call this method before calling GetOptions(VectorArray&) to set the size of that VectorArray object.

Returns:
The total number of options.
See also:
GetOptions(VectorArray& outputs)

bool OSCAR::Perturbation::GetOptions VectorArray   outputs
 

Get the outputs of perturbation process (options) all at once.

This method performs the perturbations and store the results in the parameter.

Parameters:
outputs A constant VectorArray reference that will store the perturbation results.
Returns:
false false if the size of outputs does not match the total number of options (which can be queried from GetNoOfOptions() or if the vector size of outputs does not math the size specified in the contructor and true otherwise.
Exceptions:
arraySizeMismatch arraySizeMismatch
vectorSizeMismatch vectorSizeMismatch
See also:
GetNextOption(Vector& output)

GetNoOfOptions()

SearchPattern OSCAR::Perturbation::GetSearchPattern   const
 

Get the current search pattern.

This constant method returns the current search pattern of the object.

Returns:
The current search pattern.
See also:
SetSearchPattern(SearchPattern pattern)

Perturbation& OSCAR::Perturbation::operator= const Perturbation &    rhs
 

Assignment operator.

Parameters:
rhs A Perturbation from which will be copied.

void OSCAR::Perturbation::reallocateObjects   [protected]
 

void OSCAR::Perturbation::Reset  
 

Call this method to reset GetNextOption(Vector&).

When one wants the Perturbation object to start generating the first option again, call this function

See also:
GetNextOption(Vector& output)

int OSCAR::Perturbation::SetInput const CoordinateVector   inputCoordinateVector
 

Set base vector from which the partial perturbations occur.

This method sets base vector from which the perturbations occur. The perturbations will occur only at the active elements of the parameter.

Parameters:
inputCoordinateVector A CoordinateVector reference that acts as the base for partial perturbations.
Returns:
The number of options if no errors and -1 otherwise.
Exceptions:
vectorSizeMismatch vectorSizeMismatch
See also:
SetInput(const Vector& inputVector)

CoordinateVector

int OSCAR::Perturbation::SetInput const Vector   inputVector
 

Set base vector from which the full perturbations occur.

This method sets base vector from which the full perturbations occur. The perturbations will occur at all the elements of the parameter. For partial perturbations, use SetInput(const RRJointVector&).

Parameters:
inputVector A Vector reference that acts as the base for perturbations.
Returns:
The number of options if no errors and -1 otherwise.
Exceptions:
vectorSizeMismatch vectorSizeMismatch
See also:
SetInput(const RRJointVector& inputJointVector)

bool OSCAR::Perturbation::SetPerturbedValues const Vector   _deltas
 

Set different perturbed values for individual elements.

This method sets different perturbed values for individual elements of the object.

Parameters:
_deltas A constant Vector reference containing the perturbation values for individual elements.
Returns:
false false if the size of _deltas does not match the size specified in the contructor and true otherwise.
Exceptions:
vectorSizeMismatch vectorSizeMismatch
See also:
SetPerturbedValues(double delta)

bool OSCAR::Perturbation::SetPerturbedValues double    delta
 

Set the same perturbed value for all elements.

This method sets the perturbed value for all the elements to the value of the parameter.

Parameters:
delta Perturbed value. Must be a positive number.
Returns:
false if delta is less than zero and true otherwise.
See also:
SetPerturbedValues(const Vector& _deltas)

unsigned int OSCAR::Perturbation::SetSearchPattern SearchPattern    pattern
 

Set the search pattern.

This method sets the search pattern to the value of the parameter. After a call to this method, the user should either use the return value or call GetNoOptions() to set the size of an VectorArray object before calling GetOptions(VectorArray&).

Parameters:
pattern A pattern that you want to set. Must be one of the followings: Simple, Factorial, Simfact, and Exhaustive
Returns:
The number of options for that search pattern.
See also:
GetSearchPattern()

GetNoOfOptions()

GetOptions(VectorArray& options)

bool OSCAR::Perturbation::simfactSearch unsigned int    count,
Vector   output
[protected]
 

bool OSCAR::Perturbation::simfactSearch VectorArray   outputs [protected]
 

bool OSCAR::Perturbation::simpleSearch unsigned int    count,
Vector   output
[protected]
 

bool OSCAR::Perturbation::simpleSearch VectorArray   outputs [protected]
 

void OSCAR::Perturbation::updateActivePerturbedValues   [protected]
 


Member Data Documentation

Vector* OSCAR::Perturbation::activePerturbedValues [protected]
 

unsigned int OSCAR::Perturbation::count [protected]
 

Vector OSCAR::Perturbation::fullPrevious [protected]
 

Vector OSCAR::Perturbation::initialInput [protected]
 

unsigned int OSCAR::Perturbation::noOfOptions [protected]
 

SearchPattern OSCAR::Perturbation::pattern [protected]
 

unsigned int OSCAR::Perturbation::perturbationSize [protected]
 

BoolArray OSCAR::Perturbation::perturbedJoints [protected]
 

Vector OSCAR::Perturbation::perturbedValues [protected]
 

Vector* OSCAR::Perturbation::placeHolder [protected]
 

Vector* OSCAR::Perturbation::previous [protected]
 

unsigned int OSCAR::Perturbation::size [protected]
 


The documentation for this class was generated from the following file:
RRG Homepage OSCAR Overview OSCAR Tutorials Simulations