I'm a little stumped on this and think I would benefit greatly from extra brains
In VBA I have an array that I perform a calculation on. The calculation uses a variable that can be any value between [0, 1]. Anytime the variable changes, the array changes too. I have been using Excel solver to basically "maximize" the function, but after moving most of my code off-page, I think I could do the same using some iteration. I've looked around and found something similar to what I'm looking for but it's bending my mind a little.
Here's the logic chain:
1) Calculation on array performed using 2 fixed inputs and initial variable input X (i.e. close to zero)
2) X is changed. Array calculation performed again.
3) Ideally, X changes until either A) the array is maximized or its equivalent for me, which would be B) the tolerance level is reached (i.e. array sum changes this iteration <= 0.001 or whatever)
It's almost like a feedback loop, X changes so the array changes so X changes again and so forth until it reaches the maximum/tolerance level. Computing the derivative and solving for zero doesn't seem feasible and may not be possible in Excel VBA, but I think an iterative method would work considering the interval of possible values is fixed. Where I'm having trouble is figuring out how to feed the array into a function for the X calculation and feeding the "new" X back into the array calculation.
Ideas? Thanks.
Bookmarks