www.pudn.com > acs_TSP_VB.rar > frmMMAS.frm
VERSION 5.00
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Begin VB.Form frmMMAS
Caption = "Ant System & Its Improved Algorithms(Experiment - ChenYe)"
ClientHeight = 8115
ClientLeft = 60
ClientTop = 345
ClientWidth = 11880
LinkTopic = "Form1"
ScaleHeight = 8115
ScaleWidth = 11880
Begin VB.Frame Frame1
Caption = "当前状态"
Height = 1455
Left = 0
TabIndex = 35
Top = 6600
Width = 8775
Begin VB.CommandButton cmdAbout
Caption = "ChenYe"
Height = 255
Left = 7920
TabIndex = 88
ToolTipText = "关于本软件"
Top = 1080
Width = 735
End
Begin VB.TextBox txtGlobalBestPath
BackColor = &H8000000F&
Height = 270
Left = 2880
Locked = -1 'True
TabIndex = 51
Top = 720
Width = 5775
End
Begin VB.TextBox txtGlobalBestLen
BackColor = &H8000000F&
Height = 270
Left = 1080
Locked = -1 'True
TabIndex = 50
Top = 1080
Width = 2775
End
Begin VB.TextBox txtGlobalBestIteration
BackColor = &H8000000F&
Height = 270
Left = 600
Locked = -1 'True
TabIndex = 46
Top = 720
Width = 735
End
Begin VB.Label Label20
Caption = "(CopyRighted)For Experiment Only - Written by"
Height = 255
Left = 3840
TabIndex = 66
Top = 1080
Width = 4095
End
Begin VB.Label Label15
Caption = "正在计算第"
Height = 255
Left = 120
TabIndex = 54
Top = 360
Width = 975
End
Begin VB.Label Label16
Caption = "次中的"
Height = 255
Left = 1800
TabIndex = 53
Top = 360
Width = 615
End
Begin VB.Label lblTimes
Alignment = 2 'Center
Caption = "0"
Height = 255
Left = 1080
TabIndex = 52
Top = 360
Width = 615
End
Begin VB.Label Label13
Caption = "其长度为:"
Height = 255
Left = 120
TabIndex = 49
Top = 1080
Width = 1215
End
Begin VB.Label Label8
Caption = "在第"
Height = 255
Left = 120
TabIndex = 48
Top = 720
Width = 375
End
Begin VB.Label Label9
Caption = "代找到最短路径:"
Height = 255
Left = 1440
TabIndex = 47
Top = 720
Width = 1455
End
Begin VB.Label lblIteration
Alignment = 2 'Center
Caption = "0"
Height = 255
Left = 2640
TabIndex = 38
Top = 360
Width = 735
End
Begin VB.Label Label11
Caption = "第"
Height = 255
Left = 2400
TabIndex = 37
Top = 360
Width = 255
End
Begin VB.Label Label12
Caption = "代"
Height = 255
Left = 3360
TabIndex = 36
Top = 360
Width = 255
End
End
Begin TabDlg.SSTab SSTab2
Height = 7935
Left = 8880
TabIndex = 19
Top = 120
Width = 2895
_ExtentX = 5106
_ExtentY = 13996
_Version = 393216
Tab = 1
TabHeight = 520
TabCaption(0) = "参数设置"
TabPicture(0) = "frmMMAS.frx":0000
Tab(0).ControlEnabled= 0 'False
Tab(0).Control(0)= "Label7"
Tab(0).Control(0).Enabled= 0 'False
Tab(0).Control(1)= "Label6"
Tab(0).Control(1).Enabled= 0 'False
Tab(0).Control(2)= "Label5"
Tab(0).Control(2).Enabled= 0 'False
Tab(0).Control(3)= "Label4"
Tab(0).Control(3).Enabled= 0 'False
Tab(0).Control(4)= "Label3"
Tab(0).Control(4).Enabled= 0 'False
Tab(0).Control(5)= "Label2"
Tab(0).Control(5).Enabled= 0 'False
Tab(0).Control(6)= "Label1"
Tab(0).Control(6).Enabled= 0 'False
Tab(0).Control(7)= "Label19"
Tab(0).Control(7).Enabled= 0 'False
Tab(0).Control(8)= "Label22"
Tab(0).Control(8).Enabled= 0 'False
Tab(0).Control(9)= "Label28"
Tab(0).Control(9).Enabled= 0 'False
Tab(0).Control(10)= "Label29"
Tab(0).Control(10).Enabled= 0 'False
Tab(0).Control(11)= "txtSigma"
Tab(0).Control(11).Enabled= 0 'False
Tab(0).Control(12)= "txtW"
Tab(0).Control(12).Enabled= 0 'False
Tab(0).Control(13)= "txtMaxIter"
Tab(0).Control(13).Enabled= 0 'False
Tab(0).Control(14)= "txtTaoMin"
Tab(0).Control(14).Enabled= 0 'False
Tab(0).Control(15)= "txtTaoMax"
Tab(0).Control(15).Enabled= 0 'False
Tab(0).Control(16)= "txtRou"
Tab(0).Control(16).Enabled= 0 'False
Tab(0).Control(17)= "txtBeta"
Tab(0).Control(17).Enabled= 0 'False
Tab(0).Control(18)= "txtAlpha"
Tab(0).Control(18).Enabled= 0 'False
Tab(0).Control(19)= "txtMaxAnts"
Tab(0).Control(19).Enabled= 0 'False
Tab(0).Control(20)= "txtTao0"
Tab(0).Control(20).Enabled= 0 'False
Tab(0).Control(21)= "txtQ0"
Tab(0).Control(21).Enabled= 0 'False
Tab(0).Control(22)= "chkInitRan"
Tab(0).Control(22).Enabled= 0 'False
Tab(0).ControlCount= 23
TabCaption(1) = "计算控制"
TabPicture(1) = "frmMMAS.frx":001C
Tab(1).ControlEnabled= -1 'True
Tab(1).Control(0)= "Label14"
Tab(1).Control(0).Enabled= 0 'False
Tab(1).Control(1)= "Label10"
Tab(1).Control(1).Enabled= 0 'False
Tab(1).Control(2)= "Label21"
Tab(1).Control(2).Enabled= 0 'False
Tab(1).Control(3)= "chkUseNew1"
Tab(1).Control(3).Enabled= 0 'False
Tab(1).Control(4)= "chkCAvg"
Tab(1).Control(4).Enabled= 0 'False
Tab(1).Control(5)= "txtCalcTime"
Tab(1).Control(5).Enabled= 0 'False
Tab(1).Control(6)= "cmdStop"
Tab(1).Control(6).Enabled= 0 'False
Tab(1).Control(7)= "cmdStart"
Tab(1).Control(7).Enabled= 0 'False
Tab(1).Control(8)= "lstCityData"
Tab(1).Control(8).Enabled= 0 'False
Tab(1).Control(9)= "cmdNextStep"
Tab(1).Control(9).Enabled= 0 'False
Tab(1).Control(10)= "cmdStopStep_by_Step"
Tab(1).Control(10).Enabled= 0 'False
Tab(1).ControlCount= 11
TabCaption(2) = "结果显示"
TabPicture(2) = "frmMMAS.frx":0038
Tab(2).ControlEnabled= 0 'False
Tab(2).Control(0)= "Frame2"
Tab(2).Control(0).Enabled= 0 'False
Tab(2).Control(1)= "Frame3"
Tab(2).Control(1).Enabled= 0 'False
Tab(2).Control(2)= "Frame4"
Tab(2).Control(2).Enabled= 0 'False
Tab(2).ControlCount= 3
Begin VB.CheckBox chkInitRan
Caption = "Init by Randomize Number"
Height = 255
Left = -74880
TabIndex = 102
Top = 7200
Width = 2535
End
Begin VB.TextBox txtQ0
Height = 270
Left = -74880
TabIndex = 101
Text = "0"
Top = 5640
Width = 1575
End
Begin VB.TextBox txtTao0
Height = 270
Left = -74880
TabIndex = 99
Text = "0.1"
Top = 6840
Width = 1575
End
Begin VB.CommandButton cmdStopStep_by_Step
Caption = "停止一步一步地显示"
Enabled = 0 'False
Height = 375
Left = 360
TabIndex = 97
Top = 2760
Width = 2175
End
Begin VB.CommandButton cmdNextStep
Caption = "下一步(&N)"
Enabled = 0 'False
Height = 375
Left = 600
TabIndex = 84
Top = 2280
Width = 1695
End
Begin VB.Frame Frame4
Caption = "图表绘制控制"
Height = 2415
Left = -74880
TabIndex = 73
Top = 4080
Width = 2655
Begin VB.CheckBox chkStepByStep
Caption = "一步一步地显示结果"
Height = 255
Left = 120
TabIndex = 83
Top = 2040
Width = 2295
End
Begin VB.CheckBox chkDrawTao
Caption = "在城市地图中动态绘制信息量变化情况"
Height = 375
Left = 120
TabIndex = 81
Top = 1680
Value = 1 'Checked
Width = 2295
End
Begin VB.CheckBox chkDrawPath
Caption = "在城市地图中动态绘制最优个体路径"
Height = 375
Left = 120
TabIndex = 79
Top = 1320
Value = 1 'Checked
Width = 2295
End
Begin VB.CheckBox chkDrawTogether
Caption = "将最优路径演化图与平均路径演化图绘制在同一副图中"
Height = 615
Left = 120
TabIndex = 76
Top = 720
Value = 2 'Grayed
Width = 2295
End
Begin VB.CheckBox chkDrawAvgLen
Caption = "绘制平均路径演化图"
Height = 255
Left = 120
TabIndex = 75
Top = 480
Value = 1 'Checked
Width = 1935
End
Begin VB.CheckBox chkDrawBestLen
Caption = "绘制最优路径演化图"
Height = 255
Left = 120
TabIndex = 74
Top = 240
Value = 1 'Checked
Width = 1935
End
End
Begin VB.TextBox txtMaxAnts
Height = 270
Left = -74880
TabIndex = 70
Text = "10"
Top = 720
Width = 1575
End
Begin VB.ListBox lstCityData
Height = 4200
ItemData = "frmMMAS.frx":0054
Left = 120
List = "frmMMAS.frx":008E
Sorted = -1 'True
TabIndex = 67
Top = 3480
Width = 2655
End
Begin VB.Frame Frame3
Caption = "连续计算显示控制"
Height = 855
Left = -74880
TabIndex = 60
Top = 3120
Width = 2655
Begin VB.CheckBox chkAlwaysCleanResult
Caption = "连续计算时每次开始前都清除显示数据"
Height = 375
Left = 120
TabIndex = 61
Top = 360
Value = 1 'Checked
Width = 2415
End
End
Begin VB.Frame Frame2
Caption = "清除显示的数据"
Height = 2415
Left = -74880
TabIndex = 55
Top = 600
Width = 2655
Begin VB.CommandButton cmdCleanMap
Caption = "清除城市及路径状态图"
Height = 615
Left = 120
TabIndex = 80
Top = 1680
Width = 1095
End
Begin VB.CommandButton cmdCleanList
Caption = "清除最优路径及长度列表框"
Height = 615
Left = 120
Style = 1 'Graphical
TabIndex = 59
Top = 240
Width = 1095
End
Begin VB.CommandButton cmdClearPicBestLen
Caption = "清除最优路径演化图"
Height = 615
Left = 1440
Style = 1 'Graphical
TabIndex = 58
Top = 240
Width = 1095
End
Begin VB.CommandButton cmdCleanPicAvgLen
Caption = "清除平均路径演化图"
Height = 615
Left = 120
Style = 1 'Graphical
TabIndex = 57
Top = 960
Width = 1095
End
Begin VB.CommandButton cmdCleanAll
Caption = "清除所有"
Height = 615
Left = 1440
TabIndex = 56
Top = 960
Width = 1095
End
End
Begin VB.CommandButton cmdStart
Caption = "开始计算(&S)"
Height = 375
Left = 600
TabIndex = 45
Top = 1320
Width = 1695
End
Begin VB.CommandButton cmdStop
Caption = "停止计算(&P)"
Enabled = 0 'False
Height = 375
Left = 600
TabIndex = 44
Top = 1800
Width = 1695
End
Begin VB.TextBox txtCalcTime
Alignment = 2 'Center
Height = 270
Left = 720
TabIndex = 41
Text = "20"
Top = 840
Width = 975
End
Begin VB.CheckBox chkCAvg
Height = 255
Left = 120
TabIndex = 40
Top = 840
Width = 255
End
Begin VB.CheckBox chkUseNew1
Caption = "使用新方法"
Height = 255
Left = 120
TabIndex = 39
Top = 480
Width = 1335
End
Begin VB.TextBox txtAlpha
Height = 270
Left = -74880
TabIndex = 27
Text = "2"
Top = 2040
Width = 1575
End
Begin VB.TextBox txtBeta
Height = 270
Left = -74880
TabIndex = 26
Text = "2"
Top = 2640
Width = 1575
End
Begin VB.TextBox txtRou
Height = 270
Left = -74880
TabIndex = 25
Text = "0.1"
Top = 3240
Width = 1575
End
Begin VB.TextBox txtTaoMax
Height = 270
Left = -74880
TabIndex = 24
Text = "10"
Top = 3840
Width = 1575
End
Begin VB.TextBox txtTaoMin
Height = 270
Left = -74880
TabIndex = 23
Text = "0.01"
Top = 4440
Width = 1575
End
Begin VB.TextBox txtMaxIter
Height = 270
Left = -74880
TabIndex = 22
Text = "1000"
Top = 1440
Width = 1575
End
Begin VB.TextBox txtW
Height = 270
Left = -74880
TabIndex = 21
Text = "1"
Top = 5040
Width = 1575
End
Begin VB.TextBox txtSigma
Height = 270
Left = -74880
TabIndex = 20
Text = "0.2"
Top = 6240
Width = 1575
End
Begin VB.Label Label29
Caption = "Q0"
Height = 255
Left = -74880
TabIndex = 100
Top = 5400
Width = 1575
End
Begin VB.Label Label28
Caption = "Tao0"
Height = 255
Left = -74880
TabIndex = 98
Top = 6600
Width = 1575
End
Begin VB.Label Label22
Caption = "蚂蚁数:"
Height = 255
Left = -74880
TabIndex = 69
Top = 480
Width = 1575
End
Begin VB.Label Label21
Caption = "采用这一组数据来计算:"
Height = 255
Left = 120
TabIndex = 68
Top = 3240
Width = 2175
End
Begin VB.Label Label19
Caption = "用于新方法的参数"
Height = 255
Left = -74880
TabIndex = 65
Top = 6000
Width = 1575
End
Begin VB.Label Label10
Caption = "计算"
Height = 255
Left = 360
TabIndex = 43
Top = 840
Width = 495
End
Begin VB.Label Label14
Caption = "次求平均值"
Height = 255
Left = 1800
TabIndex = 42
Top = 840
Width = 975
End
Begin VB.Label Label1
Caption = "Alpha"
Height = 255
Left = -74880
TabIndex = 34
Top = 1800
Width = 1575
End
Begin VB.Label Label2
Caption = "Beta"
Height = 255
Left = -74880
TabIndex = 33
Top = 2400
Width = 1575
End
Begin VB.Label Label3
Caption = "Rou"
Height = 255
Left = -74880
TabIndex = 32
Top = 3000
Width = 1575
End
Begin VB.Label Label4
Caption = "TaoMax"
Height = 255
Left = -74880
TabIndex = 31
Top = 3600
Width = 1575
End
Begin VB.Label Label5
Caption = "TaoMin"
Height = 255
Left = -74880
TabIndex = 30
Top = 4200
Width = 1575
End
Begin VB.Label Label6
Caption = "计算代数:"
Height = 255
Left = -74880
TabIndex = 29
Top = 1200
Width = 1575
End
Begin VB.Label Label7
Caption = "W"
Height = 255
Left = -74880
TabIndex = 28
Top = 4800
Width = 1575
End
End
Begin TabDlg.SSTab SSTab1
Height = 6375
Left = 0
TabIndex = 0
Top = 120
Width = 8805
_ExtentX = 15531
_ExtentY = 11245
_Version = 393216
Tabs = 5
Tab = 4
TabsPerRow = 5
TabHeight = 520
TabCaption(0) = "最优路径及其长度"
TabPicture(0) = "frmMMAS.frx":011B
Tab(0).ControlEnabled= 0 'False
Tab(0).Control(0)= "txtBestPathAid"
Tab(0).Control(1)= "lstBestPath"
Tab(0).Control(2)= "txtErrRep"
Tab(0).Control(3)= "lstBestLenRep"
Tab(0).Control(4)= "Label18"
Tab(0).Control(5)= "Label17"
Tab(0).ControlCount= 6
TabCaption(1) = "最优路径演化图"
TabPicture(1) = "frmMMAS.frx":0137
Tab(1).ControlEnabled= 0 'False
Tab(1).Control(0)= "picBestLen"
Tab(1).Control(1)= "AxisBestLenY"
Tab(1).Control(2)= "AxisBestLenX"
Tab(1).Control(3)= "txtBestLenYMax"
Tab(1).Control(4)= "txtBestLenYMin"
Tab(1).Control(5)= "txtBestLenXMin"
Tab(1).Control(6)= "txtBestLenXMax"
Tab(1).Control(7)= "txtBestLenNY"
Tab(1).Control(8)= "txtBestLenNX"
Tab(1).ControlCount= 9
TabCaption(2) = "平均路径演化图"
TabPicture(2) = "frmMMAS.frx":0153
Tab(2).ControlEnabled= 0 'False
Tab(2).Control(0)= "picAvgLen"
Tab(2).Control(1)= "AxisAvgLenY"
Tab(2).Control(2)= "AxisAvgLenX"
Tab(2).Control(3)= "txtAvgLenYMax"
Tab(2).Control(4)= "txtAvgLenYMin"
Tab(2).Control(5)= "txtAvgLenXMin"
Tab(2).Control(6)= "txtAvgLenXMax"
Tab(2).Control(7)= "txtAvgLenNY"
Tab(2).Control(8)= "txtAvgLenNX"
Tab(2).ControlCount= 9
TabCaption(3) = "城市及路径状态图"
TabPicture(3) = "frmMMAS.frx":016F
Tab(3).ControlEnabled= 0 'False
Tab(3).Control(0)= "picTao"
Tab(3).Control(0).Enabled= 0 'False
Tab(3).Control(1)= "picCityMap"
Tab(3).Control(1).Enabled= 0 'False
Tab(3).Control(2)= "Label25"
Tab(3).Control(2).Enabled= 0 'False
Tab(3).Control(3)= "Label24"
Tab(3).Control(3).Enabled= 0 'False
Tab(3).Control(4)= "Label23"
Tab(3).Control(4).Enabled= 0 'False
Tab(3).ControlCount= 5
TabCaption(4) = "蚂蚁运动图"
TabPicture(4) = "frmMMAS.frx":018B
Tab(4).ControlEnabled= -1 'True
Tab(4).Control(0)= "Label26"
Tab(4).Control(0).Enabled= 0 'False
Tab(4).Control(1)= "Label27"
Tab(4).Control(1).Enabled= 0 'False
Tab(4).Control(2)= "picMovOfAnt"
Tab(4).Control(2).Enabled= 0 'False
Tab(4).Control(3)= "cmdShowAntMove"
Tab(4).Control(3).Enabled= 0 'False
Tab(4).Control(4)= "lstAnt_to_Show"
Tab(4).Control(4).Enabled= 0 'False
Tab(4).Control(5)= "cmdShowBestAntMove"
Tab(4).Control(5).Enabled= 0 'False
Tab(4).Control(6)= "cmdNextMove"
Tab(4).Control(6).Enabled= 0 'False
Tab(4).Control(7)= "txtProb"
Tab(4).Control(7).Enabled= 0 'False
Tab(4).ControlCount= 8
Begin VB.TextBox txtProb
Height = 270
Left = 240
Locked = -1 'True
TabIndex = 95
Top = 2880
Width = 3015
End
Begin VB.CommandButton cmdNextMove
Caption = "蚂蚁的下一步移动"
Enabled = 0 'False
Height = 375
Left = 720
TabIndex = 94
Top = 2160
Width = 1935
End
Begin VB.CommandButton cmdShowBestAntMove
Caption = "显示最佳蚂蚁移动"
Enabled = 0 'False
Height = 495
Left = 240
TabIndex = 93
Top = 1440
Width = 2895
End
Begin VB.ListBox lstAnt_to_Show
Enabled = 0 'False
Height = 240
ItemData = "frmMMAS.frx":01A7
Left = 960
List = "frmMMAS.frx":01C9
TabIndex = 91
Top = 960
Width = 735
End
Begin VB.CommandButton cmdShowAntMove
Caption = "显示第 只蚂蚁的运动图"
Enabled = 0 'False
Height = 495
Left = 240
TabIndex = 90
Top = 840
Width = 2895
End
Begin VB.PictureBox picMovOfAnt
Appearance = 0 'Flat
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 5295
Left = 3360
ScaleHeight = 5265
ScaleWidth = 5265
TabIndex = 89
Top = 840
Width = 5295
End
Begin VB.PictureBox picTao
Appearance = 0 'Flat
AutoRedraw = -1 'True
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 4095
Left = -74760
ScaleHeight = 4065
ScaleWidth = 4065
TabIndex = 82
Top = 720
Width = 4095
End
Begin VB.PictureBox picCityMap
Appearance = 0 'Flat
AutoRedraw = -1 'True
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 4095
Left = -70440
ScaleHeight = 4065
ScaleWidth = 4065
TabIndex = 78
Top = 720
Width = 4095
End
Begin VB.TextBox txtBestPathAid
BackColor = &H8000000F&
Height = 495
Left = -74880
Locked = -1 'True
MultiLine = -1 'True
ScrollBars = 1 'Horizontal
TabIndex = 77
Top = 5760
Width = 8535
End
Begin VB.TextBox txtAvgLenNX
Alignment = 2 'Center
Height = 270
Left = -70200
TabIndex = 72
Text = "10"
Top = 6000
Width = 615
End
Begin VB.TextBox txtAvgLenNY
Alignment = 2 'Center
Height = 270
Left = -74760
TabIndex = 71
Text = "10"
Top = 2880
Width = 615
End
Begin VB.ListBox lstBestPath
Height = 4920
ItemData = "frmMMAS.frx":01EC
Left = -71880
List = "frmMMAS.frx":01EE
TabIndex = 64
Top = 720
Width = 5535
End
Begin VB.TextBox txtBestLenNX
Alignment = 2 'Center
Height = 270
Left = -70800
TabIndex = 18
Text = "10"
Top = 6000
Width = 735
End
Begin VB.TextBox txtBestLenNY
Alignment = 2 'Center
Height = 270
Left = -74760
TabIndex = 17
Text = "10"
Top = 2880
Width = 615
End
Begin VB.TextBox txtAvgLenXMax
Alignment = 1 'Right Justify
Appearance = 0 'Flat
Height = 270
Left = -67200
TabIndex = 16
Text = "1000"
Top = 6000
Width = 855
End
Begin VB.TextBox txtAvgLenXMin
Appearance = 0 'Flat
Height = 270
Left = -73920
Locked = -1 'True
TabIndex = 15
Text = "0"
Top = 6000
Width = 735
End
Begin VB.TextBox txtAvgLenYMin
Alignment = 1 'Right Justify
Appearance = 0 'Flat
Height = 270
Left = -74760
TabIndex = 14
Text = "0"
Top = 5640
Width = 735
End
Begin VB.TextBox txtAvgLenYMax
Alignment = 1 'Right Justify
Appearance = 0 'Flat
Height = 270
Left = -74760
TabIndex = 13
Text = "250000"
Top = 480
Width = 735
End
Begin VB.PictureBox AxisAvgLenX
Appearance = 0 'Flat
AutoRedraw = -1 'True
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 135
Left = -73920
ScaleHeight = 105
ScaleWidth = 7545
TabIndex = 12
Top = 5880
Width = 7575
End
Begin VB.PictureBox AxisAvgLenY
Appearance = 0 'Flat
AutoRedraw = -1 'True
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 5415
Left = -74040
ScaleHeight = 5385
ScaleWidth = 105
TabIndex = 11
Top = 480
Width = 135
End
Begin VB.PictureBox picAvgLen
Appearance = 0 'Flat
AutoRedraw = -1 'True
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 5415
Left = -73920
ScaleHeight = 5385
ScaleWidth = 7545
TabIndex = 10
Top = 480
Width = 7575
End
Begin VB.TextBox txtBestLenXMax
Alignment = 1 'Right Justify
Appearance = 0 'Flat
Height = 270
Left = -67200
TabIndex = 9
Text = "1000"
Top = 6000
Width = 855
End
Begin VB.TextBox txtBestLenXMin
Appearance = 0 'Flat
Height = 270
Left = -73920
Locked = -1 'True
TabIndex = 8
Text = "0"
Top = 6000
Width = 735
End
Begin VB.TextBox txtBestLenYMin
Alignment = 1 'Right Justify
Appearance = 0 'Flat
Height = 270
Left = -74760
TabIndex = 7
Text = "0"
Top = 5640
Width = 735
End
Begin VB.TextBox txtBestLenYMax
Alignment = 1 'Right Justify
Appearance = 0 'Flat
Height = 270
Left = -74760
TabIndex = 6
Text = "250000"
Top = 480
Width = 735
End
Begin VB.PictureBox AxisBestLenX
Appearance = 0 'Flat
AutoRedraw = -1 'True
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 135
Left = -73920
ScaleHeight = 105
ScaleWidth = 7545
TabIndex = 5
Top = 5880
Width = 7575
End
Begin VB.PictureBox AxisBestLenY
Appearance = 0 'Flat
AutoRedraw = -1 'True
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 5415
Left = -74040
ScaleHeight = 5385
ScaleWidth = 105
TabIndex = 4
Top = 480
Width = 135
End
Begin VB.PictureBox picBestLen
Appearance = 0 'Flat
AutoRedraw = -1 'True
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 5415
Left = -73920
ScaleHeight = 5385
ScaleWidth = 7545
TabIndex = 3
Top = 480
Width = 7575
End
Begin VB.TextBox txtErrRep
Height = 270
Left = -68280
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 2
Top = 360
Width = 1935
End
Begin VB.ListBox lstBestLenRep
Height = 4920
ItemData = "frmMMAS.frx":01F0
Left = -74880
List = "frmMMAS.frx":01F2
TabIndex = 1
Top = 720
Width = 2895
End
Begin VB.Label Label27
Caption = "蚂蚁这样移动的概率:"
Height = 255
Left = 240
TabIndex = 96
Top = 2640
Width = 1815
End
Begin VB.Label Label26
Caption = "该页在暂停时有效!"
Height = 255
Left = 240
TabIndex = 92
Top = 480
Width = 1935
End
Begin VB.Label Label25
Alignment = 2 'Center
Caption = "各路径信息量浓度图"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = -74760
TabIndex = 87
Top = 480
Width = 4095
End
Begin VB.Label Label24
Alignment = 2 'Center
Caption = "当前最短路径示意图"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = -70440
TabIndex = 86
Top = 480
Width = 4095
End
Begin VB.Label Label23
Alignment = 2 'Center
Caption = "(颜色越浓表示信息浓度量越大)"
Height = 255
Left = -74760
TabIndex = 85
Top = 4920
Width = 4095
End
Begin VB.Label Label18
Caption = "最优路径:"
Height = 255
Left = -71880
TabIndex = 63
Top = 480
Width = 975
End
Begin VB.Label Label17
Caption = "最优路径长度:"
Height = 255
Left = -74880
TabIndex = 62
Top = 480
Width = 1335
End
End
End
Attribute VB_Name = "frmMMAS"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Sign_Stop_Calc As Boolean
Dim BestAntOfIter As Integer, BestLenOfIter As Double
Dim WorstAntOfIter As Integer, WorstLenOfIter As Double
Dim GlobalBestLen As Double
Dim Iteration As Integer
Dim S_BestLen As Double
Dim strBestPath As String
Dim AvgLenOfIter As Double
Dim S_LenOfIter As Double
Private Sub Lock_Controls()
cmdStart.Enabled = False
chkCAvg.Enabled = False
chkUseNew1.Enabled = False
chkDrawBestLen.Enabled = False
chkDrawAvgLen.Enabled = False
chkAlwaysCleanResult.Enabled = False
chkDrawTogether.Enabled = False
lstCityData.Enabled = False
txtCalcTime.Enabled = False
txtMaxAnts.Enabled = False
txtAlpha.Enabled = False
txtBeta.Enabled = False
txtRou.Enabled = False
txtSigma.Enabled = False
txtTaoMax.Enabled = False
txtTaoMin.Enabled = False
txtW.Enabled = False
cmdStop.Enabled = True
End Sub
Private Sub UnLock_Controls()
cmdStart.Enabled = True
chkCAvg.Enabled = True
chkUseNew1.Enabled = True
chkDrawBestLen.Enabled = True
chkDrawAvgLen.Enabled = True
chkAlwaysCleanResult.Enabled = True
chkDrawTogether.Enabled = True
lstCityData.Enabled = True
txtCalcTime.Enabled = True
txtMaxAnts.Enabled = True
txtAlpha.Enabled = True
txtBeta.Enabled = True
txtRou.Enabled = True
txtSigma.Enabled = True
txtTaoMax.Enabled = True
txtTaoMin.Enabled = True
txtW.Enabled = True
cmdStop.Enabled = False
End Sub
Private Sub chkAlwaysCleanResult_Click()
If chkAlwaysCleanResult.Value = 1 Then
SignAlwaysCleanResult = True
Else
If chkAlwaysCleanResult.Value = 0 Then
SignAlwaysCleanResult = False
End If
End If
End Sub
Private Sub chkCAvg_Click()
If chkCAvg.Value = 1 Then
SignComputeAvg = True
Else
If chkCAvg.Value = 0 Then
SignComputeAvg = False
End If
End If
End Sub
Private Sub chkDrawAvgLen_Click()
If chkDrawAvgLen.Value = 1 Then
SignDrawAvgLen = True
Else
If chkDrawAvgLen.Value = 0 Then
SignDrawAvgLen = False
End If
End If
End Sub
Private Sub chkDrawBestLen_Click()
If chkDrawBestLen.Value = 1 Then
SignDrawBestLen = True
Else
If chkDrawBestLen.Value = 0 Then
SignDrawBestLen = False
End If
End If
End Sub
Private Sub chkDrawPath_Click()
If chkDrawPath.Value = 1 Then
SignDrawPath = True
Else
If chkDrawPath.Value = 0 Then
SignDrawPath = False
End If
End If
End Sub
Private Sub chkDrawTao_Click()
If chkDrawTao.Value = 1 Then
SignDrawTao = True
Else
If chkDrawTao.Value = 0 Then
SignDrawTao = False
End If
End If
End Sub
Private Sub chkStepByStep_Click()
If chkStepByStep.Value = 1 Then
SignShowStep_by_Step = True
cmdNextStep.Enabled = False
Else
If chkStepByStep.Value = 0 Then
SignShowStep_by_Step = False
cmdNextStep.Enabled = True
End If
End If
End Sub
Private Sub chkUseNew1_Click()
If chkUseNew1.Value = 1 Then
SignUseNew = True
Else
If chkUseNew1.Value = 0 Then
SignUseNew = False
End If
End If
End Sub
Private Sub chkInitRan_Click()
If chkInitRan.Value = 1 Then
SignInitRan = True
Else
If chkInitRan.Value = 0 Then
SignInitRan = False
End If
End If
End Sub
Private Sub cmdAbout_Click()
frmAbout.Show
End Sub
Private Sub cmdCleanAll_Click()
lstBestLenRep.Clear
lstBestPath.Clear
picAvgLen.Cls
picBestLen.Cls
End Sub
Private Sub cmdCleanList_Click()
lstBestLenRep.Clear
lstBestPath.Clear
End Sub
Private Sub cmdCleanPicAvgLen_Click()
picAvgLen.Cls
End Sub
Private Sub cmdClearPicBestLen_Click()
picBestLen.Cls
End Sub
Private Sub cmdNextMove_Click()
SignShowNextMove = True
cmdNextMove.Enabled = False
End Sub
Private Sub cmdNextStep_Click()
SignPause = True
cmdNextStep.Enabled = False
cmdShowAntMove.Enabled = False
lstAnt_to_Show.Enabled = False
cmdShowBestAntMove.Enabled = False
cmdStopStep_by_Step.Enabled = True
End Sub
Private Sub cmdShowAntMove_Click()
cmdNextMove.Enabled = True
a = Val(lstAnt_to_Show.Text)
If a = 0 Then
MsgBox "必须选择一只蚂蚁!"
Exit Sub
End If
Show_Ant_Move a
End Sub
Private Sub cmdShowBestAntMove_Click()
Show_Ant_Move BestAntOfIter
End Sub
Private Sub cmdStart_Click()
If lstCityData.ListIndex = -1 Then
MsgBox "必须先选择一组城市数据!"
Exit Sub
End If
Lock_Controls
Draw_XOY
r = Init_MMAS
Init_Pic
Draw_City_Init
Draw_City
Draw_Tao_Init
Show_Ant_Move_Init
Sign_Stop_Calc = False
If SignComputeAvg = False Then
CalcTimes = 1
End If
S_BestLen = 0
GlobalBestLen = 0
For Time_Calc_Avg = 1 To CalcTimes
If Sign_Stop_Calc = True Then
Exit For
End If
If SignAlwaysCleanResult = True Then
lstBestLenRep.Clear
lstBestPath.Clear
picAvgLen.Cls
picBestLen.Cls
End If
Iteration = 1
Do
lblIteration.Caption = Iteration
r = Iteration_Init
BestAntOfIter = 0
BestLenOfIter = 0
WorstAntOfIter = 0
WorstLenOfIter = 0
For i = 1 To MaxAnts
For j = 1 To MaxCities - 1
If j = 1 Then
Ant(i).Tour(j).fromCity = Ant(i).StartingCity
Ant(i).Visited(Ant(i).StartingCity) = True
Ant(i).CurrentCity = Ant(i).StartingCity
Else
Ant(i).Tour(j).fromCity = Ant(i).Tour(j - 1).toCity
End If
Ant(i).Tour(j).toCity = SelectCity(i, j)
Ant(i).CurrentCity = Ant(i).Tour(j).toCity
Ant(i).Visited(Ant(i).Tour(j).toCity) = True
Next j
Ant(i).Tour(MaxCities).fromCity = Ant(i).Tour(MaxCities - 1).toCity
Ant(i).Tour(MaxCities).toCity = Ant(i).StartingCity
Ant(i).LengthOfPath = CalcLen(i)
For k = 1 To MaxCities
Local_Update Int(Ant(i).Tour(k).fromCity), Int(Ant(i).Tour(k).toCity)
Next k
Next i
BestLenOfIter = Ant(1).LengthOfPath
BestAntOfIter = 1
WorstLenOfIter = Ant(1).LengthOfPath
WorstAntOfIter = 1
For i = 2 To MaxAnts
If Ant(i).LengthOfPath <= BestLenOfIter Then
BestAntOfIter = i
BestLenOfIter = Ant(i).LengthOfPath
Else
If Ant(i).LengthOfPath > WorstLenOfIter Then
WorstAntOfIter = i
WorstLenOfIter = Ant(i).LengthOfPath
End If
End If
Next i
''''''''''''''''''''''Result'''''''''''''''''''''''''''''''''
strBestPath = Ant(BestAntOfIter).Tour(1).fromCity
For i = 1 To MaxCities
strBestPath = strBestPath + "->" + Str(Ant(BestAntOfIter).Tour(i).toCity)
Next i
lstBestPath.AddItem strBestPath
If GlobalBestLen = 0 Then
GlobalBestLen = BestLenOfIter
txtGlobalBestIteration.Text = 1
txtGlobalBestPath.Text = strBestPath
Else
If GlobalBestLen >= BestLenOfIter Then
GlobalBestLen = BestLenOfIter
txtGlobalBestIteration.Text = Iteration
txtGlobalBestPath.Text = strBestPath
If SignDrawPath = True Then
Draw_Path BestAntOfIter
End If
End If
End If
S_LenOfIter = 0
For i = 1 To MaxAnts
S_LenOfIter = S_LenOfIter + Ant(i).LengthOfPath
Next i
AvgLenOfIter = S_LenOfIter / MaxAnts
If SignDrawAvgLen = True Then
Draw_Avg_Graph Iteration, AvgLenOfIter, False
End If
lstBestLenRep.AddItem BestLenOfIter
txtGlobalBestLen.Text = GlobalBestLen
If SignDrawBestLen = True Then
Draw_Best_Graph Iteration, BestLenOfIter
End If
If SignDrawTao = True Then
Draw_Tao
End If
If SignShowStep_by_Step = True Then
cmdNextStep.Enabled = True
cmdShowAntMove.Enabled = True
lstAnt_to_Show.Enabled = True
cmdShowBestAntMove.Enabled = True
Do
DoEvents
Loop Until SignPause = True Or Sign_Stop_Calc = True
SignPause = False
End If
''''''''''''''''''''''Result''''''''''''''''''''''''''''''''
r = PhUpdate(BestAntOfIter)
If SignUseNew = True Then
'r = PhUpdate1(WorstAntOfIter)
For i = 1 To MaxCities
aa = Ant(WorstAntOfIter).Tour(j).fromCity
bb = Ant(WorstAntOfIter).Tour(j).toCity
If NTao(aa, bb) = False Then
r = PhUpdate1(aa, bb, Ant(WorstAntOfIter).LengthOfPath, Ant(BestAntOfIter).LengthOfPath)
End If
Next i
End If
Iteration = Iteration + 1
DoEvents
Loop Until (Sign_Stop_Calc = True) Or (Iteration > MaxIter)
S_BestLen = S_BestLen + GlobalBestLen
lblTimes.Caption = Time_Calc_Avg
Next Time_Calc_Avg
txtGlobalBestLen.Text = S_BestLen / CalcTimes
UnLock_Controls
End Sub
Private Sub cmdStop_Click()
Sign_Stop_Calc = True
cmdNextStep.Enabled = False
End Sub
Private Sub cmdStopStep_by_Step_Click()
SignPause = True
SignShowStep_by_Step = False
chkStepByStep.Value = 0
cmdStopStep_by_Step.Enabled = False
cmdNextStep.Enabled = False
End Sub
Private Sub Form_Load()
SignUseNew = False
SignComputeAvg = False
SignAlwaysCleanResult = True
SignDrawBestLen = True
SignDrawAvgLen = True
SignDrawTogether = False
SignDrawPath = True
SignDrawTao = True
SignShowStep_by_Step = False
SignPause = False
cmdNextStep.Enabled = False
SignShowNextMove = False
End Sub
Private Sub lstBestLenRep_Click()
lstBestPath.ListIndex = lstBestLenRep.ListIndex
End Sub
Private Sub lstBestPath_Click()
lstBestLenRep.ListIndex = lstBestPath.ListIndex
txtBestPathAid.Text = lstBestPath.Text
End Sub
Private Sub txtMaxAnts_Change()
lstAnt_to_Show.Clear
For i = 1 To Val(txtMaxAnts.Text)
lstAnt_to_Show.AddItem i
Next i
End Sub
Private Sub txtMaxIter_Change()
txtBestLenXMax.Text = txtMaxIter.Text
txtAvgLenXMax.Text = txtMaxIter.Text
End Sub