Автор работы: Пользователь скрыл имя, 12 Января 2014 в 16:41, курсовая работа
Потенциальная возможность математического моделирования любых экономических объектов и процессов не означает, разумеется, ее успешной осуществимости при данном уровне экономических и математических знаний, имеющейся конкретной информации и вычислительной технике. И хотя нельзя указать абсолютные границы математической формализуемости экономических проблем, всегда будут существовать еще неформализованные проблемы, а также ситуации, где математическое моделирование недостаточно эффективно.
Введение
3
Реальная постановка задачи
5
Математическая модель задачи
6
Определение опорного плана
9
Определение оптимального плана
11
Охрана труда
21
Список литературы
Public optima As String
Public raz_elem, nap_stl_el As Single
Public nap_str, nap_stl As Byte
Public kol_iter, kol_iter_nado As Byte
Public str_F As String
Public nomer As Boolean
Public F As Integer
Public vid_resch As Byte
Dim mas_mesto_x(1 To 5) As Byte
Public str_opt_x As String
Public Sub Reschenie(vid_resch As Byte, kol_iter As Byte)
If ((vid_resch = 1) Or (vid_resch = 2 And kol_iter = 1)) Then
' Заполняем данные
kol_iter_nado = 1
For i = 1 To 5
mas_mesto_x(i) = 0
Next i
'-----
mas_P0(1) = CDbl(GL.T_kol_res_1.Text): mas_P0(2) = CDbl(GL.T_kol_res_2.Text)
mas_P0(3) = CDbl(GL.T_kol_res_3.Text): mas_P0(4) = CDbl(GL.T_kol_res_4.Text)
mas_P0(5) = CDbl(GL.T_kol_res_5.Text)
'-----
mas_P1_10(1, 1) = CDbl(GL.T_a_11.Text): mas_P1_10(1, 2) = CDbl(GL.T_a_12.Text)
mas_P1_10(1, 3) = CDbl(GL.T_a_13.Text): mas_P1_10(1, 4) = CDbl(GL.T_a_14.Text)
mas_P1_10(1, 5) = CDbl(GL.T_a_15.Text): mas_P1_10(1, 6) = 1
mas_P1_10(1, 7) = 0: mas_P1_10(1, 8) = 0
mas_P1_10(1, 9) = 0: mas_P1_10(1, 10) = 0
mas_P1_10(2, 1) = CDbl(GL.T_a_21.Text): mas_P1_10(2, 2) = CDbl(GL.T_a_22.Text)
mas_P1_10(2, 3) = CDbl(GL.T_a_23.Text): mas_P1_10(2, 4) = CDbl(GL.T_a_24.Text)
mas_P1_10(2, 5) = CDbl(GL.T_a_25.Text): mas_P1_10(2, 6) = 0
mas_P1_10(2, 7) = 1: mas_P1_10(2, 8) = 0
mas_P1_10(2, 9) = 0: mas_P1_10(2, 10) = 0
mas_P1_10(3, 1) = CDbl(GL.T_a_31.Text): mas_P1_10(3, 2) = CDbl(GL.T_a_32.Text)
mas_P1_10(3, 3) = CDbl(GL.T_a_33.Text): mas_P1_10(3, 4) = CDbl(GL.T_a_34.Text)
mas_P1_10(3, 5) = CDbl(GL.T_a_35.Text): mas_P1_10(3, 6) = 0
mas_P1_10(3, 7) = 0: mas_P1_10(3, 8) = 1
mas_P1_10(3, 9) = 0: mas_P1_10(3, 10) = 0
mas_P1_10(4, 1) = CDbl(GL.T_a_41.Text): mas_P1_10(4, 2) = CDbl(GL.T_a_42.Text)
mas_P1_10(4, 3) = CDbl(GL.T_a_43.Text): mas_P1_10(4, 4) = CDbl(GL.T_a_44.Text)
mas_P1_10(4, 5) = CDbl(GL.T_a_45.Text): mas_P1_10(4, 6) = 0
mas_P1_10(4, 7) = 0: mas_P1_10(4, 8) = 0
mas_P1_10(4, 9) = 1: mas_P1_10(4, 10) = 0
mas_P1_10(5, 1) = CDbl(GL.T_a_51.Text): mas_P1_10(5, 2) = CDbl(GL.T_a_52.Text)
mas_P1_10(5, 3) = CDbl(GL.T_a_53.Text): mas_P1_10(5, 4) = CDbl(GL.T_a_54.Text)
mas_P1_10(5, 5) = CDbl(GL.T_a_55.Text): mas_P1_10(5, 6) = 0
mas_P1_10(5, 7) = 0: mas_P1_10(5, 8) = 0
mas_P1_10(5, 9) = 0: mas_P1_10(5, 10) = 1
'------
mas_Bazis(1) = 6: mas_Bazis(2) = 7
mas_Bazis(3) = 8: mas_Bazis(4) = 9: mas_Bazis(5) = 10
'------
For i = 1 To 5
mas_Sb(i) = 0
Next i
'------
mas_Delti(1) = -CDbl(GL.T_prib_1.Text)
mas_Delti(2) = -CDbl(GL.T_prib_2.Text)
mas_Delti(3) = -CDbl(GL.T_prib_3.Text)
mas_Delti(4) = -CDbl(GL.T_prib_4.Text)
mas_Delti(5) = -CDbl(GL.T_prib_5.Text)
mas_Delti(6) = 0
mas_Delti(7) = 0: mas_Delti(8) = 0
mas_Delti(9) = 0: mas_Delti(10) = 0
'------
mas_Prib(1) = CDbl(GL.T_prib_1.Text)
mas_Prib(2) = CDbl(GL.T_prib_2.Text)
mas_Prib(3) = CDbl(GL.T_prib_3.Text)
mas_Prib(4) = CDbl(GL.T_prib_4.Text)
mas_Prib(5) = CDbl(GL.T_prib_5.Text)
mas_Prib(6) = 0
mas_Prib(7) = 0: mas_Prib(8) = 0
mas_Prib(9) = 0: mas_Prib(10) = 0
' Заполнение данных закончено.
End If
' Вычисление оптимальности
Do
optima = "y"
' Проверяем на оптимальность план:
For i = 1 To 10
If (mas_Delti(i) < 0) Then
optima = "n"
End If
Next i
' Проверка на оптимальность окончена
' Если план не оптимален
выщитываем симплексные
If optima = "n" Then
kol_iter = kol_iter + 1
' направляющие элементы
nap_stl_el = 0
For i = 1 To 10
If nap_stl_el > mas_Delti(i) Then
nap_stl_el = mas_Delti(i)
nap_stl = i
End If
Next i
'-----
i = 0
Do
i = i + 1
If (mas_P0(i) > 0 And mas_P1_10(i, nap_stl) > 0) Then
nap_str_el = mas_P0(i) / mas_P1_10(i, nap_stl)
End If
Loop While (mas_P1_10(i, nap_stl) <= 0 Or mas_P0(i) <= 0)
'-----
For i = 1 To 5
If (mas_P0(i) > 0 And mas_P1_10(i, nap_stl) > 0) Then
If (nap_str_el >= (mas_P0(i) / mas_P1_10(i, nap_stl))) Then
nap_str_el = mas_P0(i) / mas_P1_10(i, nap_stl)
nap_str = i
End If
End If
Next i
'-----
raz_elem = mas_P1_10(nap_str, nap_stl)
'-----
mas_P0(nap_str) = mas_P0(nap_str) / raz_elem
For i = 1 To 5
If (mas_P1_10(i, nap_stl) <> 0 And i <> nap_str) Then
mas_P0(i) = mas_P0(i) - (mas_P1_10(i, nap_stl) * mas_P0(nap_str))
End If
Next i
mas_Bazis(nap_str) = nap_stl
mas_Sb(nap_str) = mas_Prib(nap_stl) 'Delti(nap_stl) '-CDbl(mas_Delti(nap_stl)) 'Ошибка ===== raz_elem
For i = 1 To 10
mas_P1_10(nap_str, i) = mas_P1_10(nap_str, i) / raz_elem
Next i
For i = 1 To 5
If (nap_str <> i) Then
Y = mas_P1_10(i, nap_stl)
For x = 1 To 10
mas_P1_10(i, x) = mas_P1_10(i, x) - (Y * mas_P1_10(nap_str, x))
Next x
End If
Next i
For i = 1 To 10
mas_Delti(i) = 0
For x = 1 To 5
If (mas_Sb(x) <> 0) Then
mas_Delti(i) = mas_Delti(i) + (mas_Sb(x) * mas_P1_10(x, i))
End If
Next x
mas_Delti(i) = mas_Delti(i) - mas_Prib(i)
Next i
End If
Loop While ((vid_resch = 1 And optima = "n") Or (vid_resch = 2 And optima = "n" And kol_iter <> kol_iter_nado + 1))
' Вычисление оптимальности окончено.
optima = "y"
' Проверяем на оптимальность план:
For i = 1 To 10
If (mas_Delti(i) < 0) Then
optima = "n"
End If
Next i
' Проверка на оптимальность окончена.
If (optima = "y" Or kol_iter = kol_iter_nado) Then
main.Command1.Enabled = False
'Command2.Enabled = True
End If
' Вывод результатов
main.T_bas_1.Text = "P" + Str(mas_Bazis(1))
main.T_bas_2.Text = "P" + Str(mas_Bazis(2))
main.T_bas_3.Text = "P" + Str(mas_Bazis(3))
main.T_bas_4.Text = "P" + Str(mas_Bazis(4))
main.T_bas_5.Text = "P" + Str(mas_Bazis(5))
' -----------------
main.T_sb_1.Text = Str(mas_Sb(1))
main.T_sb_2.Text = Str(mas_Sb(2))
main.T_sb_3.Text = Str(mas_Sb(3))
main.T_sb_4.Text = Str(mas_Sb(4))
main.T_sb_5.Text = Str(mas_Sb(5))
' -----------------
main.T_P0_1.Text = Str(Format(mas_P0(1), "#.00"))
main.T_P0_2.Text = Str(Format(mas_P0(2), "#.00"))
main.T_P0_3.Text = Str(Format(mas_P0(3), "#.00"))
main.T_P0_4.Text = Str(Format(mas_P0(4), "#.00"))
main.T_P0_5.Text = Str(Format(mas_P0(5), "#.00"))
' -----------------
main.T_P_11.Text = Format(mas_P1_10(1, 1), "0.##")
main.T_P_12.Text = Format(mas_P1_10(1, 2), "0.##")
main.T_P_13.Text = Format(mas_P1_10(1, 3), "0.##")
main.T_P_14.Text = Format(mas_P1_10(1, 4), "0.##")
main.T_P_15.Text = Format(mas_P1_10(1, 5), "0.##")
main.T_P_16.Text = Format(mas_P1_10(1, 6), "0.##")
main.T_P_17.Text = Format(mas_P1_10(1, 7), "0.##")
main.T_P_18.Text = Format(mas_P1_10(1, 8), "0.##")
main.T_P_19.Text = Format(mas_P1_10(1, 9), "0.##")
main.T_P_110.Text = Format(mas_P1_10(1, 10), "0.##")
main.T_P_21.Text = Format(mas_P1_10(2, 1), "0.##")
main.T_P_22.Text = Format(mas_P1_10(2, 2), "0.##")
main.T_P_23.Text = Format(mas_P1_10(2, 3), "0.##")
main.T_P_24.Text = Format(mas_P1_10(2, 4), "0.##")
main.T_P_25.Text = Format(mas_P1_10(2, 5), "0.##")
main.T_P_26.Text = Format(mas_P1_10(2, 6), "0.##")
main.T_P_27.Text = Format(mas_P1_10(2, 7), "0.##")
main.T_P_28.Text = Format(mas_P1_10(2, 8), "0.##")
main.T_P_29.Text = Format(mas_P1_10(2, 9), "0.##")
main.T_P_210.Text = Format(mas_P1_10(2, 10), "0.##")
main.T_P_31.Text = Format(mas_P1_10(3, 1), "0.##")
main.T_P_32.Text = Format(mas_P1_10(3, 2), "0.##")
main.T_P_33.Text = Format(mas_P1_10(3, 3), "0.##")
main.T_P_34.Text = Format(mas_P1_10(3, 4), "0.##")
main.T_P_35.Text = Format(mas_P1_10(3, 5), "0.##")
main.T_P_36.Text = Format(mas_P1_10(3, 6), "0.##")
main.T_P_37.Text = Format(mas_P1_10(3, 7), "0.##")
main.T_P_38.Text = Format(mas_P1_10(3, 8), "0.##")
main.T_P_39.Text = Format(mas_P1_10(3, 9), "0.##")
main.T_P_310.Text = Format(mas_P1_10(3, 10), "0.##")
main.T_P_41.Text = Format(mas_P1_10(4, 1), "0.##")
main.T_P_42.Text = Format(mas_P1_10(4, 2), "0.##")
main.T_P_43.Text = Format(mas_P1_10(4, 3), "0.##")
main.T_P_44.Text = Format(mas_P1_10(4, 4), "0.##")
main.T_P_45.Text = Format(mas_P1_10(4, 5), "0.##")
main.T_P_46.Text = Format(mas_P1_10(4, 6), "0.##")
main.T_P_47.Text = Format(mas_P1_10(4, 7), "0.##")
main.T_P_48.Text = Format(mas_P1_10(4, 8), "0.##")
main.T_P_49.Text = Format(mas_P1_10(4, 9), "0.##")
main.T_P_410.Text = Format(mas_P1_10(4, 10), "0.##")
main.T_P_51.Text = Format(mas_P1_10(5, 1), "0.##")
main.T_P_52.Text = Format(mas_P1_10(5, 2), "0.##")
main.T_P_53.Text = Format(mas_P1_10(5, 3), "0.##")
main.T_P_54.Text = Format(mas_P1_10(5, 4), "0.##")
main.T_P_55.Text = Format(mas_P1_10(5, 5), "0.##")
main.T_P_56.Text = Format(mas_P1_10(5, 6), "0.##")
main.T_P_57.Text = Format(mas_P1_10(5, 7), "0.##")
main.T_P_58.Text = Format(mas_P1_10(5, 8), "0.##")
main.T_P_59.Text = Format(mas_P1_10(5, 9), "0.##")
main.T_P_510.Text = Format(mas_P1_10(5, 10), "0.##")
' -----------------
main.L_F_max.Caption = "F ="
str_F = ""
nomer = False
F = 0
For i = 1 To 5
If mas_Sb(i) <> 0 Then
If nomer = False Then
str_F = str_F + Str(mas_Sb(i)) + "*" + Str(Format(mas_P0(i), "#.00"))
nomer = True
F = F + mas_Sb(i) * mas_P0(i)
Else
str_F = str_F + "+" + Str(mas_Sb(i)) + "*" + Str(Format(mas_P0(i), "#.00"))
F = F + mas_Sb(i) * mas_P0(i)
End If
End If
Next i
main.T_F = "F=" & Str(F)
main.L_F_max.Caption = main.L_F_max.Caption & str_F & "=" & Str(F)
' -----------------
main.T_delt_1.Text = Format(mas_Delti(1), "0.##")
main.T_delt_2.Text = Format(mas_Delti(2), "0.##")
main.T_delt_3.Text = Format(mas_Delti(3), "0.##")
main.T_delt_4.Text = Format(mas_Delti(4), "0.##")
main.T_delt_5.Text = Format(mas_Delti(5), "0.##")
main.T_delt_6.Text = Format(mas_Delti(6), "0.##")
main.T_delt_7.Text = Format(mas_Delti(7), "0.##")
main.T_delt_8.Text = Format(mas_Delti(8), "0.##")
main.T_delt_9.Text = Format(mas_Delti(9), "0.##")
main.T_delt_10.Text = Format(mas_Delti(10), "0.##")
' -----------------
main.L_kol_iter.Caption = Str(kol_iter)
If optima = "y" Then
main.L_opt_d.Caption = "да"
str_opt_x = "{"
For i = 1 To 5
If mas_Sb(i) > 0 Then
mas_mesto_x(mas_Bazis(i)) = mas_P0(i)
End If
Next i
For i = 1 To 5
If mas_mesto_x(i) > 0 Then
str_opt_x = str_opt_x + Str(mas_mesto_x(i)) + "; "
Else
str_opt_x = str_opt_x + Str(0) + "; "
End If
Next i
main.L_opt.Caption = str_opt_x + "}"
Else: main.L_opt_d.Caption = "нет"
End If
' Вывод результатов окончен.
End Sub
Private Sub Command1_Click()
main.Show
main.L_opt.Caption = ""
Call Reschenie(2, 1)
'Command2.Enabled = False
main.Command1.Enabled = True
End Sub
Private Sub Command2_Click()
Unload GL
End Sub
ПРИЛОЖЕНИЕ 2
Информация о работе Проникновение математики в экономическую науку