- Main Page
- Classes
- Files

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# moRandImprSelect< M > Class Template Reference

One of the possible moMove selector (moMoveSelect). More...

`#include <moRandImprSelect.h>`

Inheritance diagram for moRandImprSelect< M >:

List of all members.

## Public Types
typedef M::EOType::Fitness | Fitness
| Alias for the fitness.
## Public Member Functions
void | init (const Fitness &__fit)
| Procedure which all that needs a moRandImprSelect.
bool | update (const M &__move, const Fitness &__fit)
| Function that updates the fitness and move vectors.
void | operator() (M &__move, Fitness &__fit) throw (EmptySelection)
| The move selection.
## Private Attributes
Fitness | init_fit
| Fitness of the current solution.
std::vector< Fitness > | vect_better_fit
| Candidate fitnesse vector.
std::vector< M > | vect_better_moves
| Candidate move vector.

## Detailed Description

### template<class M>
class moRandImprSelect< M >

One of the possible moMove selector (moMoveSelect).

All the neighbors are considered. One of them that enables an improvment of the objective function is choosen.

Definition at line 25 of file moRandImprSelect.h.

## Member Function Documentation

template<class M>

void moRandImprSelect< M >::init | ( | const Fitness & | __fit | ) | `[inline, virtual]`

Procedure which all that needs a moRandImprSelect.

Give a value to the initialise fitness. Clean the move and fitness vectors.

Parameters:

  | __fit | the current best fitness

Implements moMoveSelect< M >.

Definition at line 40 of file moRandImprSelect.h.

References moRandImprSelect< M >::init_fit, moRandImprSelect< M >::vect_better_fit, and moRandImprSelect< M >::vect_better_moves.

template<class M>

bool moRandImprSelect< M >::update | ( | const M & | __move,
|  | const Fitness & | __fit |
| ) |  |  | `[inline, virtual]`

Function that updates the fitness and move vectors.

if a move give a better fitness than the initial fitness, it is saved and the fitness too.

Parameters:

  | __move | a new move.
  | __fit | a new fitness associated to the new move.

Returns:
  TRUE.

Implements moMoveSelect< M >.

Definition at line 56 of file moRandImprSelect.h.

References moRandImprSelect< M >::init_fit, moRandImprSelect< M >::vect_better_fit, and moRandImprSelect< M >::vect_better_moves.

template<class M>

void moRandImprSelect< M >::operator() | ( | M & | __move,
|  | Fitness & | __fit |
| ) |  |  | throw (EmptySelection)`[inline, virtual]`

The move selection.

One the saved move is randomly chosen.

Parameters:

  | __move | the reference of the move that can be initialised by the function.
  | __fit | the reference of the fitness that can be initialised by the function.

Exceptions:

  | EmptySelection | If no move which improves the current fitness are found.

Implements eoBF< M &, M::EOType::Fitness &, void >.

Definition at line 77 of file moRandImprSelect.h.

References moRandImprSelect< M >::vect_better_fit, and moRandImprSelect< M >::vect_better_moves.

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

- moRandImprSelect.h