亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? 遺傳算法的vb實現.txt

?? 具有如同您所希望的那樣的確定性
?? TXT
字號:
Option Explicit
Private Const Selection As Double = 0.45
Private Const Momentum As Double = 0.05
Private Const Bits As Integer = 32 'Bits per chromosome
'Eight 4-bit sections per 32-bit chromosome, using one-point
'Crossover. 
Private Const Splices As Integer = 8
Private Const Max_Bits As Integer = Bits / Splices
Private Max_value As Integer
'For one-point crossover, divide the chromosome
'so the maximum value for 32-bit chromosomes
'(1111|1111|1111|1111|1111|1111|1111|1111) in
'decimal is the Max_value constant (8 4-bit values).
'Population of parents (population size = Bits / 2)
Private Population(1 To Bits / 2) As Chromosome
Private Sections(1 To Splices, 1 To Bits / 2) As Integer
'To break the Chromosome apart
Private Solution As Integer
Private FittestChromosome As String
Private Fittestvalue As Double
Private aryFittestvalue(1 To Splices) As Double
Private m_Quit As Boolean
Private m_Fitness As Double
Private m_FitnessSet As Boolean
Private Type Chromosome
value As String * Bits
Fitness As Double
End Type
Public Event Evaluate(values As Variant) 'Returns a safe array
Public Event Solved(Chromosome As String, Fitness As Double, values As Variant)
Public Event BestSolution(Chromosome As String, Fitness As Double, values As Variant)
Public Target As Double 'Target value
Public Sub Quit()
m_Quit = True
End Sub
Private Sub InitializePopulation()
Dim intI As Integer
Dim intParts As Integer
Dim strChromosome As String
For intI = 1 To Bits / 2
'Initialize the population
strChromosome = ""
For intParts = 1 To Splices
strChromosome = strChromosome & EncodeChromosome(Rnd * Max_value)
Next intParts
Population(intI).value = strChromosome
Next intI
End Sub
Private Function CalculateFitness()
'Calculate fitness of the chromosome
Dim Deltas(1 To Bits / 2) As Double
Dim dblDelta As Double
Dim intLoop As Integer
Dim intPopulation As Integer
Dim intSplice As Integer
Dim RetArray(1 To Splices) As Double
Dim n As Integer
For intPopulation = 1 To Bits / 2
intSplice = 0
For intLoop = 1 To Bits Step Max_Bits
intSplice = intSplice + 1
Sections(intSplice, intPopulation) = _
DecodeChromosome(Mid(Population(intPopulation).value, _
intLoop, Max_Bits))
Next intLoop
Next intPopulation
'#############################################################
For intLoop = 1 To Bits / 2
'Decode the current chromosome
For n = 1 To Splices
RetArray(n) = Sections(n, intLoop)
Next n
m_FitnessSet = False
'Get the user-defined fitness value
RaiseEvent Evaluate(RetArray)
'Wait for user response
Do While m_FitnessSet = False
DoEvents
Loop
Deltas(intLoop) = Abs(Target - Fitness)
If Deltas(intLoop) = 0 Then
Solution = intLoop
End If
Next intLoop
'#############################################################
For intLoop = 1 To Bits / 2
If Deltas(intLoop) > dblDelta Then
dblDelta = Deltas(intLoop)
End If
Next intLoop
For intLoop = 1 To Bits / 2
Population(intLoop).Fitness = dblDelta - Deltas(intLoop) + 1
Next intLoop
If Solution <> 0 Then
FittestChromosome = Population(Solution).value
Fittestvalue = Population(Solution).Fitness
'Fittest chromosome values
For n = 1 To Splices
aryFittestvalue(n) = Sections(n, Solution)
Next n
End If
End Function
Private Function NextGeneration()
Dim dblFittest As Double
Dim dblFittest2 As Double
Dim dblRndFitness As Double
Dim intCrossOver As Integer
Dim intFittest As Integer
Dim intFittest2 As Integer
Dim dblLeastFit As Double
Dim intLeastFit As Integer
Dim intLoop As Integer
Dim intChild As Integer
Dim dblRnd As Double
Dim intRnd As Integer
Dim Father As String
Dim Mother As String
Dim intMutate As Integer
Dim i As Integer
Dim n As Integer
For intLoop = 1 To Bits / 2
If Population(intLoop).Fitness > dblRndFitness Then
dblRndFitness = Population(intLoop).Fitness
End If
Next intLoop
Randomize Format(Time, "ss")
'One-Point Chromosome Crossover
intCrossOver = ((CInt(Rnd * (Splices - 1)) + 1) * Max_Bits) - Max_Bits
'Find fittest chromosome
dblRnd = Rnd * (dblRndFitness * Momentum)
dblFittest = 0
For i = 1 To Bits / 2
If Population(i).Fitness > dblRnd Then
dblRnd = Rnd * 1
If dblRnd > (1 - Selection) Then
If Population(i).Fitness > dblFittest Then
dblFittest2 = dblFittest
dblFittest = Population(i).Fitness
intFittest2 = intFittest
intFittest = i
FittestChromosome = Population(i).value
Fittestvalue = Population(i).Fitness
'Fittest chromosome values
For n = 1 To Splices
aryFittestvalue(n) = Sections(n, i)
Next n
End If
End If
End If
Next i
'Make sure there are two different parent chromosomes
If intFittest = 0 Then
intRnd = Rnd * ((Bits - 1) / 2) + 1
dblFittest = Population(intRnd).Fitness
intFittest = intRnd
End If
If intFittest2 = 0 Then
intRnd = Rnd * ((Bits - 1) / 2) + 1
dblFittest2 = Population(intRnd).Fitness
intFittest2 = intRnd
End If
'Cross them over
Father = Mid(Population(intFittest).value, 1, intCrossOver)
Mother = Mid(Population(intFittest2).value, intCrossOver + 1)
'Find the least fit chromosome and replace it
dblLeastFit = dblFittest
For intLoop = 1 To Bits / 2
If Population(intLoop).Fitness < dblLeastFit Then
dblLeastFit = Population(intLoop).Fitness
intLeastFit = intLoop
End If
Next intLoop
If intLeastFit = 0 Then
intRnd = Rnd * ((Bits - 1) / 2) + 1
dblLeastFit = Population(intRnd).Fitness
intLeastFit = intRnd
End If
'Insert the new hybrid chromosome
Population(intLeastFit).value = Father & Mother
'Mutate the chromosomes (very important)
For intLoop = 1 To Bits / 2
dblRnd = Rnd * 1
If dblRnd > (1 - Selection) Then
intMutate = CInt(Rnd * 1)
intCrossOver = Rnd * (Bits - 1)
Mid(Population(intLoop).value, intCrossOver + 1, 1) = intMutate
End If
Next intLoop
End Function
Public Sub Run()
Dim lngWhere As Long
'Get the maximum value for each splice in the chromosome
Max_value = DecodeChromosome(String(Max_Bits, "1"))
InitializePopulation
Do
CalculateFitness
If Solution <> 0 Then
Solution = 0
RaiseEvent Solved(FittestChromosome, Fittestvalue, aryFittestvalue)
Exit Sub
End If
NextGeneration
RaiseEvent BestSolution(FittestChromosome, Fittestvalue, aryFittestvalue)
DoEvents
If m_Quit = True Then
m_Quit = False
Exit Sub
End If
Loop
End Sub
Private Function EncodeChromosome(lngDecimal As Long) As String
Dim Remainder(1 To Max_Bits) As Double
Dim DecimalNumber As Double
Dim i As Integer
'get value
DecimalNumber = Val(lngDecimal)
'calculate
For i = 1 To Max_Bits
Remainder(i) = DecimalNumber Mod 2
DecimalNumber = DecimalNumber / 2
DecimalNumber = Int(DecimalNumber)
Next i
'build chromosome
For i = Max_Bits To 1 Step -1
EncodeChromosome = EncodeChromosome & Remainder(i)
Next i
Erase Remainder
End Function
Private Function DecodeChromosome(strChromosome As String) As Integer
Dim Binum(1 To Max_Bits) As Double
Dim Power As Double
Dim i As Integer
Dim BinLen As Integer
'Remove leading zeros
Do
If Len(strChromosome) = 0 Then Exit Function
If Mid(strChromosome, 1, 1) = "0" Then
strChromosome = Mid(strChromosome, 2)
Else
Exit Do
End If
Loop
'get the length of the Chromosome
BinLen = Len(strChromosome)
'get the value
Power = 2 ^ (BinLen - 1)
'calculate the decimal value
For i = 1 To Max_Bits
If Mid(strChromosome, i, 1) = "1" Then
Binum(i) = Power
ElseIf Mid(strChromosome, i, 1) = "0" Then
Binum(i) = 0
End If
Power = Power - (Power / 2)
Next i
'sum up the binary numbers
For i = 1 To Max_Bits
DecodeChromosome = DecodeChromosome + Binum(i)
Next i
Erase Binum 'Clear array
End Function
Public Property Let Fitness(value As Double)
m_Fitness = value
m_FitnessSet = True
End Property
Public Property Get Fitness() As Double
Fitness = m_Fitness
End Property

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲最新视频在线观看| 91成人在线精品| 亚洲国产三级在线| 亚洲女子a中天字幕| 亚洲国产成人午夜在线一区| 精品国产一区二区亚洲人成毛片| 欧美日韩在线综合| 欧美日韩国产首页| 在线电影院国产精品| 欧美日韩激情一区二区| 欧美人xxxx| 亚洲精品一区二区三区精华液| 欧美成人综合网站| 日本一区二区视频在线观看| 国产精品色呦呦| 亚洲同性同志一二三专区| 亚洲人成在线播放网站岛国| 亚洲成人tv网| 秋霞电影一区二区| 免费av成人在线| 亚洲综合免费观看高清在线观看| 久久久久九九视频| 国产精品国产三级国产aⅴ中文| 国产精品不卡一区| 亚洲一区二区精品3399| 日韩国产高清在线| 国产成人亚洲综合色影视| 成人激情校园春色| 欧美片网站yy| 精品国产三级电影在线观看| 国产日韩精品久久久| 国产精品高清亚洲| 亚洲成人三级小说| 国产剧情在线观看一区二区| 色天使色偷偷av一区二区| 欧美三级中文字幕在线观看| 日韩欧美一区电影| 久久综合久久久久88| 2021国产精品久久精品| 日本一区二区三级电影在线观看| 一区二区在线观看不卡| 石原莉奈在线亚洲三区| 精品亚洲成a人| 在线观看免费一区| 久久综合丝袜日本网| 一区二区三区免费| 毛片一区二区三区| 97国产一区二区| 久久久久久久国产精品影院| 一区二区三区在线不卡| 国产福利一区二区三区视频| 欧美浪妇xxxx高跟鞋交| 中文字幕一区av| 久久99国产精品久久99果冻传媒| av一区二区三区四区| 2024国产精品| 色猫猫国产区一区二在线视频| 97se亚洲国产综合自在线| 91啪亚洲精品| 欧美极品另类videosde| 日韩成人午夜电影| 在线观看亚洲一区| 国产精品沙发午睡系列990531| 蜜臂av日日欢夜夜爽一区| 一本大道久久a久久精二百| 久久久天堂av| 久久精品国产亚洲a| 欧美日韩国产小视频| 亚洲精品欧美综合四区| 成人免费av在线| 中文字幕国产一区| 国产suv精品一区二区6| 91精品啪在线观看国产60岁| 4438成人网| 亚洲精品乱码久久久久久| 国产精品一区二区无线| 日韩一级视频免费观看在线| 欧美aaaaa成人免费观看视频| 欧美日韩中文字幕一区| 亚洲视频一区在线| av福利精品导航| 国产精品国产三级国产普通话蜜臀| 岛国一区二区三区| 久久久午夜精品理论片中文字幕| 日本午夜一本久久久综合| 色噜噜狠狠色综合欧洲selulu| 亚洲精品在线观| 国产乱子伦一区二区三区国色天香 | 激情五月激情综合网| 欧美美女网站色| 亚洲国产精品人人做人人爽| 欧美日韩一区成人| 日韩精品亚洲一区| 7777精品伊人久久久大香线蕉超级流畅 | 成人福利视频网站| 亚洲男人天堂一区| 538prom精品视频线放| 久久成人av少妇免费| 久久久久亚洲蜜桃| 91麻豆.com| 美女在线一区二区| 欧美激情综合在线| 欧美视频第二页| 国内精品嫩模私拍在线| 国产日韩欧美综合在线| 91丨九色丨黑人外教| 日本不卡视频一二三区| 国产亚洲短视频| 91免费在线播放| 亚洲成人在线观看视频| 亚洲精品一区二区三区影院 | 91在线看国产| 亚洲成在线观看| 日韩一区二区在线看片| 成人一二三区视频| 日韩高清国产一区在线| 国产精品网站在线播放| 欧美精品在线一区二区三区| 亚洲韩国一区二区三区| 久久久天堂av| 欧美日韩一区精品| 成人a免费在线看| 蜜桃精品视频在线观看| 亚洲男女一区二区三区| 久久只精品国产| 欧美日韩国产另类一区| 成人午夜在线免费| 免费高清在线一区| 亚洲精品一卡二卡| 久久久av毛片精品| 91麻豆精品国产91久久久资源速度| 国产91露脸合集magnet| 久久国产免费看| 五月婷婷另类国产| 亚洲欧洲日产国产综合网| 2017欧美狠狠色| 欧美日韩美女一区二区| 色综合激情久久| av日韩在线网站| 韩国毛片一区二区三区| 亚洲午夜免费电影| 欧美激情综合网| 精品sm捆绑视频| 制服丝袜激情欧洲亚洲| 在线观看国产91| 99视频超级精品| 麻豆国产精品一区二区三区| 性做久久久久久| 亚洲电影一级黄| 亚洲国产精品天堂| 亚洲精品成a人| 一色屋精品亚洲香蕉网站| 国产女人18水真多18精品一级做| 欧美日韩高清一区| 色婷婷久久久久swag精品| 91国偷自产一区二区开放时间| 成人精品国产一区二区4080| 国产精品中文字幕日韩精品 | 午夜精品久久久久久久久久| 亚洲午夜一区二区三区| 亚洲午夜精品17c| 午夜精品久久久| 久久福利视频一区二区| 久久国产尿小便嘘嘘尿| 国产精品一级片| 福利一区二区在线| 97se狠狠狠综合亚洲狠狠| 日本道色综合久久| 欧美三级电影精品| 欧美一区二区播放| 国产日韩欧美亚洲| ...av二区三区久久精品| 亚洲黄色性网站| 免费在线看一区| 国产黑丝在线一区二区三区| 波多野结衣精品在线| 在线一区二区三区| 日韩欧美国产电影| 中文字幕欧美国产| 亚洲美女屁股眼交3| 日韩av一区二区三区四区| 国产麻豆日韩欧美久久| a级精品国产片在线观看| 在线一区二区三区四区五区 | 久久久久久久久久久久久久久99| 国产精品美女一区二区| 亚洲国产人成综合网站| 激情国产一区二区| 国产福利精品一区二区| 色噜噜久久综合| 久久免费精品国产久精品久久久久| 一区精品在线播放| 免费人成在线不卡| 丁香六月久久综合狠狠色| 欧美精品久久天天躁| 国产欧美精品日韩区二区麻豆天美 | 中文字幕一区二区在线观看| 午夜精品福利在线| 91视频在线看| 久久久不卡网国产精品一区|