00001 #ifndef SIGEL_GP_SIG_GPPARAMETER_H
00002 #define SIGEL_GP_SIG_GPPARAMETER_H
00003
00004 #include "SIGEL_GP/SIG_GPPVMHost.h"
00005 #include "SIGEL_Program/SIG_ProgramLine.h"
00006
00007 #include <qstring.h>
00008 #include <qtextstream.h>
00009 #include <qdatetime.h>
00010 #include <qdir.h>
00011 #include <qstringlist.h>
00012 #include <qarray.h>
00013
00014 namespace SIGEL_GP
00015 {
00024 class SIG_GPParameter{
00025
00026 public:
00030 enum terminationType
00031 {
00038 byTime,
00045 byGeneration,
00053 byTimeGeneration,
00060 byUser
00061 };
00062
00069 enum priorityLevel {
00075 veryLow,
00076
00082 low,
00083
00089 normal,
00090
00096 high,
00097
00103 veryHigh
00104 };
00105
00106
00110 private:
00111 int randomSeed;
00112
00116 private:
00117 int minIndLength;
00118
00122 private:
00123 int maxIndLength;
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00143 private:
00144 int reproductionProb;
00145
00149 private:
00150 int xoverProb;
00151
00155 private:
00156 int mutationProb;
00157
00162 private:
00163 double tournamentsPerGeneration;
00164
00168 private:
00169 long int maxAge;
00170
00175 private:
00176 unsigned long passiveTime;
00177
00183 private:
00184 int maxTouchsPerLoop;
00185
00190 private:
00191 int toDoSweepsPerLoop;
00192
00196 private:
00197 QDateTime terminationTime;
00198
00199 private:
00200 int terminationDurationDays;
00201
00202 private:
00203 int terminationDurationHours;
00204
00205 private:
00206 int terminationDurationMinutes;
00207
00208 private:
00209 int terminationDurationSeconds;
00210
00211 private:
00212 bool terminationUsesDate;
00213
00218 private:
00219 int terminationGenerationNo;
00220
00224 private:
00225 terminationType terminationModel;
00226
00232 private:
00233 bool saveExit;
00234
00238 private:
00239 QDir graveYardDirectory;
00240
00244 private:
00245 bool liveUndead;
00246
00247
00251 private:
00252 QDir poolImageDirectory;
00253
00257 private:
00258 int poolImageGeneration;
00259
00264 private:
00265 priorityLevel priority;
00266
00267 private:
00268 double maxFitness;
00269
00270 private:
00271 bool parsimonyPressure;
00272
00278 private:
00279 long maximumLength;
00280
00286 private:
00287 long minimumLength;
00288
00298 private:
00299 QArray< int > instructionProb;
00300
00301 private:
00302 QString fitnessName;
00303
00304 private:
00305 QList< SIG_GPPVMHost > hostList;
00306
00307 private:
00308 int timeOutMinutes;
00309
00310
00311
00312
00313
00314
00322 public:
00323 SIG_GPParameter();
00324
00335 public:
00336 SIG_GPParameter(QString parameter);
00337
00345 public:
00346 ~SIG_GPParameter();
00347
00357 public:
00358 void setRandomSeed (int seed);
00359
00369 public:
00370 int getRandomSeed() const;
00371
00381 public:
00382 void setMinIndLength (int minIndLen);
00383
00393 public:
00394 int getMinIndLength() const;
00395
00396 public:
00397 QList< SIG_GPPVMHost > const &getHostList() const;
00398
00399 public:
00400 QList< SIG_GPPVMHost > &getHostList();
00401
00411 public:
00412 void setMaxIndLength (int maxIndLen);
00413
00423 public:
00424 int getMaxIndLength() const;
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00472 public:
00473 void setReproductionProb(int prob);
00474
00483 public:
00484 int getReproductionProb() const;
00485
00494 public:
00495 void setXoverProb(int prob);
00496
00505 public:
00506 int getXoverProb() const;
00507
00516 public:
00517 void setMutationProb(int prob);
00518
00527 public:
00528 int getMutationProb() const;
00529
00536 public:
00537 void setTournamentsPerGeneration(double prob);
00538
00546 public:
00547 double getTournamentsPerGeneration() const;
00548
00556 public:
00557 void setMaxAge(long int age);
00558
00565 public:
00566 long int getMaxAge() const;
00567
00574 private:
00575 void setPassiveTime(unsigned long pTime);
00576
00583 public:
00584 unsigned long getPassiveTime() const;
00585
00592 private:
00593 void setMaxTouchsPerLoop(int touchs);
00594
00601 public:
00602 int getMaxTouchsPerLoop() const;
00603
00611 private:
00612 void setToDoSweepsPerLoop(int sweeps);
00613
00621 public:
00622 int getToDoSweepsPerLoop() const;
00623
00630 public:
00631 void setTerminationTime(QDateTime tTime);
00632
00639 public:
00640 QDateTime getTerminationTime() const;
00641
00642 public:
00643 void setTerminationDurationDays( int newValue );
00644
00645 public:
00646 int getTerminationDurationDays() const;
00647
00648 public:
00649 void setTerminationDurationHours( int newValue );
00650
00651 public:
00652 int getTerminationDurationHours() const;
00653
00654 public:
00655 void setTerminationDurationMinutes( int newValue );
00656
00657 public:
00658 int getTerminationDurationMinutes() const;
00659
00660 public:
00661 void setTerminationDurationSeconds( int newValue );
00662
00663 public:
00664 int getTerminationDurationSeconds() const;
00665
00666 public:
00667 bool getTerminationUsesDate() const;
00668
00669 public:
00670 void setTerminationUsesDate( bool newValue );
00671
00678 public:
00679 void setTerminationGenerationNo (int tGenNo);
00680
00687 public:
00688 int getTerminationGenerationNo() const;
00689
00695 public:
00696 void setTerminationModel(terminationType termi);
00697
00704 public:
00705 terminationType getTerminationModel() const;
00706
00713 public:
00714 void setGraveYardDirectory(QDir directory);
00715
00720 public:
00721 bool getSaveExit() const;
00722
00726 public:
00727 void setSaveExit(bool sexit);
00728
00735 public:
00736 QDir getGraveYardDirectory() const;
00737
00745 public:
00746 void setLiveUndead(bool grave);
00747
00755 public:
00756 bool getLiveUndead() const;
00757
00764 public:
00765 void setPoolImageDirectory(QDir PIDir);
00766
00773 public:
00774 QDir getPoolImageDirectory() const;
00775
00782 public:
00783 void setPoolImageGeneration(int gener);
00784
00791 public:
00792 int getPoolImageGeneration() const;
00793
00801 public:
00802 void setPriority(priorityLevel prio);
00803
00812 public:
00813 priorityLevel getPriority() const;
00814
00820 public:
00821 void readFromFile(QTextStream & file);
00822
00828 public:
00829 void writeToFile(QTextStream & file);
00830
00831 public:
00832 double getMaxFitness() const;
00833
00834 public:
00835 void setMaxFitness(double maxfit);
00836
00837 public:
00838 QString getFitnessName() const;
00839
00840 public:
00841 void setFitnessName(QString name);
00842
00843 public:
00844 bool getParsimonyPressure();
00845
00846 public:
00847 void setParsimonyPressure( bool pressure );
00848
00849 public:
00850 void setProbability( SIGEL_Program::Robotinstruction instruction, int prob );
00851
00852 public:
00853 int getProbability( SIGEL_Program::Robotinstruction instruction );
00854
00855 public:
00856 QArray< int > &getInstructionProbabilities();
00857
00858 public:
00859 int getTimeOutMinutes();
00860
00861 public:
00862 void setTimeOutMinutes( int newValue );
00863
00864 };
00865 }
00866 #endif // SIGEL_GP_SIG_GPPARAMETER_H
00867
00868
00869
00870
00871