⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmmain.frm

📁 遗传算法和神经网络的结合应用
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Begin VB.Form frmMain 
   Caption         =   "GenerationX"
   ClientHeight    =   4530
   ClientLeft      =   165
   ClientTop       =   735
   ClientWidth     =   3495
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4530
   ScaleWidth      =   3495
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton cmdStop 
      Caption         =   "Stop"
      Height          =   375
      Left            =   1200
      TabIndex        =   8
      Top             =   3480
      Width           =   1215
   End
   Begin MSComDlg.CommonDialog Dialog 
      Left            =   120
      Top             =   240
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.CommandButton cmdTest 
      Caption         =   "Test"
      Height          =   375
      Left            =   2400
      TabIndex        =   7
      Top             =   3480
      Width           =   1095
   End
   Begin VB.PictureBox picWorld 
      BackColor       =   &H00C0C000&
      Height          =   3495
      Left            =   0
      ScaleHeight     =   100
      ScaleMode       =   0  'User
      ScaleWidth      =   100
      TabIndex        =   6
      Top             =   0
      Width           =   3495
      Begin VB.Shape shaHare 
         FillColor       =   &H0080FF80&
         FillStyle       =   0  'Solid
         Height          =   255
         Left            =   2040
         Shape           =   2  'Oval
         Top             =   1320
         Width           =   255
      End
      Begin VB.Shape shaFox 
         FillColor       =   &H000000C0&
         FillStyle       =   0  'Solid
         Height          =   375
         Left            =   1200
         Shape           =   2  'Oval
         Top             =   2040
         Width           =   375
      End
   End
   Begin VB.Frame Frame1 
      Height          =   615
      Left            =   0
      TabIndex        =   1
      Top             =   3840
      Width           =   3495
      Begin VB.TextBox txtGeneration 
         Alignment       =   1  'Right Justify
         Height          =   285
         Left            =   960
         TabIndex        =   3
         Text            =   "0"
         Top             =   240
         Width           =   615
      End
      Begin VB.TextBox txtMaxFitness 
         Alignment       =   1  'Right Justify
         Height          =   285
         Left            =   2760
         TabIndex        =   2
         Text            =   "0"
         Top             =   240
         Width           =   615
      End
      Begin VB.Label Label2 
         Caption         =   "Mean Fitness"
         Height          =   255
         Left            =   1680
         TabIndex        =   5
         Top             =   240
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "Generation"
         Height          =   255
         Left            =   120
         TabIndex        =   4
         Top             =   240
         Width           =   855
      End
   End
   Begin VB.CommandButton cmdTrain 
      Caption         =   "Train"
      Height          =   375
      Left            =   0
      TabIndex        =   0
      Top             =   3480
      Width           =   1215
   End
   Begin VB.Menu mnuFile 
      Caption         =   "File"
      Begin VB.Menu mnuLoad 
         Caption         =   "Load"
      End
      Begin VB.Menu mnuSave 
         Caption         =   "Save"
      End
      Begin VB.Menu mnubar 
         Caption         =   "-"
      End
      Begin VB.Menu mnuExit 
         Caption         =   "Exit"
      End
   End
   Begin VB.Menu mnuRun 
      Caption         =   "Run"
      Begin VB.Menu mnuTrain 
         Caption         =   "Train"
      End
      Begin VB.Menu mnuStop 
         Caption         =   "Stop"
      End
      Begin VB.Menu mnublank2 
         Caption         =   "-"
      End
      Begin VB.Menu mnuTest 
         Caption         =   "Test"
      End
   End
   Begin VB.Menu mnuHelp 
      Caption         =   "Help"
      Begin VB.Menu mnuAbout 
         Caption         =   "About"
      End
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim Chaser As New ClassChaser
Dim StopNow As Boolean


Private Sub cmdStop_Click()
  StopNow = True
End Sub


Private Sub cmdTest_Click()
  Call Test
End Sub


Private Sub Test()
  Call Chaser.Test(1000, True, Me, shaFox, shaHare)
End Sub


Private Sub cmdTrain_Click()
  Call Train
End Sub


Private Sub Train()
  StopNow = False
  While (Not StopNow)
    Call Chaser.Update(1, 100, txtGeneration, txtMaxFitness)
    DoEvents
  Wend
End Sub



Private Sub Form_Load()
  Call Chaser.Init
End Sub


Private Sub mnuAbout_Click()
  frmAbout.show 1
End Sub


Private Sub mnuExit_Click()
  End
End Sub


Private Sub mnuLoad_Click()
  Dialog.Filter = "Genetic Algorithm Files|*.GA"
  Dialog.InitDir = App.Path
  Dialog.FilterIndex = 1
  Dialog.ShowOpen
  If (Dialog.filename <> "") Then
    Me.MousePointer = 11
    Call Chaser.GA.Load(Dialog.filename)
    Me.MousePointer = 0
  End If
End Sub

Private Sub mnuSave_Click()
  Dialog.Filter = "Genetic Algorithm Files|*.GA"
  Dialog.InitDir = App.Path
  Dialog.FilterIndex = 1
  Dialog.ShowSave
  If (Dialog.filename <> "") Then
    Me.MousePointer = 11
    Call Chaser.GA.Save(Dialog.filename)
    Me.MousePointer = 0
  End If
End Sub

Private Sub mnuStop_Click()
  StopNow = True
End Sub

Private Sub mnuTest_Click()
  Call Test
End Sub

Private Sub mnuTrain_Click()
  Call Train
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -