http://rapidshare.com/files/222099783/PAS.zip.html

Can somebody help me check y the system stated overflow when i process...

it's a shared file..could be a virus.. if that zip file.. is a vb code.. paste it here..
be careful in dealing with shared files.. could be some malicious code on it..

'Declare variable V1 for membership function graph
Dim A0, A1, A2, A3 As Integer
Dim Q1 As Single

'Declare variable V2 for membership function graph
Dim B0, B1, B2, B3 As Integer
Dim Q2 As Single

'Declare variable FAM1 for membership function graph
Dim FAM1_0, FAM1_1, FAM1_2, FAM1_3 As Integer
Dim FAM1 As Double

'Declare variable V3 for membership function graph
Dim C0, C1, C2, C3 As Integer
Dim Q3 As Single

'Declare variable FAM2 for membership function graph
Dim FAM2_0, FAM2_1, FAM2_2, FAM2_3 As Integer
Dim FAM2 As Double

'Declare variable V4 for membership function graph
Dim D0, D1, D2, D3 As Integer
Dim Q4 As Single

'Declare variable FAM3 for membership function graph
Dim FAM3_0, FAM3_1, FAM3_2, FAM3_3 As Integer
Dim FAM3 As Double

'Declare variable V5 for membership function graph
Dim E0, E1, E2, E3 As Integer
Dim Q5 As Single

'Declare variable FAM4 for membership function graph
Dim FAM4_0, FAM4_1, FAM4_2, FAM4_3 As Integer
Dim FAM4 As Double

'Declare variable V6 for membership function graph
Dim F0, F1, F2, F3 As Integer
Dim Q6 As Single

'Declare variable FAM5 for membership function graph
Dim FAM5_0, FAM5_1, FAM5_2, FAM5_3 As Integer
Dim FAM5 As Double


'Declare variable FAM Table fo memebership function graph
Dim cv_v1(1 To 9) As Double
Dim cv_v2(1 To 9) As Double
Dim counter As Integer
Dim min_prob(1 To 3, 1 To 3) As Integer
Dim probability(1 To 9) As Double
Dim column, row As Integer

Dim Light1, Light2, Light3, Light4, Light5, Light6, Light7, Light8, Light9, Light10 As Double
Dim Medium1, Medium2, Medium3, Medium4, Medium5, Medium6, Medium7, Medium8, Medium9, Medium10 As Double
Dim Heavy1, Heavy2, Heavy3, Heavy4, Heavy5, Heavy6, Heavy7, Heavy8, Heavy9, Heavy10 As Double

Dim Light_FAM1, Light_FAM2, Light_FAM3, Light_FAM4, Light_FAM5, Light_FAM6, Light_FAM7, Light_FAM8 As Double
Dim Medium_FAM1, Medium_FAM2, Medium_FAM3, Medium_FAM4, Medium_FAM5, Medium_FAM6, Medium_FAM7, Medium_FAM8 As Double
Dim Heavy_FAM1, Heavy_FAM2, Heavy_FAM3, Heavy_FAM4, Heavy_FAM5, Heavy_FAM6, Heavy_FAM7, Heavy_FAM8 As Double

'Variable decaleration for subroutine fuzzy_defuzzyfication
Dim rule(1 To 9) As String
Dim actual_prob(1 To 9) As Double
Dim z0, z1, z2, z3 As Double
Dim upperCOA, belowCOA As Double
Dim crisp_Probability_1, crisp_Probability_2, crisp_Probability_3, crisp_Probability_4, crisp_Probability_5, crisp_Probability_6, crisp_Probability_7, crisp_Probability_8, crisp_Probability_9 As Double



    
    
Private Sub cmdProcess_Click()
    Call fuzzy_v1
    Call fuzzy_v2
    Call fuzzy_inference_0
    Call fuzzy_defuzzification_0
    
    Call fuzzy_v3
    Call fuzzy_v4
    Call fuzzy_inference_1
    Call fuzzy_defuzzification_1
    
    Call fuzzy_v5
    Call fuzzy_v6
    Call fuzzy_inference_2
    Call fuzzy_defuzzification_2
    
    Call Fam_1
    Call Fam_2
    Call fuzzy_inference_3
    Call fuzzy_defuzzification_3
    
    Call Fam_3
    Call Fam_4
    Call fuzzy_inference_4
    Call fuzzy_defuzzification_4
    
    
'==== Show value for FAM Table ==============================================
    famT1.Text = crisp_Probability_1
    famT2.Text = crisp_Probability_2
    famT3.Text = crisp_Probability_3
    famT4.Text = crisp_Probability_4
    famT5.Text = crisp_Probability_5
    
    
    
     
'==== Show the result of system ===================================
        If Text9.Text < 34 Then
        RESULT.Text = "Bad price"
        
    ElseIf Text9.Text >= 34 And Text9.Text < 54 Then
        RESULT.Text = "Average price"
    
    Else
        RESULT.Text = "Good price"
    
    End If
End Sub
Function fuzzy_v1()
    If v1.Text = "" Then
        MsgBox "PLEASE INSERT VALUE FOR QUESTION 1", vbCritical, "ERROR"
    End If
    
    Q1 = Val(v1.Text)

    'Intialize variable V1 for membership function graph
    A0 = 5
    A1 = 10
    A2 = 15
    A3 = 20


'Zone1
    If Q1 < A0 Then
        Light1 = 1
        Medium1 = 0
        Heavy1 = 0
        
'Zone2
    ElseIf (Q1 >= A0) And (Q1 < A1) Then
        Light1 = (A1 - Q1) / (A1 - A0)
        Medium1 = (Q1 - A0) / (A1 - A0)
        Heavy1 = 0
        
'Zone3
    ElseIf (Q1 >= A1) And (Q1 < A2) Then
        Light1 = 0
        Medium1 = 1
        Heavy1 = 0
        
'Zone4
    ElseIf (Q1 >= A2) And (Q1 < A3) Then
        Light1 = 0
        Medium1 = (A3 - Q1) / (A3 - A2)
        Heavy1 = (Q1 - A2) / (A3 - A2)
        
'Zone5
    Else
        Light1 = 0
        Medium1 = 0
        Heavy1 = 1
        
    End If

End Function
Function fuzzy_v2()
    If v2.Text = "" Then
        MsgBox "PLEASE INSERT VALUE FOR QUESTION 2", vbCritical, "ERROR"
    End If

    Q2 = Val(v2.Text)

    'Intialize variable V2 for membership function graph
    B0 = 5
    B1 = 10
    B2 = 15
    B3 = 20
    
'Zone1
    If Q2 < B0 Then
        Light2 = 1
        Medium2 = 0
        Heavy2 = 0
        
'Zone2
    ElseIf (Q2 >= B0) And (Q2 < B1) Then
        Light2 = (B1 - Q2) / (B1 - B0)
        Medium2 = (Q2 - B0) / (B1 - B0)
        Heavy2 = 0
        
'Zone3
    ElseIf (Q2 >= B1) And (Q2 < B2) Then
        Light2 = 0
        Medium2 = 1
        Heavy2 = 0
        
'Zone4
    ElseIf (Q2 >= B2) And (Q2 < B3) Then
        Light2 = 0
        Medium2 = (B3 - Q2) / (B3 - B2)
        Heavy2 = (Q2 - B2) / (B3 - B2)
        
'Zone5
    Else
        Light2 = 0
        Medium2 = 0
        Heavy2 = 1
        
    End If
End Function
Function fuzzy_inference_0()
    column = 0

    'declare array column
    cv_v1(1) = Light1
    cv_v1(2) = Medium1
    cv_v1(3) = Heavy1

    'declare array row
    cv_v2(1) = Light2
    cv_v2(2) = Medium2
    cv_v2(3) = Heavy2

    For row = 1 To 3
        For column = 1 To 3
            counter = counter + 1
            min_prob(row, column) = Min(cv_v2(row), cv_v1(column))
        Next column
    Next row

    probability(1) = Min(cv_v2(1), cv_v1(1))
    probability(2) = Min(cv_v2(2), cv_v1(1))
    probability(3) = Min(cv_v2(3), cv_v1(1))
    probability(4) = Min(cv_v2(1), cv_v1(2))
    probability(5) = Min(cv_v2(2), cv_v1(2))
    probability(6) = Min(cv_v2(3), cv_v1(2))
    probability(7) = Min(cv_v2(1), cv_v1(3))
    probability(8) = Min(cv_v2(2), cv_v1(3))
    probability(9) = Min(cv_v2(3), cv_v1(3))
End Function

Function fuzzy_defuzzification_0()
 Dim i, j As Integer
    Dim prob1, prob2 As Double
    
    'initialize upperCOA, belowCOA and crisp_Probability_1
    upperCOA = 0
    belowCOA = 0
    'z0,z1,z2,z3 for output variable actual_prob
    z0 = 6
    z1 = 16
    z2 = 22
    z3 = 32
    
    'rules for FAM Table
    rule(1) = "Short"
    rule(2) = "Medium"
    rule(3) = "Medium"
    rule(4) = "Medium"
    rule(5) = "Medium"
    rule(6) = "High"
    rule(7) = "Medium"
    rule(8) = "High"
    rule(9) = "High"
        
    For i = 1 To 9
        If rule(i) = "Short" Then
            If probability(i) < 1 Then
                actual_prob(i) = z1 - (probability(i) * (z1 - z0))
            Else
                actual_prob(i) = z0
            End If
        End If
        
        If rule(i) = "Medium" Then
            If probability(i) < 1 Then
                'left leg of trapazoid
                prob1 = z0 + (probability(i) * (z1 - z0))
                'right leg of trapazoid
                prob2 = z3 - (probability(i) * (z3 - z2))
            Else
                prob1 = z1
                prob2 = z2
            End If
            '2 actual values of probability for MEDIUM Label
            actual_prob(i) = prob1 + prob2
        End If
        
        If rule(i) = "High" Then
            If probability(i) < 1 Then
                actual_prob(i) = z2 + (probability(i) * (z3 - z2))
            Else
                actual_prob(i) = 32
            End If
        End If
        
    Next i
    
    'calculate defuzzyfication value using center of area (COA)
    For j = 1 To 9
        upperCOA = upperCOA + probability(j) * actual_prob(j)
        If rule(j) = "Medium" Then
            probability(j) = 2 * probability(j)
        End If
        belowCOA = belowCOA + probability(j)
    Next j
    
    'calculate crisp value of actual_personality%
    crisp_Probability_1 = upperCOA / belowCOA

End Function
Function fuzzy_v3()
    If v3.Text = "" Then
        MsgBox "PLEASE INSERT VALUE FOR QUESTION 3", vbCritical, "ERROR"
    End If
    
    Q3 = Val(v3.Text)

    'Intialize variable V3 for membership function graph
    C0 = 5
    C1 = 10
    C2 = 15
    C3 = 20

'Zone1
    If Q3 < C0 Then
        Light3 = 1
        Medium3 = 0
        Heavy3 = 0
        
'Zone2
    ElseIf (Q3 >= C0) And (Q3 < C1) Then
        Light3 = (C1 - Q3) / (C1 - C0)
        Medium3 = (Q3 - C0) / (C1 - C0)
        Heavy3 = 0
        
'Zone3
    ElseIf (Q3 >= C1) And (Q3 < C2) Then
        Light3 = 0
        Medium3 = 1
        Heavy3 = 0
        
'Zone4
    ElseIf (Q3 >= C2) And (Q3 < C3) Then
        Light3 = 0
        Medium3 = (C3 - Q3) / (C3 - C2)
        Heavy3 = (Q3 - C2) / (C3 - C2)
        
'Zone5
    Else
        Light3 = 0
        Medium3 = 0
        Heavy3 = 1
        
    End If
End Function
Function fuzzy_v4()
    If v4.Text = "" Then
        MsgBox "PLEASE INSERT VALUE FOR QUESTION 4", vbCritical, "ERROR"
    End If
    
    Q4 = Val(v4.Text)

    'Intialize variable V4 for membership function graph
    D0 = 5
    D1 = 10
    D2 = 15
    D3 = 20
'Zone1
    If Q4 < D0 Then
        Light4 = 1
        Medium4 = 0
        Heavy4 = 0
        
'Zone2
    ElseIf (Q4 >= D0) And (Q4 < D1) Then
        Light4 = (D1 - Q4) / (D1 - D0)
        Medium4 = (Q4 - D0) / (D1 - D0)
        Heavy4 = 0
        
'Zone3
    ElseIf (Q4 >= D1) And (Q4 < D2) Then
        Light4 = 0
        Medium4 = 1
        Heavy4 = 0
        
'Zone4
    ElseIf (Q4 >= D2) And (Q4 < D3) Then
        Light4 = 0
        Medium4 = (D3 - Q4) / (D3 - D2)
        Heavy4 = (Q4 - D2) / (D3 - D2)
        
'Zone5
    Else
        Light4 = 0
        Medium4 = 0
        Heavy4 = 1
        
    End If
End Function
Function fuzzy_inference_1()
    column = 0
    
    'declare array column
    cv_v1(1) = Light_FAM1
    cv_v1(2) = Medium_FAM1
    cv_v1(3) = Heavy_FAM1
    
    'declare array row
    cv_v2(1) = Light3
    cv_v2(2) = Medium3
    cv_v2(3) = Heavy3
    
    For row = 1 To 3
        For column = 1 To 3
            counter = counter + 1
            min_prob(row, column) = Min(cv_v2(row), cv_v1(column))
        Next column
    Next row
    
    probability(1) = Min(cv_v2(1), cv_v1(1))
    probability(2) = Min(cv_v2(2), cv_v1(1))
    probability(3) = Min(cv_v2(3), cv_v1(1))
    probability(4) = Min(cv_v2(1), cv_v1(2))
    probability(5) = Min(cv_v2(2), cv_v1(2))
    probability(6) = Min(cv_v2(3), cv_v1(2))
    probability(7) = Min(cv_v2(1), cv_v1(3))
    probability(8) = Min(cv_v2(2), cv_v1(3))
    probability(9) = Min(cv_v2(3), cv_v1(3))
End Function
Function fuzzy_defuzzification_1()
 Dim i, j As Integer
    Dim prob1, prob2 As Double
    
    'initialize upperCOA, belowCOA and crisp_Probability_2
    upperCOA = 0
    belowCOA = 0
    'z0,z1,z2,z3 for output variable actual_prob
    z0 = 9
    z1 = 19
    z2 = 28
    z3 = 38
    
    'rules for FAM Table
    rule(1) = "Short"
    rule(2) = "Medium"
    rule(3) = "Medium"
    rule(4) = "Medium"
    rule(5) = "Medium"
    rule(6) = "High"
    rule(7) = "Medium"
    rule(8) = "High"
    rule(9) = "High"
        
    For i = 1 To 9
        If rule(i) = "Short" Then
            If probability(i) < 1 Then
                actual_prob(i) = z1 - (probability(i) * (z1 - z0))
            Else
                actual_prob(i) = z0
            End If
        End If
        
        If rule(i) = "Medium" Then
            If probability(i) < 1 Then
                'left leg of trapazoid
                prob1 = z0 + (probability(i) * (z1 - z0))
                'right leg of trapazoid
                prob2 = z3 - (probability(i) * (z3 - z2))
            Else
                prob1 = z1
                prob2 = z2
            End If
            '2 actual values of probability for MEDIUM Label
            actual_prob(i) = prob1 + prob2
        End If
        
        If rule(i) = "High" Then
            If probability(i) < 1 Then
                actual_prob(i) = z2 + (probability(i) * (z3 - z2))
            Else
                actual_prob(i) = 38
            End If
        End If
        
    Next i
    
    'calculate defuzzyfication value using center of area (COA)
    For j = 1 To 9
        upperCOA = upperCOA + probability(j) * actual_prob(j)
        If rule(j) = "Medium" Then
            probability(j) = 2 * probability(j)
        End If
        belowCOA = belowCOA + probability(j)
    Next j
    
    'calculate crisp value of actual_personality%
    crisp_Probability_2 = upperCOA / belowCOA

End Function
Function fuzzy_v5()
    If v5.Text = "" Then
        MsgBox "PLEASE INSERT VALUE FOR QUESTION 5", vbCritical, "ERROR"
    End If
    
    Q5 = Val(v5.Text)

    'Intialize variable V5 for membership function graph
    E0 = 5
    E1 = 10
    E2 = 15
    E3 = 20

'Zone1
    If Q5 < E0 Then
        Light5 = 1
        Medium5 = 0
        Heavy5 = 0
        
'Zone2
    ElseIf (Q5 >= E0) And (Q5 < E1) Then
        Light5 = (E1 - Q5) / (E1 - E0)
        Medium5 = (Q5 - E0) / (E1 - E0)
        Heavy5 = 0
        
'Zone3
    ElseIf (Q5 >= E1) And (Q5 < E2) Then
        Light5 = 0
        Medium5 = 1
        Heavy5 = 0
        
'Zone4
    ElseIf (Q5 >= E2) And (Q5 < E3) Then
        Light5 = 0
        Medium5 = (E3 - Q5) / (E3 - E2)
        Heavy5 = (Q5 - E2) / (E3 - E2)
        
'Zone5
    Else
        Light5 = 0
        Medium5 = 0
        Heavy5 = 1
        
    End If
End Function
Function fuzzy_v6()
    If v6.Text = "" Then
        MsgBox "PLEASE INSERT VALUE FOR QUESTION 6", vbCritical, "ERROR"
    End If
    
    Q6 = Val(v6.Text)

    'Intialize variable V6 for membership function graph
    F0 = 5
    F1 = 10
    F2 = 15
    F3 = 20
'Zone1
    If Q6 < F0 Then
        Light6 = 1
        Medium6 = 0
        Heavy6 = 0
        
'Zone2
    ElseIf (Q6 >= F0) And (Q6 < F1) Then
        Light6 = (F1 - Q6) / (F1 - F0)
        Medium6 = (Q6 - F0) / (F1 - F0)
        Heavy6 = 0
        
'Zone3
    ElseIf (Q6 >= F1) And (Q6 < F2) Then
        Light6 = 0
        Medium6 = 1
        Heavy6 = 0
        
'Zone4
    ElseIf (Q6 >= F2) And (Q6 < F3) Then
        Light6 = 0
        Medium6 = (F3 - Q6) / (F3 - F2)
        Heavy6 = (Q6 - F2) / (F3 - F2)
        
'Zone5
    Else
        Light6 = 0
        Medium6 = 0
        Heavy6 = 1
        
    End If

End Function
Function fuzzy_inference_2()
    column = 0
    
    'declare array column
    cv_v1(1) = Light_FAM2
    cv_v1(2) = Medium_FAM2
    cv_v1(3) = Heavy_FAM2
    
    'declare array row
    cv_v2(1) = Light4
    cv_v2(2) = Medium4
    cv_v2(3) = Heavy4
    
    For row = 1 To 3
        For column = 1 To 3
            counter = counter + 1
            min_prob(row, column) = Min(cv_v2(row), cv_v1(column))
        Next column
    Next row
    
    probability(1) = Min(cv_v2(1), cv_v1(1))
    probability(2) = Min(cv_v2(2), cv_v1(1))
    probability(3) = Min(cv_v2(3), cv_v1(1))
    probability(4) = Min(cv_v2(1), cv_v1(2))
    probability(5) = Min(cv_v2(2), cv_v1(2))
    probability(6) = Min(cv_v2(3), cv_v1(2))
    probability(7) = Min(cv_v2(1), cv_v1(3))
    probability(8) = Min(cv_v2(2), cv_v1(3))
    probability(9) = Min(cv_v2(3), cv_v1(3))
End Function
Function fuzzy_defuzzification_2()
 Dim i, j As Integer
    Dim prob1, prob2 As Double
    
    'initialize upperCOA, belowCOA and crisp_Probability_3
    upperCOA = 0
    belowCOA = 0
    'z0,z1,z2,z3 for output variable actual_prob
    z0 = 12
    z1 = 22
    z2 = 34
    z3 = 44
    
    'rules for FAM Table
    rule(1) = "Short"
    rule(2) = "Medium"
    rule(3) = "Medium"
    rule(4) = "Medium"
    rule(5) = "Medium"
    rule(6) = "High"
    rule(7) = "Medium"
    rule(8) = "High"
    rule(9) = "High"
        
    For i = 1 To 9
        If rule(i) = "Short" Then
            If probability(i) < 1 Then
                actual_prob(i) = z1 - (probability(i) * (z1 - z0))
            Else
                actual_prob(i) = z0
            End If
        End If
        
        If rule(i) = "Medium" Then
            If probability(i) < 1 Then
                'left leg of trapazoid
                prob1 = z0 + (probability(i) * (z1 - z0))
                'right leg of trapazoid
                prob2 = z3 - (probability(i) * (z3 - z2))
            Else
                prob1 = z1
                prob2 = z2
            End If
            '2 actual values of probability for MEDIUM Label
            actual_prob(i) = prob1 + prob2
        End If
        
        If rule(i) = "High" Then
            If probability(i) < 1 Then
                actual_prob(i) = z2 + (probability(i) * (z3 - z2))
            Else
                actual_prob(i) = 44
            End If
        End If
        
    Next i
    
    'calculate defuzzyfication value using center of area (COA)
    For j = 1 To 9
        upperCOA = upperCOA + probability(j) * actual_prob(j)
        If rule(j) = "Medium" Then
            probability(j) = 2 * probability(j)
        End If
        belowCOA = belowCOA + probability(j)
    Next j
    
    'calculate crisp value of actual_personality%
    crisp_Probability_3 = upperCOA / belowCOA
End Function

Function Fam_1()
    If famT1.Text = "" Then
        MsgBox "PLEASE INSERT VALUE FOR FAM 1", vbCritical, "ERROR"
    End If
    
    'Intialize variable FAM 1 for membership function graph
    FAM1_0 = 6
    FAM1_1 = 16
    FAM1_2 = 22
    FAM1_3 = 32
'Zone1
    If FAM1 < FAM1_0 Then
        Light_FAM1 = 1
        Medium_FAM1 = 0
        Heavy_FAM1 = 0
        
'Zone2
    ElseIf (FAM1 >= FAM1_0) And (FAM1 < FAM1_1) Then
        Light_FAM1 = (FAM1_1 - FAM1) / (FAM1_1 - FAM1_0)
        Medium_FAM1 = (FAM1 - FAM1_0) / (FAM1_1 - FAM1_0)
        Heavy_FAM1 = 0
        
'Zone3
    ElseIf (FAM1 >= FAM1_1) And (FAM1 < FAM1_2) Then
        Light_FAM1 = 0
        Medium_FAM1 = 1
        Heavy_FAM1 = 0
        
'Zone4
    ElseIf (FAM1 >= FAM1_2) And (FAM1 < FAM1_3) Then
        Light_FAM1 = 0
        Medium_FAM1 = (FAM1_3 - FAM1) / (FAM1_3 - FAM1_2)
        Heavy_FAM1 = (FAM1 - FAM1_2) / (FAM1_3 - FAM1_2)
        
'Zone5
    Else
        Light_FAM1 = 0
        Medium_FAM1 = 0
        Heavy_FAM1 = 1
        
    End If
End Function

Function Fam_2()
    If famT2.Text = "" Then
        MsgBox "PLEASE INSERT VALUE FOR FAM 2", vbCritical, "ERROR"
    End If

    'Intialize variable FAM 2 for membership function graph
    FAM2_0 = 9
    FAM2_1 = 19
    FAM2_2 = 28
    FAM2_3 = 38
'Zone1
    If FAM2 < FAM2_0 Then
        Light_FAM2 = 1
        Medium_FAM2 = 0
        Heavy_FAM2 = 0
        
'Zone2
    ElseIf (FAM2 >= FAM2_0) And (FAM2 < FAM2_1) Then
        Light_FAM2 = (FAM2_1 - FAM1) / (FAM2_1 - FAM2_0)
        Medium_FAM2 = (FAM2 - FAM2_0) / (FAM2_1 - FAM2_0)
        Heavy_FAM2 = 0
        
'Zone3
    ElseIf (FAM2 >= FAM2_1) And (FAM2 < FAM2_2) Then
        Light_FAM2 = 0
        Medium_FAM2 = 1
        Heavy_FAM2 = 0
        
'Zone4
    ElseIf (FAM2 >= FAM2_2) And (FAM2 < FAM2_3) Then
        Light_FAM2 = 0
        Medium_FAM2 = (FAM2_3 - FAM2) / (FAM2_3 - FAM2_2)
        Heavy_FAM2 = (FAM2 - FAM2_2) / (FAM2_3 - FAM2_2)
        
'Zone5
    Else
        Light_FAM2 = 0
        Medium_FAM2 = 0
        Heavy_FAM2 = 1
        
    End If
End Function
Function fuzzy_inference_3()
    column = 0
    
    'declare array column
    cv_v1(1) = Light_FAM3
    cv_v1(2) = Medium_FAM3
    cv_v1(3) = Heavy_FAM3
    
    'declare array row
    cv_v2(1) = Light5
    cv_v2(2) = Medium5
    cv_v2(3) = Heavy5
    
    For row = 1 To 3
        For column = 1 To 3
            counter = counter + 1
            min_prob(row, column) = Min(cv_v2(row), cv_v1(column))
        Next column
    Next row
    
    probability(1) = Min(cv_v2(1), cv_v1(1))
    probability(2) = Min(cv_v2(2), cv_v1(1))
    probability(3) = Min(cv_v2(3), cv_v1(1))
    probability(4) = Min(cv_v2(1), cv_v1(2))
    probability(5) = Min(cv_v2(2), cv_v1(2))
    probability(6) = Min(cv_v2(3), cv_v1(2))
    probability(7) = Min(cv_v2(1), cv_v1(3))
    probability(8) = Min(cv_v2(2), cv_v1(3))
    probability(9) = Min(cv_v2(3), cv_v1(3))
End Function
Function fuzzy_defuzzification_3()
  Dim i, j As Integer
    Dim prob1, prob2 As Double
    
    'initialize upperCOA, belowCOA and crisp_Probability_4
    upperCOA = 0
    belowCOA = 0
    'z0,z1,z2,z3 for output variable actual_prob
    z0 = 15
    z1 = 25
    z2 = 40
    z3 = 50
    
    'rules for FAM Table
    rule(1) = "Short"
    rule(2) = "Medium"
    rule(3) = "Medium"
    rule(4) = "Medium"
    rule(5) = "Medium"
    rule(6) = "High"
    rule(7) = "Medium"
    rule(8) = "High"
    rule(9) = "High"
        
    For i = 1 To 9
        If rule(i) = "Short" Then
            If probability(i) < 1 Then
                actual_prob(i) = z1 - (probability(i) * (z1 - z0))
            Else
                actual_prob(i) = z0
            End If
        End If
        
        If rule(i) = "Medium" Then
            If probability(i) < 1 Then
                'left leg of trapazoid
                prob1 = z0 + (probability(i) * (z1 - z0))
                'right leg of trapazoid
                prob2 = z3 - (probability(i) * (z3 - z2))
            Else
                prob1 = z1
                prob2 = z2
            End If
            '2 actual values of probability for MEDIUM Label
            actual_prob(i) = prob1 + prob2
        End If
        
        If rule(i) = "High" Then
            If probability(i) < 1 Then
                actual_prob(i) = z2 + (probability(i) * (z3 - z2))
            Else
                actual_prob(i) = 50
            End If
        End If
        
    Next i
    
    'calculate defuzzyfication value using center of area (COA)
    For j = 1 To 9
        upperCOA = upperCOA + probability(j) * actual_prob(j)
        If rule(j) = "Medium" Then
            probability(j) = 2 * probability(j)
        End If
        belowCOA = belowCOA + probability(j)
    Next j
    
    'calculate crisp value of actual_personality%
    crisp_Probability_4 = upperCOA / belowCOA
End Function

Function Fam_3()
   If famT3.Text = "" Then
        MsgBox "PLEASE INSERT VALUE FOR FAM 3", vbCritical, "ERROR"
    End If

    'Intialize variable FAM 3 for membership function graph
    FAM3_0 = 12
    FAM3_1 = 22
    FAM3_2 = 34
    FAM3_3 = 44
'Zone1
    If FAM3 < FAM3_0 Then
        Light_FAM3 = 1
        Medium_FAM3 = 0
        Heavy_FAM3 = 0
        
'Zone2
    ElseIf (FAM3 >= FAM3_0) And (FAM3 < FAM3_1) Then
        Light_FAM3 = (FAM3_1 - FAM3) / (FAM3_1 - FAM3_0)
        Medium_FAM3 = (FAM3 - FAM3_0) / (FAM3_1 - FAM3_0)
        Heavy_FAM3 = 0
        
'Zone3
    ElseIf (FAM3 >= FAM3_1) And (FAM3 < FAM3_2) Then
        Light_FAM3 = 0
        Medium_FAM3 = 1
        Heavy_FAM3 = 0
        
'Zone4
    ElseIf (FAM3 >= FAM3_2) And (FAM3 < FAM3_3) Then
        Light_FAM3 = 0
        Medium_FAM3 = (FAM3_3 - FAM3) / (FAM3_3 - FAM3_2)
        Heavy_FAM3 = (FAM3 - FAM3_2) / (FAM3_3 - FAM3_2)
        
'Zone5
    Else
        Light_FAM3 = 0
        Medium_FAM3 = 0
        Heavy_FAM3 = 1
        
    End If
End Function
Function Fam_4()
    If famT4.Text = "" Then
        MsgBox "PLEASE INSERT VALUE FOR FAM 4", vbCritical, "ERROR"
    End If

    'Intialize variable FAM 4 for membership function graph
    FAM4_0 = 15
    FAM4_1 = 25
    FAM4_2 = 40
    FAM4_3 = 50
'Zone1
    If FAM4 < FAM4_0 Then
        Light_FAM4 = 1
        Medium_FAM4 = 0
        Heavy_FAM4 = 0
        
'Zone2
    ElseIf (FAM4 >= FAM4_0) And (FAM4 < FAM4_1) Then
        Light_FAM4 = (FAM4_1 - FAM4) / (FAM4_1 - FAM4_0)
        Medium_FAM4 = (FAM4 - FAM4_0) / (FAM4_1 - FAM4_0)
        Heavy_FAM4 = 0
        
'Zone3
    ElseIf (FAM4 >= FAM4_1) And (FAM4 < FAM4_2) Then
        Light_FAM4 = 0
        Medium_FAM4 = 1
        Heavy_FAM4 = 0
        
'Zone4
    ElseIf (FAM4 >= FAM4_2) And (FAM4 < FAM4_3) Then
        Light_FAM4 = 0
        Medium_FAM4 = (FAM4_3 - FAM4) / (FAM4_3 - FAM4_2)
        Heavy_FAM4 = (FAM4 - FAM4_2) / (FAM4_3 - FAM4_2)
        
'Zone5
    Else
        Light_FAM4 = 0
        Medium_FAM4 = 0
        Heavy_FAM4 = 1
        
    End If

End Function
Function fuzzy_inference_4()
    column = 0
    
    'declare array column
    cv_v1(1) = Light_FAM4
    cv_v1(2) = Medium_FAM4
    cv_v1(3) = Heavy_FAM4
    
    'declare array row
    cv_v2(1) = Light6
    cv_v2(2) = Medium6
    cv_v2(3) = Heavy6
    
    For row = 1 To 3
        For column = 1 To 3
            counter = counter + 1
            min_prob(row, column) = Min(cv_v2(row), cv_v1(column))
        Next column
    Next row
    
    probability(1) = Min(cv_v2(1), cv_v1(1))
    probability(2) = Min(cv_v2(2), cv_v1(1))
    probability(3) = Min(cv_v2(3), cv_v1(1))
    probability(4) = Min(cv_v2(1), cv_v1(2))
    probability(5) = Min(cv_v2(2), cv_v1(2))
    probability(6) = Min(cv_v2(3), cv_v1(2))
    probability(7) = Min(cv_v2(1), cv_v1(3))
    probability(8) = Min(cv_v2(2), cv_v1(3))
    probability(9) = Min(cv_v2(3), cv_v1(3))
End Function
Function fuzzy_defuzzification_4()
 Dim i, j As Integer
    Dim prob1, prob2 As Double
    
    'initialize upperCOA, belowCOA and crisp_Probability_5
    upperCOA = 0
    belowCOA = 0
    'z0,z1,z2,z3 for output variable actual_prob
    z0 = 18
    z1 = 28
    z2 = 46
    z3 = 56
    
    'rules for FAM Table
    rule(1) = "Short"
    rule(2) = "Medium"
    rule(3) = "Medium"
    rule(4) = "Medium"
    rule(5) = "Medium"
    rule(6) = "High"
    rule(7) = "Medium"
    rule(8) = "High"
    rule(9) = "High"
        
    For i = 1 To 9
        If rule(i) = "Short" Then
            If probability(i) < 1 Then
                actual_prob(i) = z1 - (probability(i) * (z1 - z0))
            Else
                actual_prob(i) = z0
            End If
        End If
        
        If rule(i) = "Medium" Then
            If probability(i) < 1 Then
                'left leg of trapazoid
                prob1 = z0 + (probability(i) * (z1 - z0))
                'right leg of trapazoid
                prob2 = z3 - (probability(i) * (z3 - z2))
            Else
                prob1 = z1
                prob2 = z2
            End If
            '2 actual values of probability for MEDIUM Label
            actual_prob(i) = prob1 + prob2
        End If
        
        If rule(i) = "High" Then
            If probability(i) < 1 Then
                actual_prob(i) = z2 + (probability(i) * (z3 - z2))
            Else
                actual_prob(i) = 56
            End If
        End If
        
    Next i
    
    'calculate defuzzyfication value using center of area (COA)
    For j = 1 To 9
        upperCOA = upperCOA + probability(j) * actual_prob(j)
        If rule(j) = "Medium" Then
            probability(j) = 2 * probability(j)
        End If
        belowCOA = belowCOA + probability(j)
    Next j
    
    'calculate crisp value of actual_personality%
    crisp_Probability_5 = upperCOA / belowCOA

End Function
'Decalre looping for minimum value
Function Min(cv_v1, cv_v2)
    
    Min = cv_v1
    If cv_v2 < cv_v1 Then
        Min = cv_v2
    End If
    
End Function
Private Sub Slider1_Click()

    v1.Text = Slider1.Value
    
End Sub

Private Sub Slider2_Click()

    v2.Text = Slider2.Value
    
End Sub

Private Sub Slider3_Click()

    v3.Text = Slider3.Value
    
End Sub

Private Sub Slider4_Click()

    v4.Text = Slider4.Value
    
End Sub

Private Sub Slider5_Click()

    v5.Text = Slider5.Value
    
End Sub

Private Sub Slider6_Click()

    v6.Text = Slider6.Value
    
End Sub
Next i
    
    'calculate defuzzyfication value using center of area (COA)
    For j = 1 To 9
        upperCOA = upperCOA + probability(j) * actual_prob(j)
        If rule(j) = "Medium" Then
            probability(j) = 2 * probability(j)
        End If
        belowCOA = belowCOA + probability(j)
    Next j
    
    'calculate crisp value of actual_personality%
    [B]crisp_Probability_2 = upperCOA / belowCOA[/B]

error overflow at as Bold part.. pls help me see y..

hi denniskhor, try putting "options explicit" before declaring all your variables.. i'm afraid you declare so many variables that system run out of resources or memory...

your variable crisp_probability_2 try declaring as variant just check if it will help..

one possibility also that the result of your data exceeds the range ..
check out this one from msdn for Double Data Type:

-1.79769313486231570E+308 through -4.94065645841246544E-324 for negative values

from 4.94065645841246544E-324 through 1.79769313486231570E+308 for positive values

link for this is >>http://msdn.microsoft.com/en-us/library/x99xtshc.aspx

check out also this site >> http://answers.google.com/answers/threadview?id=29552

option explicit link from msdn..>> http://msdn.microsoft.com/en-us/library/y9341s4f(VS.80).aspx

still the same problem occur.. hope can got easy way to solve it.

i found the solution ady... the problem occur because i din arrange the function.. thanks..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.