Mya  Lynch

Mya Lynch

1598768100

Optimising a Rubbish Collection Strategy with Genetic Algorithms

Genetic Algorithms are a family of optimisation techniques that loosely resemble evolutionary processes in nature. It may be a crude analogy, but if you squint your eyes, Darwin’s Natural Selection does roughly resemble an optimisation task where the aim is to craft organisms perfectly suited to thrive in their environments. While it may have taken many millennia for humans to develop opposable thumbs and eagles to develop 20/4 vision, in this article I will show how to implement a Genetic Algorithm in Python for “evolving” a rubbish collecting robot in a couple of hours.

Background

The best example I’ve come across to demonstrate how Genetic Algorithms work comes from a fantastic book on complex systems by Melanie Mitchell called “Complexity: A Guided Tour” (highly recommended). In one chapter, Mitchell introduces a robot named Robby whose sole purpose in life is to pick up rubbish and describes how to optimise a control strategy for Robby using a GA. Below I will explain my approach to solving this problem and show how to implement the algorithm in Python. There are some great packages for constructing these kinds of algorithms (such as DEAP) but in this tutorial, I will only be using base Python, Numpy and TQDM (optional).

While this is only a toy example, GAs are used in a number of real-world applications. As a data scientist, I most often use them for hyper-parameter optimisation and model choice. While they can be computationally expensive, GAs allow us to explore multiple areas of a search space in parallel and are a good option when computing a gradient is difficult.

Problem Description

A robot named Robby lives in a two-dimensional grid world full of rubbish and surrounded by 4 walls (shown below). The aim of this project is to evolve an optimal control strategy for Robby that will allow him to pick up rubbish efficiently and not crash into walls.

#python #data-science #genetic-algorithm #evolutionary-algorithms

What is GEEK

Buddha Community

Optimising a Rubbish Collection Strategy with Genetic Algorithms
Mya  Lynch

Mya Lynch

1598768100

Optimising a Rubbish Collection Strategy with Genetic Algorithms

Genetic Algorithms are a family of optimisation techniques that loosely resemble evolutionary processes in nature. It may be a crude analogy, but if you squint your eyes, Darwin’s Natural Selection does roughly resemble an optimisation task where the aim is to craft organisms perfectly suited to thrive in their environments. While it may have taken many millennia for humans to develop opposable thumbs and eagles to develop 20/4 vision, in this article I will show how to implement a Genetic Algorithm in Python for “evolving” a rubbish collecting robot in a couple of hours.

Background

The best example I’ve come across to demonstrate how Genetic Algorithms work comes from a fantastic book on complex systems by Melanie Mitchell called “Complexity: A Guided Tour” (highly recommended). In one chapter, Mitchell introduces a robot named Robby whose sole purpose in life is to pick up rubbish and describes how to optimise a control strategy for Robby using a GA. Below I will explain my approach to solving this problem and show how to implement the algorithm in Python. There are some great packages for constructing these kinds of algorithms (such as DEAP) but in this tutorial, I will only be using base Python, Numpy and TQDM (optional).

While this is only a toy example, GAs are used in a number of real-world applications. As a data scientist, I most often use them for hyper-parameter optimisation and model choice. While they can be computationally expensive, GAs allow us to explore multiple areas of a search space in parallel and are a good option when computing a gradient is difficult.

Problem Description

A robot named Robby lives in a two-dimensional grid world full of rubbish and surrounded by 4 walls (shown below). The aim of this project is to evolve an optimal control strategy for Robby that will allow him to pick up rubbish efficiently and not crash into walls.

#python #data-science #genetic-algorithm #evolutionary-algorithms

Joseph  Murray

Joseph Murray

1621559580

Collection vs Collections in Java: Difference Between Collection & Collections in Java

Introduction

This article will be looking into one of the most popular questions in Java Language – What is Collection in Java? Also, what do you mean by Collections in Java? Are Collection and Collections the same or different in Java?

What is Collection?

What is Collections?

Conclusion

#full stack development #collection #collection vs collections in java #collections in java #difference between collection and collections in java

Lina  Biyinzika

Lina Biyinzika

1626429780

Introduction to Genetic Algorithm

What is Optimization?

  • Making something better.
  • Increase efficiency.

Optimization problem

  • A problem in which we have to find the values of inputs (also called solutions or decision variables) from all possible inputs in such a way that we get the “best” output values.
  • Definition of “best”- Finding the values of inputs that result in a maximum or minimum of a function called the objective function.
  • There can be multiple objective functions as well (depends on the problem).

Optimization algorithm

An algorithm used to solve an optimization problem is called an optimization algorithm.

Evolutionary Algorithms

Algorithms that simulate physical and/or biological behavior in nature to solve optimization problems.

Genetic Algorithm (GA)

  • It is a subset of evolutionary algorithms that simulates/models Genetics and Evolution (biological behavior) to optimize a highly complex function.
  • A highly complex function can be:
  • 1. Very difficult to model mathematically.
  • 2. Computationally expensive to solve. Eg. NP-hard problems.
  • 3. Involves a large number of parameters.

Background of GA

  • Introduced by Prof. John Holland in 1965.
  • The first article on GA was published in 1975.
  • GA is based on two fundamental biological processes:
  • 1. Genetics (by G.J. Mendel in 1865): It is the branch of biology that deals with the study of genes, gene variation, and heredity.
  • 2. Evolution (by C. Darwin in 1875): It is the process by which the population of organisms changes over generations.

Natural selection in Evolution

  1. A population of individuals exists in an environment with limited resources.
  2. Competition for those resources causes the selection of those fitter individuals that are better adapted to the environment.
  3. These individuals act as seeds for the generation of new individuals through recombination and mutation.
  4. Evolved new individuals act as initial population and Steps 1 to 3 are repeated.

Nature-GA Analogy

Structure of GA

GA vs Traditional Algorithms

Applications of GA

  • 1. Acoustics
  • 2. Aerospace Engineering
  • 3. Financial Markets
  • 4. Geophysics
  • 5. Materials Engineering
  • 6. Routing and Scheduling
  • 7. Systems Engineering

Problems with GA

  • 1. Population Selection Problem
  • 2. Defining Fitness Function
  • 3. Premature or rapid convergence of GA
  • 4. Convergence to Local Optima

#evolutionary-algorithms #data-science #genetic-algorithm #algorithm

Genetic Algorithm (GA): A Simple and Intuitive Guide

Learn what are metaheuristics and why we use them sometimes instead of traditional optimization algorithms. Learn the metaheuristic Genetic Algorithm (GA) and how it works through a simple step by step guide.

#genetic-algorithm #algorithms #optimization #metaheuristics #data-science #algorithms

Beth  Nabimanya

Beth Nabimanya

1624882500

A Guide to Genetic ‘Learning’ Algorithms for Optimization

In a broader mathematical or computational perspective, an optimization problem is defined as a problem of finding the best solution from all feasible solutions. In terms of Machine Learning and Artificial Intelligence, two significant algorithms that perform these tasks are Reinforcement Learning and Genetic Algorithms. They serve the purpose of finding the ‘best fit’ solutions from a range of possible solutions for a given problem statement. In the article that follows below, we will be working closely on these algorithms and will see their implementation in action on an Image Processing problem.

What is a Genetic Algorithm (GA)?

Genetic algorithms are random, adaptive heuristic search algorithms that act on a population of doable solutions. they need loosely supported the mechanics of population biology and choice.

Genetic algorithms are based on the ideas of natural selection and genetics. New solutions are typically made by ‘mutating’ members of this population, and by ‘mating’ 2 resolutions along to create a replacement solution.

The upper solutions are selected to breed and change and so the more severe ones are discarded. They are probabilistic search methods; this implies that the states that they explore are not determined entirely by the properties of the problems. A random method helps to guide the search. Genetic algorithms are utilized in AI like different search algorithms utilized in AI — to seem for potential solutions to hunt out one that solves the matter.

#artificial-intelligence #genetics #algorithms #data-science #genetic ‘learning’ algorithms