MCPcopy Create free account
hub / github.com/ResearchCodesHub/QuantumGeneticAlgorithms / mutation

Function mutation

QGA.py:206–228  ·  view source on GitHub ↗
(pop_mutation_rate, mutation_rate)

Source from the content-addressed store, hash-verified

204# pop_mutation_rate: mutation rate in the population
205# mutation_rate: probability of a mutation of a bit
206def mutation(pop_mutation_rate, mutation_rate):
207 uallele=0;
208 for i in range(1,popSize):
209 up=np.random.random_integers(100)
210 up=up/100
211 if up<=pop_mutation_rate:
212 for j in range(1,genomeLength):
213 ualelle=up=np.random.random_integers(100)
214 ualelle=ualelle/100
215 if uallele<=mutation_rate:
216 nqpv[i,j,0]=qpv[i,j,1]
217 nqpv[i,j,1]=qpv[i,j,0]
218 else:
219 nqpv[i,j,0]=qpv[i,j,0]
220 nqpv[i,j,1]=qpv[i,j,1]
221 else:
222 for j in range(1,genomeLength):
223 nqpv[i,j,0]=qpv[i,j,0]
224 nqpv[i,j,1]=qpv[i,j,1]
225 for i in range(1,popSize):
226 for j in range(1,genomeLength):
227 qpv[i,j,0]=nqpv[i,j,0]
228 qpv[i,j,1]=nqpv[i,j,1]
229
230#########################################################
231# PERFORMANCE GRAPH #

Callers 1

Q_GAFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected