神经网络算法或类似算法为使用遗传算法的应用程序找到适当的参数以缩短运行时间

发布于 2024-10-23 19:45:32 字数 2744 浏览 7 评论 0原文

我用 Java 开发了一个使用遗传算法的应用程序。我的应用程序需要如下参数:

 How many genes will be populate at first?
 How many genes will be killed after crossover and mutation?
 What will be the mutation rate?

我可以测试如下内容:

How long(milliseconds) does it take to find a solution.

如何找到合适的值作为我的应用程序的参数。我的意思是我将给出结果作为输入:

Genes to populate |  Genes to kill   |   Mutation rate   |   Result(milliseconds)
---------------------------------------------------------------------------------
50                        5                 16/1000                 146
50                        5                 16/1000                 208
50                        5                 16/1000                 1000
50                        5                 16/1000                 216
100                       5                 16/1000                 178
100                       5                 16/1000                 546
100                       5                 16/1000                 646
100                       5                 16/1000                 46
100                       5                 16/1000                 186
50                        10                16/1000                 346
50                        10                16/1000                 246
50                        10                16/1000                 546
50                        5                 34/1000                 746
50                        5                 34/1000                 186
50                        5                 34/1000                 196
50                        10                34/1000                 496
50                        10                34/1000                 23
50                        10                34/1000                 169

结果是随机的。我没有测试我的程序。

运行该算法后(我想我会给出一个对我有利的结果时间,例如 78 毫秒),它会说类似这样的内容:

You should use that parameters to get a result that takes 78 milliseconds:
Genes to populate |  Genes to kill   |   Mutation rate   
--------------------------------------------------------
34                        7                  24/1000        

PS1:

PS2 我也可以使用 API 或软件程序来找到它。

编辑: 这些是我现在使用的变量及其值:

MAX_POPULATION_SIZE = 50;
HARD_WEIGHTS = {1,20,1,1,1,20,1};/* It means that I have 7 variables for this */
NUMBER_OF_GENES_TO_KILL = 5;
MUTATION_RATE = 100;
MAX_MUTATION_NUMBER = 1000;
/* Mutation rate is MUTATION_RATE/MAX_MUTATION_NUMBER */

I developed an application with Java that uses genetic algorithms. My application needs parameters as like:

 How many genes will be populate at first?
 How many genes will be killed after crossover and mutation?
 What will be the mutation rate?

I can test something as like:

How long(milliseconds) does it take to find a solution.

How can I find the good values as parameters for my application. I mean I will give as an input that results:

Genes to populate |  Genes to kill   |   Mutation rate   |   Result(milliseconds)
---------------------------------------------------------------------------------
50                        5                 16/1000                 146
50                        5                 16/1000                 208
50                        5                 16/1000                 1000
50                        5                 16/1000                 216
100                       5                 16/1000                 178
100                       5                 16/1000                 546
100                       5                 16/1000                 646
100                       5                 16/1000                 46
100                       5                 16/1000                 186
50                        10                16/1000                 346
50                        10                16/1000                 246
50                        10                16/1000                 546
50                        5                 34/1000                 746
50                        5                 34/1000                 186
50                        5                 34/1000                 196
50                        10                34/1000                 496
50                        10                34/1000                 23
50                        10                34/1000                 169

That results are random. I didn't test my program.

After I run that algorithm(I think I will give a result time that is good for me for example 78 milliseconds) it will say something like that:

You should use that parameters to get a result that takes 78 milliseconds:
Genes to populate |  Genes to kill   |   Mutation rate   
--------------------------------------------------------
34                        7                  24/1000        

PS1: One more is that, what strategy I should follow to test it. For example just changing one parameters and test them some number of times and changing other parameter etc.etc.(I tried to give my example values as like that) or testing some values and find one parameter and using that parameter always and testing other parameters that changes one by one and finding other parameter and using that two parameters and changing other one by one and going on like that.

PS2 I can use an API or a software program to find it too.

EDIT:
These are my variables that I use nowwith their values:

MAX_POPULATION_SIZE = 50;
HARD_WEIGHTS = {1,20,1,1,1,20,1};/* It means that I have 7 variables for this */
NUMBER_OF_GENES_TO_KILL = 5;
MUTATION_RATE = 100;
MAX_MUTATION_NUMBER = 1000;
/* Mutation rate is MUTATION_RATE/MAX_MUTATION_NUMBER */

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

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

发布评论

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

评论(1

一身骄傲 2024-10-30 19:45:32

我首先会得到一些参数组合的统计数据
(实际上似乎可以尝试所有组合 - 或者你有
更多参数?)
那么直接的方法是构建某种映射
这些统计数据,例如
{a,b,c}-> {最小值,最大值,平均值,dev}
(指标值统计参数)
然后找到与所需指标值对应的参数集。

如果参数空间太大,情况会更复杂
完全列举是不可能的。然后你必须建造一个更小的
在收集足够的样本后,首先近似参数空间
在随机点。

更新:
或许可以利用一些现有的工具。基本上是一样的
统计数据压缩器必须执行的任务。所以可以准备
一个包含 N {metric;params} 行的(二进制)表来构建模型,然后是 {metric;...}
部分行。然后,在处理所需的度量值后,我们必须随机提供
数据到解码器(而不是有效的算术代码),它会根据累积的统计数据解码“最可能”的参数组合。
最好的工具可能是 paq8 - http://www.mattmahoney.net/dc/#paq

建议想法的一个简单演示是使用 paq8 压缩文本,然后
在接近结尾处修改存档(引入错误)。从存档中解压的(损坏的)文件通常会包含错误后生成的句子。
Paq8 通常可以检测表中的行大小,但其预测可能会在
在这种情况下,可以通过向表中添加具有特定表尺寸的 .bmp 标题来实现。

I'd get some statistics for parameter combinations first
(actually it seems possible to try all combinations - or do you have
more parameters?)
Then the direct way would be to build some kind of mapping from
these statistics, like
{a,b,c} -> {min,max,avg,dev}
(parameters to metric value stats)
and then find the parameter sets corresponding to desired metric value.

It would be more complicated if parameter space is too large so that
full enumeration is impossible. Then you'd have to build a smaller
approximation of parameter space first, after gathering enough samples
at random points.

Update:
Its may be possible to make use of some existing tools. Basically, its the same
task as what statistical data compressors have to do. So its possible to prepare
a (binary) table with N {metric;params} rows to build the model, and then {metric;...}
partial row. Then, after processing the desired metric value, we'd have to feed random
data to the decoder (instead of valid arithmetic code), and it would decode the "most probable" parameter combination based on accumulated statistics.
The best tool for that would be probably paq8 - http://www.mattmahoney.net/dc/#paq

A simple demonstration of suggested idea would be to compress a text with paq8, then
modify the archive near the end (introduce an error). The (broken) file unpacked from the archive would usually contain a generated sentence after the error.
Paq8 usually can detect the row size in a table, but its prediction may be improved in
such case by adding a .bmp header to the table, with specific table dimensions.

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