📄 modfindbestandworstindividual.bas
字号:
Attribute VB_Name = "ModFindBestAndWorstIndividual"
'找出最优、最差个体
'并更新当前最优个体
Sub FindBestAndWorstIndividual()
Dim i As Integer
BestIndividual = Population(0)
WorstIndividual = Population(0)
For i = 1 To PopSize - 1
If Population(i).fitness > BestIndividual.fitness Then
BestIndividual = Population(i)
Best_Index = i
ElseIf Population(i).fitness < WorstIndividual.fitness Then
WorstIndividual = Population(i)
Worst_Index = i
End If
Next i
If Generation = 0 Then
CurrentBest = BestIndividual
ElseIf BestIndividual.fitness > CurrentBest.fitness Then
CurrentBest = BestIndividual
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -