Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to main content

How Evolutionary Algorithms Consume Energy Depending on the Language and Its Level

  • Conference paper
  • First Online:
Learning and Intelligent Optimization (LION 2024)

Abstract

Making evolutionary algorithms greener implies tackling implementation issues from different angles. Practitioners need to focus on those that can be more easily leveraged, such as the choice of the language that is going to be used; high-level (interpreted), mid-level (based on multi-platform virtual machines), and low-level (native) languages will need power in different ways, and choosing one or the other will have an impact on energy consumption. We will be looking at the implementation of key evolutionary algorithm functions, in three languages at three different levels: the high-level JavaScript, the mid-level Kotlin, which runs on the Java Virtual Machine, and the low-level Zig. Looking beyond the obvious, as the lower the level, the less energy consumption should be expected, we will try to have a more holistic view of the implementation of the algorithms in order to extract best practices regarding its green implementation.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 64.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 79.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Data Availability Statement

The source of this paper as well as the data and whole writing history is available from https://github.com/JJ/energy-ga-icsoft-2023 under a GPL license.

Notes

  1. 1.

    Described in https://www.un.org/millenniumgoals/bkgd.shtml, for instance.

  2. 2.

    Please note that there are no languages that are considered low-level and interpreted, although there are minimalist interpreted languages like Lua [9].

  3. 3.

    Which, for the purposes of this paper, is considered mid-level, since it compiles to bytecode.

  4. 4.

    Please note that at the time of writing this, many other versions have been published; we have used this one to be able to compare with previous papers. These same papers show that its performance and energy consumption have important improvements, so in case of close calls, we would recommend retaking measurements at the time of running your experiments.

  5. 5.

    We are not saying here that it is not an energy-consuming operation, even more so here where we are generating all chromosomes we are using in a single loop; however, while the initial population is generated only once in an EA, every other operation used here is going to be repeated every generation; thus, in terms of either time of energy consumption, the proportion employed by chromosome generation will be one vs. number of generations needed to find the solution.

  6. 6.

    zig will greatly vary the amount of energy needed depending on relatively irrelevant choices such as using constant or mutable pointers; in a previous experiment run, included in the repository, that used mutable pointers, energy consumption was almost 10% higher.

References

  1. Abdelhafez, A., Alba, E., Luque, G.: A component-based study of energy consumption for sequential and parallel genetic algorithms. J. Supercomput. 75(10), 6194–6219 (2019). https://doi.org/10.1007/s11227-019-02843-4

    Article  MATH  Google Scholar 

  2. Connolly Bree, D., Ó Cinnéide, M.: Energy efficiency of the visitor pattern: contrasting Java and C++ implementations. Empirical Softw. Eng. 28(6), 145 (2023)

    Google Scholar 

  3. Corne, D., Lones, M.A.: Evolutionary Algorithms, pp. 1–22. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-07153-4_27-1

  4. Díaz-Álvarez, J., Castillo, P.A., Fernandez de Vega, F., Chávez, F., Alvarado, J.: Population size influence on the energy consumption of genetic programming. Meas. Control 55(1-2), 102–115 (2022)

    Google Scholar 

  5. Fortin, F.A., De Rainville, F.M., Gardner, M.A.G., Parizeau, M., Gagné, C.: DEAP: evolutionary algorithms made easy. J. Mach. Learn. Res. 13(1), 2171–2175 (2012)

    MathSciNet  MATH  Google Scholar 

  6. Garg, K., Jindal, C., Kumar, S., Juneja, S.: Analyzing and rating greenness of nature-inspired algorithms. In: 6th International Conference on Innovative Computing and Communication (ICICC 2023) (2023)

    Google Scholar 

  7. Hidalgo, I., et al.: Sustainable artificial intelligence systems: an energy efficiency approach (2023)

    Google Scholar 

  8. Holló-Szabó, Á., Albert, I., Botzheim, J.: Statistical racing crossover based genetic algorithm for vehicle routing problem. In: 2021 IEEE 21st International Symposium on Computational Intelligence and Informatics (CINTI), pp. 000267–000272. IEEE (2021)

    Google Scholar 

  9. Ierusalimschy, R., de Figueiredo, L.H., Celes, W.: The evolution of Lua. In: Proceedings of the Third ACM SIGPLAN Conference on History of Programming Languages, p. 2-1 (2007)

    Google Scholar 

  10. Köhler, S., et al.: Pinpoint the Joules: unifying runtime-support for energy measurements on heterogeneous systems. In: 2020 IEEE/ACM International Workshop on Runtime and Operating Systems for Supercomputers (ROSS), pp. 31–40 (2020). https://doi.org/10.1109/ROSS51935.2020.00009

  11. Lannelongue, L., et al.: Greener principles for environmentally sustainable computational science. Nat. Comput. Sci. 3(6), 514–521 (2023)

    Article  MATH  Google Scholar 

  12. Lima, L.G., Soares-Neto, F., Lieuthier, P., Castor, F., Melfe, G., Fernandes, J.P.: Haskell in green land: analyzing the energy behavior of a purely functional language. In: 2016 IEEE 23rd International Conference on Software Analysis, Evolution, and Reengineering (SANER), vol. 1, pp. 517–528. IEEE (2016)

    Google Scholar 

  13. Merelo-Guervós, J.J., et al.: Ranking the performance of compiled and interpreted languages in genetic algorithms. In: Proceedings of the International Conference on Evolutionary Computation Theory and Applications, Porto, Portugal, vol. 11, pp. 164–170 (2016)

    Google Scholar 

  14. Merelo-Guervós, J.-J., et al.: Ranking programming languages for evolutionary algorithm operations. In: Squillero, G., Sim, K. (eds.) EvoApplications 2017. LNCS, vol. 10199, pp. 689–704. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-55849-3_44

    Chapter  MATH  Google Scholar 

  15. Merelo-Guervós, J.J., García-Valdez, M., Castillo, P.A.: An analysis of energy consumption of JavaScript interpreters with evolutionary algorithm workloads. In: Fill, H., Mayo, F.J.D., van Sinderen, M., Maciaszek, L.A. (eds.) Proceedings of the 18th International Conference on Software Technologies, ICSOFT 2023, Rome, Italy, 10–12 July 2023, pp. 175–184. SCITEPRESS (2023). https://doi.org/10.5220/0012128100003538

  16. Merelo, J.J., Romero, G., Arenas, M.G., Castillo, P.A., Mora, A.M., Laredo, J.L.J.: Implementation matters: programming best practices for evolutionary algorithms. In: Cabestany, J., Rojas, I., Joya, G. (eds.) IWANN 2011. LNCS, vol. 6692, pp. 333–340. Springer, Heidelberg (2011). https://doi.org/10.1007/978-3-642-21498-1_42

    Chapter  MATH  Google Scholar 

  17. Pereira, R., et al.: Ranking programming languages by energy efficiency. Sci. Comput. Program. 205, 102609 (2021)

    Google Scholar 

  18. Pinto, G., Castor, F.: Energy efficiency: a new concern for application software developers. Commun. ACM 60(12), 68–75 (2017)

    Article  MATH  Google Scholar 

  19. Theis, T.N., Wong, H.S.P.: The end of Moore’s Law: a new beginning for information technology. Comput. Sci. Eng. 19(2), 41–50 (2017)

    Article  MATH  Google Scholar 

  20. de Vega, F.F., et al.: A cross-platform assessment of energy consumption in evolutionary algorithms. In: Handl, J., Hart, E., Lewis, P.R., López-Ibáñez, M., Ochoa, G., Paechter, B. (eds.) PPSN 2016. LNCS, vol. 9921, pp. 548–557. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-45823-6_51

    Chapter  MATH  Google Scholar 

  21. Watson, R.A., Hornby, G.S., Pollack, J.B.: Modeling building-block interdependency. In: Eiben, A.E., Bäck, T., Schoenauer, M., Schwefel, H.-P. (eds.) PPSN 1998. LNCS, vol. 1498, pp. 97–106. Springer, Heidelberg (1998). https://doi.org/10.1007/BFb0056853

    Chapter  Google Scholar 

Download references

Acknowledgements

This work is supported by the Ministerio español de Economía y Competitividad (Spanish Ministry of Competitivity and Economy) under project PID2020-115570GB-C22 (DemocratAI::UGR).

We are also very grateful to the zig community, withouts which programming these operations in that language would have been impossible.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Juan J. Merelo-Guervós .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2025 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Merelo-Guervós, J.J., García-Valdez, M. (2025). How Evolutionary Algorithms Consume Energy Depending on the Language and Its Level. In: Festa, P., Ferone, D., Pastore, T., Pisacane, O. (eds) Learning and Intelligent Optimization. LION 2024. Lecture Notes in Computer Science, vol 14990. Springer, Cham. https://doi.org/10.1007/978-3-031-75623-8_20

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-75623-8_20

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-75622-1

  • Online ISBN: 978-3-031-75623-8

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics