home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / ainet / panel.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-07-22  |  22.8 KB  |  612 lines

  1. VERSION 4.00
  2. Begin VB.Form MainForm 
  3.    Caption         =   "Test PANEL for Testing aiNet Functions"
  4.    ClientHeight    =   7068
  5.    ClientLeft      =   924
  6.    ClientTop       =   3372
  7.    ClientWidth     =   8160
  8.    Height          =   7452
  9.    Icon            =   "Panel.frx":0000
  10.    Left            =   876
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   7068
  13.    ScaleWidth      =   8160
  14.    Top             =   3036
  15.    Width           =   8256
  16.    Begin VB.CommandButton InfoBtn 
  17.       BackColor       =   &H000000FF&
  18.       Caption         =   "Info"
  19.       Height          =   372
  20.       Left            =   6840
  21.       TabIndex        =   13
  22.       Top             =   2040
  23.       Width           =   1092
  24.    End
  25.    Begin VB.CommandButton SaveBtn 
  26.       Caption         =   "Save Model"
  27.       Height          =   372
  28.       Left            =   5520
  29.       TabIndex        =   12
  30.       Top             =   1560
  31.       Width           =   1212
  32.    End
  33.    Begin VB.CommandButton GenerateBtn 
  34.       Caption         =   "Generate MV"
  35.       Height          =   372
  36.       Left            =   5520
  37.       TabIndex        =   11
  38.       Top             =   2040
  39.       Width           =   1212
  40.    End
  41.    Begin VB.CommandButton SettingsBtn 
  42.       Caption         =   "Settings"
  43.       Height          =   372
  44.       Left            =   4200
  45.       TabIndex        =   10
  46.       Top             =   2040
  47.       Width           =   1212
  48.    End
  49.    Begin VB.CommandButton ExcludeBtn 
  50.       Caption         =   "Exclude MV"
  51.       Height          =   372
  52.       Left            =   2880
  53.       TabIndex        =   9
  54.       Top             =   2040
  55.       Width           =   1212
  56.    End
  57.    Begin VB.CommandButton NewMVBtn 
  58.       Caption         =   "New MV"
  59.       Height          =   372
  60.       Left            =   1560
  61.       TabIndex        =   8
  62.       Top             =   2040
  63.       Width           =   1212
  64.    End
  65.    Begin VB.CommandButton ShowModelBtn 
  66.       Caption         =   "Show Model"
  67.       Height          =   372
  68.       Left            =   240
  69.       TabIndex        =   7
  70.       Top             =   2040
  71.       Width           =   1212
  72.    End
  73.    Begin VB.CommandButton ExitBtn 
  74.       BackColor       =   &H00C0C0C0&
  75.       Caption         =   "Exit"
  76.       Height          =   372
  77.       Left            =   6840
  78.       TabIndex        =   6
  79.       Top             =   1560
  80.       Width           =   1092
  81.    End
  82.    Begin VB.CommandButton NewCapacityBtn 
  83.       Caption         =   "New Capacity"
  84.       Height          =   372
  85.       Left            =   4200
  86.       TabIndex        =   5
  87.       Top             =   1560
  88.       Width           =   1212
  89.    End
  90.    Begin VB.CommandButton PredictBtn 
  91.       Caption         =   "Prediction"
  92.       Height          =   372
  93.       Left            =   2880
  94.       TabIndex        =   4
  95.       Top             =   1560
  96.       Width           =   1212
  97.    End
  98.    Begin VB.CommandButton PredictionBtn 
  99.       Caption         =   "Load Sample"
  100.       Height          =   372
  101.       Left            =   1560
  102.       TabIndex        =   3
  103.       Top             =   1560
  104.       Width           =   1212
  105.    End
  106.    Begin VB.CommandButton StatusBtn 
  107.       Caption         =   "Status Report"
  108.       Height          =   372
  109.       Left            =   240
  110.       TabIndex        =   2
  111.       Top             =   1560
  112.       Width           =   1212
  113.    End
  114.    Begin VB.TextBox tOut 
  115.       BeginProperty Font 
  116.          name            =   "Courier New"
  117.          charset         =   1
  118.          weight          =   400
  119.          size            =   10.2
  120.          underline       =   0   'False
  121.          italic          =   0   'False
  122.          strikethrough   =   0   'False
  123.       EndProperty
  124.       Height          =   4332
  125.       Left            =   240
  126.       MultiLine       =   -1  'True
  127.       ScrollBars      =   2  'Vertical
  128.       TabIndex        =   1
  129.       Top             =   2520
  130.       Width           =   7692
  131.    End
  132.    Begin VB.PictureBox Picture1 
  133.       BorderStyle     =   0  'None
  134.       Height          =   1452
  135.       Left            =   240
  136.       Picture         =   "Panel.frx":0442
  137.       ScaleHeight     =   1452
  138.       ScaleWidth      =   7692
  139.       TabIndex        =   0
  140.       Top             =   120
  141.       Width           =   7692
  142.    End
  143. Attribute VB_Name = "MainForm"
  144. Attribute VB_Creatable = False
  145. Attribute VB_Exposed = False
  146. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  147. ' Support for text output
  148. Public NL As String          ' Carriage return + newline
  149. Public T As String           ' tab
  150. ' Various global variables
  151. Public Ret As Long              ' Used as return value for aiXX function calls.
  152. Public X As Single              ' Temporary vector
  153. Public Y As Single
  154. Public Par1 As Long             ' Transfer variables
  155. Public Par2 As Long
  156. Public PenaltyCoeff As Double   ' Penalty coefficient value
  157. Public NormType As Long         ' Type of normalization
  158. Public PenaltyType As Long      ' Type of penalty function
  159. Public InfListSize As Long      ' Size of the influence list
  160. Public InfListType As Long      ' Type of the influence list
  161. Public FileName As String
  162. ' The model!
  163. Public Model As Long
  164. Sub ReportError(ByVal err As Long)
  165.     If err <> AIERR_NO_ERROR Then
  166.         tOut = tOut + NL + "Error[" + CStr(err) + "]: "
  167.         If err = AIERR_PENALTY_ZERO Then tOut = tOut + "Penalty parameter was set to ZERO!"
  168.         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."
  169.         If err = AIERR_PENALTY_TOO_SMALL Then tOut = tOut + "The penalty parameter value is too small!"
  170.         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!"
  171.         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!"
  172.         If err = AIERR_EQUAL_COLUMN Then tOut = tOut + "All values in one columns are the same. The normalization is not possible!"
  173.         If err = AIERR_CSV_OPEN Then tOut = tOut + "Unable to open a CSV file!"
  174.         If err = AIERR_CSV_READ Then tOut = tOut + "Unable to read from CSV file. Wrong format!"
  175.         If err = AIERR_MEMORY_ALLOCATION Then tOut = tOut + "Unable to allocate new memory!"
  176.         If err = AIERR_INVALID_POINTER Then tOut = tOut + "Specified poitner (model) is invalid!"
  177.         If err = AIERR_INVALID_INDEX Then tOut = tOut + "Specified index is invalid - out of range!"
  178.         If err = AIERR_NO_FREE_ENTRY Then tOut = tOut + "There are no free entries in the model!"
  179.     End If
  180. End Sub
  181. Sub SetupStrings()
  182.    NL = Chr(13) + Chr(10)
  183.    T = Chr(9)
  184. End Sub
  185. Private Function IsHole(ByVal X As Single, ByVal Y As Single) As Boolean
  186.     r = Sqr(X * X + Y * Y)
  187.     If r > 0.7 Then
  188.         IsHole = False
  189.     Else
  190.         IsHole = True
  191.     End If
  192. End Function
  193. Private Sub ExcludeBtn_Click()
  194.     If Model = 0 Then
  195.         tOut = NL + "Load the model first!"
  196.     Else
  197.         Ret = 0
  198.         ExcludeMV.Show 1
  199.         If Ret <> 0 Then
  200.             tOut = NL + "Exclude Model Vectors:" + NL
  201.             Dim exclude As Long
  202.             If Ret = 1 Or Ret = 2 Then
  203.                 exclude = 0  ' Ret = 2 ... include
  204.                 If Ret = 1 Then exclude = 1
  205.                 If ExcludeMV.Range = True Then
  206.                     Dim first As Long
  207.                     Dim last As Long
  208.                     first = CStr(ExcludeMV.first)
  209.                     last = CStr(ExcludeMV.last)
  210.                     Par1 = aiExcludeModelVectorRange(Model, first, last, exclude)
  211.                 Else
  212.                     Dim index As Long
  213.                     index = CStr(ExcludeMV.index)
  214.                     Par1 = aiExcludeModelVector(Model, index, exclude)
  215.                 End If
  216.                 If Par1 = AIERR_NO_ERROR Then
  217.                     If ExcludeMV.Range = True Then
  218.                         tOut = tOut + "Model Vectors int the range [" + ExcludeMV.first + "," + ExcludeMV.last + "] were "
  219.                     Else
  220.                         tOut = tOut + "Model Vector at index [" + ExcludeMV.index + "] was "
  221.                     End If
  222.                     If exclude = 1 Then
  223.                         tOut = tOut + "excluded!"
  224.                     Else
  225.                         tOut = tOut + "included!"
  226.                     End If
  227.                     tOut = tOut + NL + NL + "Select 'Status Report' or 'Show Model' button!"
  228.                 Else
  229.                     ReportError (Par1)
  230.                 End If
  231.             Else ' Ret = 3 - Delete
  232.                 index = CStr(ExcludeMV.index)
  233.                 Par1 = aiDeleteModelVector(Model, index)
  234.                 If Par1 < 0 Then
  235.                     ReportError (Par1)
  236.                 Else
  237.                     tOut = tOut + "Model Vector at index [" + ExcludeMV.index + "] was deleted!"
  238.                 End If
  239.             End If
  240.         End If
  241.     End If
  242. End Sub
  243. Private Sub ExitBtn_Click()
  244.    End
  245. End Sub
  246. Private Sub Form_Load()
  247.    X = 0
  248.    Y = 0
  249.    SetupStrings
  250.    Model = 0   'It is very impotant to make clear that model is not set yet!
  251.    Settings.Regular = True
  252.    NormType = NORMALIZE_REGULAR
  253.    Settings.Static = True
  254.    PenaltyType = PENALTY_STATIC
  255.    PenaltyCoeff = 0.2
  256.    Settings.Coefficient = CStr(PenaltyCoeff)
  257.    InfListSize = 0
  258.    Settings.listSize = "0"
  259.    InfListType = MOST_INFLUENT
  260.    Settings.ShowMost = True
  261.    'You can put the registration code here'
  262.    'Ret = aiRegistration("Your Name", "Your Code")
  263.    ShowInfo
  264. End Sub
  265. Private Sub DisplayStatus()
  266.     Dim nMV As Long
  267.     Dim nVar As Long
  268.     Dim Version As Long
  269.     Version = aiGetVersion()
  270.     major = Int(Version / 100)
  271.     minor = Version Mod 100
  272.     tOut = "aiNetDLL version " + CStr(major) + "." + CStr(minor)
  273.     tOut = tOut + " (C) Copyright by aiNet, 1997" + NL + NL
  274.     If Model = 0 Then
  275.         tOut = tOut + "Model is not initialized yet!" + NL + "There is nothing to report."
  276.     Else
  277.         tOut = tOut + "Model Data Structure" + NL
  278.         
  279.         nVar = aiGetNumberOfVariables(Model)
  280.         tOut = tOut + T + "Number of variables: " + CStr(nVar) + NL
  281.         
  282.         Ret = aiGetNumberOfInputVariables(Model)
  283.         tOut = tOut + T + "Number of input variables: " + CStr(Ret) + NL
  284.         
  285.         nMV = aiGetNumberOfModelVectors(Model)
  286.         tOut = tOut + T + "Number of model vectors: " + CStr(nMV) + NL
  287.         
  288.         Ret = aiGetCapacity(Model)
  289.         tOut = tOut + T + "Model capacity: " + CStr(Ret) + NL
  290.         
  291.         Ret = aiGetFreeEntries(Model)
  292.         tOut = tOut + T + "Model free entries: " + CStr(Ret) + NL
  293.         
  294.         i = nVar
  295.         tOut = tOut + T + "Discrete flags for variables: "
  296.         While i > 0
  297.             tOut = tOut + CStr(aiGetDiscreteFlag(Model, i))
  298.             If i <> 1 Then tOut = tOut + ", "
  299.             i = i - 1
  300.         Wend
  301.         tOut = tOut + NL
  302.         
  303.         tOut = tOut + T + "Number of excluded model vectors: "
  304.         i = 1
  305.         counter = 0
  306.         While i <= nMV
  307.             If aiIsModelVectorExcluded(Model, i) = 1 Then counter = counter + 1
  308.             i = i + 1
  309.         Wend
  310.         tOut = tOut + CStr(counter) + NL
  311.         
  312.         tOut = tOut + "End of Model Data Structure."
  313.     End If
  314. End Sub
  315. Private Sub ShowModel()
  316.     Dim nMV As Long
  317.     Dim nVar As Long
  318.     Dim nInp As Long
  319.     Dim Cap As Long
  320.     If Model = 0 Then
  321.         tOut = "Model is not initialized yet!" + NL + "There is nothing to show!" + NL + NL + "Load the model first!"
  322.     Else
  323.         tOut = "Model Data:" + NL
  324.         
  325.         nVar = aiGetNumberOfVariables(Model)
  326.         nInp = aiGetNumberOfInputVariables(Model)
  327.         nMV = aiGetNumberOfModelVectors(Model)
  328.         Cap = aiGetCapacity(Model)
  329.         If Cap > 100 Then
  330.             tOut = tOut + "Warning: Only first 100 entries will be shown on screen!" + NL
  331.             Cap = 100
  332.         End If
  333.         
  334.         For r = 1 To Cap
  335.             tOut = tOut + CStr(r) + ": "
  336.             If r <= nMV Then
  337.                 For c = 1 To nVar
  338.                     tOut = tOut + CStr(aiGetVariable(Model, r, c))
  339.                     'Here is an alternative to the statement above.
  340.                     'Dim x As Single
  341.                     'Ret = aiGetVariableVB(Model, r, c, x)
  342.                     'tOut = tOut + CStr(x)
  343.                     If c <> nVar Then tOut = tOut + ", "
  344.                 Next
  345.                 If aiIsModelVectorExcluded(Model, r) = 1 Then
  346.                     tOut = tOut + ", Excluded"
  347.                 End If
  348.             Else
  349.                 tOut = tOut + "Free entry"
  350.             End If
  351.             tOut = tOut + NL
  352.         Next
  353.         
  354.     End If
  355. End Sub
  356. Private Sub Form_Terminate()
  357.     If Model <> 0 Then
  358.         aiDeleteModel (Model)
  359.     End If
  360. End Sub
  361. Private Sub GenerateBtn_Click()
  362.     If Model = 0 Then
  363.         tOut = NL + "Load the model first!"
  364.     Else
  365.         Generate.Show 1
  366.         tOut = "The Generate Command:" + NL + NL
  367.         If Ret > 0 Then
  368.             Dim free As Long
  369.             free = aiGetFreeEntries(Model)
  370.             If free > 0 Then
  371.                 ReDim vec(1 To 3) As Single
  372.                 For i = 1 To free
  373.                     vec(1) = Rnd * 2 - 1
  374.                     vec(2) = Rnd * 2 - 1
  375.                     vec(3) = 0#
  376.                     If IsHole(vec(1), vec(2)) Then vec(3) = 1#
  377.                     Ret = aiAppendModelVector(Model, vec(1))
  378.                     If Ret < 0 Then ReportError (Ret)
  379.                 Next
  380.                 tOut = tOut + NL + CStr(free) + " randomly generated model vectors were appended to the model."
  381.             Else
  382.                 tOut = tOut + "There are no free entries in the model!" + NL
  383.                 tOut = tOut + "Make some free entries first. Use the 'New Capacity' command!" + NL
  384.             End If
  385.         Else
  386.             tOut = tOut + "The command was canceled!"
  387.         End If
  388.     End If
  389. End Sub
  390. Private Sub InfoBtn_Click()
  391.     ShowInfo
  392. End Sub
  393. Private Sub NewCapacityBtn_Click()
  394.     If Model <> 0 Then
  395.         Dim nMV As Long
  396.         nMV = aiGetNumberOfModelVectors(Model)
  397.         Capacity.Capacity = CStr(aiGetCapacity(Model))
  398.         Capacity.ModelVectors = CStr(nMV)
  399.         Capacity.FreeEntries = CStr(aiGetFreeEntries(Model))
  400.         Ret = 0
  401.         Capacity.Show 1
  402.         If Ret <> 0 Then
  403.             tOut = "You set the new model capacity to " + CStr(Ret) + "entries." + NL
  404.             If Ret < nMV Then
  405.                 tOut = tOut + CStr(nMV - Ret) + " model vectors in the range [" + CStr(Ret) + " - " + CStr(nMV) + "]were be deleted."
  406.             Else
  407.                 tOut = tOut + "There is exactly " + CStr(Ret - nMV) + " free entries in the model."
  408.             End If
  409.             tOut = tOut + NL + NL + "Select 'Status Report' button to see the new model status."
  410.             Ret = aiSetCapacity(Model, Ret)
  411.         End If
  412.         
  413.     Else
  414.         tOut = NL + "Load the model first!"
  415.     End If
  416. End Sub
  417. Private Sub NewMVBtn_Click()
  418.     ReDim Vector(1 To 3) As Single
  419.     If Model = 0 Then
  420.         tOut = NL + "Load the model first!"
  421.     Else
  422.         tOut = "New model vector command!" + NL + NL
  423.         Ret = 0  ' Ok/Cancel
  424.         NewMV.XC = CStr(X)
  425.         NewMV.YC = CStr(Y)
  426.         If NewMV.index = "" Then NewMV.index = "0"
  427.         NewMV.Show 1
  428.         
  429.         If Ret <> 0 Then
  430.             Dim index As Long
  431.             index = CLng(NewMV.index)
  432.             Vector(1) = X
  433.             Vector(2) = Y
  434.             If Sqr(X * X + Y * Y) > 0.7 Then
  435.                 Vector(3) = 0
  436.             Else
  437.                 Vector(3) = 1
  438.             End If
  439.             If NewMV.Insert = True Then
  440.                 tOut = tOut + "Insert mode" + NL
  441.                 Ret = aiInsertModelVector(Model, index, Vector(1))
  442.             Else
  443.                 If NewMV.Overwrite = True Then
  444.                     tOut = tOut + "Overwrite mode" + NL
  445.                     Ret = aiOverwriteModelVector(Model, index, Vector(1))
  446.                 Else
  447.                     tOut = tOut + "Append mode" + NL
  448.                     Ret = aiAppendModelVector(Model, Vector(1))
  449.                 End If
  450.             End If
  451.             If Ret < 0 Then
  452.                 ReportError (Ret)
  453.             Else
  454.                 If NewMV.Append = False Then
  455.                     tOut = tOut + "Successfully processed at index " + CStr(Ret)
  456.                 Else
  457.                     tOut = tOut + "Successfully appended."
  458.                 End If
  459.             End If
  460.         End If ' Ret <>0
  461.     End If ' Model <> 0
  462. End Sub
  463. Private Sub PredictBtn_Click()
  464.     If Model = 0 Then
  465.         tOut = "You must load the model first!" + NL + NL + "Select the 'Load Sample' button!"
  466.     Else
  467.         tOut = "Results of prediction:" + NL
  468.         tOut = tOut + "Normalization: "
  469.         If NormType = NORMALIZATION_REGULAR Then
  470.             tOut = tOut + "Regular" + NL
  471.         Else
  472.             tOut = tOut + "Statistical" + NL
  473.         End If
  474.         
  475.         tOut = tOut + "Penalty Type: "
  476.         If PenaltyType = PENALTY_STATIC Then
  477.             tOut = tOut + "Static" + NL
  478.         Else
  479.             If PenaltyType = PENALTY_DYNAMIC Then
  480.                 tOut = tOut + "Dyamic" + NL
  481.             Else
  482.                 tOut = tOut + "Nearest" + NL
  483.             End If
  484.         End If
  485.         tOut = tOut + "Penalty Coefficient: " + CStr(PenaltyCoeff) + NL
  486.         tOut = tOut + "Size of the Influence List: " + CStr(InfListSize) + NL
  487.         tOut = tOut + "Type of the Influence List: "
  488.         If InfListType = MOST_INFLUENT Then
  489.             tOut = tOut + "Show Most Influent MVs"
  490.         Else
  491.             tOut = tOut + "Show Least Influent MVs"
  492.         End If
  493.         tOut = tOut + NL + NL
  494.         
  495.         ' Prediction
  496.         tOut = tOut + "Prediction ..." + NL
  497.         tOut = tOut + "X, Y -> pred IN/OUT, Correct/Incorrect, Influence list" + NL
  498.         ReDim predict(0 To 17) As Single
  499.         predict(0) = 0.75: predict(1) = 0#: predict(2) = 0         'First prediction vector
  500.         predict(3) = 0.325: predict(4) = 0.563: predict(5) = 1     '2nd prediction vector
  501.         predict(6) = -0.375: predict(7) = 0.65: predict(8) = 0     '...
  502.         predict(9) = -0.65: predict(10) = 0#: predict(11) = 1
  503.         predict(12) = -0.375: predict(13) = -0.65: predict(14) = 0
  504.         predict(15) = 0.325: predict(16) = -0.563: predict(17) = 1 '6th prediction vector
  505.         ReDim list(1 To 2) As Long
  506.         If InfListSize > 0 Then
  507.             ReDim list(1 To InfListSize) As Long
  508.         End If
  509.         
  510.         Ret = aiNormalize(Model, NormType)
  511.         ReportError (Ret) 'Just in case
  512.         
  513.         For i = 0 To 5
  514.             Ret = aiPredictionEx(Model, predict(i * 3), PenaltyCoeff, PenaltyType, list(1), InfListSize, InfListType)
  515.             ReportError (Ret) 'Just in case
  516.             tOut = tOut + CStr(predict(i * 3)) + ", " + CStr(predict(i * 3 + 1)) + " -> " + CStr(predict(3 * i + 2)) + ": "
  517.             Dim in1 As Boolean ' correct answer
  518.             in1 = IsHole(predict(i * 3), predict(i * 3 + 1))
  519.             Dim in2 As Boolean ' predicted answer
  520.             in2 = predict(i * 3 + 2) >= 0.5
  521.             If in1 = in2 Then ' Are both answers the same ?
  522.                 tOut = tOut + "Correct : "
  523.             Else
  524.                 tOut = tOut + "Incorrect : "
  525.             End If
  526.             If InfListSize > 0 Then
  527.                 For j = 1 To InfListSize
  528.                     tOut = tOut + CStr(list(j))
  529.                     If j <> InfListSize Then tOut = tOut + ", "
  530.                 Next
  531.             End If
  532.             tOut = tOut + NL
  533.         Next
  534.         
  535.         Ret = aiDenormalize(Model)
  536.         ReportError (Ret) 'Just in case
  537.         
  538.     End If
  539. End Sub
  540. Private Sub PredictionBtn_Click()
  541.     If Model <> 0 Then
  542.         aiDeleteModel (Model)
  543.         Model = 0
  544.     End If
  545.     ' If the model does not load in your computer, then enter full path to
  546.     ' the hole.csv file below!!!
  547.     FileName = "c:\cpp\ainet\dll\vb4\32bit\hole.csv"
  548.     Model = aiCreateModelFromCSVFile(FileName)
  549.     If Model = 0 Then
  550.         tOut = "Model creation failed!" + NL + NL
  551.         tOut = tOut + "There can be three reasons for such behaviour:" + NL
  552.         tOut = tOut + "1. There is not enough system memory to create the model (very unlikely)" + NL
  553.         tOut = tOut + "2. The CSV file can not be found. Check the file path in the source code!" + NL
  554.         tOut = tOut + "3. The CSV file is corrupt. Check the file contents!"
  555.     Else
  556.         tOut = "File [" + FileName + "] was read" + NL
  557.         tOut = tOut + "and model was created successfully!" + NL + NL
  558.         tOut = tOut + "Select 'Status Report' button to see the model status."
  559.     End If
  560. End Sub
  561. Private Sub SaveBtn_Click()
  562.     tOut = "The 'Save Model' command." + NL
  563.     If Model = 0 Then
  564.         tOut = NL + "There is nothing to save!" + NL
  565.         tOut = tOut + "Load the model first!"
  566.     Else
  567.         Ret = aiSaveCSVFile(Model, FileName)
  568.         If Ret < 0 Then ReportError (Ret)
  569.         tOut = tOut + "The model was saved in CSV format on file [" + FileName + "]." + NL
  570.     End If
  571. End Sub
  572. Private Sub SettingsBtn_Click()
  573.     Settings.Show 1
  574.     If Ret = 1 Then
  575.         NormType = NORMALIZE_STATISTICAL
  576.         If Settings.Regular = True Then NormType = NORMALIZE_REGULAR
  577.         
  578.         PenaltyType = PENALTY_STATIC
  579.         If Settings.Dynamic = True Then PenaltyType = PENALTY_DYNAMIC
  580.         If Settings.NN = True Then PenaltyType = PENALTY_NEAREST
  581.         PenaltyCoeff = CDbl(Settings.Coefficient)
  582.         
  583.         InfListSize = CLng(Settings.listSize)
  584.         InfListType = LEAST_INFLUENT
  585.         If Settings.ShowMost = True Then InfListType = MOST_INFLUENT
  586.         
  587.         tOut = NL + "New Settings were set."
  588.         tOut = tOut + NL + "Click 'Settings' button again to see the new settings!"
  589.     Else
  590.         tOut = ""
  591.     End If
  592. End Sub
  593. Private Sub ShowModelBtn_Click()
  594.     ShowModel
  595. End Sub
  596. Private Sub StatusBtn_Click()
  597.     DisplayStatus
  598. End Sub
  599. Private Sub ShowInfo()
  600.     tOut = "About this sample program" + NL
  601.     tOut = tOut + "=========================" + NL + NL
  602.     tOut = tOut + "This program is intended to serve as a test panel for aiNet.DLL "
  603.     tOut = tOut + "library functions. Almost all functions that can be found "
  604.     tOut = tOut + "in aiNet.DLL are used in this application. The functions "
  605.     tOut = tOut + "are used in a direct way, usually without parameter "
  606.     tOut = tOut + "validation. We suggest you to study the source code. "
  607.     tOut = tOut + "You may modify the source code as mush as you want. "
  608.     tOut = tOut + "Actually, you will have to modify at least the path "
  609.     tOut = tOut + "to the 'HOLE.CSV' file to bring this program to life."
  610.     tOut = tOut + NL + NL + "Enjoy!" + NL + NL + NL + "A.K. aiNet, 1997"
  611. End Sub
  612.