# genetic algorithm rgenoud

 Classic List Threaded
1 message
Reply | Threaded
Open this post in threaded view
|

## genetic algorithm rgenoud

 Hi, everyone,I have some question about r function genoud,I wanna maximum value by genetic algorithm, I find the maximum at the 4th generation,but it return the final generation parameters, how to get parameters at the maximum Solution Found Generation 4?Here is my reslut. > ccc<-genoud(obj, nvars, max=TRUE, pop.size=100, max.generations=6, wait.generations=10, +                 hard.generation.limit=TRUE, starting.values=initial, MemoryMatrix=TRUE, +                 Domains=domain, solution.tolerance=0.001, +                 gr=NULL, boundary.enforcement=2, lexical=FALSE, gradient.check=TRUE) Mon May 15 18:13:12 2017 Domains:  1.000000e-01   <=  X1   <=    9.000000e-01  1.000000e-01   <=  X2   <=    9.000000e-01  -4.000000e+00   <=  X3   <=    0.000000e+00  -4.000000e+00   <=  X4   <=    0.000000e+00 Data Type: Floating Point Operators (code number, name, population)         (1) Cloning...........................  15         (2) Uniform Mutation..................  12         (3) Boundary Mutation.................  12         (4) Non-Uniform Mutation..............  12         (5) Polytope Crossover................  12         (6) Simple Crossover..................  12         (7) Whole Non-Uniform Mutation........  12         (8) Heuristic Crossover...............  12         (9) Local-Minimum Crossover...........  0 HARD Maximum Number of Generations: 6 Maximum Nonchanging Generations: 10 Population size       : 100 Convergence Tolerance: 1.000000e-03 Using the BFGS Derivative Based Optimizer on the Best Individual Each Generation. Checking Gradients before Stopping. Not Using Out of Bounds Individuals and Not Allowing Trespassing. Maximization Problem. GENERATION: 0 (initializing the population) Fitness value... -5.912128e+03 mean............ -6.442347e+03 variance........ 1.179732e+05 #unique......... 100, #Total UniqueCount: 100 var 1: best............ 3.000000e-01 mean............ 4.814350e-01 variance........ 4.892024e-02 var 2: best............ 6.000000e-01 mean............ 5.335781e-01 variance........ 5.179974e-02 var 3: best............ -0.000000e+00 mean............ -1.980869e+00 variance........ 1.270631e+00 var 4: best............ -0.000000e+00 mean............ -1.982480e+00 variance........ 1.204300e+00 GENERATION: 1 Fitness value... -5.909967e+03 mean............ -6.008847e+03 variance........ 2.125842e+04 #unique......... 58, #Total UniqueCount: 158 var 1: best............ 2.820132e-01 mean............ 3.362869e-01 variance........ 3.198647e-02 var 2: best............ 5.871256e-01 mean............ 4.662973e-01 variance........ 6.761477e-02 var 3: best............ -1.463394e-01 mean............ -8.376994e-01 variance........ 6.333863e-01 var 4: best............ -1.372913e-02 mean............ -7.832451e-01 variance........ 3.991555e-01 GENERATION: 2 Fitness value... -5.908249e+03 mean............ -5.922936e+03 variance........ 2.232644e+03 #unique......... 70, #Total UniqueCount: 228 var 1: best............ 2.910925e-01 mean............ 3.076608e-01 variance........ 8.631241e-03 var 2: best............ 3.837691e-01 mean............ 5.855038e-01 variance........ 8.868941e-03 var 3: best............ -2.016831e-01 mean............ -1.526335e-01 variance........ 1.392833e-02 var 4: best............ -1.342662e-02 mean............ -1.270327e-01 variance........ 1.397955e-01 GENERATION: 3 Fitness value... -5.908123e+03 mean............ -5.933645e+03 variance........ 8.874073e+03 #unique......... 70, #Total UniqueCount: 298 var 1: best............ 2.913567e-01 mean............ 2.989516e-01 variance........ 3.632307e-03 var 2: best............ 3.838545e-01 mean............ 5.067217e-01 variance........ 1.073156e-02 var 3: best............ -2.342257e-01 mean............ -2.188100e-01 variance........ 1.262224e-01 var 4: best............ -3.252022e-02 mean............ -1.402457e-01 variance........ 1.842350e-01 GENERATION: 4 Fitness value... -5.907940e+03 mean............ -5.931249e+03 variance........ 8.737023e+03 #unique......... 72, #Total UniqueCount: 370 var 1: best............ 2.907849e-01 mean............ 2.952465e-01 variance........ 4.856191e-04 var 2: best............ 3.838545e-01 mean............ 4.040577e-01 variance........ 8.343920e-03 var 3: best............ -2.793723e-01 mean............ -3.377302e-01 variance........ 2.782687e-01 var 4: best............ -1.866717e-02 mean............ -8.493510e-02 variance........ 8.594147e-02 GENERATION: 5 Fitness value... -5.907940e+03 mean............ -5.932551e+03 variance........ 1.248701e+04 #unique......... 71, #Total UniqueCount: 441 var 1: best............ 2.907836e-01 mean............ 2.968347e-01 variance........ 1.578217e-03 var 2: best............ 3.838527e-01 mean............ 3.913217e-01 variance........ 2.296338e-03 var 3: best............ -2.793718e-01 mean............ -3.590458e-01 variance........ 1.803674e-01 var 4: best............ -1.866715e-02 mean............ -1.059354e-01 variance........ 1.982122e-01 GENERATION: 6 Fitness value... -5.907940e+03 mean............ -5.927423e+03 variance........ 6.798897e+03 #unique......... 67, #Total UniqueCount: 508 var 1: best............ 2.907843e-01 mean............ 2.959871e-01 variance........ 2.418476e-03 var 2: best............ 3.838536e-01 mean............ 3.832054e-01 variance........ 2.009262e-03 var 3: best............ -2.793720e-01 mean............ -3.222433e-01 variance........ 7.709038e-02 var 4: best............ -1.866716e-02 mean............ -1.177508e-01 variance........ 1.431557e-01 NOTE: HARD MAXIMUM GENERATION LIMIT HIT Solution Fitness Value: -5.907940e+03 Parameters at the Solution (parameter, gradient):  X[ 1] :        2.907843e-01    G[ 1] : 0.000000e+00  X[ 2] :        3.838536e-01    G[ 2] : 0.000000e+00  X[ 3] :        -2.793720e-01   G[ 3] : -1.323345e-05  X[ 4] :        -1.866716e-02   G[ 4] : 3.911049e-06 Solution Found Generation 4 Number of Generations Run 6 Mon May 15 18:13:19 2017 Total run time : 0 hours 0 minutes and 7 seconds Warning message: In genoud(obj, nvars, max = TRUE, pop.size = 100, max.generations = 6,  :   Stopped because hard maximum generation limit was hit. thanks. Meng-ke.