What can I do to make a GA spread the intial population over a larger area

2 views (last 30 days)
Dear community,
I am currently optimising the size of a combination of a chp unit and an auxiliary boiler. I feed the algorithm with all sorts of information about investment costs, fuel efficiencies, o&m costs and so on. As a start, I am looking at 12 timesteps only, in which the combination of chp unit and the boiler jointly have to supply heat to a city quarter. So I have chp unit power from 1:12, boiler power from 13:24 and at 25 and 26 the rated power of the two. The rated power of both chp unit and boiler is the final result.
For instance the needed heat supply is 20kW in all 12 timesteps. So chp unit power and boiler power have to meet this request. There are billions of combinations possible but my ga goes for quite a narrow range as for instance:
CHP Power [kW] 19.5 19.4 19.6 19.7. 19.65 .... Boiler [kW] 0.5 0.6 0.4 0.3 0.35 ....
The ga creates an intial population from which he starts optimisation. The algorithm ends up in a local minimum that is not the global minimum. The reason for this is that the genetics of its initial population is simply not different enough. With other words my individuals are too similar to each other.
However if I provide the ga with an initial population with a combination of a optimal solution from linprog and of the initial population that it usually comes up with, it finds the same solution as linprog and also as fmincon. You might now wonder, why I want to use ga in the first place...the answer is that I want to do multiobjective programming next, so I need my ga to work first...
Do you have any suggestions as to how to spread the gene variation further?
Thanks in advance,
Mathias

Answers (1)

Alan Weiss
Alan Weiss on 21 Jul 2015
The documentation has suggestions about setting the initial diversity. I suggest that you put bounds on all your variables, and then ga uses those bounds to set its initial population. You might also need to take a larger-than-default population size, or to use the @gacreationlinearfeasible creation function.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
  7 Comments
Mathias Tholey
Mathias Tholey on 25 Jul 2015
I have found out that the reason why there are basically only the first 24 columns used in my programm is that eqnsolv deep down in the GA decides to choose an XBASIC solution instead of the minnormstep. As one cannot change this code I have to accept this situation but then I don't understand why even with this rather undispersed solution, the ga does not manage to evolve into other directions...
I know this is quite a complex question but maybe there is someone out there who can help me!
Best wishes,
Mathias
Alan Weiss
Alan Weiss on 27 Jul 2015
It is possible that the creation function gacreationlinearfeasible is getting stuck near the initial feasible point that it creates. So perhaps the best thing to do is to give ga a new creation function, based on gacreationlinearfeasible, that works as follows: Instead of generating one feasible point and then looking for feasible directions from that point, instead solve a number of linear programming problems using linprog. Each linear programming problem has the same linear constraints and bounds as your original problem.
The new feature is to take f, the linprog objective function vector, to be randn(1,nvars), where nvars is the number of variables in your problem. For better scaling you could even take f to be f/norm(f).
This linear programming problem has a solution that is a vertex of the constraint simplex, chosen in a random direction. As you generate your initial population you could even discard points that have already been found, while being careful not to halt the generation entirely by getting stuck if you have already generated all feasible vertices.
To implement this function, you can create a new function, say called gacreatelinear2. In that file, copy over the code from gacreationlinearfeasible, and replace the block of code starting at line 97:
if directionCounter > maxDirections
and ending at line 160, with the linprog calls.
If you don't want to write your own creation function like this, you could generate an initial population by running the linprog code yourself several times, and then taking a few convex combinations of the resulting vertices, as your initial population.
Whatever you choose to do, be sure to either pass in the custom creation function, or the custom initial population, to your ga options.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!