Trouble achieving the global minimum in the GA

Good Afternoon,
I have created a program that will optimize the design of a rectangular reinforced concrete beam using the genetic algorithm. It uses discrete variables: beam height and width, as well as the number of rebars and the diameter of those rebars. I have set up the fitness function to minimize cost. When I run the program, it does not always find the absolute minimum, but rather the second or third best, which I know from the Excel worksheet I've created, consisting of all combinations of those four variables. I've tried adjusting the stopping criteria, such as stall generation and stall time, as well as increasing the generations and population, but nothing seems to affect it. I have been varying the span of the beam and the cost coefficients of the steel and concrete. While certain values give the absolute minimum every time, other spans/costs will only provide the second or third best every time, no matter how many times I run the program again. The solution converges, but it stops before reaching the maximum number of generations I specified.
Let me know if more information is required.
Thanks for any help you can provide,
Alex

Answers (3)

Hi, did you try the suggestions in the newsgroup discussion? If so, what option values did you use?
You could also try setting a nicely dispersed initial population as a partial initial population.
Finally, it sounds as if the problem is small enough that you could search every value. If so, why use a random search method at all?
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
Alan,
Sorry, I didn't see the other response. To answer one of your questions, all the variables are integer-based.
For my population size, I've used various values, all giving me the same result. Currently my population is at 1000. My StallGenLimit is also 1000. Neither of these seem to help produce a better result.
When you say you could search for every value, how would you go about doing this? I've considered this but didn't know how.
Thanks,
Alex
To search every value, suppose your integer values are
x(1) = 1:15;
x(2) = 4:20;
x(3) = -5:5;
x(4) = 2:2:100;
You have two choices: vectorized function, or non-vectorized function. For a non-vectorized function:
F = zeros(15,17,11,50); % allocate answer
for i1 = 1:15
for i2 = 1:17
for i3 = 1:11
for i4 = 1:50
F(i1,i2,i3,i4) = myfun([i1,i2+3,i3-6,i4*2]);
end
end
end
end
For a vectorized function (I think this is right, but I haven't tested it):
i1 = 1:15;
i2 = 1:17;
i3 = 1:11;
i4 = 1:50;
F(i1,i2,i3,i4) = myfun([i1,i2+3,i3-6,i4*2]);
For more information on vectorized functions in GA, see the documentation and the links in that section.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

1 Comment

I have one more question: I'm using a mapping function to run each of the variables through discrete variables, but it requires me to use the same size vectors for each. In your example, you use 15, 17, 11, 50. Is there a way around this?
Thanks again,
Alex

Sign in to comment.

Categories

Asked:

on 7 Jun 2013

Community Treasure Hunt

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

Start Hunting!