CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

# Thread: Genetic algorithm problem: Request optimization

1. Junior Member
Join Date
Jan 2011
Posts
2

## Genetic algorithm problem: Request optimization

Hello,

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:

Days(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, ' ')

I really have to use Genetic Algorithms to solve the problem. The idea here is to produce a schedule to use every week and to revise it every 6 months. The values in the input are from the sums of orders of an entire year.

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?

2. Elite Member Power Poster
Join Date
May 2006
Location
UK
Posts
4,473

## Re: Genetic algorithm problem: Request optimization

You maybe better off posting in the algorithms forum.

Once you have your algorithm, if you need help converting it to Java code ask here.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•