Click here to Skip to main content
15,936,565 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,
I am trying to solve the facility location problem and one of the methods to solve it is by using the genetic algorithm . I have a fair understanding of how the algorithm works but i am unable to put it into code form .

example problem

There are 3 levels and a total of 5 potential facility locations .

2 out of the 5 facilities are on level 1 and the rest of the 3 are on level 2 .

level 3 consists of 5 clients .

To reach any client on level 3 , one has to start at level 1 then move on to level 2 and then finally to a particular client .

There is a fixed cost associated with setting up a facility .

The distances between any 2 locations , i.e , facilities on level 1 to facilities on level 2 , facilities on level 2 to clients on level 3 is given . I need to minimise the cost .

cost = (cost of setting up warehouse) + (distance * cost per unit distance)

demand for each client has to be satisfied .

If someone could give me a rough idea of how to go about this using the Genetic Algorithm it would be of massive help .
Posted

Interesting . Yes it is something i can build upon . Finally i need to decide upon the ideal number of facilities to be set up among the potential facilities while minimizing the total cost . The hard constraint being that the demand at every client must be met .

Thanks a lot !
 
Share this answer
 
hi,
first of all the traversal paths need to be well defined. i.e. which all are the possible traversals.
example.
startPoint-->level1facility1-->level2facility1-->client1
startPoint-->level1facility1-->level2facility2-->client2
startPoint-->level1facility1-->level2facility3-->client3
--------------------------------------------------------
.................................etc.

Basically, what this algo solves is :
what is the minimal cost path to reach from say,level1facility1 to client3 ??

Now select a suitable data structure. A graph would be helpful in this case to represent the levels. Thinking in terms of a generic solution and not just limited to 3 levels.
If you select a graph the Dijkstra's algorithm[^] would help you.

hope this helps !!

OR
take a look at Genetic Algorithms and the Traveling Salesman Problem[
title="New Window">^
] and see how it suits your case.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900