Home \ Evolutionary Algorithms \ Practical Genetic Algorithms in Python and MATLAB – Video Tutorial
Practical Genetic Algorithms in Python and MATLAB - Video Tutorial

Practical Genetic Algorithms in Python and MATLAB – Video Tutorial

What are Genetic Algorithms?

Genetic algorithms (GAs) are like nature-inspired computer programs that help find the best solutions to problems. They work by creating lots of possible solutions, like mixing and matching traits, just as animals do. Then, they pick the best ones and repeat the process, making each new generation even better. It’s like evolution in your computer, finding the fittest answer over time.

Genetic Algorithms are computational techniques used for optimization and problem-solving. They are inspired by the process of natural selection and genetic inheritance. GAs are considered as a subset of Evolutionary Algorithms. In Genetic Algorithms, potential solutions to a problem are represented as individuals in a population.

Through a process of selection, crossover (combining traits), and mutation (introducing variations), the algorithm evolves and refines these solutions over generations. By favoring the fittest individuals, genetic algorithms efficiently search for the best possible solution to a given problem in a way that mimics the principles of biological evolution.

Genetic Algorithms (GAs) are members of a general class of optimization algorithms, known as Evolutionary Algorithms (EAs), which simulate a fictional environment based on theory of evolution to deal with various types of mathematical problem, especially those related to optimization. Also Genetic Algorithms can be categorized as a subset of Metaheuristics, which are general-purpose tools and algorithms to solve optimization and unsupervised learning problems.

Why do we use GAs and why is it important to learn it?

Understanding Genetic Algorithms is crucial because they have a wide range of practical applications in our modern world. They are used in fields like Engineering, Finance, and Artificial Intelligence to find optimal solutions to complex problems.

For example, they can help design more efficient and aerodynamic vehicles, optimize investment portfolios, or even train Machine Learning models to make better predictions. Learning about genetic algorithms empowers individuals to tackle these realworld challenges by harnessing the principles of evolution and optimization to find smarter solutions faster.

About this Free Practical Genetic Algorithm Course

The ‘Practical Genetic Algorithm in Python and MATLAB’ course is prepared by Dr. Mostapha Kalami on Yarpiz. This course is your gateway to unlocking the exciting world of Genetic Algorithms without the jargon.

In the first part of the course, we break down the core theories and principles of genetic algorithms in simple terms, making it easy for anyone to grasp. No rocket science here!

As we dive into the second part, things get hands-on and practical. We roll up our sleeves and start implementing a basic genetic algorithm from scratch using MATLAB. Starting with Binary Genetic Algorithm, we build it up step by step. And here’s the cool part – we then take it a notch higher by introducing the ‘Real Coded Genetic Algorithm,’ where numbers are the name of the game.

But we’re not stopping there. In the third part of the course, we switch gears and implement the real coded GA using Python with VS Code. In both Python and MATLAB, we run the code we implemented, create nifty plots, and tweak parameters to have a better picture of how this algorithm behaves in the real world.

Join us on this free journey of discovery and become familiar with Genetic Algorithms, one practical step at a time!

What you will gain

At the end of this course, you will be fully familiar with concepts of evolutionary computation and will be able to implement genetic algorithms from scratch and also, utilize them to solve your own optimization problems. All source codes implemented within course and hand-written notes of the lectures, are available to download, in the downloads section of this very page. After finishing this course, you will be able to:

  • Gain a clear and practical understanding of genetic algorithms, demystifying complex concepts.
  • Develop hands-on skills to implement genetic algorithms from scratch in both MATLAB and Python.
  • Equip yourself with a powerful problem-solving tool that can be applied across various domains.
  • Learn how to implement both Binary and Real Coded Genetic Algorithms.
  • Learn the coding and parameter tuning of GAs, allowing you to become familiar with how to customize genetic algorithms for specific tasks.
  • Get ready to use Genetic Algorithms in practical applications, from optimization to machine learning.
  • Build confidence in your ability to tackle complex problems with genetic algorithms.
  • Enhance your skills and increase your value in fields like engineering, finance, data science, and more.
  • You can also receive a certificate of completion from Alison to showcase your newfound expertise.
  • By completing this course, you’ll be well-equipped to harness the power of genetic algorithms in various real-world scenarios.

Course Outline and Content

In this series of video tutorials, we are going to learn about Genetic Algorithms, from theory to implementation. After having a brief review of theories behind EA and GA, two main versions of genetic algorithms, namely Binary Genetic Algorithm and Real-coded Genetic Algorithm, are implemented from scratch and line-by-line, using both Python and MATLAB.

This course is instructed by Dr. Mostapha Kalami Heris, who has years of practical work and active teaching in the field of computational intelligence. The course outline and content is the following:

  • Introduction to Evolutionary Algorithms and Genetic Algorithms
  • Becoming familiar with the theories, concepts and steps behind GAs
  • Implementing Genetic Algorithms in MATLAB from scratch
    • Implementing Binary Genetic Algorithm in MATLAB from Scratch
    • Implementing Real Coded Genetic Algorithm in MATLAB from scratch
  • Implementing Real Coded Genetic Algorithm in Python from scratch
  • Running the codes, plotting and analyzing the results. Tweaking the parameters and variables to understand the code better and watch the behavior of the algorithm

Components of the genetic algorithms, such as initialization, parent selection, crossover, mutation, sorting and selection, are discussed in this tutorials, and backed by practical implementation. Theoretical concepts of these operators and components can be understood very well using this practical and hands-on approach.

This course includes:

  • Almost 4 hours on-demand video
  • Access on PC, mobile, tablet and TV on different platforms such as Yarpiz website, Youtube, Udemy and Alison
  • Downloadable resources
  • Certificate available on Alison


  • Basic Programming Skills: Participants should have a fundamental understanding of programming concepts, as the course involves implementing genetic algorithms in both MATLAB and Python.
  • Mathematics Background: A basic grasp of mathematics, including concepts such as algebra and statistics, will be beneficial for understanding the algorithms and their behavior.
  • MATLAB and Python Setup: Ensure access to the MATLAB software and Python, along with a code editor like VS Code, to follow along with the practical implementations.
  • Curiosity and Enthusiasm: An eagerness to learn and a curiosity about genetic algorithms and their applications are essential. No prior knowledge of genetic algorithms is required.
  • Computer and Internet Access: Participants should have access to a computer or laptop with a stable internet connection to access course materials and engage in coding exercises.
  • Dedication and Patience: Genetic algorithms can be intricate, so a willingness to work through problems and debug code is important.
  • No Age or Educational Background Restrictions: This course is open to learners of all ages and educational backgrounds, from beginners to experienced professionals.
  • Desire to Apply Learning: To get the most out of the course, participants should be interested in applying genetic algorithms to practical problem-solving scenarios.

Who can benefit from this course?

This course is designed to be accessible to a broad audience, from beginners to experienced professionals, making genetic algorithms approachable and practical for a wide range of learners.

  • Students: Both undergraduate and graduate students studying Computer Science, Engineering, Mathematics, or related fields can gain valuable insights into Genetic Algorithms.
  • Future Data Scientists: The people who want to become Data scientists and are interested in understanding and implementing Genetic Algorithms for data-driven tasks like feature selection, model tuning, and more.
  • Engineers: Engineers from various disciplines (mechanical, electrical, civil, etc.) seeking efficient solutions to complex design and optimization problems.
  • Researchers: Researchers in academia and industry exploring novel approaches to solving intricate problems across different domains.
  • Professionals in Finance: Finance professionals wanting to optimize investment portfolios and make data-driven decisions.
  • Artificial Intelligence Enthusiasts: Individuals interested in AI and machine learning who want to grasp the foundations of genetic algorithms.
  • Entrepreneurs and Startups: Innovators and entrepreneurs looking for creative solutions to business challenges and product optimization.
  • Math Enthusiasts: Mathematics enthusiasts intrigued by the intersection of mathematics and computational techniques for problem-solving.
  • Anyone Curious About Algorithms: Anyone with a curious mind eager to learn and apply algorithms to solve real-world problems

About the Instructor

Meet Dr. Mostapha Kalami Heris, your guide in the ‘Practical Genetic Algorithm in Python and MATLAB’ course. Dr. Kalami, born in 1983 in Heris, Iran, is a distinguished expert in the field of Control and Systems Engineering. His academic journey led him to earn a B.S. from Tabriz University in 2006, an M.S. from Ferdowsi University of Mashhad in 2008, and a PhD from Khaje Nasir Toosi University of Technology in 2013, all focused on Control and Systems Engineering.

Dr. Kalami is not just an instructor; he’s also a vital member of the Yarpiz Team, known for providing valuable academic source codes and tutorials. His passion extends to diverse areas, including computer programming, machine learning, artificial intelligence, meta-heuristics, and control engineering. With his wealth of knowledge and experience, Dr. Kalami is the ideal mentor to guide you through the fascinating world of genetic algorithms, making complex topics accessible and engaging for learners of all backgrounds.

Watch Online

The video tutorial is available to watch online, via Yarpiz YouTube Channel. The YouTube playlist, containing all parts of this series, follows.


The download link of this project follows.

Python and MATLAB Codes for Practical Genetic Algorithms


Citing This Work

If you wish, you can cite this content as follows.

Cite as:

Mostapha Kalami Heris, Practical Genetic Algorithms in Python and MATLAB – Video Tutorial (URL: https://yarpiz.com/632/ypga191215-practical-genetic-algorithms-in-python-and-matlab), Yarpiz, 2020.

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.


Check Also

Numerical Computations in MATLAB: Optimization

Optimization in MATLAB — Video Tutorial

In this video tutorial, “Optimization” has been reviewed and implemented using MATLAB. For watching full ...