MRPT  1.9.9
CCoinDistribution Class Reference

## Detailed Description

This is a example of problem resolution using the CAStarAlgorithm template.

Although this problem is better solved with dynamic programming, it illustrates perfectly how to inherit from that template in order to solve a problem.

Let's assume a currency composed of coins whose values are 2, 7, 8 and 19. The problem consists of finding a minimal set of these coins whose total value equals a given amount.

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

## Public Member Functions

CCoinDistribution ()

size_t money () const
Auxiliary function to calculate the amount of money. More...

bool operator== (const CCoinDistribution &mon) const
Implementing the == operator is mandatory, because it allows the A* algorithm to reject repeated solutions. More...

## Public Attributes

size_t coins2 {0}

size_t coins7 {0}

size_t coins8 {0}

size_t coins19 {0}

## ◆ CCoinDistribution()

 CCoinDistribution::CCoinDistribution ( )
inline

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

## ◆ money()

 size_t CCoinDistribution::money ( ) const
inline

Auxiliary function to calculate the amount of money.

Not strictly necessary, but handy.

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

## ◆ operator==()

 bool CCoinDistribution::operator== ( const CCoinDistribution & mon ) const
inline

Implementing the == operator is mandatory, because it allows the A* algorithm to reject repeated solutions.

Actually, the template should not compile if this operator is not present.

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

## ◆ coins19

 size_t CCoinDistribution::coins19 {0}

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

## ◆ coins2

 size_t CCoinDistribution::coins2 {0}

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

## ◆ coins7

 size_t CCoinDistribution::coins7 {0}

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

## ◆ coins8

 size_t CCoinDistribution::coins8 {0}

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

 Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: cb8dd5fc8 Sat Dec 7 21:55:39 2019 +0100 at sáb dic 7 22:00:13 CET 2019