(ga_engine)
Terminate the evolution using the **bestrawscore** and **rounddecimal**
    parameter obtained from the individual

    Example:
       >>> genome.setParams(bestrawscore=0.00, rounddecimal=2)
       (...)
       >>> ga_engine.terminationCriteria.set(GSimpleGA.RawScoreCriteria)
Terminate the evolution using the **bestrawscore** and **rounddecimal**
    parameter obtained from the individual
Terminate the evolution using the ** bestrawscore ** and ** rounddecimal ** parameter obtained from the individual
def RawScoreCriteria(ga_engine):
    """ Terminate the evolution using the **bestrawscore** and **rounddecimal**
    parameter obtained from the individual

    Example:
       >>> genome.setParams(bestrawscore=0.00, rounddecimal=2)
       (...)
       >>> ga_engine.terminationCriteria.set(GSimpleGA.RawScoreCriteria)

    """
    ind = ga_engine.bestIndividual()
    bestRawScore = ind.getParam("bestrawscore")
    roundDecimal = ind.getParam("rounddecimal")

    if bestRawScore is None:
        Util.raiseException("you must specify the bestrawscore parameter", ValueError)

    if ga_engine.getMinimax() == Consts.minimaxType["maximize"]:
        if roundDecimal is not None:
            return round(bestRawScore, roundDecimal) <= round(ind.score, roundDecimal)
        else:
            return bestRawScore <= ind.score
    else:
        if roundDecimal is not None:
            return round(bestRawScore, roundDecimal) >= round(ind.score, roundDecimal)
        else:
            return bestRawScore >= ind.score
def RawScoreCriteria ( ga_engine ) : ind = ga_engine . bestIndividual ( ) bestRawScore = ind . getParam ( "bestrawscore" ) roundDecimal = ind . getParam ( "rounddecimal" ) if bestRawScore is None : Util . raiseException ( "you must specify the bestrawscore parameter" , ValueError ) if ga_engine . getMinimax ( ) == Consts . minimaxType [ "maximize" ] : if roundDecimal is not None : return round ( bestRawScore , roundDecimal ) <= round ( ind . score , roundDecimal ) else : return bestRawScore <= ind . score else : if roundDecimal is not None : return round ( bestRawScore , roundDecimal ) >= round ( ind . score , roundDecimal ) else : return bestRawScore >= ind . score