# Thread: Optimising a Multivariable Function

1. ## Optimising a Multivariable Function

$f(x,y,z) = (A + BCx + CDy) * (1+f(z-z^2))$

Where:
$x+y+z = g$
$0 < g <= 1$
a, b, c, d, f, g = positive "user input" constants for the program

I want to find the maximum possible result of the function, and the corresponding distribution of x,y,z. So an optimisation problem.

For calculations sake, I'll input some actual values for the constants.
$f(x,y,z) = (50000 + 50(800x) + 8(800y)) * (1+1.5(z-z^2))$
$f(x,y,z) = (50000 + 40000x + 6400y)) * (1+1.5(z-z^2))$

Where:
$x+y+z = 0.4$

So I've concluded that a maximum will occur somewhere along the triangular plane bounded by three 3 dimensional vertices'. I believe the formula can be rearranged a bit to just deal with 2 variables and have the final variable (z) = g - (x + y)... But I think 3 variable optimising is still possible regardless, and would be of more use to me because I plan on increasing the number of variables once I sufficiently understand the process... Anyway, as I was saying, vertices'.

1: (0.4 0, 0)
2: (0, 0.4, 0)
3: (0, 0, 0.4)

From experience (not mathematical reasoning), the maximum can occur anywhere on that plane, not just at one of those vertices's or along the boundary. Some examples I've seen have stated that maximums will occur along the boundary of a plane... In any case, I'm reasonably well confused.

I have done some reading and am well aware that this is way out of my league :P I'm not completely hopeless, but I've never done much work at this level before. I'm doing this because it's just an intriguing concept that I actually came across in a game a while ago, but none the less it holds interest for me even now. I did create a topic on this same problem a little while ago but I've since done some further reading and think the topic I labeled it as was misleading and not even correct :S I've also done some further work on the matter.

--------------------------------------------------

Work so far:

$f(x,y,z) = (50000 + 40000x + 6400y)) * (1+1.5(z-z^2))
x+y+z = 0.4$

Expanded Function f(x,y,z)

$f(x,y,z) = -75000z^2 - 60000xz^2 - 9600yz^2 + 75000z$ $+ 60000xz + 9600yz + 40000x + 6400y + 50000$

Partial Derivatives

$(df/dz) = -150000z - 120000xz - 19200yz + 60000x + 9600y + 75000$
$(df/dz) = -600(100x + 16y + 125)(2z - 1)$

$(df/dy) = -9600z2 + 9600z + 6400$
$(df/dy) = -3200(3z^2 - 3z - 2)$

$(df/dx) = -60000z2 + 60000z + 40000$
$(df/dx) = -20000(3z^2 - 3z - 2)$

The plan afaik is to start working with lagrange multipliers next... But I've also heard someone mention the simplex method for solving it, and a search on "optimisation" returned so much stuff I wouldn't know where to start. Any solution would have to be a definitive exact solution as I'm attempting to do the maths to use in excel without the need for iterative calculations (hate them, sloppy in my view). Having said that, I don't know if thats possible.

Any assistance would be great. In as simple terms, step by step as possible?

Thanks.

2. Convert this to an unconstained optimisation problem by using the constaint

$x+y+z=G$

to elliminate one of the variables in the objective.

Then the objective:

$f(x,y,z) = (A + Bx + Cy) ~(1+D(z-z^2))$

becomes:

$h(x,z) = (A + Bx + C(G-x-z)) ~ (1+D(z-z^2))$

which is unconstained.

RonL