use eoExceptions everywhere
This commit is contained in:
parent
75ac37b02a
commit
eba2e14950
127 changed files with 524 additions and 418 deletions
|
|
@ -182,12 +182,12 @@ eoGenOp<EOT> & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit<EO
|
|||
eoValueParam<double>& pCrossParam = _parser.createParam(0.6, "pCross", "Probability of Crossover", 'C', "Variation Operators" );
|
||||
// minimum check
|
||||
if ( (pCrossParam.value() < 0) || (pCrossParam.value() > 1) )
|
||||
throw runtime_error("Invalid pCross");
|
||||
throw eoParamException("Invalid pCross");
|
||||
|
||||
eoValueParam<double>& pMutParam = _parser.createParam(0.1, "pMut", "Probability of Mutation", 'M', "Variation Operators" );
|
||||
// minimum check
|
||||
if ( (pMutParam.value() < 0) || (pMutParam.value() > 1) )
|
||||
throw runtime_error("Invalid pMut");
|
||||
throw eoParamException("Invalid pMut");
|
||||
|
||||
|
||||
// the crossover - with probability pCross
|
||||
|
|
|
|||
|
|
@ -215,12 +215,12 @@ try {
|
|||
double pCross = parser.createParam(0.6, "pCross", "Probability of Crossover", 'C', "Variation Operators" ).value();
|
||||
// minimum check
|
||||
if ( (pCross < 0) || (pCross > 1) )
|
||||
throw runtime_error("Invalid pCross");
|
||||
throw eoParamException("Invalid pCross");
|
||||
|
||||
double pMut = parser.createParam(0.1, "pMut", "Probability of Mutation", 'M', "Variation Operators" ).value();
|
||||
// minimum check
|
||||
if ( (pMut < 0) || (pMut > 1) )
|
||||
throw runtime_error("Invalid pMut");
|
||||
throw eoParamException("Invalid pMut");
|
||||
|
||||
// now create the generalOp
|
||||
eoSGAGenOp<Indi> op(cross, pCross, mut, pMut);
|
||||
|
|
@ -827,7 +827,7 @@ eoContinue<Indi> & do_make_continue(eoParser& _parser, eoState& _state, eoEvalFu
|
|||
|
||||
// now check that there is at least one!
|
||||
if (!continuator)
|
||||
throw runtime_error("You MUST provide a stopping criterion");
|
||||
throw eoException("You MUST provide a stopping criterion");
|
||||
// OK, it's there: store in the eoState
|
||||
_state.storeFunctor(continuator);
|
||||
|
||||
|
|
|
|||
|
|
@ -206,12 +206,12 @@ try
|
|||
double pCross = parser.createParam(0.6, "pCross", "Probability of Crossover", 'C', "Variation Operators" ).value();
|
||||
// minimum check
|
||||
if ( (pCross < 0) || (pCross > 1) )
|
||||
throw runtime_error("Invalid pCross");
|
||||
throw eoParamException("Invalid pCross");
|
||||
|
||||
double pMut = parser.createParam(0.1, "pMut", "Probability of Mutation", 'M', "Variation Operators" ).value();
|
||||
// minimum check
|
||||
if ( (pMut < 0) || (pMut > 1) )
|
||||
throw runtime_error("Invalid pMut");
|
||||
throw eoParamException("Invalid pMut");
|
||||
|
||||
// now create the generalOp
|
||||
eoSGAGenOp<Indi> op(cross, pCross, mut, pMut);
|
||||
|
|
@ -278,7 +278,7 @@ try
|
|||
// first check the directory (and creates it if not exists already):
|
||||
if (fileMyStructStat || plotMyStructStat)
|
||||
if (! testDirRes(dirName, true) )
|
||||
throw runtime_error("Problem with resDir");
|
||||
throw eoParamException("Problem with resDir");
|
||||
|
||||
// should we write it to a file ?
|
||||
if (fileMyStructStat)
|
||||
|
|
|
|||
|
|
@ -182,12 +182,12 @@ eoGenOp<EOT> & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit<EO
|
|||
eoValueParam<double>& pCrossParam = _parser.createParam(0.6, "pCross", "Probability of Crossover", 'C', "Variation Operators" );
|
||||
// minimum check
|
||||
if ( (pCrossParam.value() < 0) || (pCrossParam.value() > 1) )
|
||||
throw runtime_error("Invalid pCross");
|
||||
throw eoParamException("Invalid pCross");
|
||||
|
||||
eoValueParam<double>& pMutParam = _parser.createParam(0.1, "pMut", "Probability of Mutation", 'M', "Variation Operators" );
|
||||
// minimum check
|
||||
if ( (pMutParam.value() < 0) || (pMutParam.value() > 1) )
|
||||
throw runtime_error("Invalid pMut");
|
||||
throw eoParamException("Invalid pMut");
|
||||
|
||||
|
||||
// the crossover - with probability pCross
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue