# ParadisEO-MOMovingObjects: moRandImprSelect< M > Class Template Reference

# 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 &_fitness)
| Procedure which all that needs a moRandImprSelect.
bool | update (const M &_move, const Fitness &_fitness)
| Function that updates the fitness and move vectors.
void | operator() (M &_move, Fitness &_fitness)
| The move selection.

## Private Attributes

Fitness | initial_fitness
| Fitness of the current solution.
std::vector< Fitness > | better_fitnesses
| Candidate fitnesse vector.
std::vector< M > | 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 49 of file moRandImprSelect.h.

## Member Function Documentation

template<class M>

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

Procedure which all that needs a moRandImprSelect.

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

Parameters:

  | _fitness | the current best fitness

Implements moMoveSelect< M >.

Definition at line 63 of file moRandImprSelect.h.

References moRandImprSelect< M >::better_fitnesses, moRandImprSelect< M >::better_moves, and moRandImprSelect< M >::initial_fitness.

template<class M>

bool moRandImprSelect< M >::update | ( | const M & | _move,
|  | const Fitness & | _fitness |
| ) |  |  | `[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.
  | _fitness | a new fitness associated to the new move.

Returns:
  true.

Implements moMoveSelect< M >.

Definition at line 79 of file moRandImprSelect.h.

References moRandImprSelect< M >::better_fitnesses, moRandImprSelect< M >::better_moves, and moRandImprSelect< M >::initial_fitness.

template<class M>

void moRandImprSelect< M >::operator() | ( | M & | _move,
|  | Fitness & | _fitness |
| ) |  |  | `[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.
  | _fitness | the reference of the fitness that can be initialised by the function.

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

Definition at line 98 of file moRandImprSelect.h.

References moRandImprSelect< M >::better_fitnesses, moRandImprSelect< M >::better_moves, and eoRng::random().

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

- moRandImprSelect.h