📄 panel.frm
字号:
VERSION 4.00
Begin VB.Form MainForm
Caption = "Test PANEL for Testing aiNet Functions"
ClientHeight = 7068
ClientLeft = 924
ClientTop = 3372
ClientWidth = 8160
Height = 7452
Icon = "Panel.frx":0000
Left = 876
LinkTopic = "Form1"
ScaleHeight = 7068
ScaleWidth = 8160
Top = 3036
Width = 8256
Begin VB.CommandButton InfoBtn
BackColor = &H000000FF&
Caption = "Info"
Height = 372
Left = 6840
TabIndex = 13
Top = 2040
Width = 1092
End
Begin VB.CommandButton SaveBtn
Caption = "Save Model"
Height = 372
Left = 5520
TabIndex = 12
Top = 1560
Width = 1212
End
Begin VB.CommandButton GenerateBtn
Caption = "Generate MV"
Height = 372
Left = 5520
TabIndex = 11
Top = 2040
Width = 1212
End
Begin VB.CommandButton SettingsBtn
Caption = "Settings"
Height = 372
Left = 4200
TabIndex = 10
Top = 2040
Width = 1212
End
Begin VB.CommandButton ExcludeBtn
Caption = "Exclude MV"
Height = 372
Left = 2880
TabIndex = 9
Top = 2040
Width = 1212
End
Begin VB.CommandButton NewMVBtn
Caption = "New MV"
Height = 372
Left = 1560
TabIndex = 8
Top = 2040
Width = 1212
End
Begin VB.CommandButton ShowModelBtn
Caption = "Show Model"
Height = 372
Left = 240
TabIndex = 7
Top = 2040
Width = 1212
End
Begin VB.CommandButton ExitBtn
BackColor = &H00C0C0C0&
Caption = "Exit"
Height = 372
Left = 6840
TabIndex = 6
Top = 1560
Width = 1092
End
Begin VB.CommandButton NewCapacityBtn
Caption = "New Capacity"
Height = 372
Left = 4200
TabIndex = 5
Top = 1560
Width = 1212
End
Begin VB.CommandButton PredictBtn
Caption = "Prediction"
Height = 372
Left = 2880
TabIndex = 4
Top = 1560
Width = 1212
End
Begin VB.CommandButton PredictionBtn
Caption = "Load Sample"
Height = 372
Left = 1560
TabIndex = 3
Top = 1560
Width = 1212
End
Begin VB.CommandButton StatusBtn
Caption = "Status Report"
Height = 372
Left = 240
TabIndex = 2
Top = 1560
Width = 1212
End
Begin VB.TextBox tOut
BeginProperty Font
name = "Courier New"
charset = 1
weight = 400
size = 10.2
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
Height = 4332
Left = 240
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 1
Top = 2520
Width = 7692
End
Begin VB.PictureBox Picture1
BorderStyle = 0 'None
Height = 1452
Left = 240
Picture = "Panel.frx":0442
ScaleHeight = 1452
ScaleWidth = 7692
TabIndex = 0
Top = 120
Width = 7692
End
End
Attribute VB_Name = "MainForm"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Support for text output
'
Public NL As String ' Carriage return + newline
Public T As String ' tab
'
' Various global variables
'
Public Ret As Long ' Used as return value for aiXX function calls.
Public X As Single ' Temporary vector
Public Y As Single
Public Par1 As Long ' Transfer variables
Public Par2 As Long
Public PenaltyCoeff As Double ' Penalty coefficient value
Public NormType As Long ' Type of normalization
Public PenaltyType As Long ' Type of penalty function
Public InfListSize As Long ' Size of the influence list
Public InfListType As Long ' Type of the influence list
Public FileName As String
'
' The model!
'
Public Model As Long
Sub ReportError(ByVal err As Long)
If err <> AIERR_NO_ERROR Then
tOut = tOut + NL + "Error[" + CStr(err) + "]: "
If err = AIERR_PENALTY_ZERO Then tOut = tOut + "Penalty parameter was set to ZERO!"
If err = AIERR_NO_IO_VARIABLES Then tOut = tOut + "Input or Output variables are not properly defined! There must be at least one input and one ouput variable."
If err = AIERR_PENALTY_TOO_SMALL Then tOut = tOut + "The penalty parameter value is too small!"
If err = AIERR_EMPTY_ROW Then tOut = tOut + "An empty row was found in the model. There must be no empty rows in the model!"
If err = AIERR_EMPTY_COLUMN Then tOut = tOut + "An empty column was found in the model. There must be no empty rows in the model!"
If err = AIERR_EQUAL_COLUMN Then tOut = tOut + "All values in one columns are the same. The normalization is not possible!"
If err = AIERR_CSV_OPEN Then tOut = tOut + "Unable to open a CSV file!"
If err = AIERR_CSV_READ Then tOut = tOut + "Unable to read from CSV file. Wrong format!"
If err = AIERR_MEMORY_ALLOCATION Then tOut = tOut + "Unable to allocate new memory!"
If err = AIERR_INVALID_POINTER Then tOut = tOut + "Specified poitner (model) is invalid!"
If err = AIERR_INVALID_INDEX Then tOut = tOut + "Specified index is invalid - out of range!"
If err = AIERR_NO_FREE_ENTRY Then tOut = tOut + "There are no free entries in the model!"
End If
End Sub
Sub SetupStrings()
NL = Chr(13) + Chr(10)
T = Chr(9)
End Sub
Private Function IsHole(ByVal X As Single, ByVal Y As Single) As Boolean
r = Sqr(X * X + Y * Y)
If r > 0.7 Then
IsHole = False
Else
IsHole = True
End If
End Function
Private Sub ExcludeBtn_Click()
If Model = 0 Then
tOut = NL + "Load the model first!"
Else
Ret = 0
ExcludeMV.Show 1
If Ret <> 0 Then
tOut = NL + "Exclude Model Vectors:" + NL
Dim exclude As Long
If Ret = 1 Or Ret = 2 Then
exclude = 0 ' Ret = 2 ... include
If Ret = 1 Then exclude = 1
If ExcludeMV.Range = True Then
Dim first As Long
Dim last As Long
first = CStr(ExcludeMV.first)
last = CStr(ExcludeMV.last)
Par1 = aiExcludeModelVectorRange(Model, first, last, exclude)
Else
Dim index As Long
index = CStr(ExcludeMV.index)
Par1 = aiExcludeModelVector(Model, index, exclude)
End If
If Par1 = AIERR_NO_ERROR Then
If ExcludeMV.Range = True Then
tOut = tOut + "Model Vectors int the range [" + ExcludeMV.first + "," + ExcludeMV.last + "] were "
Else
tOut = tOut + "Model Vector at index [" + ExcludeMV.index + "] was "
End If
If exclude = 1 Then
tOut = tOut + "excluded!"
Else
tOut = tOut + "included!"
End If
tOut = tOut + NL + NL + "Select 'Status Report' or 'Show Model' button!"
Else
ReportError (Par1)
End If
Else ' Ret = 3 - Delete
index = CStr(ExcludeMV.index)
Par1 = aiDeleteModelVector(Model, index)
If Par1 < 0 Then
ReportError (Par1)
Else
tOut = tOut + "Model Vector at index [" + ExcludeMV.index + "] was deleted!"
End If
End If
End If
End If
End Sub
Private Sub ExitBtn_Click()
End
End Sub
Private Sub Form_Load()
X = 0
Y = 0
SetupStrings
Model = 0 'It is very impotant to make clear that model is not set yet!
Settings.Regular = True
NormType = NORMALIZE_REGULAR
Settings.Static = True
PenaltyType = PENALTY_STATIC
PenaltyCoeff = 0.2
Settings.Coefficient = CStr(PenaltyCoeff)
InfListSize = 0
Settings.listSize = "0"
InfListType = MOST_INFLUENT
Settings.ShowMost = True
'You can put the registration code here'
'Ret = aiRegistration("Your Name", "Your Code")
ShowInfo
End Sub
Private Sub DisplayStatus()
Dim nMV As Long
Dim nVar As Long
Dim Version As Long
Version = aiGetVersion()
major = Int(Version / 100)
minor = Version Mod 100
tOut = "aiNetDLL version " + CStr(major) + "." + CStr(minor)
tOut = tOut + " (C) Copyright by aiNet, 1997" + NL + NL
If Model = 0 Then
tOut = tOut + "Model is not initialized yet!" + NL + "There is nothing to report."
Else
tOut = tOut + "Model Data Structure" + NL
nVar = aiGetNumberOfVariables(Model)
tOut = tOut + T + "Number of variables: " + CStr(nVar) + NL
Ret = aiGetNumberOfInputVariables(Model)
tOut = tOut + T + "Number of input variables: " + CStr(Ret) + NL
nMV = aiGetNumberOfModelVectors(Model)
tOut = tOut + T + "Number of model vectors: " + CStr(nMV) + NL
Ret = aiGetCapacity(Model)
tOut = tOut + T + "Model capacity: " + CStr(Ret) + NL
Ret = aiGetFreeEntries(Model)
tOut = tOut + T + "Model free entries: " + CStr(Ret) + NL
i = nVar
tOut = tOut + T + "Discrete flags for variables: "
While i > 0
tOut = tOut + CStr(aiGetDiscreteFlag(Model, i))
If i <> 1 Then tOut = tOut + ", "
i = i - 1
Wend
tOut = tOut + NL
tOut = tOut + T + "Number of excluded model vectors: "
i = 1
counter = 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -