Rajat Gupta
Rajat Gupta

Reputation: 51

How to set the variables as integers in a Genetic Algorithm Function in GA package in R

Have a look at documentation of GA package in R

ftp://cran.r-project.org/pub/R/web/packages/GA/GA.pdf

Upvotes: 5

Views: 1071

Answers (1)

Ben
Ben

Reputation: 41

The only solution I have found so far is to use a ceiling, floor, or round function in order to convert the decimal value to an integer within the fitness function--before passing it to the actual function being optimized.

This, however, slows down the GA function greatly.

There is another genetic algorithm that might be useful if you only wish to use integers. It is called GeneticAlg.int from the gramEvol package.

Upvotes: 4

Related Questions