#include <cEnviroment.h>
List of all members.
Detailed Description
Definition at line 118 of file cEnviroment.h.
Constructor & Destructor Documentation
enviroment::cEnviroment::cEnviroment |
( |
| ) |
|
|
protected |
virtual enviroment::cEnviroment::~cEnviroment |
( |
| ) |
|
|
virtual |
Member Function Documentation
void enviroment::cEnviroment::deleteNotRunningOperations |
( |
| ) |
|
|
private |
This method will delete all operations which are done (respectively stored in the
- See also:
- liOperationsToDelete ).
unsigned long long enviroment::cEnviroment::getAlgorithmIdentifier |
( |
| ) |
|
cIndividual* enviroment::cEnviroment::getBestIndividual |
( |
unsigned long |
lNumber = 1 | ) |
const |
This method returns the lNumber'th best individual. Beware: You have to care for, that the returned individual gets deleted after usage.
- Parameters:
-
lNumber | the number for the individual to return |
- Returns:
- a pointer to the lNumber'th best individual or NULL, if non such exists
const cIndividualInfo* enviroment::cEnviroment::getBestIndividualInfo |
( |
unsigned long |
lNumber = 1 , |
|
|
short |
iLive = 1 |
|
) |
| const |
This method returns the information for the lNumber'th best individual.
- Parameters:
-
lNumber | the number of the individual to return |
iLive | a number which indicate of which kind the individual should be, from which the information is to be returned; possible values: 0 : search the informations of all individuals in the enviroment, regardless if they are living or not 1 : search return the information just of living individuals -1: search return the information just of dead individuals else: an empty list is to be returned; reserved for future use, please don't use this |
- Returns:
- a pointer to the information for the lNumber'th best individual or NULL, if non such exists
static const cChoosOperator* enviroment::cEnviroment::getChoosOperator |
( |
| ) |
|
|
static |
- Returns:
- a pointer to the object for selecting a good operator or NULL, if non such exists;
- See also:
- pChoosOperator
double enviroment::cEnviroment::getCpuRunTime |
( |
| ) |
const |
- Returns:
- the time in secounds the enviroment was running;
- See also:
- isRunning() gives back true for this time
- Returns:
- a pointer to the object for checking the endcondition of the enviroment or NULL, if non such exists;
- See also:
- pEndCondition
time_t enviroment::cEnviroment::getFirstStartTime |
( |
| ) |
const |
- Returns:
- the time the
- See also:
- start() method was called the first time for this enviroment or 0, if non such exists
- Returns:
- A pointer to the object for evaluing the fitness of individuals (respectively the objects they represents).
- See also:
- pObjectFitnessAlgorithm
cIndividual* enviroment::cEnviroment::getIndividual |
( |
| ) |
const |
This method returns the the individual with the given identifier. Beware: You have to care for, that the returned individual gets deleted after usage.
- Parameters:
-
identifier | the identifier for the individual which is to be returned |
- Returns:
- a pointer to the individual with the given identifier or NULL, if non exists
This method returns the information for the individual with the given identifier.
- Parameters:
-
identifier | the identifier for the individual, for which the information is to be returned |
- Returns:
- a pointer to the information for the individual with the given identifier or NULL, if non exists
list<const cIndividualInfo*> enviroment::cEnviroment::getIndividualInfos |
( |
short |
iLive = 0 | ) |
const |
This method returns the information about individuals in the enviroment.
- Parameters:
-
iLive | a number which indicate of which kind the individuals should be, from which the information is to be returned; possible values: 0 : return the informations of all individuals in the enviroment, regardless if they are living or not 1 : return the information just of living individuals -1: return the information just of dead individuals else: an empty list is to be returned; reserved for future use, please don't use this |
- Returns:
- a list with pointers to the information about the individuals
- Returns:
- a pointer to the object for selecting a good individual or NULL, if non such exists;
- See also:
- pIndividualSelection
static const cInitEnviroment* enviroment::cEnviroment::getInitEnviroment |
( |
| ) |
|
|
static |
- Returns:
- a pointer to the object for initializing the enviroment or NULL, if non such exists;
- See also:
- pInitEnviroment
static cEnviroment* enviroment::cEnviroment::getInstance |
( |
| ) |
|
|
static |
This method returns a pointer to an instance of the enviroment/ genetic algorithm, if the parameters are set.
- See also:
- setParameter()
- Returns:
- pointer to an instance of the enviroment/ genetic algorithm, if the parameters are set, else NULL
time_t enviroment::cEnviroment::getLastStartTime |
( |
| ) |
const |
- Returns:
- the time the
- See also:
- start() method was called the last time or 0, if non such exists
static const cMaximumReached* enviroment::cEnviroment::getMaximumReached |
( |
| ) |
|
|
static |
- Returns:
- a pointer to the object for checking if individuals needs to be deleted befor adding new individuals or NULL, if non such exists;
- See also:
- pMaximumIndividuals
unsigned long enviroment::cEnviroment::getNumberOfCalledOperations |
( |
| ) |
|
unsigned long enviroment::cEnviroment::getNumberOfIndividuals |
( |
short |
iLive = 1 | ) |
|
This method returns the number of individuals in the enviroment.
- Parameters:
-
iLive | a number which indicate of which kind the individuals should be, which are counted; possible values: 0 : return the count of all individuals in the enviroment, regardless if they are living or not 1 : return the count just of living individuals -1: return the count just of dead individuals else: 0 is to be returned; reserved for future use, please don't use this |
- Returns:
- the count of the individuals of the given type
unsigned int enviroment::cEnviroment::getNumberOfRunningOperations |
( |
| ) |
|
- Returns:
- the number of operations, which run at the time
- Returns:
- a pointer to the object for evaluing the fitness of operators of the enviroment and for handling them or NULL, if non such exists;
- See also:
- pOperationFitnessAlgorithmus
static const cResourceCheck* enviroment::cEnviroment::getResourceCheck |
( |
| ) |
|
|
static |
- Returns:
- a pointer to the object for checking if more operators could be started or NULL, if non such exists;
- See also:
- pResourceCheck
- Returns:
- a pointer to the object for selecting a bad individual or NULL, if non such exists;
- See also:
- pSelectIndividualToDelete
bool enviroment::cEnviroment::insertIndividual |
( |
const cIndividual * |
pInIndividual, |
|
|
const cOperation * |
pProducerOperation = NULL |
|
) |
| |
This method inserts a copy of the given living individual into the enviroment. The type of the individual has to be correct for this enviroment and the individual has to be correct for inserting.
- Parameters:
-
pInIndividual | a pointer to the individual to insert |
pProducerOperation | the operation which produced the individual, if NULL (standardvalue) no operation gets credit for creating the individual |
- Returns:
- true if the individual was inserted, else false
virtual bool enviroment::cEnviroment::isRunning |
( |
| ) |
const |
|
virtual |
- See also:
- start()
-
stop()
- Returns:
- true if the enviroment is running, else false
void enviroment::cEnviroment::operationStatusChange |
( |
cOperation * |
pOperation, |
|
|
bool |
isRunning |
|
) |
| |
|
virtual |
This method adds the given individual listener object to the set of individual listener objects. Listeners of the set gets notified if new indeviduals wher inserted into the enviroment or old wher deleted.
- See also:
- unregisterIndividualListener()
-
setIndividualListener
-
clNewIndividualListener
- Parameters:
-
individualListener | a pointer to the individual listener object to add to the set of individual listeners |
- Returns:
- true if the individual listener was added, else false
This method removes the given individual from the enviroment and delets it.
- Parameters:
-
pInIndividual | a pointer to the individual to delete |
- Returns:
- true if the given individual was deleted, else false
virtual bool enviroment::cEnviroment::run |
( |
| ) |
|
|
virtual |
This method runs the enviroment. It will wait till the enviroment is ended befor returning. This method will do the work of the enviroment.
- See also:
- start()
-
stop()
-
setIsRunning()
- Returns:
- true if the operation was started
static void* enviroment::cEnviroment::runTread |
( |
void * |
inputArg | ) |
|
|
staticprivate |
This method runs the enviroment for a tread. It will wait till the operation is ended befor returning. It will simply call run().
- See also:
- run()
-
start()
-
stop()
This method sets the parameters for the enviroment. You can't create an instance of the enviroment, if the parameters aren't set correctly. All parameters are copied for the use in the enviroment.
- See also:
- bParameterSet
-
getInstance()
- Parameters:
-
pInInit | A pointer to the object for initializing the enviroment. If NULL the initializing object isn't changed. |
- See also:
- pInitEnviroment
- Parameters:
-
pInObjectFitnessAlgorithm | A pointer to the object for evaluing the fitness of individuals (respectively the objects they represents). If NULL the object for evaluing the fitnes isn't changed. Make sure this object /algorithm has an original individual set, else setParameter() will return false. |
- See also:
- pObjectFitnessAlgorithm
- Parameters:
-
pInEndCondition | A pointer to the object for checking the endcondition of the enviroment. If Null (standardvalue) and no object for checking the endcondition exists an cEndConditionCheck object is taken to be the endcondition, else, if an object for checking the endcondition exists, it isn't changed. |
- See also:
- pEndCondition and
-
cEndConditionCheck
- Parameters:
-
pInIndividualSelection | A pointer to the object for selecting a good individual. If Null (standardvalue) and no object for selecting a good individual exists an |
- See also:
- pInIndividualSelectionWeel object is taken for selection, else, if an object for selecting a good individual exists, it isn't changed.
-
pIndividualSelection
- Parameters:
-
pInMaximumIndividuals | A pointer to the object for checking if individuals needs to be deleted befor adding new individuals. If Null (standardvalue) and no object for checking the maximal individuals exists an |
- See also:
- cMaximumReached object is taken for checking if the maximum number of individuals wher reached, else, if an object for checking the maximum number of individuals exists, it isn't changed.
-
pMaximumIndividuals
- Parameters:
-
pInSelectIndividualToDelete | A pointer to the object for selecting a bad individual. If Null (standardvalue) and no object for selecting a bad individual exists an |
- See also:
- cSelectIndividualToDeleteWeel object is taken for selection, else, if an object for selecting a bad individual exists, it isn't changed.
-
pSelectIndividualToDelete
- Parameters:
-
pInOperationFitnessAlgorithmus | A pointer to the object for evaluing the fitness of operators of the enviroment and for handling them. If Null (standardvalue) and no object for evaluing the fitness of operators exists an |
- See also:
- cOperatorFitnessAlgorithmBasic object is taken for handling the operators, else, if an object for evaluing the fitness of the operators exists, it isn't changed.
-
pOperationFitnessAlgorithmus
- Parameters:
-
pInChoosOperator | A pointer to the object for selecting a good operator. If Null (standardvalue) and no object for selecting a good operator exists an |
- See also:
- cChoosOperator object is taken for for selecting an operator, else, if an object for choosing good operator exists, it isn't changed.
-
pChoosOperator
- Parameters:
-
pInResourceCheck | A pointer to the object for checking if more operators could be started. If Null (standardvalue) and no object for checking if more operators could be started exists an |
- See also:
- cResourceCheck object is taken for the check, else, if an object for checking if more operators could be started exists, it isn't changed.
-
pResourceCheck
- Returns:
- if all parameter could be set true, else false; if true was returned,
- See also:
- getInstance() will return a enviroment instance, elso it will return NULL
static void enviroment::cEnviroment::shortSleep |
( |
| ) |
|
|
staticprivate |
This function sleeps for a short period.
bool enviroment::cEnviroment::start |
( |
| ) |
|
This method starts the enviroment and returns, without waiting that the enviroment halts. The method run() will do the work of the enviroment. So overwrite the method run() if you wan't to change the behavour of the enviroment and not this method.
- See also:
- run()
-
stop()
-
isRunning()
- Returns:
- true if the enviroment was started, else false
virtual bool enviroment::cEnviroment::stop |
( |
| ) |
|
|
virtual |
This method stops the enviroment and returns when it halted.
- See also:
- run()
-
start()
-
isRunning()
- Returns:
- true if the enviroment was stoped, else false
static void* enviroment::cEnviroment::stopOperation |
( |
void * |
inputArg | ) |
|
|
staticprivate |
This method stop the operation for a tread. It will wait till the operation is stoped befor returning.
- See also:
- stop()
- Parameters:
-
inputArg | a pointer to the operation to stop |
This method removes the given individual listener object from the set of individual listener objects. Listeners of the set gets notified if new indeviduals wher inserted into the enviroment or old wher deleted.
- See also:
- registerIndividualListener()
-
setIndividualListener
-
clNewIndividualListener
- Parameters:
-
individualListener | a pointer to the individual listener object to removes from the set of individual listeners |
- Returns:
- true if the individual listener was removed, else false
Member Data Documentation
bool enviroment::cEnviroment::bIsRunning |
|
staticprotected |
If true the enviroment is running, else not.
Definition at line 233 of file cEnviroment.h.
bool enviroment::cEnviroment::bLiDeadIndividualInfosSorted |
|
staticprotected |
If true the list with the living individuals is sorted, else not.
Definition at line 181 of file cEnviroment.h.
bool enviroment::cEnviroment::bLiLivingIndividualInfosSorted |
|
staticprotected |
If true the list with the living individuals is sorted, else not.
Definition at line 161 of file cEnviroment.h.
bool enviroment::cEnviroment::bParameterSet |
|
staticprotected |
If true the parameter for the enviroment are set, else not.
Definition at line 228 of file cEnviroment.h.
bool enviroment::cEnviroment::bStopFlag |
|
staticprotected |
If true the enviroment should be stoped, else not.
Definition at line 238 of file cEnviroment.h.
double enviroment::cEnviroment::dCpuRunTime |
|
staticprotected |
The time in secounds the enviroment was running. (
- See also:
- isRunning() gives back true for this time)
Definition at line 204 of file cEnviroment.h.
long long enviroment::cEnviroment::lAlgorithmIdentifier |
|
staticprotected |
The identifier for the enviroment/ genetic algorithm. It should be unique for every enviroment, even on different computers.
Definition at line 125 of file cEnviroment.h.
list<const cIndividualInfo*> enviroment::cEnviroment::liDeadIndividualInfos |
|
staticprotected |
A list with pointers to the informations of the dead individuals in the enviroment. This list will allways be sorted with the best individuals (fitness) at the front.
Definition at line 176 of file cEnviroment.h.
list<const cIndividualInfo*> enviroment::cEnviroment::liLivingIndividualInfos |
|
staticprotected |
A list with pointers to the informations of the living individuals in the enviroment.
Definition at line 156 of file cEnviroment.h.
list<cOperation*> enviroment::cEnviroment::liOperationsToDelete |
|
staticprotected |
A list with the operations which are done and can be deleted.
Definition at line 192 of file cEnviroment.h.
unsigned long long enviroment::cEnviroment::lNumberOfCalledOperations |
|
staticprotected |
The number of operations executed/ called by the enviroment.
Definition at line 197 of file cEnviroment.h.
The container for the dead individuals in the enviroment. This field is for better internal handling of individuals.
initialize with: mapDeadIndividuals( compIndividualFitness )
Definition at line 169 of file cEnviroment.h.
The container for the living individuals in the enviroment. This field is for better internal handling of individuals.
initialize with: mapLivingIndividuals( compIndividualFitness )
Definition at line 150 of file cEnviroment.h.
map< cOperation * , cOperationInformation > enviroment::cEnviroment::mapRunningOperations |
|
staticprotected |
A map with the information for the running operations and the information for them.
Definition at line 187 of file cEnviroment.h.
const std::string enviroment::cEnviroment::OPERATION_DOMAIN |
The type of individuals on which the enviroment will run.
Definition at line 316 of file cEnviroment.h.
A pointer to the object for selecting a good operator.
Definition at line 283 of file cEnviroment.h.
A pointer to the object for checking the endcondition of the enviroment.
Definition at line 256 of file cEnviroment.h.
A pointer to the enviroment instance.
Definition at line 130 of file cEnviroment.h.
A pointer to the object for selecting a good individual.
Definition at line 261 of file cEnviroment.h.
A pointer to the object for initializing the enviroment.
Definition at line 244 of file cEnviroment.h.
A pointer to the object for checking if individuals needs to be deleted befor adding new individuals.
Definition at line 267 of file cEnviroment.h.
A pointer to the object for evaluing the fitness of individuals respectively the objects they represents.
Definition at line 250 of file cEnviroment.h.
A pointer to the object for evaluing the fitness of operators of the enviroment and for handling them.
Definition at line 278 of file cEnviroment.h.
A pointer to the object for checking, if more operators could be started.
Definition at line 289 of file cEnviroment.h.
A pointer to the object for selecting a bad individual.
Definition at line 272 of file cEnviroment.h.
pthread_t* enviroment::cEnviroment::pThreadEnviroment |
|
staticprotected |
This set contains pointers to all objects, which want's to be notified, if new indeviduals wher inserted into the enviroment or old wher deleted.
- See also:
- clNewIndividualListener
Definition at line 297 of file cEnviroment.h.
time_t enviroment::cEnviroment::tmFirstStartTime |
|
staticprotected |
time_t enviroment::cEnviroment::tmLastCpuRunTime |
|
staticprotected |
The time the the cpu time was evalued the last time. This variable is for evaluing the cpu time while the enviroemnt runs.
Definition at line 210 of file cEnviroment.h.
time_t enviroment::cEnviroment::tmLastStartTime |
|
staticprotected |
The documentation for this class was generated from the following file: