Trouble achieving the global minimum in the GA
Show older comments
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)
Alan Weiss
on 7 Jun 2013
0 votes
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
Alex
on 7 Jun 2013
0 votes
Alan Weiss
on 7 Jun 2013
Edited: Alan Weiss
on 7 Jun 2013
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
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!