遗传算法:请求优化

发布于 2024-10-11 12:12:51 字数 1067 浏览 5 评论 0原文

我是遗传算法的新手,我被指派实施遗传算法来优化药房每个工作日的请求顺序。首先解释一下问题:

有9个家庭提出要求在工作周的任何一天(周一至周五)上班。药房每天只能服务 1 到 3 个家庭,不能多也不能少,并且不能在同一周内重复任何家庭。主要目标是优化每个家庭的最佳就诊日期,这样药房就可以在对问题施加限制的情况下满足每周的最大请求量。优化算法的输入是每个家庭发出的每个请求数量的年平均值。例如:(

为了简化示例,我们只处理 3 个家庭):

输入:

        | 周一 | 周二 | 周三  |周四|周五
F1  | 10   | 20  | 2     | 0      nbsp;    | 7
F2 | 20     | 12   | 0      | 1       | 2
F3 | 2      | 0     | 0      | 19   | 3

可能的解决方案:

|星期一 |周二 |周三 |星期四 |周五
|        | F2 | | F1    | F3 | |

到目前为止,我一直在研究遗传学和遗传算法的整个概念。我研究过粒子群优化,但由于我的时间相当短,我决定使用一个框架。我正在使用 JGAP,但我的主要问题是如何提出潜在的解决方案?我的意思是,我应该如何组织染色体上用于交配、繁殖等的基因……?我已经开发了适应度函数,但我无法按照我想要的方式编码基因。有什么建议吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寄人书 2024-10-18 12:12:52

我以什么方式展示我的潜力
解决方案?

每个家庭都应该安排一天。因此,您可以存储每个家庭安排的日期。一个基因将是 5 天中的一天,一个 chrome 将有 9 个这样的天数,每个家庭一个,

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

所以周一家庭 1,周二家庭 2 和 3,等等。您应该施加所有其他约束(药房每天只能参加1到3个家庭)的健身功能。

另一种编码可能是

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

因此您将接受所有可能的约会并填写家庭,或将其保留为空。在这种情况下,健身功能应确保每个家庭都有准确的一次预约。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文