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

📄 +ʢk

📁 模糊数学基础及实用算法 (源码) 科学出版社 www.sciencep.com
💻
字号:
VERSION 5.00
Begin VB.Form frmFile 
   Appearance      =   0  'Flat
   BackColor       =   &H80000005&
   Caption         =   "模糊物元"
   ClientHeight    =   5490
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5985
   LinkTopic       =   "Form1"
   ScaleHeight     =   5490
   ScaleWidth      =   5985
   StartUpPosition =   3  '窗口缺省
   Begin VB.Frame Frame2 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "计算隶属度方法"
      ForeColor       =   &H80000008&
      Height          =   615
      Left            =   360
      TabIndex        =   14
      Top             =   3840
      Width           =   3495
      Begin VB.OptionButton Opt3 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         Caption         =   "不变换"
         ForeColor       =   &H80000008&
         Height          =   255
         Left            =   2400
         TabIndex        =   17
         Top             =   240
         Width           =   975
      End
      Begin VB.OptionButton Opt2 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         Caption         =   "模式2"
         ForeColor       =   &H80000008&
         Height          =   255
         Left            =   1200
         TabIndex        =   16
         Top             =   240
         Width           =   975
      End
      Begin VB.OptionButton Opt1 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         Caption         =   "模式1"
         ForeColor       =   &H80000008&
         Height          =   255
         Left            =   120
         TabIndex        =   15
         Top             =   240
         Value           =   -1  'True
         Width           =   1455
      End
   End
   Begin VB.FileListBox File1 
      Appearance      =   0  'Flat
      Height          =   1290
      Left            =   240
      TabIndex        =   12
      Top             =   1560
      Width           =   2655
   End
   Begin VB.Frame Frame1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "计算关联系数方法"
      ForeColor       =   &H80000008&
      Height          =   615
      Left            =   360
      TabIndex        =   8
      Top             =   4680
      Width           =   4335
      Begin VB.OptionButton OptA 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         Caption         =   "先乘后取大"
         ForeColor       =   &H80000008&
         Height          =   255
         Index           =   3
         Left            =   2880
         TabIndex        =   11
         Top             =   240
         Width           =   1335
      End
      Begin VB.OptionButton OptA 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         Caption         =   "先取小后取大"
         ForeColor       =   &H80000008&
         Height          =   255
         Index           =   2
         Left            =   1320
         TabIndex        =   10
         Top             =   240
         Width           =   1455
      End
      Begin VB.OptionButton OptA 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         Caption         =   "先乘后加"
         ForeColor       =   &H80000008&
         Height          =   255
         Index           =   1
         Left            =   120
         TabIndex        =   9
         Top             =   240
         Value           =   -1  'True
         Width           =   1095
      End
   End
   Begin VB.TextBox txtR 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      Height          =   270
      Left            =   360
      TabIndex        =   7
      Top             =   3360
      Width           =   5295
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "结束"
      Height          =   375
      Left            =   4920
      TabIndex        =   5
      ToolTipText     =   "结束程序运行"
      Top             =   4800
      Width           =   855
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定"
      Height          =   375
      Left            =   4920
      TabIndex        =   4
      ToolTipText     =   "选择好文件并给出行数和列数后单击"
      Top             =   4200
      Width           =   855
   End
   Begin VB.DirListBox Dir1 
      Appearance      =   0  'Flat
      Height          =   1770
      Left            =   3120
      TabIndex        =   1
      Top             =   360
      Width           =   2535
   End
   Begin VB.DriveListBox Drive1 
      Appearance      =   0  'Flat
      Height          =   300
      Left            =   240
      TabIndex        =   0
      Top             =   360
      Width           =   2655
   End
   Begin VB.Label lblF 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "选择数据文件"
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   240
      TabIndex        =   13
      Top             =   1320
      Width           =   2655
   End
   Begin VB.Label lblFile 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "模糊物元分析数据文件全名"
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   1560
      TabIndex        =   6
      Top             =   3120
      Width           =   3015
   End
   Begin VB.Label lblC 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "选择文件夹"
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   3120
      TabIndex        =   3
      Top             =   120
      Width           =   2415
   End
   Begin VB.Label lblD 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "选择驱动器"
      ForeColor       =   &H80000008&
      Height          =   255
      Left            =   240
      TabIndex        =   2
      Top             =   120
      Width           =   2655
   End
End
Attribute VB_Name = "frmFile"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'模糊物元
'模糊物元文件窗体模块,启动窗体
Option Explicit
Dim intI As Integer, intJ As Integer
Dim intFileNumber As Integer                        '文件号
Dim strData As String                               '临时保存数据

Private Sub Form_Load()
    File1.Pattern = "*.dat"                         '只显示数据文件
    intModel = 1                                    '隶属度算法缺省为模式1
    intOpt = 1                                      '关联系数算法缺省为加权平均
End Sub

'选择驱动器
Private Sub Drive1_Change()
    Dir1.Path = Drive1.Drive
End Sub

'选择目录
Private Sub Dir1_Change()
    File1.Path = Dir1.Path
End Sub

'选择数据文件
Private Sub File1_Click()
    txtR.Text = Dir1.Path & "\" & File1.FileName
End Sub

'确定,给出文件名和行数、列数后单击
Private Sub cmdOK_Click()
    If txtR.Text = "" Then
        MsgBox "必须先选定模糊物元分析数据文件!", , "数据文件错误"
        Exit Sub
    End If
    strR = txtR.Text                                    '模糊物元分析文件名
    intFileNumber = FreeFile                            '取得文件号码
    Open strR For Input As intFileNumber                '打开模糊物元分析文件
    Input #intFileNumber, intRow, intCol                '读文件的行数、列数
    N = intRow - 2                                      '事物的个数
    M = intCol - 1                                      '特征的个数
    ReDim R(1 To N, 1 To M)                             '模糊物元分析数据矩阵
    ReDim B(1 To N)                                     '结果向量
    ReDim D(1 To N)                                     '事物的数值向量
    ReDim X(1 To N)                                     '临时向量
    ReDim A(1 To M)                                     '权重向量
    ReDim V(1 To M)                                     '优化方式向量
'读数据
    For intI = 1 To intRow
        For intJ = 1 To intCol
            Input #intFileNumber, strData
            If intI < intRow - 1 And intJ < intCol Then R(intI, intJ) = Val(strData)
            If intI = intRow - 1 And intJ < intCol Then V(intJ) = Val(strData)
            If intI = intRow And intJ < intCol Then A(intJ) = Val(strData)
            If intI < intRow - 1 And intJ = intCol Then D(intI) = Val(strData)
        Next intJ
    Next intI
    Close
    frmResu.Visible = True
End Sub

'选择隶属度的算法为模式1
Private Sub Opt1_Click()
    intModel = 1
End Sub

'选择隶属度的算法为模式2
Private Sub Opt2_Click()
    intModel = 2
End Sub

'题目中直接给定隶属度,不进行变换
Private Sub Opt3_Click()
    intModel = 0
End Sub

'选择计算关联度方法
Private Sub OptA_Click(Index As Integer)
    intOpt = Index
End Sub

'结束运行
Private Sub cmdExit_Click()
    Unload Me
    End
End Sub

⌨️ 快捷键说明

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