This function performs a floating-point genetic algorithm search with a statistical forecasting operator that generates offspring which probably will be generated in future generations. Use of this operator makes floating-point genetic algorithms hybrid, that is, forecasting future generations mimics a local search.

1 2 3 | ```
forecasting_ga(evalFunc, chsize, minv, maxv, crossprob, mutationprob,
forecastprob, elitism, popsize, maxiter, MinimumForecastLength,
ForecastFunction)
``` |

`evalFunc` |
Function to be minimized |

`chsize` |
Chromosome size |

`minv` |
Vector of lower bounds of decision variables (genes) |

`maxv` |
Vector of upper bounds of decision variables (genes) |

`crossprob` |
Crossover probability |

`mutationprob` |
Mutation probability |

`forecastprob` |
Probability of forecasting operator applied on variables (genes) |

`elitism` |
Number of chromosomes that are directly copied into the next generations |

`popsize` |
Population size |

`maxiter` |
Maximum number of iterations (generations) |

`MinimumForecastLength` |
Minimum number of ancestors of a chromosome before applying statistical forecast |

`ForecastFunction` |
R function to be used in forecasting. ForecastArima is implemented as R code and any other forecast functions can be implemented instead |

EvalFunc is always encapsulates a minimization problem. Genetic operators satisfy the boundary constraints. Since the current forecast method is ARIMA, the parameter ForecastFunction must be manually set to ForecastArima if there is no any other function at hand. A new user-defined forecast function can easly be implemented which is based on the other well-known forecast methods.

Returns the population at last generation ordered by cost (fitness) values. First element is the best.

Mehmet Hakan Satman <mhsatman@istanbul.edu.tr>

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ```
# Required package forega
require("forega")
set.seed(12345)
# This function has the global minimum at x_1 = pi and x_2 = exp(1)
f <- function (x){
return( (x[1]-pi)^2 + (x[2]-2.71828)^2 )
}
# Performing a floating-point genetic algorithm search with forecast probability of 0.10
res <- forecasting_ga(evalFunc=f, chsize=2, minv=rep(-10.0,2),
maxv=rep(10.0,2), crossprob=0.80, mutationprob=0.01,
popsize=100, maxiter=1000, MinimumForecastLength=20,
ForecastFunction=ForecastArima, elitism=2, forecastprob=0.01)
# Show the first chromosome of the returned population matrix
print(res[1,])
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.