giacomelli / GeneticSharp

GeneticSharp is a fast, extensible, multi-platform and multithreading C# Genetic Algorithm library that simplifies the development of applications using Genetic Algorithms (GAs).
MIT License
1.27k stars 332 forks source link

How is the number of totalBits, required, computed? #42

Closed MattWolf74 closed 5 years ago

MattWolf74 commented 5 years ago

Using GeneticSharp, I started working on some optimizations in order to lower the computational power, required. For that purpose I try to lower the totalBits but it does not seem apparent how the required number bits is computed given

Can someone please comment on how the total number bits, required, are computed. Ideally I want to set the totalBits parameter as function of chosen precision and value range.

Thanks

giacomelli commented 5 years ago

The four arguments of FloatingPointChromosome's constructor are:

1) The minimum values of numbers inside the chromosome. 2) The maximum values of numbers inside the chromosome. 3) The total bits used to represent each number. For example, if your maximum value is 998, so 10 bits is what you need.

GeneticSharp will warn you if you try to use a total bits that cannot hold a number inside your floating point chromosome.

4) The number of fraction (scale or decimal) part of the number.

MattWolf74 commented 5 years ago

What does it mean "if the maximum value is 998"? Do those values refer to the possible values of input variables or the result of the objective function? How are the required bits calculated for a floating point number? I am asking because there are different approaches.

Thanks

On Mon, Oct 22, 2018, 19:14 Diego Giacomelli notifications@github.com wrote:

The four arguments of FloatingPointChromosome's constructor are:

  1. The minimum values of numbers inside the chromosome.
  2. The maximum values of numbers inside the chromosome.
  3. The total bits used to represent each number. For example, if your maximum value is 998, so 10 bits is what you need.

GeneticSharp will warn you if you try to use a total bits that cannot hold a number inside your floating point chromosome.

  1. The number of fraction (scale or decimal) part of the number.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/giacomelli/GeneticSharp/issues/42#issuecomment-431799675, or mute the thread https://github.com/notifications/unsubscribe-auth/APznJtWeOotQ3JEw6CATLFk3QGF62qtTks5unaiggaJpZM4XyU8p .

giacomelli commented 5 years ago

It means the maximum number that a chromosome can represent (solution).

MattWolf74 commented 5 years ago

So it is the input variables to the objective function and hence the number of bits required is also a function of the fractionDigits specified in each Chromosome, correct?

On Tue, Oct 23, 2018 at 2:21 AM Diego Giacomelli notifications@github.com wrote:

It means the maximum number that a chromosome can represent (solution).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/giacomelli/GeneticSharp/issues/42#issuecomment-431923518, or mute the thread https://github.com/notifications/unsubscribe-auth/APznJmtp2BymPLClouTGYeWB82gLGoxBks5ungy9gaJpZM4XyU8p .

giacomelli commented 5 years ago

Correct.