29 #include "evorobotexperiment.h"
31 #include <configurationparameters.h>
32 #include <parametersettable.h>
37 #include <QWaitCondition>
55 void startingReplication(
int replication );
59 void recoveredInterruptedEvolution( QString statfile );
66 void endGeneration(
int generation,
double fmax,
double faverage,
double fmin );
71 static const int MAXINDIVIDUALS = 1000;
78 void evolveSteadyState();
80 void evolveGenerational();
84 double getNoise(
double minn,
double maxn);
87 void putGenome(
int fromgenome,
int tobestgenome);
88 void getGenome(
int frombestgenome,
int togenome,
int mut);
90 int mutate(
int w,
double mut);
92 void setInitialPopulation(
int*);
93 void setMutations(
float*);
96 void saveagenotype(FILE *fp,
int ind);
97 void loadgenotype(FILE *fp,
int ind);
99 int loadallg(
int gen,
const char *filew);
108 void getLastFStat(
double &
min,
double &
max,
double &average );
109 int loadStatistics(
char *filename);
110 int* getGenes(
int ind);
111 int* getBestGenes(
int ind);
113 void resetGenerationCounter();
114 void copyGenes(
int from,
int to,
int mut);
116 void computeFStat2();
123 void getPheParametersAndMutationsFromEvonet();
128 void updateGenomeFromEvonet(
int ind );
161 static void describe( QString type );
167 virtual void postConfigureInitialization();
172 virtual void evolveAllReplicas();
234 bool isEnabledStepByStep();
256 virtual QVector<EvoRobotExperiment*> getEvoRobotExperimentPool();
263 virtual unsigned int currentGeneration();
270 virtual unsigned int getStartingSeed();
277 virtual unsigned int getCurrentSeed();
284 virtual unsigned int getNumReplications();
291 virtual unsigned int getNumOfGenerations();
298 virtual double getCurrentMutationRate();
304 virtual void setCurrentMutationRate(
double mutation_rate );
313 virtual unsigned int loadGenotypes(QString filename);
320 virtual unsigned int numLoadedGenotypes()
const;
328 virtual int* getGenesForIndividual(
unsigned int id);
338 virtual QString statisticsFilename(
unsigned int seed);
348 virtual QString bestsFilename(
unsigned int seed);
353 virtual QString bestsFilename();
364 virtual QString generationFilename(
unsigned int generation,
unsigned int seed);
369 virtual QString generationFilename();
375 virtual void doNotUseMultipleThreads();
384 void enableStepByStep(
bool enable );
420 void setGenomeLength(
int genomelength)
422 if (genomelength < 1) {
425 m_genomelength = genomelength;
430 int getGenomeLength()
const
432 return m_genomelength;
435 void resize(
int newSize)
442 if (newSize < m_pop.size()) {
443 for (
int i = (m_pop.size() - 1); i >= newSize; i--) {
446 m_pop.resize(newSize);
447 }
else if (newSize > m_pop.size()) {
448 const int oldSize = m_pop.size();
449 m_pop.resize(newSize);
450 for (
int i = oldSize; i < newSize; i++) {
451 m_pop[i] =
new int[m_genomelength];
458 m_pop.append(
new int[m_genomelength]);
461 return (m_pop.size() - 1);
474 int* operator[](
int i)
477 if (i > m_pop.size()) {
484 const int* operator[](
int i)
const
487 if (i > m_pop.size()) {
495 QVector<int *> m_pop;
501 Population bestgenome;
503 int loadedIndividuals;
514 QString evolutionType;
526 double mutationdecay;
528 double initial_mutation;
536 double fmin, fmax,faverage;
544 QMutex mutexStepByStep;
546 QWaitCondition waitForNextStep;
553 unsigned int numThreads;
555 int savePopulationEachNGenerations;
571 bool averageIndividualFitnessOverGenerations;
579 ConfigurationParameters savedConfigurationParameters;
586 QString savedExperimentPrefix;