use eoExceptions everywhere
This commit is contained in:
parent
75ac37b02a
commit
eba2e14950
127 changed files with 524 additions and 418 deletions
|
|
@ -133,7 +133,7 @@ public :
|
|||
|
||||
performance_type performance(void) const
|
||||
{
|
||||
if(!valid_performance) throw runtime_error("no performance");
|
||||
if(!valid_performance) throw eoException("no performance");
|
||||
return Traits::get_performance(rep_fitness);
|
||||
}
|
||||
|
||||
|
|
@ -145,8 +145,8 @@ public :
|
|||
|
||||
worth_type worth(void) const
|
||||
{
|
||||
if(!valid_worth) throw runtime_error("no worth");
|
||||
if(!Traits::needs_mapping) throw runtime_error("no mapping");
|
||||
if(!valid_worth) throw eoException("no worth");
|
||||
if(!Traits::needs_mapping) throw eoException("no mapping");
|
||||
return Traits::get_worth(rep_fitness);
|
||||
}
|
||||
|
||||
|
|
@ -236,14 +236,14 @@ public :
|
|||
{
|
||||
if (!fitness_traits::needs_mapping)
|
||||
{
|
||||
throw runtime_error("eoPop: no scaling needed, yet a scaling function is defined");
|
||||
throw eoException("eoPop: no scaling needed, yet a scaling function is defined");
|
||||
}
|
||||
|
||||
(*p2w)(*this);
|
||||
}
|
||||
else if (fitness_traits::needs_mapping)
|
||||
{
|
||||
throw runtime_error("eoPop: no scaling function attached to the population, while one was certainly called for");
|
||||
throw eoException("eoPop: no scaling function attached to the population, while one was certainly called for");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -374,7 +374,7 @@ class Experiment : public eoserial::Persistent
|
|||
} else if( distribName == "exponential" ) {
|
||||
_distribution = & exponentialDistribution;
|
||||
} else {
|
||||
throw std::runtime_error("When unpacking experience, no distribution found.");
|
||||
throw eoException("When unpacking experience, no distribution found.");
|
||||
}
|
||||
|
||||
eoserial::unpackObject( *obj, "distribution", *_distribution );
|
||||
|
|
@ -503,7 +503,7 @@ int main( int argc, char** argv )
|
|||
{
|
||||
if( isChosenDistrib )
|
||||
{
|
||||
throw std::runtime_error("Only one distribution can be chosen during a launch!");
|
||||
throw eoException("Only one distribution can be chosen during a launch!");
|
||||
} else
|
||||
{
|
||||
isChosenDistrib = true;
|
||||
|
|
@ -517,7 +517,7 @@ int main( int argc, char** argv )
|
|||
|
||||
if( !isChosenDistrib )
|
||||
{
|
||||
throw std::runtime_error("No distribution chosen. One distribution should be chosen.");
|
||||
throw eoException("No distribution chosen. One distribution should be chosen.");
|
||||
}
|
||||
|
||||
Experiment e( pdistrib, size, packet_size, worker_print_waiting_time, seed, fileName );
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ int main(int argc, char** argv)
|
|||
// eo::log << eo::setlevel( eo::debug );
|
||||
Node::init( argc, argv );
|
||||
if( Node::comm().size() != 7 ) {
|
||||
throw std::runtime_error("World size should be 7.");
|
||||
throw eoException("World size should be 7.");
|
||||
}
|
||||
|
||||
SerializableVector< SerializableBase<int> > v;
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ int main(int argc, char** argv)
|
|||
|
||||
const int ALL = Node::comm().size();
|
||||
if( ALL < 3 ) {
|
||||
throw std::runtime_error("Needs at least 3 processes to be launched!");
|
||||
throw eoException("Needs at least 3 processes to be launched!");
|
||||
}
|
||||
|
||||
// Tests are auto described thanks to member "description"
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ void runAlgorithm(EOT, eoParser& _parser, eoState& _state, eoRealVectorBounds& _
|
|||
|
||||
if (lambda_rate.value() < 1.0f)
|
||||
{
|
||||
throw logic_error("lambda_rate must be larger than 1 in a comma strategy");
|
||||
throw eoParamException("lambda_rate must be larger than 1 in a comma strategy");
|
||||
}
|
||||
|
||||
// Initialization
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ void init(eoPop<Dummy> & _pop, unsigned _pSize)
|
|||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error("init pop with 0 size");
|
||||
throw eoPopSizeException(_pSize,"init pop with 0 size");
|
||||
}
|
||||
for (unsigned i=0; i<_pSize; i++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ bool check_permutation(const Chrom & _chrom)
|
|||
std::cout << " Error: Wrong permutation !" << std::endl;
|
||||
std::string s;
|
||||
s.append( " Wrong permutation in t-eoInitPermutation");
|
||||
throw std::runtime_error( s );
|
||||
throw eoException( s );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ bool check_permutation(const Chrom& _chrom){
|
|||
std::cout << " Error: Wrong permutation !" << std::endl;
|
||||
std::string s;
|
||||
s.append( " Wrong permutation in t-eoShiftMutation");
|
||||
throw std::runtime_error( s );
|
||||
throw eoException( s );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ void testSelectMany(eoSelect<EOT> & _select, std::string _name)
|
|||
{
|
||||
unsigned trouve = isInPop<Dummy>(offspring[i], parents);
|
||||
if (trouve == parents.size()) // pas trouve
|
||||
throw std::runtime_error("Pas trouve ds parents");
|
||||
throw eoException("Pas trouve ds parents");
|
||||
nb[trouve]++;
|
||||
}
|
||||
// dump to file so you can plot using gnuplot - dir name is hardcoded!
|
||||
|
|
@ -149,7 +149,7 @@ eoValueParam<unsigned> tournamentSizeParam = parser.createParam(unsigned(2), "to
|
|||
parentsOrg[pSize-1].fitness(10*pSize);
|
||||
}
|
||||
else
|
||||
throw std::runtime_error("Invalid fitness Type"+fitnessType);
|
||||
throw eoInvalidFitnessError("Invalid fitness Type"+fitnessType);
|
||||
|
||||
std::cout << "Initial parents (odd)\n" << parentsOrg << std::endl;
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ void testSelectMany(eoSelect<EOT> & _select, std::string _name)
|
|||
{
|
||||
unsigned trouve = isInPop<Dummy>(offspring[i], parents);
|
||||
if (trouve == parents.size()) // pas trouve
|
||||
throw std::runtime_error("Pas trouve ds parents");
|
||||
throw eoException("Pas trouve ds parents");
|
||||
nb[trouve]++;
|
||||
}
|
||||
// dump to file so you can plot using gnuplot - dir name is hardcoded!
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ bool check_permutation(const Chrom& _chrom){
|
|||
std::cout << " Error: Wrong permutation !" << std::endl;
|
||||
std::string s;
|
||||
s.append( " Wrong permutation in t-eoShiftMutation");
|
||||
throw std::runtime_error( s );
|
||||
throw eoException( s );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ bool check_permutation(const Chrom& _chrom){
|
|||
std::cout << " Error: Wrong permutation !" << std::endl;
|
||||
std::string s;
|
||||
s.append( " Wrong permutation in t-eoShiftMutation");
|
||||
throw std::runtime_error( s );
|
||||
throw eoException( s );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ bool check_permutation(const Chrom& _chrom){
|
|||
std::cout << " Error: Wrong permutation !" << std::endl;
|
||||
std::string s;
|
||||
s.append( " Wrong permutation in t-eoShiftMutation");
|
||||
throw std::runtime_error( s );
|
||||
throw eoException( s );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue