MRPT  1.9.9
List of all members | Public Member Functions | Private Attributes
CAStarExample Class Reference

Detailed Description

To use the template, a class must be derived from CAStarAlgorithm<Solution class>="">.

In this case, the Solution Class is CCoinDistribution.

Definition at line 65 of file vision_stereo_rectify/test.cpp.

Inheritance diagram for CAStarExample:

Public Member Functions

 CAStarExample (size_t goal)
 When a class derives from CAStarAlgorithm, its constructor should include all the data that define the specific problem. More...
 
bool isSolutionEnded (const CCoinDistribution &s) override
 The following five methods must be implemented to use the algorithm: More...
 
bool isSolutionValid (const CCoinDistribution &s) override
 Client code must implement this method. More...
 
void generateChildren (const CCoinDistribution &s, vector< CCoinDistribution > &sols) override
 Client code must implement this method. More...
 
double getHeuristic (const CCoinDistribution &s) override
 Client code must implement this method. More...
 
double getCost (const CCoinDistribution &s) override
 Client code must implement this method. More...
 
int getOptimalSolution (const CCoinDistribution &initialSol, CCoinDistribution &finalSol, double upperLevel=HUGE_VAL, double maxComputationTime=HUGE_VAL)
 Finds the optimal solution for a problem, using the A* algorithm. More...
 

Private Attributes

const size_t N
 Problem goal. More...
 

Constructor & Destructor Documentation

◆ CAStarExample()

CAStarExample::CAStarExample ( size_t  goal)
inline

When a class derives from CAStarAlgorithm, its constructor should include all the data that define the specific problem.

Definition at line 78 of file vision_stereo_rectify/test.cpp.

Member Function Documentation

◆ generateChildren()

void CAStarExample::generateChildren ( const CCoinDistribution sol,
vector< CCoinDistribution > &  sols 
)
inlineoverridevirtual

Client code must implement this method.

Given a partial solution, returns all its children solution, regardless of their validity or completeness.

Implements mrpt::graphs::CAStarAlgorithm< CCoinDistribution >.

Definition at line 90 of file vision_stereo_rectify/test.cpp.

◆ getCost()

double CAStarExample::getCost ( const CCoinDistribution sol)
inlineoverridevirtual

Client code must implement this method.

Given a (possibly partial) solution, calculates its cost so far. This cost must not decrease with each step. That is, a solution cannot have a smaller cost than the previous one from which it was generated.

Implements mrpt::graphs::CAStarAlgorithm< CCoinDistribution >.

Definition at line 108 of file vision_stereo_rectify/test.cpp.

◆ getHeuristic()

double CAStarExample::getHeuristic ( const CCoinDistribution sol)
inlineoverridevirtual

Client code must implement this method.

Given a partial solution, estimates the cost of the remaining (unknown) part. This cost must always be greater or equal to zero, and not greater than the actual cost. Thus, must be 0 if the solution is complete.

Implements mrpt::graphs::CAStarAlgorithm< CCoinDistribution >.

Definition at line 102 of file vision_stereo_rectify/test.cpp.

◆ getOptimalSolution()

int mrpt::graphs::CAStarAlgorithm< CCoinDistribution >::getOptimalSolution ( const CCoinDistribution initialSol,
CCoinDistribution finalSol,
double  upperLevel = HUGE_VAL,
double  maxComputationTime = HUGE_VAL 
)
inlineinherited

Finds the optimal solution for a problem, using the A* algorithm.

Returns whether an optimal solution was actually found. Returns 0 if no solution was found, 1 if an optimal solution was found and 2 if a (possibly suboptimal) solution was found but the time lapse ended.

Definition at line 91 of file CAStarAlgorithm.h.

References mrpt::graphs::CAStarAlgorithm< T >::generateChildren(), mrpt::graphs::CAStarAlgorithm< T >::getTotalCost(), mrpt::graphs::CAStarAlgorithm< T >::isSolutionEnded(), mrpt::graphs::CAStarAlgorithm< T >::isSolutionValid(), mrpt::system::CTicTac::Tac(), and mrpt::system::CTicTac::Tic().

◆ isSolutionEnded()

bool CAStarExample::isSolutionEnded ( const CCoinDistribution s)
inlineoverridevirtual

The following five methods must be implemented to use the algorithm:

Implements mrpt::graphs::CAStarAlgorithm< CCoinDistribution >.

Definition at line 82 of file vision_stereo_rectify/test.cpp.

◆ isSolutionValid()

bool CAStarExample::isSolutionValid ( const CCoinDistribution sol)
inlineoverridevirtual

Client code must implement this method.

Returns true if the given solution is acceptable, that is, doesn't violate the problem logic.

Implements mrpt::graphs::CAStarAlgorithm< CCoinDistribution >.

Definition at line 86 of file vision_stereo_rectify/test.cpp.

Member Data Documentation

◆ N

const size_t CAStarExample::N
private

Problem goal.

Definition at line 71 of file vision_stereo_rectify/test.cpp.




Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 0cbd40372 Sun Nov 17 09:43:05 2019 +0100 at dom nov 17 09:45:09 CET 2019