(genome, **args)
return (sister, brother)
The crossover of 1D Binary String, Single Point

   .. warning:: You can't use this crossover method for binary strings with length of 1.
The crossover of 1D Binary String, Single Point
The crossover of 1D Binary String Single Point
def G1DBinaryStringXSinglePoint(genome, **args):
   """ The crossover of 1D Binary String, Single Point

   .. warning:: You can't use this crossover method for binary strings with length of 1.

   """
   sister = None
   brother = None
   gMom = args["mom"]
   gDad = args["dad"]

   if len(gMom) == 1:
      Util.raiseException("The Binary String have one element, can't use the Single Point Crossover method !", TypeError)

   cut = rand_randint(1, len(gMom) - 1)

   if args["count"] >= 1:
      sister = gMom.clone()
      sister.resetStats()
      sister[cut:] = gDad[cut:]

   if args["count"] == 2:
      brother = gDad.clone()
      brother.resetStats()
      brother[cut:] = gMom[cut:]

   return (sister, brother)
def G1DBinaryStringXSinglePoint ( genome , * * args ) : sister = None brother = None gMom = args [ "mom" ] gDad = args [ "dad" ] if len ( gMom ) == 1 : Util . raiseException ( "The Binary String have one element, can't use the Single Point Crossover method !" , TypeError ) cut = rand_randint ( 1 , len ( gMom ) - 1 ) if args [ "count" ] >= 1 : sister = gMom . clone ( ) sister . resetStats ( ) sister [ cut : ] = gDad [ cut : ] if args [ "count" ] == 2 : brother = gDad . clone ( ) brother . resetStats ( ) brother [ cut : ] = gMom [ cut : ] return ( sister , brother )