luca-scr / GA

An R package for optimization using genetic algorithms
http://luca-scr.github.io/GA/
91 stars 29 forks source link

Discrete input parameters #9

Closed shma1 closed 7 years ago

shma1 commented 7 years ago

What changes are to be made so that the input parameters are considered to be discrete/integer values.

  1. Making high penalties in the fitness function is not the right option as it becomes a part of the iterative process.
  2. skipping the non-integer values is again a part of iterative process.

Something needs to be changed in: ga(type = c("binary", "real-valued", "permutation"), min, max, nBits, fitness, ..., ) to make the algo take in only integer/ discrete parameters. I have four discrete params.

I cant figure it out :( Thanks..

luca-scr commented 7 years ago

If you have discrete/integer values for your decision variables, you have two options:

  1. use type = "binary" search by encoding your decision variables as binary values
  2. use type = "real-valued" by encoding your decision variables as floating-point values in a specified range and apply some repairing to convert the values to integers.

For an example of both approaches see Section 4.6 of the following paper

Best,

Luca