Next
Next
k = 0
For L = 0 To G_Alt_Number - 1
D(L) = a(L)
Next
Do
D(G_Alt_Number) = k
loD1 = 0
indD = 0
For L = 0 To G_Alt_Number - 1
For s = 0 To G_Alt_Number - 1
If (D(L) > -G_Alt_Number) And (D(s) > -G_Alt_Number) And (L <> s) And (CredibilityMatrix(L, s) > loD1) And (CredibilityMatrix(L, s) < (loD - Lambda(loD))) Then
loD1 = CredibilityMatrix(L, s)
End If
If CredibilityMatrix(L, s) <= (loD - Lambda(loD1)) Then
indD = indD + 1
End If
Next
Next
If indD = 0 Then
loD1 = 0
End If
For L = 0 To G_Alt_Number - 1
p1(L) = 0
f1(L) = 0
Next
For L = 0 To G_Alt_Number - 1
For s = 0 To G_Alt_Number - 1
If (D(L) > -G_Alt_Number) And (D(s) > -G_Alt_Number) And (L <> s) And (q1(s) > -G_Alt_Number) Then
If CredibilityMatrix(L, s) > loD1 And (CredibilityMatrix(L, s) - CredibilityMatrix(s, L)) > Lambda(CredibilityMatrix(L, s)) Then
p1(L) = p1(L) + 1
End If
If CredibilityMatrix(s, L) > loD1 And (CredibilityMatrix(s, L) - CredibilityMatrix(L, s)) > Lambda(CredibilityMatrix(s, L)) Then
f1(L) = f1(L) + 1
End If
End If
Next
If D(L) > -G_Alt_Number And q1(L) > -G_Alt_Number Then
q1(L) = p1(L) - f1(L)
Else
q1(L) = -G_Alt_Number
End If
Next
max = q1(0)
For L = 1 To G_Alt_Number - 1
If q1(L) > max Then
max = q1(L)
End If
Next
indD1 = 0
For L = 0 To G_Alt_Number - 1
If q1(L) = max Then
D1(L) = L
indD1 = indD1 + 1
Else
D1(L) = -G_Alt_Number
End If
Next
If indD1 > 1 Then
D1(G_Alt_Number) = k
k = k + 1
loD = loD1
For L = 0 To G_Alt_Number - 1
If D1(L) <= -G_Alt_Number Then
q1(L) = -G_Alt_Number
End If
Next
End If
For L = 0 To G_Alt_Number
D(L) = D1(L)
Next
Loop While (indD1 > 1) And (loD1 > 0)
For i = 0 To G_Alt_Number - 1
If D(i) > -G_Alt_Number Then
a(i) = -G_Alt_Number
Descend(i, 1) = i
Descend(i, 0) = -n
q1(i) = -G_Alt_Number
Else
q1(i) = 0
End If
Next
n = n + 1
indA = 0
For i = 0 To G_Alt_Number - 1
If a(i) > -G_Alt_Number Then
indA = indA + 1
End If
Next
Loop While (indA > 0) 'And (loD1 > 0)
'==============
Do
A1(G_Alt_Number) = Y
loC = 0
For i = 0 To G_Alt_Number - 1
For j = 0 To G_Alt_Number - 1
If (A1(i) < G_Alt_Number) And (A1(j) < G_Alt_Number) And (i <> j) And (CredibilityMatrix(i, j) > loC) Then
loC = CredibilityMatrix(i, j)
End If
Next
Next
X = 0
' Do
For L = 0 To G_Alt_Number - 1
c(L) = A1(L)
Next
Do
c(G_Alt_Number) = X
loC1 = 0
indC = 0
For L = 0 To G_Alt_Number - 1
For s = 0 To G_Alt_Number - 1
If (c(L) < G_Alt_Number) And (c(s) < G_Alt_Number) And (L <> s) And (CredibilityMatrix(L, s) > loC1) And (CredibilityMatrix(L, s) < (loC - Lambda(loC))) Then
loC1 = CredibilityMatrix(L, s)
End If
If CredibilityMatrix(L, s) <= (loC - Lambda(loC1)) Then
indC = indC + 1
End If
Next
Next
If indC = 0 Then
loC1 = 0
End If
For L = 0 To G_Alt_Number - 1
p2(L) = 0
f2(L) = 0
Next
For L = 0 To G_Alt_Number - 1
For s = 0 To G_Alt_Number - 1
If (c(L) < G_Alt_Number) And (c(s) < G_Alt_Number) And (L <> s) And (q2(s) < G_Alt_Number) Then
If CredibilityMatrix(L, s) > loC1 And (CredibilityMatrix(L, s) - CredibilityMatrix(s, L)) > Lambda(CredibilityMatrix(L, s)) Then
p2(L) = p2(L) + 1
End If
If CredibilityMatrix(s, L) > loC1 And (CredibilityMatrix(s, L) - CredibilityMatrix(L, s)) > Lambda(CredibilityMatrix(s, L)) Then
f2(L) = f2(L) + 1
End If
End If
Next
If c(L) < G_Alt_Number And q2(L) < G_Alt_Number Then 'Then
q2(L) = p2(L) - f2(L)
Else
q2(L) = G_Alt_Number
End If
Next
min = q2(0)
For L = 1 To G_Alt_Number - 1
If q2(L) < min Then
min = q2(L)
End If
Next
indC1 = 0
For L = 0 To G_Alt_Number - 1
If q2(L) = min Then
c1(L) = L
indC1 = indC1 + 1
Else
c1(L) = G_Alt_Number
End If
Next
If indC1 > 1 Then
c1(G_Alt_Number) = X
X = X + 1
loC = loC1
For L = 0 To G_Alt_Number - 1
If c1(L) >= G_Alt_Number Then
q2(L) = G_Alt_Number
End If
Next
End If
For L = 0 To G_Alt_Number - 1
c(L) = c1(L)
Next
Loop While (indC1 > 1) And (loC1 > 0)
For i = 0 To G_Alt_Number - 1
'q2(i) = 0 '========
If c(i) < G_Alt_Number Then
A1(i) = G_Alt_Number
Ascend(i, 1) = i
Ascend(i, 0) = Y
q2(i) = G_Alt_Number '========
Else
q2(i) = 0
End If
Next
Y = Y + 1
indA1 = 0
For i = 0 To G_Alt_Number - 1
If A1(i) < G_Alt_Number Then
indA1 = indA1 + 1
End If
Next
Loop While (indA1 > 0) 'And (loC1 > 0)
'============== End Calculate Distillation ==============
'================= Nesravnimost ==============
Dim br As Integer
br = 1
ReDim Nesravnimost(G_Alt_Number - 1, G_Alt_Number - 1)
For i = 0 To G_Alt_Number - 1
n = 1
For j = 0 To G_Alt_Number - 1
If i <> j Then
If (((Descend(i, 0) > Descend(j, 0)) And (Ascend(i, 0) >= _
Ascend(j, 0))) Or ((Descend(i, 0) >= Descend(j, 0)) And (Ascend(i, 0) > _
Ascend(j, 0)))) Then
Nesravnimost(i, j) = "p+"
End If
If (Descend(i, 0) = Descend(j, 0)) And (Ascend(i, 0) = Ascend(j, 0)) Then
Nesravnimost(i, j) = "i"
End If
If (((Descend(i, 0) > Descend(j, 0)) And (Ascend(i, 0) < _
Ascend(j, 0))) Or ((Descend(i, 0) < Descend(j, 0)) And (Ascend(i, 0) > _
Ascend(j, 0)))) Then
Nesravnimost(i, j) = "r"
End If
If (((Descend(i, 0) <= Descend(j, 0)) And (Ascend(i, 0) < _
Ascend(j, 0))) Or ((Descend(i, 0) < Descend(j, 0)) And (Ascend(i, 0) <= _
Ascend(j, 0)))) Then
Nesravnimost(i, j) = "p-"
n = n + 1
End If
Else
Nesravnimost(i, j) = "i"
End If
Next
If (br < n) Then
br = n
End If
Next
'====================Nesravnimost ==============
'==============
ReDim Naredba(G_Alt_Number - 1, 1)
For i = 1 To G_Alt_Number
Naredba(i - 1, 1) = i
Naredba(i - 1, 0) = br
For j = 0 To G_Alt_Number - 1
If Nesravnimost(i - 1, j) = "p-" Then
Naredba(i - 1, 0) = Naredba(i - 1, 0) - 1
End If
Next
Next
'==============
'====================== Sort Ranking Alter. Begin============
For i = 0 To G_Alt_Number - 1
For j = i + 1 To G_Alt_Number - 1
If Naredba(j, 0) > Naredba(i, 0) Then
SrtRankBuf1 = Naredba(j, 0)
SrtRankBuf2 = Naredba(j, 1)
Naredba(j, 0) = Naredba(i, 0)
Naredba(j, 1) = Naredba(i, 1)
Naredba(i, 0) = SrtRankBuf1
Naredba(i, 1) = SrtRankBuf2
End If
Next
Next
'====================== Sort Ranking Alter. End==============
'====================== Filling result form Begin ==============
AHPrezult.MSFlexGrid1.ColWidth(0) = 2000
AHPrezult.MSFlexGrid1.ColWidth(1) = 2000
AHPrezult.MSFlexGrid1.ColWidth(2) = 6000
AHPrezult.MSFlexGrid1.Col = 0
AHPrezult.MSFlexGrid1.Rows = G_Alt_Number + 1
maxval = Naredba(0, 0)
minval = Naredba(UBound(Naredba, 1), 0)
AHPrezult.FillData Naredba(), maxval, minval, G_Alt_Number
AHPrezult.Show
'====================== Filling result form End ==============
End Sub
При затваряне на формата се извиква процедурата Form_Unload, която инициализира променливата ElectreVisible със стойност False.
Private Sub Form_Unload(Cancel As Integer)
ElectreVisible = False
If PrinterVisible = True Then
Form8.Check7.Value = 0
Form8.Check7.Enabled = False
End If
End Sub
Сподели с приятели: |