yngeng33
Industrial
- Jan 20, 2009
- 2
Hi everyone,
I'm encountering an issue with Excel Solver giving me an incorrect solution to an optimization problem.
My objective function is f() = [a] - ; where both a and b are a function of a third variable - time (specifically, number of years). My constraint on f() is that it is >= 0. Time is the variable I am changing in my optimization, and it is constrained to a positive (including 0) integer value.
Further, in my spreadsheet, the value of [a] comes from a user-defined function I've written in VBA that uses a For loop which takes the time variable I'm changing in the optimization as the loop termination point. (e.g. the loop looks like "For i to (no. of years)").
The problems I encounter are:
a) whenever the starting value of f() is negative before I run the Solver optimization; once I run solver to optimize, I get the message "Solver could not find feasible solution"
b) even if Solver finds a solution, it is generally suboptimal - i.e. I can usually manually enter a time that minimizes the [a]- differential even further
c) when it does fail to find a solution, I end up with a decimal value in the time field, even though I've clearly constrained it to an integer value
I've tested the optimization problem with [a] being derived from a different in-built Excel function; as opposed to my one which uses a 'For' loop. It works perfectly, so either there is something wrong with my function (I've checked it a dozen times and it works fine) or there is some clash with Solver I'm not aware of.
My question is - is there some reason the solver iterations/guesses of the changing variable (i.e. time, in my case) can clash with the for loop in my custom function? If I constrain the changing variable as being an integer (as I've done), will Solver only guess integer values for it and if so, why is this clashing with my function?
Any help/suggestions are greatly appreciated
I'm encountering an issue with Excel Solver giving me an incorrect solution to an optimization problem.
My objective function is f() = [a] - ; where both a and b are a function of a third variable - time (specifically, number of years). My constraint on f() is that it is >= 0. Time is the variable I am changing in my optimization, and it is constrained to a positive (including 0) integer value.
Further, in my spreadsheet, the value of [a] comes from a user-defined function I've written in VBA that uses a For loop which takes the time variable I'm changing in the optimization as the loop termination point. (e.g. the loop looks like "For i to (no. of years)").
The problems I encounter are:
a) whenever the starting value of f() is negative before I run the Solver optimization; once I run solver to optimize, I get the message "Solver could not find feasible solution"
b) even if Solver finds a solution, it is generally suboptimal - i.e. I can usually manually enter a time that minimizes the [a]- differential even further
c) when it does fail to find a solution, I end up with a decimal value in the time field, even though I've clearly constrained it to an integer value
I've tested the optimization problem with [a] being derived from a different in-built Excel function; as opposed to my one which uses a 'For' loop. It works perfectly, so either there is something wrong with my function (I've checked it a dozen times and it works fine) or there is some clash with Solver I'm not aware of.
My question is - is there some reason the solver iterations/guesses of the changing variable (i.e. time, in my case) can clash with the for loop in my custom function? If I constrain the changing variable as being an integer (as I've done), will Solver only guess integer values for it and if so, why is this clashing with my function?
Any help/suggestions are greatly appreciated