Dear Community,
I am just new to Mathematica that came with my Raspberry Pi2. For a while now I have been looking for a program, which is able to minimize a discontinuous and nonlinear problem. Up to now I created the following formulas:
f1[x_] :=
Piecewise[{{0.00000000000252413096488599 x^4 -
0.0000000295981935774312 x^3 + 0.0001268180409138660 x^2 -
0.239339875030011 x + 368.934089585833, x > 0}, {0, x <= 0}}]
f2[x_] :=
Piecewise[{{0.00000000000327848026710691 x^4 -
0.0000000379764365996404 x^3 + 0.0001584280843487410 x^2 -
0.284905693712486 x + 386.639837124850, x > 0}, {0, x <= 0}}]
f3[x_] :=
Piecewise[{{0.00000000000273770414832564 x^4 -
0.0000000245466477791088 x^3 + 0.0000876247218487314 x^2 -
0.151272246878742 x + 298.178569447775, x > 0}, {0, x <= 0}}]
f4[x_] :=
Piecewise[{{0.00000000000151824463118546 x^4 -
0.0000000164748347339070 x^3 + 0.0000716029554621768 x^2 -
0.140270401260495 x + 293.998348739492, x > 0}, {0, x <= 0}}]
NMinimize[{f1[w] + f2[x] + f3[y] + f4[z],
Plus[w, x, y, z] == 7000}, {w \[Element] Interval[{0, 4000}],
x \[Element] Interval[{0, 4000}], y \[Element] Interval[{0, 3000}],
z \[Element] Interval[{0, 3000}]}]
Unfortunately now I get the following error messages three times before the calculation is aborted:
During evaluation of In[8]:= NMinimize::nnum: The function value {812.066} is not a number at {Subscript[w, 1],Subscript[x, 1],Subscript[y, 1],Subscript[z, 1]} = {1052.02,1848.71,2479.67,1619.59}.
Is there any quick way of resolving this issue? Did I enter something in a wrong way? At least the sum of the resulting values for w,x,y, and z being 7000 is correct, maybe 812,066 is a local minimum already. But why is there an error message? I also tried to use Minimize and different Methods, but the outcome is the same in all cases.
And it is just a LOCAL minimum: As one might be able to see from the equation, fx[0]=0. A minimum value, f.e. for the entered w+x+y+z==7000, should incorporate that some of the functions are set to zero! Is there any way to include this possibility in a fast way? Or do I have to write a minimization for all 16 possibilities and minimize these again?
Best regards, Peter