SlideShare a Scribd company logo
1 of 43
Download to read offline
How to easily find the optimal solution
without exhaustive search
using Genetic Algorithms
Viacheslav Kakovskyi — Kyiv.py #16
1
Me!
@kakovskyi
Python Developer at SoftServe
Recent projects:
● Backend for instant messenger
● Backend for embedded system for traffic analysis
● Software for personal nutrition planning
2
Agenda
● Cases from my experience
● Terminology
● Genetic Algorithms by example
● Theoretical background
● Genetic Algorithms in Python
● Pros and cons
● Tasks from real life
● Summary
● Further reading
3
Software for personal nutrition planning
● Find a set of suboptimal personal nutrition plans
● Minimize difference between required macronutrients and energetic value for
suggested plan
● Genetic Algorithms used for generation of daily meals
● The problem is similar to Knapsack problem
4
Embedded system for traffic analysis (R&D)
5
Data from camera (LPR), 2D Data from radar, 2D
Embedded system for traffic analysis (R&D)
● Find suboptimal transition matrix (4x4)
● Challenge: surface relief
● Maximize intersection of data from LPR and converted data from radar
● Tried to use Genetic Algorithms for parametric optimization
6
Math party
● Function - a rule
● Domain - a set of possible input values of a function
● Codomain - a set of possible output values of a function
● Extremum - maximum or minimum of a function for a given domain
● Local extremum - an extremum of some neighbourhood of domain
● Global extremum - an extremum of all domain
7
Genetics party
● Genotype - a set of genes of an instance
● Phenotype - a set of features of an instance
● Fitness-function - a function which describes adaptability of an instance
● Generation defines a lifetime of instances
● Population - a set of all instances which exist in the same area
8
Genetics party
● Selection - a stage of GA when instances are chosen from a population for
later breeding
● Crossover - an operator used to vary chromosomes from one generation to
the next
● Mutation - an operator used to maintain genetic diversity from one generation
of a population to the next
9
Genetic Algorithms by example
● Problem: find a solution of a linear Diophantine equation
● The equation: 1027x + 712y = 1
● D(x) = [-1 500; 1 500]
● D(y) = [-1 500; 1 500]
Analytical solution:
● http://mathworld.wolfram.com/DiophantineEquation.html
● http://math.stackexchange.com/a/20727
10
Genetic Algorithms by example
● Problem type: minimization
● F(x,y) = |1027x+ 712y - 1|
● lambda x, y: abs(1027 * x + 712 * y - 1)
● IND_SIZE = 4
● NGEN = 100
● Initial population:
(-432, 325) -> 212265
(48, 1217) -> 915799
(-660, 1473) -> 370955
(22, 786) -> 582225
11
Selection
● Ordering: 212265, 370955, 582225, 915799
● (48, 1217) -> 915799 is the worst adapted
12
Crossover
13
Crossover
14
Mutation
15
● Add a random integer from the range [-10, 10]
● MUTPB = 0.25
Mutation
16
● Add a random integer from the range [-10, 10]
● MUTPB = 0.25
Selection 2
17
Selection 2
18
Last generation
19
Flowchart
20
Complexity
● IND_SIZE - size of population
● NGEN - number of generations
● CXPB - crossover probability
● MUTPB - mutation probability
Complexity ≈ IND_SIZE * NGEN * O(Fitness) * O(Selection) *
(CXPB * O(Crossover) + MUTPB * O(Mutation))
21
Guidelines
● Define your fitness-function
● Choose the problem type
● Define the domain and NGEN
● Define how the initial population should be chosen and IND_SIZE
● Define the type of selection
● Define the type of crossover
● Define the type of mutation and MUTPB
● Try it!
● Define heuristics if needed
22
Genetic Algorithms in Python
● DEAP
● Pyevolve
● PyBrain
● pygene
● pyeasyga
● pyneurgen
● pyislands
● inspyred
● tinyevolver
23
DEAP: Distributed Evolutionary Algorithms in Python
● Batteries included
● Parallelization
● Genetic Programming
● Works on Python 2, Python 3 and PyPy
● Lots of scientific projects already use it
24
DEAP by example
● Problem: find a solution of a linear Diophantine equation.
● The equation: 1027x+ 712y = 1
● D(x) = [-1 500; 1 500]
● D(y) = [-1 500; 1 500]
25
DEAP by example
"""
The equation: 1027 * x + 712 * y = 1
D(x) = [-1 500; 1 500]
D(y) = [-1 500; 1 500]
"""
import random
import operator
from deap import tools, base, creator, algorithms
MIN, MAX = -1500, 1500
SOLUTION = [-165, 238]
VARIABLES = len(SOLUTION)
MUT_MIN, MUT_MAX = -10, 10
NGEN, IND_SIZE, CXPB, MUTPB, TRN_SIZE = 100, 50, 0.5, 0.25, 100
HALL_SIZE = 10
DEFAULT_MAIN_ARGS = NGEN, IND_SIZE, CXPB, MUTPB
BEST_INSTANCE_MSG = 'Best instance:'
NO_SOLUTION_MSG = 'No solution in integers. Distance is:'
26
def fitness(instance):
x, y = instance
return abs(1027 * x + 712 * y - 1),
def spawn_instance():
return random.randint(MIN, MAX), random.randint(MIN, MAX)
def mutate(instance, mutpb):
if random.random() <= mutpb:
index = random.randint(0, len(instance) - 1)
instance[index] += random.randint(MUT_MIN, MUT_MAX)
return instance,
return instance,
def get_best_result(population):
if isinstance(population[0], list):
fitness_values = list(map(fitness, population))
index = fitness_values.index(min(fitness_values))
return population[index]
else:
return min(population, key=operator.attrgetter('fitness'))
DEAP by example
def terminate(population):
if fitness(get_best_result(population)) == (0, ):
raise StopIteration
return False
def distance_from_best_result(population):
result = get_best_result(population)
return fitness(result)[0]
def output(best_instance):
print(BEST_INSTANCE_MSG, best_instance)
distance = fitness(best_instance)
if distance:
print(NO_SOLUTION_MSG, distance)
27
def setup(mutpb):
creator.create("FitnessMin", base.Fitness, weights=(-1,))
creator.create("Individual", list, fitness=creator.FitnessMin)
toolbox = base.Toolbox()
toolbox.register("attribute", random.randint, MIN, MAX)
toolbox.register("individual", tools.initRepeat, creator.Individual,
toolbox.attribute, n=VARIABLES)
toolbox.register("population", tools.initRepeat, list, toolbox.individual)
toolbox.register("mate", tools.cxOnePoint)
toolbox.register("mutate", mutate, mutpb=mutpb)
toolbox.register("select", tools.selBest)
toolbox.register("evaluate", fitness)
return toolbox
DEAP by example
def main(ngen, ind_size, cxpb, mutpb):
toolbox = setup(ind_size)
population = toolbox.population(n=ind_size)
stats = tools.Statistics()
stats.register("best_instance_of_population", get_best_result)
stats.register("distance", distance_from_best_result)
stats.register("terminate", terminate)
halloffame = tools.HallOfFame(HALL_SIZE)
try:
algorithms.eaSimple(population, toolbox, cxpb, mutpb, ngen,
stats=stats, halloffame=halloffame)
except StopIteration:
pass
finally:
best_instance = halloffame[0]
output(best_instance)
return best_instance
if __name__ == '__main__':
main(*DEFAULT_MAIN_ARGS)
28
github.com/viachk/ga-example-diophantine
Crossover types
29
● cxOnePoint
● cxTwoPoint
● cxUniform
● cxPartialyMatched
● cxUniformPartialyMatched
● cxOrdered
● cxBlend
● cxESBlend
● cxESTwoPoint
● cxSimulatedBinary
● cxSimulatedBinaryBounded
● cxMessyOnePoint
Mutation types
● mutGaussian
● mutShuffleIndexes
● mutFlipBit
● mutPolynomialBounded
● mutUniformInt
● mutESLogNormal
30
Selection types
● selTournament
● selRoulette
● selNSGA2
● selSPEA2
● selRandom
● selBest
● selWorst
● selTournamentDCD
● selDoubleTournament
31
Pros of Genetic Algorithms
● easy in use
● lots lots of options for heuristics
● can solve majority of problems (somehow)
32
Cons of Genetic Algorithms
33
Local vs Global extrema
34
Cons of Genetic Algorithms
● can't find the optimal solution
● terminates after the first local extremum
● computationally expensive
35
Right tasks for Genetic Algorithms
● parametric optimization
● NP-complete problems
● machine learning
● bioinformatics
● when you need to design a prototype, looks like a proper solution for a
hackaton
https://en.wikipedia.org/wiki/List_of_genetic_algorithm_applications (78 items)
36
Wrong tasks for Genetic Algorithms
● real-time processing
● an accurate method of solving the problem already exists
● huge amount of local extrema
37
Summaries about Genetic Algorithms
● easy to start
● stochastic
● have lots of options for heuristics
● but the task should be formalized
● we have batteries for them in Python
● applicable in variety of real-life tasks
● terminate after the first local extremum
● computationally expensive
● for 99% of tasks find suboptimal solution
38
Next steps
● Video: Genetic Algorithms by example (Eng)
● Video: Genetic Algorithms by example (Ru)
● Video: MIT AI class - Genetic Algorithms (Eng)
● Video: Kyiv AI 2012 - Evolutionary Algorithms (Ru)
● Video: Implementation of Genetic Algorithms (Ru)
● Video: A Framework for Genetic Algorithms Based on Hadoop (Eng)
39
Next steps
● Pretty awesome book about Genetic Algorithms by Panchenko (Ru)
● Articles about Genetic Algorithms (Ru)
● Q&A about Genetic Algorithms (Ru)
● A Framework for Genetic Algorithms Based on Hadoop (Eng)
40
Next steps
Try DEAP
41
Thank you!
42
Viacheslav Kakovskyi
viach.kakovskyi@gmail.com
@kakovskyi
Evolved antenna
43

More Related Content

What's hot

Property-based Testing and Generators (Lua)
Property-based Testing and Generators (Lua)Property-based Testing and Generators (Lua)
Property-based Testing and Generators (Lua)Sumant Tambe
 
PythonBrasil[8] - CPython for dummies
PythonBrasil[8] - CPython for dummiesPythonBrasil[8] - CPython for dummies
PythonBrasil[8] - CPython for dummiesTatiana Al-Chueyr
 
Gelly in Apache Flink Bay Area Meetup
Gelly in Apache Flink Bay Area MeetupGelly in Apache Flink Bay Area Meetup
Gelly in Apache Flink Bay Area MeetupVasia Kalavri
 
Vasia Kalavri – Training: Gelly School
Vasia Kalavri – Training: Gelly School Vasia Kalavri – Training: Gelly School
Vasia Kalavri – Training: Gelly School Flink Forward
 
Michael Häusler – Everyday flink
Michael Häusler – Everyday flinkMichael Häusler – Everyday flink
Michael Häusler – Everyday flinkFlink Forward
 
Sebastian Schelter – Distributed Machine Learing with the Samsara DSL
Sebastian Schelter – Distributed Machine Learing with the Samsara DSLSebastian Schelter – Distributed Machine Learing with the Samsara DSL
Sebastian Schelter – Distributed Machine Learing with the Samsara DSLFlink Forward
 
2015 TaPP - Interoperability for Provenance-aware Databases using PROV and JSON
2015 TaPP - Interoperability for Provenance-aware Databases using PROV and JSON2015 TaPP - Interoperability for Provenance-aware Databases using PROV and JSON
2015 TaPP - Interoperability for Provenance-aware Databases using PROV and JSONBoris Glavic
 
FastR+Apache Flink
FastR+Apache FlinkFastR+Apache Flink
FastR+Apache FlinkJuan Fumero
 
Apache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-On
Apache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-OnApache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-On
Apache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-OnApache Flink Taiwan User Group
 
Apache Flink internals
Apache Flink internalsApache Flink internals
Apache Flink internalsKostas Tzoumas
 
Machine Learning with Apache Flink at Stockholm Machine Learning Group
Machine Learning with Apache Flink at Stockholm Machine Learning GroupMachine Learning with Apache Flink at Stockholm Machine Learning Group
Machine Learning with Apache Flink at Stockholm Machine Learning GroupTill Rohrmann
 
Why you should be using structured logs
Why you should be using structured logsWhy you should be using structured logs
Why you should be using structured logsStefan Krawczyk
 
Apache Flink Deep Dive
Apache Flink Deep DiveApache Flink Deep Dive
Apache Flink Deep DiveVasia Kalavri
 
Flink Batch Processing and Iterations
Flink Batch Processing and IterationsFlink Batch Processing and Iterations
Flink Batch Processing and IterationsSameer Wadkar
 
Ufuc Celebi – Stream & Batch Processing in one System
Ufuc Celebi – Stream & Batch Processing in one SystemUfuc Celebi – Stream & Batch Processing in one System
Ufuc Celebi – Stream & Batch Processing in one SystemFlink Forward
 
Chris Hillman – Beyond Mapreduce Scientific Data Processing in Real-time
Chris Hillman – Beyond Mapreduce Scientific Data Processing in Real-timeChris Hillman – Beyond Mapreduce Scientific Data Processing in Real-time
Chris Hillman – Beyond Mapreduce Scientific Data Processing in Real-timeFlink Forward
 
Andriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tipsAndriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tipsOWASP Kyiv
 

What's hot (20)

Property-based Testing and Generators (Lua)
Property-based Testing and Generators (Lua)Property-based Testing and Generators (Lua)
Property-based Testing and Generators (Lua)
 
PythonBrasil[8] - CPython for dummies
PythonBrasil[8] - CPython for dummiesPythonBrasil[8] - CPython for dummies
PythonBrasil[8] - CPython for dummies
 
Gelly in Apache Flink Bay Area Meetup
Gelly in Apache Flink Bay Area MeetupGelly in Apache Flink Bay Area Meetup
Gelly in Apache Flink Bay Area Meetup
 
Vasia Kalavri – Training: Gelly School
Vasia Kalavri – Training: Gelly School Vasia Kalavri – Training: Gelly School
Vasia Kalavri – Training: Gelly School
 
Michael Häusler – Everyday flink
Michael Häusler – Everyday flinkMichael Häusler – Everyday flink
Michael Häusler – Everyday flink
 
Sebastian Schelter – Distributed Machine Learing with the Samsara DSL
Sebastian Schelter – Distributed Machine Learing with the Samsara DSLSebastian Schelter – Distributed Machine Learing with the Samsara DSL
Sebastian Schelter – Distributed Machine Learing with the Samsara DSL
 
2015 TaPP - Interoperability for Provenance-aware Databases using PROV and JSON
2015 TaPP - Interoperability for Provenance-aware Databases using PROV and JSON2015 TaPP - Interoperability for Provenance-aware Databases using PROV and JSON
2015 TaPP - Interoperability for Provenance-aware Databases using PROV and JSON
 
FastR+Apache Flink
FastR+Apache FlinkFastR+Apache Flink
FastR+Apache Flink
 
Apache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-On
Apache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-OnApache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-On
Apache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-On
 
NANO266 - Lecture 9 - Tools of the Modeling Trade
NANO266 - Lecture 9 - Tools of the Modeling TradeNANO266 - Lecture 9 - Tools of the Modeling Trade
NANO266 - Lecture 9 - Tools of the Modeling Trade
 
Apache Flink internals
Apache Flink internalsApache Flink internals
Apache Flink internals
 
Machine Learning with Apache Flink at Stockholm Machine Learning Group
Machine Learning with Apache Flink at Stockholm Machine Learning GroupMachine Learning with Apache Flink at Stockholm Machine Learning Group
Machine Learning with Apache Flink at Stockholm Machine Learning Group
 
Why you should be using structured logs
Why you should be using structured logsWhy you should be using structured logs
Why you should be using structured logs
 
Apache Flink Deep Dive
Apache Flink Deep DiveApache Flink Deep Dive
Apache Flink Deep Dive
 
Flink Batch Processing and Iterations
Flink Batch Processing and IterationsFlink Batch Processing and Iterations
Flink Batch Processing and Iterations
 
cb streams - gavin pickin
cb streams - gavin pickincb streams - gavin pickin
cb streams - gavin pickin
 
Graph ql api gateway
Graph ql api gatewayGraph ql api gateway
Graph ql api gateway
 
Ufuc Celebi – Stream & Batch Processing in one System
Ufuc Celebi – Stream & Batch Processing in one SystemUfuc Celebi – Stream & Batch Processing in one System
Ufuc Celebi – Stream & Batch Processing in one System
 
Chris Hillman – Beyond Mapreduce Scientific Data Processing in Real-time
Chris Hillman – Beyond Mapreduce Scientific Data Processing in Real-timeChris Hillman – Beyond Mapreduce Scientific Data Processing in Real-time
Chris Hillman – Beyond Mapreduce Scientific Data Processing in Real-time
 
Andriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tipsAndriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tips
 

Viewers also liked

Android开发工程师必备
Android开发工程师必备Android开发工程师必备
Android开发工程师必备mornone
 
Problemas de diseño de mezcla ultimo
Problemas de diseño de mezcla ultimoProblemas de diseño de mezcla ultimo
Problemas de diseño de mezcla ultimosaidysantacruz
 
Не_виплачують_заробітної_плати
Не_виплачують_заробітної_платиНе_виплачують_заробітної_плати
Не_виплачують_заробітної_платиVitalij Misjats
 
Tecnologías sociales.
Tecnologías sociales.Tecnologías sociales.
Tecnologías sociales.José María
 
News Analysis - Is HP getting lean or falling apart?
News Analysis - Is HP getting lean or falling apart?News Analysis - Is HP getting lean or falling apart?
News Analysis - Is HP getting lean or falling apart?Holger Mueller
 
data science in academia and the real world
data science in academia and the real worlddata science in academia and the real world
data science in academia and the real worldchris wiggins
 
HAPPYWEEK 186 - 2016.09.19.
HAPPYWEEK 186 - 2016.09.19.HAPPYWEEK 186 - 2016.09.19.
HAPPYWEEK 186 - 2016.09.19.Jiří Černák
 
INDEPEDENT OUTSOURCING ASSURANCE
INDEPEDENT OUTSOURCING ASSURANCEINDEPEDENT OUTSOURCING ASSURANCE
INDEPEDENT OUTSOURCING ASSURANCEArul Nambi
 
Basic Planning Principles Of Assyrian, Egyptian, Roman and Greek Cities
Basic Planning Principles Of Assyrian, Egyptian, Roman and Greek CitiesBasic Planning Principles Of Assyrian, Egyptian, Roman and Greek Cities
Basic Planning Principles Of Assyrian, Egyptian, Roman and Greek CitiesRajat Katarne
 
Entrepreneurial ecosystem markers -slides
Entrepreneurial ecosystem markers -slidesEntrepreneurial ecosystem markers -slides
Entrepreneurial ecosystem markers -slidesNorris Krueger
 
resumen de investigación consultada
resumen de investigación consultadaresumen de investigación consultada
resumen de investigación consultadamanuelyunga
 
Sheena Lowrie, Spaces 2012
Sheena Lowrie, Spaces 2012Sheena Lowrie, Spaces 2012
Sheena Lowrie, Spaces 2012TCV Scotland
 
很完整的健康方案
很完整的健康方案很完整的健康方案
很完整的健康方案honan4108
 
Bar Menus Copenhagen Spirits & Cocktailsv2
Bar Menus Copenhagen Spirits & Cocktailsv2Bar Menus Copenhagen Spirits & Cocktailsv2
Bar Menus Copenhagen Spirits & Cocktailsv2Philip Duff
 
Universidad nacional de chimborazo(Nellyta)
Universidad nacional de chimborazo(Nellyta)Universidad nacional de chimborazo(Nellyta)
Universidad nacional de chimborazo(Nellyta)UNACH
 

Viewers also liked (20)

Genetic Programming in Python
Genetic Programming in PythonGenetic Programming in Python
Genetic Programming in Python
 
Android开发工程师必备
Android开发工程师必备Android开发工程师必备
Android开发工程师必备
 
Problemas de diseño de mezcla ultimo
Problemas de diseño de mezcla ultimoProblemas de diseño de mezcla ultimo
Problemas de diseño de mezcla ultimo
 
H7
H7H7
H7
 
Не_виплачують_заробітної_плати
Не_виплачують_заробітної_платиНе_виплачують_заробітної_плати
Не_виплачують_заробітної_плати
 
Tecnologías sociales.
Tecnologías sociales.Tecnologías sociales.
Tecnologías sociales.
 
Freitas aula 4
Freitas aula 4Freitas aula 4
Freitas aula 4
 
News Analysis - Is HP getting lean or falling apart?
News Analysis - Is HP getting lean or falling apart?News Analysis - Is HP getting lean or falling apart?
News Analysis - Is HP getting lean or falling apart?
 
data science in academia and the real world
data science in academia and the real worlddata science in academia and the real world
data science in academia and the real world
 
HAPPYWEEK 186 - 2016.09.19.
HAPPYWEEK 186 - 2016.09.19.HAPPYWEEK 186 - 2016.09.19.
HAPPYWEEK 186 - 2016.09.19.
 
Evaluation question 1 music video
Evaluation question 1 music videoEvaluation question 1 music video
Evaluation question 1 music video
 
INDEPEDENT OUTSOURCING ASSURANCE
INDEPEDENT OUTSOURCING ASSURANCEINDEPEDENT OUTSOURCING ASSURANCE
INDEPEDENT OUTSOURCING ASSURANCE
 
Basic Planning Principles Of Assyrian, Egyptian, Roman and Greek Cities
Basic Planning Principles Of Assyrian, Egyptian, Roman and Greek CitiesBasic Planning Principles Of Assyrian, Egyptian, Roman and Greek Cities
Basic Planning Principles Of Assyrian, Egyptian, Roman and Greek Cities
 
Entrepreneurial ecosystem markers -slides
Entrepreneurial ecosystem markers -slidesEntrepreneurial ecosystem markers -slides
Entrepreneurial ecosystem markers -slides
 
resumen de investigación consultada
resumen de investigación consultadaresumen de investigación consultada
resumen de investigación consultada
 
El adjetivo
El adjetivoEl adjetivo
El adjetivo
 
Sheena Lowrie, Spaces 2012
Sheena Lowrie, Spaces 2012Sheena Lowrie, Spaces 2012
Sheena Lowrie, Spaces 2012
 
很完整的健康方案
很完整的健康方案很完整的健康方案
很完整的健康方案
 
Bar Menus Copenhagen Spirits & Cocktailsv2
Bar Menus Copenhagen Spirits & Cocktailsv2Bar Menus Copenhagen Spirits & Cocktailsv2
Bar Menus Copenhagen Spirits & Cocktailsv2
 
Universidad nacional de chimborazo(Nellyta)
Universidad nacional de chimborazo(Nellyta)Universidad nacional de chimborazo(Nellyta)
Universidad nacional de chimborazo(Nellyta)
 

Similar to How to easily find the optimal solution without exhaustive search using Genetic Algorithms

Jay Yagnik at AI Frontiers : A History Lesson on AI
Jay Yagnik at AI Frontiers : A History Lesson on AIJay Yagnik at AI Frontiers : A History Lesson on AI
Jay Yagnik at AI Frontiers : A History Lesson on AIAI Frontiers
 
Applying Linear Optimization Using GLPK
Applying Linear Optimization Using GLPKApplying Linear Optimization Using GLPK
Applying Linear Optimization Using GLPKJeremy Chen
 
XGBoost @ Fyber
XGBoost @ FyberXGBoost @ Fyber
XGBoost @ FyberDaniel Hen
 
IIBMP2019 講演資料「オープンソースで始める深層学習」
IIBMP2019 講演資料「オープンソースで始める深層学習」IIBMP2019 講演資料「オープンソースで始める深層学習」
IIBMP2019 講演資料「オープンソースで始める深層学習」Preferred Networks
 
Online advertising and large scale model fitting
Online advertising and large scale model fittingOnline advertising and large scale model fitting
Online advertising and large scale model fittingWush Wu
 
Paper Study: Melding the data decision pipeline
Paper Study: Melding the data decision pipelinePaper Study: Melding the data decision pipeline
Paper Study: Melding the data decision pipelineChenYiHuang5
 
DC02. Interpretation of predictions
DC02. Interpretation of predictionsDC02. Interpretation of predictions
DC02. Interpretation of predictionsAnton Kulesh
 
A GENETIC-FROG LEAPING ALGORITHM FOR TEXT DOCUMENT CLUSTERING
A GENETIC-FROG LEAPING ALGORITHM FOR TEXT DOCUMENT CLUSTERINGA GENETIC-FROG LEAPING ALGORITHM FOR TEXT DOCUMENT CLUSTERING
A GENETIC-FROG LEAPING ALGORITHM FOR TEXT DOCUMENT CLUSTERINGLubna_Alhenaki
 
Fundamental of Machine Learning
Fundamental of Machine LearningFundamental of Machine Learning
Fundamental of Machine LearningSARCCOM
 
Machine learning using TensorFlow on DSX
Machine learning using TensorFlow on DSX Machine learning using TensorFlow on DSX
Machine learning using TensorFlow on DSX Tuhin Mahmud
 
Parallel Optimization in Machine Learning
Parallel Optimization in Machine LearningParallel Optimization in Machine Learning
Parallel Optimization in Machine LearningFabian Pedregosa
 
Stripe CTF3 wrap-up
Stripe CTF3 wrap-upStripe CTF3 wrap-up
Stripe CTF3 wrap-upStripe
 
Machine Learning Crash Course by Sebastian Raschka
Machine Learning Crash Course by Sebastian RaschkaMachine Learning Crash Course by Sebastian Raschka
Machine Learning Crash Course by Sebastian RaschkaPawanJayarathna1
 
Keynote at IWLS 2017
Keynote at IWLS 2017Keynote at IWLS 2017
Keynote at IWLS 2017Manish Pandey
 
Systematic Generation Data and Types in C++
Systematic Generation Data and Types in C++Systematic Generation Data and Types in C++
Systematic Generation Data and Types in C++Sumant Tambe
 
Reinforcement learning
Reinforcement learningReinforcement learning
Reinforcement learningDongHyun Kwak
 

Similar to How to easily find the optimal solution without exhaustive search using Genetic Algorithms (20)

Jay Yagnik at AI Frontiers : A History Lesson on AI
Jay Yagnik at AI Frontiers : A History Lesson on AIJay Yagnik at AI Frontiers : A History Lesson on AI
Jay Yagnik at AI Frontiers : A History Lesson on AI
 
Pycon 2012 Scikit-Learn
Pycon 2012 Scikit-LearnPycon 2012 Scikit-Learn
Pycon 2012 Scikit-Learn
 
Applying Linear Optimization Using GLPK
Applying Linear Optimization Using GLPKApplying Linear Optimization Using GLPK
Applying Linear Optimization Using GLPK
 
XGBoost @ Fyber
XGBoost @ FyberXGBoost @ Fyber
XGBoost @ Fyber
 
IIBMP2019 講演資料「オープンソースで始める深層学習」
IIBMP2019 講演資料「オープンソースで始める深層学習」IIBMP2019 講演資料「オープンソースで始める深層学習」
IIBMP2019 講演資料「オープンソースで始める深層学習」
 
Online advertising and large scale model fitting
Online advertising and large scale model fittingOnline advertising and large scale model fitting
Online advertising and large scale model fitting
 
Paper Study: Melding the data decision pipeline
Paper Study: Melding the data decision pipelinePaper Study: Melding the data decision pipeline
Paper Study: Melding the data decision pipeline
 
DC02. Interpretation of predictions
DC02. Interpretation of predictionsDC02. Interpretation of predictions
DC02. Interpretation of predictions
 
Deep Learning meetup
Deep Learning meetupDeep Learning meetup
Deep Learning meetup
 
A GENETIC-FROG LEAPING ALGORITHM FOR TEXT DOCUMENT CLUSTERING
A GENETIC-FROG LEAPING ALGORITHM FOR TEXT DOCUMENT CLUSTERINGA GENETIC-FROG LEAPING ALGORITHM FOR TEXT DOCUMENT CLUSTERING
A GENETIC-FROG LEAPING ALGORITHM FOR TEXT DOCUMENT CLUSTERING
 
Svm V SVC
Svm V SVCSvm V SVC
Svm V SVC
 
Dafunctor
DafunctorDafunctor
Dafunctor
 
Fundamental of Machine Learning
Fundamental of Machine LearningFundamental of Machine Learning
Fundamental of Machine Learning
 
Machine learning using TensorFlow on DSX
Machine learning using TensorFlow on DSX Machine learning using TensorFlow on DSX
Machine learning using TensorFlow on DSX
 
Parallel Optimization in Machine Learning
Parallel Optimization in Machine LearningParallel Optimization in Machine Learning
Parallel Optimization in Machine Learning
 
Stripe CTF3 wrap-up
Stripe CTF3 wrap-upStripe CTF3 wrap-up
Stripe CTF3 wrap-up
 
Machine Learning Crash Course by Sebastian Raschka
Machine Learning Crash Course by Sebastian RaschkaMachine Learning Crash Course by Sebastian Raschka
Machine Learning Crash Course by Sebastian Raschka
 
Keynote at IWLS 2017
Keynote at IWLS 2017Keynote at IWLS 2017
Keynote at IWLS 2017
 
Systematic Generation Data and Types in C++
Systematic Generation Data and Types in C++Systematic Generation Data and Types in C++
Systematic Generation Data and Types in C++
 
Reinforcement learning
Reinforcement learningReinforcement learning
Reinforcement learning
 

Recently uploaded

20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...Akihiro Suda
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 

Recently uploaded (20)

20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 

How to easily find the optimal solution without exhaustive search using Genetic Algorithms

  • 1. How to easily find the optimal solution without exhaustive search using Genetic Algorithms Viacheslav Kakovskyi — Kyiv.py #16 1
  • 2. Me! @kakovskyi Python Developer at SoftServe Recent projects: ● Backend for instant messenger ● Backend for embedded system for traffic analysis ● Software for personal nutrition planning 2
  • 3. Agenda ● Cases from my experience ● Terminology ● Genetic Algorithms by example ● Theoretical background ● Genetic Algorithms in Python ● Pros and cons ● Tasks from real life ● Summary ● Further reading 3
  • 4. Software for personal nutrition planning ● Find a set of suboptimal personal nutrition plans ● Minimize difference between required macronutrients and energetic value for suggested plan ● Genetic Algorithms used for generation of daily meals ● The problem is similar to Knapsack problem 4
  • 5. Embedded system for traffic analysis (R&D) 5 Data from camera (LPR), 2D Data from radar, 2D
  • 6. Embedded system for traffic analysis (R&D) ● Find suboptimal transition matrix (4x4) ● Challenge: surface relief ● Maximize intersection of data from LPR and converted data from radar ● Tried to use Genetic Algorithms for parametric optimization 6
  • 7. Math party ● Function - a rule ● Domain - a set of possible input values of a function ● Codomain - a set of possible output values of a function ● Extremum - maximum or minimum of a function for a given domain ● Local extremum - an extremum of some neighbourhood of domain ● Global extremum - an extremum of all domain 7
  • 8. Genetics party ● Genotype - a set of genes of an instance ● Phenotype - a set of features of an instance ● Fitness-function - a function which describes adaptability of an instance ● Generation defines a lifetime of instances ● Population - a set of all instances which exist in the same area 8
  • 9. Genetics party ● Selection - a stage of GA when instances are chosen from a population for later breeding ● Crossover - an operator used to vary chromosomes from one generation to the next ● Mutation - an operator used to maintain genetic diversity from one generation of a population to the next 9
  • 10. Genetic Algorithms by example ● Problem: find a solution of a linear Diophantine equation ● The equation: 1027x + 712y = 1 ● D(x) = [-1 500; 1 500] ● D(y) = [-1 500; 1 500] Analytical solution: ● http://mathworld.wolfram.com/DiophantineEquation.html ● http://math.stackexchange.com/a/20727 10
  • 11. Genetic Algorithms by example ● Problem type: minimization ● F(x,y) = |1027x+ 712y - 1| ● lambda x, y: abs(1027 * x + 712 * y - 1) ● IND_SIZE = 4 ● NGEN = 100 ● Initial population: (-432, 325) -> 212265 (48, 1217) -> 915799 (-660, 1473) -> 370955 (22, 786) -> 582225 11
  • 12. Selection ● Ordering: 212265, 370955, 582225, 915799 ● (48, 1217) -> 915799 is the worst adapted 12
  • 15. Mutation 15 ● Add a random integer from the range [-10, 10] ● MUTPB = 0.25
  • 16. Mutation 16 ● Add a random integer from the range [-10, 10] ● MUTPB = 0.25
  • 21. Complexity ● IND_SIZE - size of population ● NGEN - number of generations ● CXPB - crossover probability ● MUTPB - mutation probability Complexity ≈ IND_SIZE * NGEN * O(Fitness) * O(Selection) * (CXPB * O(Crossover) + MUTPB * O(Mutation)) 21
  • 22. Guidelines ● Define your fitness-function ● Choose the problem type ● Define the domain and NGEN ● Define how the initial population should be chosen and IND_SIZE ● Define the type of selection ● Define the type of crossover ● Define the type of mutation and MUTPB ● Try it! ● Define heuristics if needed 22
  • 23. Genetic Algorithms in Python ● DEAP ● Pyevolve ● PyBrain ● pygene ● pyeasyga ● pyneurgen ● pyislands ● inspyred ● tinyevolver 23
  • 24. DEAP: Distributed Evolutionary Algorithms in Python ● Batteries included ● Parallelization ● Genetic Programming ● Works on Python 2, Python 3 and PyPy ● Lots of scientific projects already use it 24
  • 25. DEAP by example ● Problem: find a solution of a linear Diophantine equation. ● The equation: 1027x+ 712y = 1 ● D(x) = [-1 500; 1 500] ● D(y) = [-1 500; 1 500] 25
  • 26. DEAP by example """ The equation: 1027 * x + 712 * y = 1 D(x) = [-1 500; 1 500] D(y) = [-1 500; 1 500] """ import random import operator from deap import tools, base, creator, algorithms MIN, MAX = -1500, 1500 SOLUTION = [-165, 238] VARIABLES = len(SOLUTION) MUT_MIN, MUT_MAX = -10, 10 NGEN, IND_SIZE, CXPB, MUTPB, TRN_SIZE = 100, 50, 0.5, 0.25, 100 HALL_SIZE = 10 DEFAULT_MAIN_ARGS = NGEN, IND_SIZE, CXPB, MUTPB BEST_INSTANCE_MSG = 'Best instance:' NO_SOLUTION_MSG = 'No solution in integers. Distance is:' 26 def fitness(instance): x, y = instance return abs(1027 * x + 712 * y - 1), def spawn_instance(): return random.randint(MIN, MAX), random.randint(MIN, MAX) def mutate(instance, mutpb): if random.random() <= mutpb: index = random.randint(0, len(instance) - 1) instance[index] += random.randint(MUT_MIN, MUT_MAX) return instance, return instance, def get_best_result(population): if isinstance(population[0], list): fitness_values = list(map(fitness, population)) index = fitness_values.index(min(fitness_values)) return population[index] else: return min(population, key=operator.attrgetter('fitness'))
  • 27. DEAP by example def terminate(population): if fitness(get_best_result(population)) == (0, ): raise StopIteration return False def distance_from_best_result(population): result = get_best_result(population) return fitness(result)[0] def output(best_instance): print(BEST_INSTANCE_MSG, best_instance) distance = fitness(best_instance) if distance: print(NO_SOLUTION_MSG, distance) 27 def setup(mutpb): creator.create("FitnessMin", base.Fitness, weights=(-1,)) creator.create("Individual", list, fitness=creator.FitnessMin) toolbox = base.Toolbox() toolbox.register("attribute", random.randint, MIN, MAX) toolbox.register("individual", tools.initRepeat, creator.Individual, toolbox.attribute, n=VARIABLES) toolbox.register("population", tools.initRepeat, list, toolbox.individual) toolbox.register("mate", tools.cxOnePoint) toolbox.register("mutate", mutate, mutpb=mutpb) toolbox.register("select", tools.selBest) toolbox.register("evaluate", fitness) return toolbox
  • 28. DEAP by example def main(ngen, ind_size, cxpb, mutpb): toolbox = setup(ind_size) population = toolbox.population(n=ind_size) stats = tools.Statistics() stats.register("best_instance_of_population", get_best_result) stats.register("distance", distance_from_best_result) stats.register("terminate", terminate) halloffame = tools.HallOfFame(HALL_SIZE) try: algorithms.eaSimple(population, toolbox, cxpb, mutpb, ngen, stats=stats, halloffame=halloffame) except StopIteration: pass finally: best_instance = halloffame[0] output(best_instance) return best_instance if __name__ == '__main__': main(*DEFAULT_MAIN_ARGS) 28 github.com/viachk/ga-example-diophantine
  • 29. Crossover types 29 ● cxOnePoint ● cxTwoPoint ● cxUniform ● cxPartialyMatched ● cxUniformPartialyMatched ● cxOrdered ● cxBlend ● cxESBlend ● cxESTwoPoint ● cxSimulatedBinary ● cxSimulatedBinaryBounded ● cxMessyOnePoint
  • 30. Mutation types ● mutGaussian ● mutShuffleIndexes ● mutFlipBit ● mutPolynomialBounded ● mutUniformInt ● mutESLogNormal 30
  • 31. Selection types ● selTournament ● selRoulette ● selNSGA2 ● selSPEA2 ● selRandom ● selBest ● selWorst ● selTournamentDCD ● selDoubleTournament 31
  • 32. Pros of Genetic Algorithms ● easy in use ● lots lots of options for heuristics ● can solve majority of problems (somehow) 32
  • 33. Cons of Genetic Algorithms 33
  • 34. Local vs Global extrema 34
  • 35. Cons of Genetic Algorithms ● can't find the optimal solution ● terminates after the first local extremum ● computationally expensive 35
  • 36. Right tasks for Genetic Algorithms ● parametric optimization ● NP-complete problems ● machine learning ● bioinformatics ● when you need to design a prototype, looks like a proper solution for a hackaton https://en.wikipedia.org/wiki/List_of_genetic_algorithm_applications (78 items) 36
  • 37. Wrong tasks for Genetic Algorithms ● real-time processing ● an accurate method of solving the problem already exists ● huge amount of local extrema 37
  • 38. Summaries about Genetic Algorithms ● easy to start ● stochastic ● have lots of options for heuristics ● but the task should be formalized ● we have batteries for them in Python ● applicable in variety of real-life tasks ● terminate after the first local extremum ● computationally expensive ● for 99% of tasks find suboptimal solution 38
  • 39. Next steps ● Video: Genetic Algorithms by example (Eng) ● Video: Genetic Algorithms by example (Ru) ● Video: MIT AI class - Genetic Algorithms (Eng) ● Video: Kyiv AI 2012 - Evolutionary Algorithms (Ru) ● Video: Implementation of Genetic Algorithms (Ru) ● Video: A Framework for Genetic Algorithms Based on Hadoop (Eng) 39
  • 40. Next steps ● Pretty awesome book about Genetic Algorithms by Panchenko (Ru) ● Articles about Genetic Algorithms (Ru) ● Q&A about Genetic Algorithms (Ru) ● A Framework for Genetic Algorithms Based on Hadoop (Eng) 40