I have 5 variables that input into a function. I want to review every possible combination/permutation of the variables and select the one that maximizes the output of this function.
To create every possible combination, the variables will have a minimum, maximum, and interval it will test. E.g. VAR1 can have a min value of 0, maximum value of 75, and will test each interval of 2.5. Additionally, I have a constraint flag. If the combination violates a constraint, the flag is FALSE, and the program should throw out the result.
The variables are also dependent on each other, so it couldn't simply loop thru each variable. It would have to loop through each variable combination. Thus the possible combinations is not 5x25 but 5^25
I am envisioning the program to loop through all the combinations and store the current maximum output and compare it to the current combination. If the current combination is greater than the maximum, it would throw out the old maximum combination and redefine the current combination as the maximum.
In excel there are 3 columns: StartingPoint (ColumnA), EndingPoint (ColumnB), Interval (ColumnC), where each row is its own variable. StartingPoint array is defined as A2:A6, EndingPoint array is defined as B2:B6, Interval array is defined as C2:C6. Constraint flag is in cell D2 (If false throw out the results). Variable results should be displayed in ColumnF with the maximized function in cell G2. The number of variables inputted into this function can vary so the code should have this flexibility.
Thanks in advance!
(I am very familiar with excel solver and simply dont like it. This solution simply picks the best one. Where as solver will get caught at a poor solving point depending on the path it takes.)
To create every possible combination, the variables will have a minimum, maximum, and interval it will test. E.g. VAR1 can have a min value of 0, maximum value of 75, and will test each interval of 2.5. Additionally, I have a constraint flag. If the combination violates a constraint, the flag is FALSE, and the program should throw out the result.
The variables are also dependent on each other, so it couldn't simply loop thru each variable. It would have to loop through each variable combination. Thus the possible combinations is not 5x25 but 5^25
I am envisioning the program to loop through all the combinations and store the current maximum output and compare it to the current combination. If the current combination is greater than the maximum, it would throw out the old maximum combination and redefine the current combination as the maximum.
In excel there are 3 columns: StartingPoint (ColumnA), EndingPoint (ColumnB), Interval (ColumnC), where each row is its own variable. StartingPoint array is defined as A2:A6, EndingPoint array is defined as B2:B6, Interval array is defined as C2:C6. Constraint flag is in cell D2 (If false throw out the results). Variable results should be displayed in ColumnF with the maximized function in cell G2. The number of variables inputted into this function can vary so the code should have this flexibility.
Thanks in advance!
(I am very familiar with excel solver and simply dont like it. This solution simply picks the best one. Where as solver will get caught at a poor solving point depending on the path it takes.)