Skip to content

Commit

Permalink
Rerun examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
vrettasm committed Feb 6, 2025
1 parent c639175 commit 7f2c19d
Show file tree
Hide file tree
Showing 12 changed files with 147 additions and 158 deletions.
16 changes: 8 additions & 8 deletions examples/binh_and_korn_multiobjective.ipynb

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions examples/easom_in_parallel.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@
"output_type": "stream",
"text": [
"Parallel evolution in progress with 4 islands ...\n",
"Final Avg. Fitness = 0.5522, Spread = 0.3457.\n",
"Elapsed time: 1.611 seconds.\n"
"Final Avg. Fitness = 0.5101, Spread = 0.3827.\n",
"Elapsed time: 2.800 seconds.\n"
]
}
],
Expand All @@ -184,10 +184,10 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Minimum Found: -0.99999\n",
"Minimum Found: -0.99997\n",
"\n",
"x0 = 3.13973\n",
"x1 = 3.14261\n"
"x0 = 3.14467\n",
"x1 = 3.14461\n"
]
}
],
Expand Down
6 changes: 3 additions & 3 deletions examples/one_max.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Initial Avg. Fitness = 25.1200.\n",
"Initial Avg. Fitness = 24.8500.\n",
"StandardGA finished in 28 iterations.\n",
"Final Avg. Fitness = 46.0600.\n",
"Elapsed time: 3.218 seconds.\n"
"Final Avg. Fitness = 45.3600.\n",
"Elapsed time: 3.122 seconds.\n"
]
}
],
Expand Down
28 changes: 14 additions & 14 deletions examples/osyczka_kundu_multiobjective.ipynb

Large diffs are not rendered by default.

27 changes: 14 additions & 13 deletions examples/queens_puzzle.ipynb

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions examples/rastrigin.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
"test_GA = StandardGA(initial_pop=population,\n",
" fit_func=fun_Rastrigin,\n",
" select_op=LinearRankSelector(),\n",
" mutate_op=MetaMutator(0.2),\n",
" mutate_op=MetaMutator(),\n",
" crossx_op=MetaCrossover())"
]
},
Expand All @@ -163,15 +163,15 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Initial Avg. Fitness = 93.8700.\n",
"StandardGA finished in 41 iterations.\n",
"Final Avg. Fitness = 196.5627.\n",
"Elapsed time: 0.875 seconds.\n"
"Initial Avg. Fitness = 95.2951.\n",
"StandardGA finished in 118 iterations.\n",
"Final Avg. Fitness = 199.3225.\n",
"Elapsed time: 2.723 seconds.\n"
]
}
],
"source": [
"test_GA(epochs=1000, elitism=True, f_tol=1.0e-8, verbose=False)"
"test_GA(epochs=1000, elitism=True, f_tol=1.0e-8, adapt_probs=True, verbose=False)"
]
},
{
Expand All @@ -183,13 +183,13 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Maximum Found: 201.76545\n",
"Maximum Found: 201.76470\n",
"\n",
"x0 = 4.524011\n",
"x1 = 4.524011\n",
"x2 = 4.524011\n",
"x3 = 4.524011\n",
"x4 = 4.524011\n"
"x0 = 4.521652\n",
"x1 = 4.521652\n",
"x2 = 4.521652\n",
"x3 = 4.521652\n",
"x4 = 4.521652\n"
]
}
],
Expand Down
20 changes: 10 additions & 10 deletions examples/rosenbrock_on_a_disk.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"\n",
"To do this we apply the [Penalty method](https://en.wikipedia.org/wiki/Penalty_method). Within this setting the global minimum is found at:\n",
"\n",
"$\\hat{f}(1.0, 1.0) = 0.0$."
"$\\hat{f}(1, 1) = 0$."
]
},
{
Expand Down Expand Up @@ -71,7 +71,7 @@
"from pygenalgo.operators.crossover.uniform_crossover import UniformCrossover\n",
"\n",
"# Import Mutation Operator(s).\n",
"from pygenalgo.operators.mutation.meta_mutator import MetaMutator"
"from pygenalgo.operators.mutation.random_mutator import RandomMutator"
]
},
{
Expand Down Expand Up @@ -152,7 +152,7 @@
"test_GA = StandardGA(initial_pop=population,\n",
" fit_func=fun_Rosenbrock,\n",
" select_op=LinearRankSelector(),\n",
" mutate_op=MetaMutator(),\n",
" mutate_op=RandomMutator(),\n",
" crossx_op=UniformCrossover())"
]
},
Expand All @@ -175,14 +175,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Initial Avg. Fitness = -158.2089.\n",
"Final Avg. Fitness = -11.4857.\n",
"Elapsed time: 39.965 seconds.\n"
"Initial Avg. Fitness = -208.3777.\n",
"Final Avg. Fitness = -36.0724.\n",
"Elapsed time: 64.357 seconds.\n"
]
}
],
"source": [
"test_GA(epochs=2000, elitism=True, adapt_probs=True)"
"test_GA(epochs=3000, elitism=True, adapt_probs=True)"
]
},
{
Expand All @@ -194,10 +194,10 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Minimum Found: 0.00002\n",
"Minimum Found: 0.00470\n",
"\n",
"x0 = 0.99601\n",
"x1 = 0.99210\n"
"x0 = 0.93147\n",
"x1 = 0.86748\n"
]
}
],
Expand Down
25 changes: 16 additions & 9 deletions examples/sphere.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
"M = 5\n",
"\n",
"# Define the number of chromosomes.\n",
"N = 200\n",
"N = 100\n",
"\n",
"# Sample the initial points randomly.\n",
"x0_init = np.random.uniform(-10.0, +10.0, size=(N, M))\n",
Expand Down Expand Up @@ -164,9 +164,9 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Initial Avg. Fitness = -166.7747.\n",
"Final Avg. Fitness = -0.2346.\n",
"Elapsed time: 36.765 seconds.\n"
"Initial Avg. Fitness = -165.1591.\n",
"Final Avg. Fitness = -0.3805.\n",
"Elapsed time: 10.840 seconds.\n"
]
}
],
Expand All @@ -185,11 +185,11 @@
"text": [
"Minimum Found: 0.00000\n",
"\n",
"x0 = -0.000280\n",
"x1 = 0.000301\n",
"x2 = -0.000044\n",
"x3 = 0.000606\n",
"x4 = -0.000084\n"
"x0 = 0.000008\n",
"x1 = 0.000312\n",
"x2 = 0.001160\n",
"x3 = 0.000193\n",
"x4 = 0.000395\n"
]
}
],
Expand Down Expand Up @@ -224,6 +224,13 @@
"source": [
"### End of file"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
54 changes: 27 additions & 27 deletions examples/sphere_in_parallel.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -174,36 +174,36 @@
"\n",
"Current period 1 / 10:\n",
"\n",
"Best Fitness in island 0 is:= -0.07980.\n",
"Best Fitness in island 1 is:= -0.00110.\n",
"Best Fitness in island 2 is:= -0.07571.\n",
"Best Fitness in island 3 is:= -0.11169.\n",
"Best Fitness in island 0 is:= -0.05178.\n",
"Best Fitness in island 1 is:= -0.02364.\n",
"Best Fitness in island 2 is:= -0.03107.\n",
"Best Fitness in island 3 is:= -0.07727.\n",
"\n",
"Current period 2 / 10:\n",
"\n",
"Best Fitness in island 0 is:= -0.00205.\n",
"Best Fitness in island 1 is:= -0.00006.\n",
"Best Fitness in island 2 is:= -0.00006.\n",
"Best Fitness in island 3 is:= -0.00111.\n",
"Best Fitness in island 0 is:= -0.00968.\n",
"Best Fitness in island 1 is:= -0.00455.\n",
"Best Fitness in island 2 is:= -0.00020.\n",
"Best Fitness in island 3 is:= -0.00003.\n",
"\n",
"Current period 3 / 10:\n",
"\n",
"Best Fitness in island 0 is:= -0.00045.\n",
"Best Fitness in island 1 is:= -0.00002.\n",
"Best Fitness in island 2 is:= -0.00000.\n",
"Best Fitness in island 3 is:= -0.00006.\n",
"Best Fitness in island 0 is:= -0.00019.\n",
"Best Fitness in island 1 is:= -0.00066.\n",
"Best Fitness in island 2 is:= -0.00001.\n",
"Best Fitness in island 3 is:= -0.00001.\n",
"\n",
"Current period 4 / 10:\n",
"\n",
"Best Fitness in island 0 is:= -0.00013.\n",
"Best Fitness in island 1 is:= -0.00000.\n",
"Best Fitness in island 0 is:= -0.00001.\n",
"Best Fitness in island 1 is:= -0.00004.\n",
"Best Fitness in island 2 is:= -0.00000.\n",
"Best Fitness in island 3 is:= -0.00001.\n",
"\n",
"Current period 5 / 10:\n",
"\n",
"Best Fitness in island 0 is:= -0.00000.\n",
"Best Fitness in island 1 is:= -0.00000.\n",
"Best Fitness in island 1 is:= -0.00001.\n",
"Best Fitness in island 2 is:= -0.00000.\n",
"Best Fitness in island 3 is:= -0.00000.\n",
"\n",
Expand Down Expand Up @@ -241,8 +241,8 @@
"Best Fitness in island 1 is:= -0.00000.\n",
"Best Fitness in island 2 is:= -0.00000.\n",
"Best Fitness in island 3 is:= -0.00000.\n",
"Final Avg. Fitness = -0.5472, Spread = 1.0713.\n",
"Elapsed time: 19.415 seconds.\n"
"Final Avg. Fitness = -0.4221, Spread = 1.1236.\n",
"Elapsed time: 20.221 seconds.\n"
]
}
],
Expand All @@ -261,16 +261,16 @@
"text": [
"Minimum Found: 0.00000\n",
"\n",
"x0 = -0.000051\n",
"x1 = -0.000051\n",
"x2 = -0.000051\n",
"x3 = -0.000051\n",
"x4 = -0.000051\n",
"x5 = -0.000051\n",
"x6 = -0.000051\n",
"x7 = -0.000051\n",
"x8 = -0.000051\n",
"x9 = -0.000051\n"
"x0 = -0.000562\n",
"x1 = -0.000562\n",
"x2 = 0.000429\n",
"x3 = -0.000562\n",
"x4 = 0.000429\n",
"x5 = -0.000562\n",
"x6 = -0.000562\n",
"x7 = 0.000429\n",
"x8 = 0.000429\n",
"x9 = -0.000562\n"
]
}
],
Expand Down
24 changes: 12 additions & 12 deletions examples/tanaka_multiobjective.ipynb

Large diffs are not rendered by default.

53 changes: 17 additions & 36 deletions examples/tsp.ipynb

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions examples/zakharov.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Initial Avg. Fitness = -587795.2911.\n",
"Final Avg. Fitness = -8731.2197.\n",
"Elapsed time: 20.294 seconds.\n"
"Initial Avg. Fitness = -399832.7223.\n",
"Final Avg. Fitness = -9415.2936.\n",
"Elapsed time: 25.728 seconds.\n"
]
}
],
Expand All @@ -188,13 +188,13 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Minimum Found: 0.00001\n",
"Minimum Found: 0.00000\n",
"\n",
"x1 = 0.000315\n",
"x2 = 0.000315\n",
"x3 = 0.000315\n",
"x4 = 0.000315\n",
"x5 = 0.000315\n"
"x1 = 0.000452\n",
"x2 = 0.000452\n",
"x3 = -0.001730\n",
"x4 = 0.000452\n",
"x5 = 0.000452\n"
]
}
],
Expand Down

0 comments on commit 7f2c19d

Please sign in to comment.