#include <CaDesigner.h>
Mostly copy-pasted from FSS (Fast SAT Solver) project.
Definition at line 265 of file CaDesigner.h.
Public Member Functions | |
virtual | ~CaDesigner () |
const GAStatistics & | getStatistics () const |
Return useful statistic data managed by GAStatistics class. | |
int | getSolutionsCount () |
Return total count of solutions alredy found by designer. | |
int | stopAtGeneration () const |
Return current limit for count of generations. | |
float | minFitness () |
float | avgFitness () |
float | maxFitness () |
virtual void | start () |
Start process execution. | |
virtual void | stop () |
Stop currently executed process as soon as possible. | |
virtual void | reset () |
Reset process to its initial state. | |
virtual long | getTimeElapsed () |
Returns time elapsed by activity. | |
virtual int | getStepsCount () |
Returns current step number. | |
virtual void | addObserver (IObserver *) |
Add observer to list of listeners. | |
Static Public Member Functions | |
static CaDesigner * | create (CaEvaluator *evaluator) |
Use this to create CaDesigner object instead of calling constructor directly. | |
Protected Member Functions | |
CaDesigner (CaEvaluator *evaluator) | |
Non-public constructor. | |
virtual void | initialize () |
Initialize process. | |
virtual void | doStep () |
Do one step of process. | |
void | notify () |
Send notification to all observers (listeners). | |
Private Attributes | |
Private * | d |
~CaDesigner | ( | ) | [virtual] |
CaDesigner | ( | CaEvaluator * | evaluator | ) | [protected] |
Non-public constructor.
Use static method create() instead.
Definition at line 166 of file CaDesigner.cpp.
References CaEvaluator::caSize(), d, GA_INITAL_NGEN, GA_POP_SIZE, and RULE_WIDTH.
Referenced by create().
CaDesigner * create | ( | CaEvaluator * | evaluator | ) | [static] |
Use this to create CaDesigner object instead of calling constructor directly.
evaluator | An instance of CaEvaluator object which has to be valid until CaDesigner is destroeyd. |
Definition at line 192 of file CaDesigner.cpp.
References CaDesigner(), and initialize().
Referenced by main().
const GAStatistics & getStatistics | ( | ) | const |
Return useful statistic data managed by GAStatistics class.
Definition at line 198 of file CaDesigner.cpp.
References d.
Referenced by ResultsWatch::notify(), FitnessWatch::notify(), and writeStats().
int getSolutionsCount | ( | ) |
Return total count of solutions alredy found by designer.
Definition at line 202 of file CaDesigner.cpp.
References d.
Referenced by ResultsWatch::notify().
int stopAtGeneration | ( | ) | const |
Return current limit for count of generations.
Definition at line 206 of file CaDesigner.cpp.
References d.
Referenced by writeStats().
float minFitness | ( | ) |
Definition at line 210 of file CaDesigner.cpp.
References d.
Referenced by writeStats().
float avgFitness | ( | ) |
Definition at line 214 of file CaDesigner.cpp.
References d.
Referenced by writeStats().
float maxFitness | ( | ) |
Definition at line 218 of file CaDesigner.cpp.
References d.
Referenced by FitnessWatch::FitnessWatch(), and FitnessWatch::notify().
void initialize | ( | ) | [protected, virtual] |
Initialize process.
Implements AbstractProcess.
Definition at line 223 of file CaDesigner.cpp.
References d, and GA_INITAL_NGEN.
Referenced by create().
void doStep | ( | ) | [protected, virtual] |
Do one step of process.
Implements AbstractProcess.
Definition at line 231 of file CaDesigner.cpp.
References C_NO_COLOR, C_YELLOW, d, and AbstractProcessWatched::stop().
void start | ( | ) | [virtual, inherited] |
Start process execution.
This method returns control after process ends (or after it is stopped by stop() or reset() method)
Reimplemented from AbstractProcess.
Definition at line 399 of file CaDesigner.cpp.
References AbstractProcess::start().
void stop | ( | ) | [virtual, inherited] |
Stop currently executed process as soon as possible.
Reimplemented from AbstractProcess.
Definition at line 406 of file CaDesigner.cpp.
References AbstractProcess::stop().
Referenced by doStep().
void reset | ( | ) | [virtual, inherited] |
Reset process to its initial state.
Reimplemented from AbstractProcess.
Definition at line 415 of file CaDesigner.cpp.
References AbstractProcess::reset().
long getTimeElapsed | ( | ) | [virtual, inherited] |
Returns time elapsed by activity.
Definition at line 422 of file CaDesigner.cpp.
Referenced by writeStats().
int getStepsCount | ( | ) | [virtual, inherited] |
Returns current step number.
Definition at line 369 of file CaDesigner.cpp.
void addObserver | ( | IObserver * | observer | ) | [virtual, inherited] |
Add observer to list of listeners.
observer | Observer object to add to list of listeners. |
Design pattern observer
Implements ISubject.
Definition at line 320 of file CaDesigner.cpp.
void notify | ( | ) | [protected, inherited] |
Send notification to all observers (listeners).
Definition at line 324 of file CaDesigner.cpp.
References IObserver::notify().
Referenced by AbstractProcess::start().
Private* d [private] |
Reimplemented from AbstractProcessWatched.
Definition at line 307 of file CaDesigner.h.
Referenced by avgFitness(), CaDesigner(), doStep(), getSolutionsCount(), getStatistics(), initialize(), maxFitness(), minFitness(), stopAtGeneration(), and ~CaDesigner().