Question

I'm new to genetic algorithms and I've been assigned to implement a genetic algorithm to optimize the order of requests per weekday of a pharmacy. First of all, let me explain the problem:

There are 9 families which issue requests to be attended at any day of a work week (monday to friday). The pharmacy can only attend 1 to 3 families per day, no more no less and they can't repeat any family in the same week. The main goal is to optimize the best day for each family to be attended, in that way, the pharmacy attends the maximum requests per week with the constraints imposed on the problem. The input to the optimization algorithm is the annual mean of each number of requests issued by each family. For example:

(let's work with only 3 families, to simplify the example):

Input:

        | Mon | Tue | Wed | Thu | Fri
F1   | 10     | 20   | 2      | 0     | 7
F2   | 20     | 12   | 0      | 1     | 2
F3   | 2       | 0     | 0      | 19   | 3

Possible solution:

| Mon | Tue | Wed | Thu | Fri
|         | F2   | F1    | F3   |

So far I've been studying the whole concept of genetics and genetic algorithms. I've looked into particle swarm optimization but as my time is rather short, I decided to use a framework. I'm using JGAP, but my main problem is in what way do I present a potential solution? I mean, how should I organize the genes on the chromossome used for mating, breeding, etc...? I've already developed a fitness function, but I can't encode the genes the way I wanted to. Any suggestions?

Was it helpful?

Solution

in what way do I present a potential solution?

Every family should be scheduled on a day. So, you could store on what day each family is scheduled. A gene would be one of the 5 days, a chrome would have 9 of these, one for each familiy

         1 2 3 4 5 6 7 8 9
Chrome   M T T F W H T M T

So family 1 on Monday, family 2 and 3 on Tuesday, etc. You should impose all the other constraints (The pharmacy can only attend 1 to 3 families per day) in the fitness function.

Another encoding could be

 M1 M2 M3 T1 T2 T3 W1 W2 W3 ... F2 F3
 1  2  -  -  5  -  9  -  3  ... 4  -

So you would take all possible appointments and fill in families, or keep them empty. In this case the fitness function should make sure every family has exactly one appointment.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top