00001 #include "GLInitialiserShuffleIntVector.h" 00002 #include "GLLogicError.h" 00003 #include "GLOrganismVector.h" 00004 #include "GLRandomNumbersGenerator.h" 00005 00015 GLBaseOrganism* GLInitialiserShuffleIntVector::initialiseOrganism() 00016 { 00017 //check, that the organism is of the correct type. 00018 vector<int> chromosome(m_size); 00019 GLRandomNumbersGenerator::shuffleIntegerVector( 00020 chromosome, 0, chromosome.size()); 00021 return new GLOrganismVector<int>(chromosome); 00022 }//initialiseOrganism 00023 00024 00029 void GLInitialiserShuffleIntVector::setSize(int size) 00030 { 00031 if (size <= 0) 00032 { 00033 char errormsg[1000]; 00034 sprintf(errormsg, "\nGLInitialiserShuffleIntVector::setSize\n" 00035 "Parameter size(=%i) should be > 0", 00036 size); 00037 throw errormsg; 00038 } 00039 m_size = size; 00040 }//setSize 00041