CaEvaluator Class Reference

#include <Ca.h>

List of all members.


Detailed Description

CA evaluator runs the given CA and evaluates its fitness for the desired purpose.

Moreover it can gathers various statistics about the CA's run, mostly useful to present the found solution to user.

Definition at line 282 of file Ca.h.


Public Member Functions

 CaEvaluator (const IGate &gate, const IGateBinding &binding, const CaEvalParams &params)
 
Parameters:
gate Gate definition used to compute CA's fitness.

 ~CaEvaluator ()
size_t caSize () const
 Return size of CA in one direction.
float eval (const ICaRules *ca)
 Evaluate given CA and compute its fitness.
bool cntSteps (const ICaRules *ca, unsigned &min, unsigned &max)
 Simulate given CA and check how much steps it needs to compute the desired result.
void simulate (const ICaRules *ca, std::ostream &str, TBus in)
 Simulate given CA for given input and dump to stream in human-readable (colorized if possible) format.
void simulate (const ICaRules *ca, std::ostream &str)
 Simulate given CA for all possible inputs and dump to stream in human-readable (colorized if possible) format.

Private Attributes

Private * d

Constructor & Destructor Documentation

CaEvaluator ( const IGate gate,
const IGateBinding binding,
const CaEvalParams params 
)

Parameters:
gate Gate definition used to compute CA's fitness.

Parameters:
binding Binding object defining gate-CA signals mapping.
params Additional evaluation parameters.

Definition at line 209 of file Ca.cpp.

References IGateBinding::clone(), IGate::clone(), and d.

Here is the call graph for this function:

~CaEvaluator (  ) 

Definition at line 220 of file Ca.cpp.

References d.


Member Function Documentation

size_t caSize (  )  const

Return size of CA in one direction.

Definition at line 226 of file Ca.cpp.

References d.

Referenced by CaDesigner::CaDesigner(), main(), and simulate().

Here is the caller graph for this function:

float eval ( const ICaRules ca  ) 

Evaluate given CA and compute its fitness.

Parameters:
ca Non-uniform CA defined by the set of rules.
Returns:
Return CA's fitness in the range <0, 1>. 0 means useless, 1 means "solution found".

Definition at line 230 of file Ca.cpp.

References applyRules(), d, IGateBinding::getOutput(), and IGateBinding::setInput().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

bool cntSteps ( const ICaRules ca,
unsigned &  min,
unsigned &  max 
)

Simulate given CA and check how much steps it needs to compute the desired result.

The maximum is bounded by params.nSteps value given as initialization parameter.

Parameters:
ca Non-uniform CA defined by the set of rules.
min Destination to store minimal steps value.
max Destination to store maximal steps value.

Definition at line 288 of file Ca.cpp.

References applyRules(), d, IGateBinding::getOutput(), and IGateBinding::setInput().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

void simulate ( const ICaRules ca,
std::ostream &  str,
TBus  in 
)

Simulate given CA for given input and dump to stream in human-readable (colorized if possible) format.

Parameters:
ca Non-uniform CA defined by the set of rules.
str Standard output stream to dump the output.
in Desired gate's input to simulate CA for.

Definition at line 381 of file Ca.cpp.

References applyRules(), C_LIGHT_BLUE, C_NO_COLOR, caSize(), d, IGateBinding::setInput(), IGateBinding::setOutput(), and writeCaState().

Referenced by main(), and simulate().

Here is the call graph for this function:

Here is the caller graph for this function:

void simulate ( const ICaRules ca,
std::ostream &  str 
)

Simulate given CA for all possible inputs and dump to stream in human-readable (colorized if possible) format.

Parameters:
str Standard output stream to dump the output.
ca Non-uniform CA defined by the set of rules.

Definition at line 417 of file Ca.cpp.

References C_LIGHT_GREEN, C_NO_COLOR, d, and simulate().

Here is the call graph for this function:


Member Data Documentation

Private* d [private]

Definition at line 336 of file Ca.h.

Referenced by CaEvaluator(), caSize(), cntSteps(), eval(), simulate(), and ~CaEvaluator().


The documentation for this class was generated from the following files:
Generated on Sat May 2 16:39:37 2009 for nucad by  doxygen 1.5.4