Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4ad007e

Browse files
authored
Add files via upload
1 parent158e53c commit4ad007e

File tree

1 file changed

+60
-3
lines changed

1 file changed

+60
-3
lines changed

‎docs/source/Footer.rst

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ Release Date: 28 September 2021
845845
``save_solutions=True``.
846846

847847
2. The user can use the ``tqdm`` library to show a progress bar.
848-
https://github.com/ahmedfgad/GeneticAlgorithmPython/discussions/50
848+
https://github.com/ahmedfgad/GeneticAlgorithmPython/discussions/50.
849849

850850
..code::python
851851
@@ -874,6 +874,50 @@ Release Date: 28 September 2021
874874
875875
ga_instance.plot_result()
876876
877+
But this work does not work if the ``ga_instance`` will be pickled (i.e.
878+
the ``save()`` method will be called.
879+
880+
..code::python
881+
882+
ga_instance.save("test")
883+
884+
To solve this issue, define a function and pass it to the
885+
``on_generation`` parameter. In the next code, the
886+
``on_generation_progress()`` function is defined which updates the
887+
progress bar.
888+
889+
..code::python
890+
891+
import pygad
892+
import numpy
893+
import tqdm
894+
895+
equation_inputs= [4,-2,3.5]
896+
desired_output=44
897+
898+
deffitness_func(solution,solution_idx):
899+
output= numpy.sum(solution* equation_inputs)
900+
fitness=1.0/ (numpy.abs(output- desired_output)+0.000001)
901+
return fitness
902+
903+
defon_generation_progress(ga):
904+
pbar.update(1)
905+
906+
num_generations=100
907+
with tqdm.tqdm(total=num_generations)as pbar:
908+
ga_instance= pygad.GA(num_generations=num_generations,
909+
sol_per_pop=5,
910+
num_parents_mating=2,
911+
num_genes=len(equation_inputs),
912+
fitness_func=fitness_func,
913+
on_generation=on_generation_progress)
914+
915+
ga_instance.run()
916+
917+
ga_instance.plot_result()
918+
919+
ga_instance.save("test")
920+
877921
1. Solved the issue of unequal length between the ``solutions`` and
878922
``solutions_fitness`` when the ``save_solutions`` parameter is set to
879923
``True``. Now, the fitness of the last population is appended to the
@@ -1366,8 +1410,8 @@ A number of research papers used PyGAD and here are some of them:
13661410
- Jaros, Marta, and Jiri Jaros. "Performance-Cost Optimization of
13671411
Moldable Scientific Workflows."
13681412

1369-
- Thorat, Divya.*Enhanced genetic algorithm to reduce makespan of
1370-
multiple jobs in map-reduce application on serverless platform*.
1413+
- Thorat, Divya."Enhanced genetic algorithm to reduce makespan of
1414+
multiple jobs in map-reduce application on serverless platform".
13711415
Diss. Dublin, National College of Ireland, 2020.
13721416

13731417
- Koch, Chris, and Edgar Dobriban. "AttenGen: Generating Live
@@ -1389,6 +1433,19 @@ A number of research papers used PyGAD and here are some of them:
13891433
Long Short-Term Memory Network for Long-Term Load Forecasting." *IEEE
13901434
Access* 9 (2021): 68511-68522.
13911435

1436+
- Antunes, E. D. O., Caetano, M. F., Marotta, M. A., Araujo, A.,
1437+
Bondan, L., Meneguette, R. I., & Rocha Filho, G. P. (2021, August).
1438+
Soluções Otimizadas para o Problema de Localização de Máxima
1439+
Cobertura em Redes Militarizadas 4G/LTE. In *Anais do XXVI Workshop
1440+
de Gerência e Operação de Redes e Serviços* (pp. 152-165). SBC.
1441+
1442+
More Links
1443+
==========
1444+
1445+
https://rodriguezanton.com/identifying-contact-states-for-2d-objects-using-pygad-and/
1446+
1447+
https://torvaney.github.io/projects/t9-optimised
1448+
13921449
For More Information
13931450
====================
13941451

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp