Распределение ресурсов по трем отраслям

ActiveCell.Cells(i + 0, 8) = Int(GetF2Pos(i + 0, d) * d)

ActiveCell.Cells(i + 0, 9) = GetF3Val(i + 0, d)

ActiveCell.Cells(i + 0, 10) = Int(GetF3Pos(i + 0, d) * d)

ActiveCell.Cells(i + 0, 6) = Abs(z - ActiveCell.Cells(i + 0, 8) - ActiveCell.Cells(i + 0, 10))

Next

ListBox1.Clear

For i = 1 To 3

m_str = Str(i) + ": X = " + Str(ActiveCell.Cells(n + 0, 4 + i

* 2)) + " F = " + Str(ActiveCell.Cells(n + 0, 3 + i * 2))

ListBox1.AddItem (m_str)

Next

Range("A10:J10").Select

End Sub

Private Sub CommandButton2_Click()

Hide

End Sub

Public Function GetF2Val(n As Integer, d As Double) As Double

Dim maxs As Double

maxs = f_g2(0) + f_g1(n * d)

For i = 1 To n

If f_g2(i * d) + f_g1((n - i) * d) >= maxs Then

maxs = f_g2(i * d) + f_g1((n - i) * d)

End If

Next

GetF2Val = maxs

End Function

Public Function GetF2Pos(n As Integer, d As Double) As Integer

Dim maxs As Double

Dim maxp As Integer

Range("A11").Select

maxs = f_g2(0) + f_g1(n * d)

max_p = 0

For i = 1 To n

If f_g2(i * d) + f_g1((n - i) * d) >= maxs Then

maxs = f_g2(i * d) + f_g1((n - i) * d)

maxp = i

End If

Next

GetF2Pos = maxp

End Function

Public Function GetF3Val(n As Integer, d As Double) As Double

Dim maxs As Double

maxs = f_g3(0) + f_g2(n * d)

For i = 1 To n

If f_g3(i * d) + f_g2((n - i) * d) >= maxs Then

maxs = f_g3(i * d) + f_g2((n - i) * d)

End If

Next

GetF3Val = maxs

End Function

Public Function GetF3Pos(n As Integer, d As Double) As Integer

Dim maxs As Double

Dim maxp As Integer

Range("A11").Select

maxs = f_g3(0) + f_g2(n * d)

max_p = 0

For i = 1 To n

If f_g3(i * d) + f_g2((n - i) * d) >= maxs Then

maxs = f_g3(i * d) + f_g2((n - i) * d)

maxp = i

End If

Next

GetF3Pos = maxp

End Function

Страница:  1  2  3 


Другие рефераты на тему «Программирование, компьютеры и кибернетика»:

Поиск рефератов

Последние рефераты раздела

Copyright © 2010-2024 - www.refsru.com - рефераты, курсовые и дипломные работы