sccinraffound = 0 self_sccinraffound = 0 iterations = int((args.iteration/(maxlength+1-args.minDim))) timeCreatinVector = [] timeAnalysisVector = [] for instanceID, instance in enumerate((range(iterations))): # FOR EACH ITERATION # Flush standard output sys.stdout.flush() nCleavage = 0 nCondensa = 0 # Create the complete population of species according to the Max Length and the alphabet alphabet = ['A', 'B'] speciesList = sp.createCompleteSpeciesPopulation(maxlength, alphabet) originalSpeciesList = deepcopy(speciesList) # compute population carinality totSpecies = sp.getTotNumberOfSpeciesFromCompletePop(maxlength) # Compute overall conceivable number of reactions totCleavage = reactions.getNumOfCleavages(speciesList) if (args.creationMethod == 1) | (args.creationMethod == 4): totCond = reactions.getNumOfCondensations(totSpecies) else: totCond = 0 totRcts = totCleavage + totCond # If the reaction probability is 0, it is set to the critical value of 1 reaction per species on average prob = (1 / float(totRcts)) * averageConn
# CREATE CHEMIST FOLDER print "|- ARTIFICIAL CHEMISTRY ", singlechem+1, " Creation..." zeroBeforeName = readfiles.zeroBeforeStrNum(singlechem+1, args.chemistries) chemFolder = 'CH' + str(zeroBeforeName) + str(singlechem+1) chemFolderPath = os.path.join(folderName, chemFolder) if not os.path.isdir(chemFolderPath): try: os.mkdir(chemFolderPath) except: print "Impossible to create statistic directory", chemFolderPath; sys.exit(1) # CREATE ARTIFICIAL CHEMISTRY # Create foodlist foodList = range(int(2**(args.lastFood+1)-2)) # Create species List speciesList = sp.createCompleteSpeciesPopulation(args.maxDim, parameters[14]) originalSpeciesList = deepcopy(speciesList) # Crate chemist # compute population cardinality totSpecies = sp.getTotNumberOfSpeciesFromCompletePop(args.maxDim) # Compute overall conceivable number of reactions totCleavage = reactions.getNumOfCleavages(originalSpeciesList) # Compute the number of reactions according to the chemistry type adopted if args.creationMethod == 1: totCond = reactions.getNumOfCondensations(totSpecies) else: totCond = 0 totRcts = totCleavage + totCond # If the reaction probability is 0, it is set to the critical value of 1 reaction per species on average if parameters[21] == 0: prob = (1 / float(totRcts)) * args.avgCon
print "|- ARTIFICIAL CHEMISTRY ", singlechem + 1, " Creation..." zeroBeforeName = readfiles.zeroBeforeStrNum(singlechem + 1, args.chemistries) chemFolder = "CH" + str(zeroBeforeName) + str(singlechem + 1) chemFolderPath = os.path.join(folderName, chemFolder) if not os.path.isdir(chemFolderPath): try: os.mkdir(chemFolderPath) except: print "Impossible to create statistic directory", chemFolderPath sys.exit(1) # CREATE ARTIFICIAL CHEMISTRY # Create foodlist foodList = range(int(2 ** (args.lastFood + 1) - 2)) # Create species List speciesList = sp.createCompleteSpeciesPopulation(args.maxDim, parameters["alphabet"]) originalSpeciesList = deepcopy(speciesList) # Crate chemist # compute population cardinality totSpecies = sp.getTotNumberOfSpeciesFromCompletePop(args.maxDim) # Compute overall conceivable number of reactions totCleavage = reactions.getNumOfCleavages(originalSpeciesList) # Compute the number of reactions according to the chemistry type adopted if args.creationMethod == 1: totCond = reactions.getNumOfCondensations(totSpecies) else: totCond = 0 totRcts = totCleavage + totCond