Курсовая работа: Распределение ресурсов по трем отраслям
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