代表遗传算法的二进制基因组的一个明智的方法是什么? [英] What's a sensible way to represent a binary genome for a genetic algorithm?

查看:219
本文介绍了代表遗传算法的二进制基因组的一个明智的方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的上一个问题掩盖了我缺乏经验,并且基于假设。现在我更聪明了(把1和0放在一个字符串中?Pah!我笑了这个建议!)

My previous question belied my inexperience and was based on an assumption. Now I am much wiser. (Put 1s and 0s in a string? Pah! I laugh at the suggestion!)

我的问题是,我应该如何编码我的基因组

在纸上,它们如下所示:

On paper, they look like this:

01010011010110010

17位编码(在某些情况下为单个,在某些情况下为组)要测试的参数

17 bits that encode (in some cases singly and in some cases as groups) the parameters to be tested.

要求是:


  1. 需要可扩展。目前可能有17个,但是随着选项被添加,删除或修改范围,这可能会增长/缩小。

  2. 每个位都需要单独轻松,以代表点突变。

  3. 理想情况下,取两个基因组的最后一个X%并将其切换(代表交叉)应该很简单。

  4. 必须有一个以明文形式表达基因组的直接方式。这里的重点是方便而不是人类的可翻译性。 (Think URL shorteners。)

  1. Needs to be scalable. There might be 17 at the moment, but this could grow/shrink as options are added, removed or have their range modified.
  2. Each bit needs to be individually flippable, to represent spot mutations.
  3. Ideally, it should be easy to take the last X% of two genomes and switch them over (representing crossover).
  4. There must be a straightforward way of representing the genome in plaintext. Here the emphasis is on convenience rather than human translatability. (Think URL shorteners.)

任何人都有好的想法? (如果它很有用,我使用C#。)

Anyone got any great ideas? (If it's useful, I'm using C#.)

推荐答案

像Andrey表示,BitArray可能是你最好的答案,所有的要求

Like Andrey said, BitArray is probably your best answer, it meets all your requirements.

1)您可以使用构造函数

1) you can set the number of bits with the constructor

设置位数2)允许您设置(on或关闭),或者,还有,Xor,不在位

2) it allows you Set (on or off),Or,And,Xor, Not on bits

3)你可以循环你最后的x%做交叉

3) you can loop over your last x% to do crossover

4)有一个ToString应该允许你输出。

4) there is a ToString that should allow you to output it.

这篇关于代表遗传算法的二进制基因组的一个明智的方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆