generate multiple scenarios and evaluate them in Matlab

Hi All, Im working on a problem that involves generating scenario and evaluating them and then choosing the one with the best outcomes (least cost and great productivity). I am dealing with five variables, each variable has five dimensions (1,2,3,5). So the total number of scenarios is 5^5. I was able so far to generate only one scenario using randi function at the time and to evaluate it. What I am looking for is any help for to b generate as much as possible or all the scenarios and evaluate each one of them at the time, store the results in Matlab and then find another function or to evaluate each scenarion and select the best and give a result (cost and best scenario). It may be an easy issue for you most but am a starter in Matlab. Thanks

More Answers (1)

Did you try the obvious approach of 5 nested "for" loops? At each iteration of the inner most loop you'll have a new combination of the 5 parameters - a new "scenario" - and the 5 for loops will make sure you see them all at some point.
Since I don't know how you define cost, you need to define the function at the center of that nested for loop to evaluate your scenario's cost.

Categories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!