solver  1.0
Public Member Functions | Private Attributes | List of all members
UnimodalFunctionHeuristic Class Reference

An unimodal function for two movements and their fixed total time. More...

+ Collaboration diagram for UnimodalFunctionHeuristic:

Public Member Functions

 UnimodalFunctionHeuristic (Movement *mv1, Movement *mv2, double duration)
 Constructor initializes the member variables. More...
 
double tolerance () const
 
pair< double, double > durations (const double &alpha) const
 Calculates durations of the movements based on the relative step. More...
 
double functionValue (const double &alpha) const
 Returns a function value, i.e. total energy consumption of both movements. More...
 

Private Attributes

double mDirection
 A maximal possible difference in duration for both the movements.
 
double mFromX
 The minimal duration of the first movement.
 
double mToX
 The maximal duration of the first movement.
 
MovementmMv1
 The first movement to be considered.
 
MovementmMv2
 The second movement to be considered.
 
double mTotalDuration
 The time needed for both the movements is equal to this fixed value.
 

Detailed Description

An unimodal function for two movements and their fixed total time.

An unimodal convex function, represented by this class, can be used in the Golden Section search algorithm to find optimal timing of two movements where their total time is fixed.

See also
goldenSearch, HeuristicAlgorithms::heuristicLocationChanges

Definition at line 36 of file HeuristicAlgorithms.cpp.

Constructor & Destructor Documentation

UnimodalFunctionHeuristic::UnimodalFunctionHeuristic ( Movement mv1,
Movement mv2,
double  duration 
)
inline

Constructor initializes the member variables.

Parameters
mv1,mv2Movements which optimal duration is to be determined.
durationThe total time, considered to be fixed, needed for both the movements.

Definition at line 43 of file HeuristicAlgorithms.cpp.

Member Function Documentation

pair<double, double> UnimodalFunctionHeuristic::durations ( const double &  alpha) const
inline

Calculates durations of the movements based on the relative step.

Parameters
alphaA step, i.e. a value from 0 to 1, used for obtaining the timing of the movements.

Definition at line 71 of file HeuristicAlgorithms.cpp.

double UnimodalFunctionHeuristic::functionValue ( const double &  alpha) const
inline

Returns a function value, i.e. total energy consumption of both movements.

Parameters
alphaVariable value corresponding to a relative step.

Definition at line 87 of file HeuristicAlgorithms.cpp.

double UnimodalFunctionHeuristic::tolerance ( ) const
inline

As there is no use to solve the timing of movements with too high precision, $10^{-2}\,s$ is enough in the most cases, this method returns a relative tolerance ensuring that Golden Section search is stopped if just enough precise solution is found.

Definition at line 60 of file HeuristicAlgorithms.cpp.


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