ECF 1.5
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
AntEvalOp Class Reference

Artificial ant evaluation class (and environment simulator) More...

#include <AntEvalOp.h>

Inheritance diagram for AntEvalOp:
EvaluateOp

Public Member Functions

void registerParameters (StateP)
 Register evaluator parameters. Called before EvaluateOp::initialize method. More...
 
FitnessP evaluate (IndividualP individual)
 Evaluation function, simulates ant movement and counts the eaten food. More...
 
bool initialize (StateP)
 Initialize the simulator, read environments from input file. More...
 
void turnLeft ()
 Turn ant on the left. More...
 
bool facingFood ()
 Check if there's food in front. More...
 
void turnRight ()
 Turn ant on the right. More...
 
void moveAhead ()
 Move ant ahead. More...
 
virtual FitnessP evaluate (IndividualP)=0
 Evaluate a single individual. Method must create and return a Fitness object. More...
 
virtual void registerParameters (StateP)
 Register evaluator parameters. Called before EvaluateOp::initialize method. More...
 
virtual bool initialize (StateP)
 Initialize the evaluator. Called before first evaluation occurs. More...
 

Static Public Attributes

static bool trace = false
 trace the ant's movement in the simulator (for visual output) More...
 
static bool step = false
 show the ant's movement interactive step by step (no effect if trace is false!) More...
 

Protected Member Functions

void showStep (string action)
 Show the ant's current action (interactive) More...
 

Protected Attributes

uint x_
 
uint y_
 
uint facing_
 
uint moves_
 
uint foodEaten_
 
std::vector< uint > rowNo
 
std::vector< uint > columnNo
 
std::vector< uint > maxSteps
 
std::vector< uint > foodNo
 
std::vector< char * > board
 
uint tmpRow
 
uint tmpColumn
 
uint tmpMaxSteps
 
uint tmpFoodNo
 
uint boardNo
 
uint boardNo2
 
char * tmpBoard
 
StateP state_
 
string currentTree
 

Static Protected Attributes

static const char LEFT = '<'
 
static const char RIGHT = '>'
 
static const char UP = '^'
 
static const char DOWN = 'v'
 

Friends

ostream & operator<< (ostream &os, AntEvalOp &ant)
 Output the current state of the board (show ant movements) More...
 

Detailed Description

Artificial ant evaluation class (and environment simulator)

Definition at line 50 of file AntEvalOp.h.

Member Function Documentation

◆ evaluate()

FitnessP AntEvalOp::evaluate ( IndividualP  individual)
virtual

Evaluation function, simulates ant movement and counts the eaten food.

Implements EvaluateOp.

Definition at line 98 of file AntEvalOp.cpp.

◆ facingFood()

bool AntEvalOp::facingFood ( )

Check if there's food in front.

Definition at line 256 of file AntEvalOp.cpp.

◆ initialize()

bool AntEvalOp::initialize ( StateP  state)
virtual

Initialize the simulator, read environments from input file.

Reimplemented from EvaluateOp.

Definition at line 45 of file AntEvalOp.cpp.

◆ moveAhead()

void AntEvalOp::moveAhead ( )

Move ant ahead.

Definition at line 211 of file AntEvalOp.cpp.

◆ registerParameters()

void AntEvalOp::registerParameters ( StateP  )
virtual

Register evaluator parameters. Called before EvaluateOp::initialize method.

Reimplemented from EvaluateOp.

Definition at line 35 of file AntEvalOp.cpp.

◆ showStep()

void AntEvalOp::showStep ( string  action)
protected

Show the ant's current action (interactive)

Definition at line 277 of file AntEvalOp.cpp.

◆ turnLeft()

void AntEvalOp::turnLeft ( )

Turn ant on the left.

Definition at line 183 of file AntEvalOp.cpp.

◆ turnRight()

void AntEvalOp::turnRight ( )

Turn ant on the right.

Definition at line 197 of file AntEvalOp.cpp.

Friends And Related Function Documentation

◆ operator<<

ostream & operator<< ( ostream &  os,
AntEvalOp ant 
)
friend

Output the current state of the board (show ant movements)

Definition at line 23 of file AntEvalOp.cpp.

Member Data Documentation

◆ board

std::vector<char*> AntEvalOp::board
protected

Definition at line 65 of file AntEvalOp.h.

◆ boardNo

uint AntEvalOp::boardNo
protected

Definition at line 72 of file AntEvalOp.h.

◆ boardNo2

uint AntEvalOp::boardNo2
protected

Definition at line 73 of file AntEvalOp.h.

◆ columnNo

std::vector<uint> AntEvalOp::columnNo
protected

Definition at line 62 of file AntEvalOp.h.

◆ currentTree

string AntEvalOp::currentTree
protected

Definition at line 80 of file AntEvalOp.h.

◆ DOWN

const char AntEvalOp::DOWN = 'v'
staticprotected

Definition at line 79 of file AntEvalOp.h.

◆ facing_

uint AntEvalOp::facing_
protected

Definition at line 56 of file AntEvalOp.h.

◆ foodEaten_

uint AntEvalOp::foodEaten_
protected

Definition at line 58 of file AntEvalOp.h.

◆ foodNo

std::vector<uint> AntEvalOp::foodNo
protected

Definition at line 64 of file AntEvalOp.h.

◆ LEFT

const char AntEvalOp::LEFT = '<'
staticprotected

Definition at line 79 of file AntEvalOp.h.

◆ maxSteps

std::vector<uint> AntEvalOp::maxSteps
protected

Definition at line 63 of file AntEvalOp.h.

◆ moves_

uint AntEvalOp::moves_
protected

Definition at line 57 of file AntEvalOp.h.

◆ RIGHT

const char AntEvalOp::RIGHT = '>'
staticprotected

Definition at line 79 of file AntEvalOp.h.

◆ rowNo

std::vector<uint> AntEvalOp::rowNo
protected

Definition at line 61 of file AntEvalOp.h.

◆ state_

StateP AntEvalOp::state_
protected

Definition at line 76 of file AntEvalOp.h.

◆ step

bool AntEvalOp::step = false
static

show the ant's movement interactive step by step (no effect if trace is false!)

Definition at line 86 of file AntEvalOp.h.

◆ tmpBoard

char* AntEvalOp::tmpBoard
protected

Definition at line 74 of file AntEvalOp.h.

◆ tmpColumn

uint AntEvalOp::tmpColumn
protected

Definition at line 69 of file AntEvalOp.h.

◆ tmpFoodNo

uint AntEvalOp::tmpFoodNo
protected

Definition at line 71 of file AntEvalOp.h.

◆ tmpMaxSteps

uint AntEvalOp::tmpMaxSteps
protected

Definition at line 70 of file AntEvalOp.h.

◆ tmpRow

uint AntEvalOp::tmpRow
protected

Definition at line 68 of file AntEvalOp.h.

◆ trace

bool AntEvalOp::trace = false
static

trace the ant's movement in the simulator (for visual output)

Definition at line 85 of file AntEvalOp.h.

◆ UP

const char AntEvalOp::UP = '^'
staticprotected

Definition at line 79 of file AntEvalOp.h.

◆ x_

uint AntEvalOp::x_
protected

Definition at line 55 of file AntEvalOp.h.

◆ y_

uint AntEvalOp::y_
protected

Definition at line 55 of file AntEvalOp.h.


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