Maximize[{91 x1 + 71 x2 + 105 x3 + 103 x4 + 96 x5,
2.36 x1 + 2.12 x2 + 1.89 x3 + 3.77 x4 + 2.87 x5 <= 50, 0 <= x1 <= 3,
1 <= x3 <= 5, 1 <= x4, 2 <= x3 + x4 <= 5}, {x1, x2, x3, x4,
x5}, NonNegativeIntegers]
Because the Maximize
function sometimes returns the local optimal value, I want to use the NMaximize
function to solve it. But the NMaximize
function cannot use the non negative integer field as the solution condition:
NMaximize[-x^4 - 3 x^2 + x, x∈
Reals]
NMaximize[-x^4 - 3 x^2 + x, x∈
NonNegativeReals]
NMaximize[{91 x1 + 71 x2 + 105 x3 + 103 x4 + 96 x5,
2.36 x1 + 2.12 x2 + 1.89 x3 + 3.77 x4 + 2.87 x5 <= 50, 0 <= x1 <= 3,
0 <= x2, 1 <= x3 <= 5, 1 <= x4,
2 <= x3 + x4 <= 5}, {x1, x2, x3, x4, x5} ∈
NonNegativeIntegers]