The document is a slide deck presentation about evolutionary algorithms. It introduces the speaker and provides an example of NASA using an evolutionary algorithm to design small antennae for spacecraft. The presentation then discusses how evolutionary algorithms are inspired by biological evolution, using techniques like recombination, mutation, and survival of the fittest to solve optimization problems. It presents the travelling salesman problem as an example problem that can be solved using evolutionary algorithms and provides pseudocode for a basic evolutionary algorithm.
Evolutionary Algorithms: the key to solving complex Java puzzles! - Bas knopperNLJUG
Java Developers sometimes face programming challenges, such as creating a school roster or determining a salesperson’s optimal route, that are extremely difficult to crack using conventional approaches. Discover how Evolutionary Algorithms can be applied to solve these complex puzzles. The session starts with a success story from the NASA space archives to explain the concepts. Once the stage is set, it’s puzzle solving time! Learn to code Evolutionary Algorithms using plain Java - although existing Java frameworks such as JGAP are also addressed. The session concludes with a checklist that can be used to determine whether Evolutionary Algorithms are a good fit to the problem. With this checklist, the decision has never been easier!
This is an overview about Java Mission Control and Java Flight Recorder which is part of the Oracle JDK since JDK 7u40. The purpose of JFR is to have a continuous recording about the behavior of the JVM and the Java application at the same time. You can walk back in time and find out whats going on, to discover a specific problem situation in history
J-Fall 2014 - Evolutionary Algorithms: The Key to Solving Complex Java PuzzlesBas W. Knopper
J-Fall 2014 presentation on Evolutionary Algorithms. The abstract of the presentation: Java developers sometimes face programming challenges, such as creating a school roster or determining a salesperson’s optimal route, that are extremely difficult to crack with conventional approaches. Discover how evolutionary algorithms can be applied to solve such complex puzzles. This session starts with a success story from the NASA space archives to explain the concepts. Once the stage is set, it’s puzzle-solving time! Learn how to code evolutionary algorithms by using plain Java—although existing Java frameworks such as JGAP are also addressed. The session concludes with a checklist for determining whether evolutionary algorithms are a good fit for any particular problem. With this checklist, the decision has never been easier!
Evolutionary Algorithms: the key to solving complex Java puzzles! - Bas knopperNLJUG
Java Developers sometimes face programming challenges, such as creating a school roster or determining a salesperson’s optimal route, that are extremely difficult to crack using conventional approaches. Discover how Evolutionary Algorithms can be applied to solve these complex puzzles. The session starts with a success story from the NASA space archives to explain the concepts. Once the stage is set, it’s puzzle solving time! Learn to code Evolutionary Algorithms using plain Java - although existing Java frameworks such as JGAP are also addressed. The session concludes with a checklist that can be used to determine whether Evolutionary Algorithms are a good fit to the problem. With this checklist, the decision has never been easier!
This is an overview about Java Mission Control and Java Flight Recorder which is part of the Oracle JDK since JDK 7u40. The purpose of JFR is to have a continuous recording about the behavior of the JVM and the Java application at the same time. You can walk back in time and find out whats going on, to discover a specific problem situation in history
J-Fall 2014 - Evolutionary Algorithms: The Key to Solving Complex Java PuzzlesBas W. Knopper
J-Fall 2014 presentation on Evolutionary Algorithms. The abstract of the presentation: Java developers sometimes face programming challenges, such as creating a school roster or determining a salesperson’s optimal route, that are extremely difficult to crack with conventional approaches. Discover how evolutionary algorithms can be applied to solve such complex puzzles. This session starts with a success story from the NASA space archives to explain the concepts. Once the stage is set, it’s puzzle-solving time! Learn how to code evolutionary algorithms by using plain Java—although existing Java frameworks such as JGAP are also addressed. The session concludes with a checklist for determining whether evolutionary algorithms are a good fit for any particular problem. With this checklist, the decision has never been easier!
Toronto Virtual Meetup #11 - Reviewing Complex DataWeave Transformation Use-caseAlexandra N. Martinez
Alexandra guides us during a complex DataWeave transformation use-case and how to solve it using Tail Recursive functions and other core functions like map, reduce, etc.
Value Objects, Full Throttle (to be updated for spring TC39 meetings)Brendan Eich
Slides I prepared for the 29 January 2014 Ecma TC39 meeting, on Value Objects in JS, an ES7 proposal -- this one shotgunned the roadmap-space of declarative syntax, to find the right amount per TC39 (nearly zero, turns out).
Big Decimal: Avoid Rounding Errors on Decimals in JavaScriptIgalia
Daniel Ehrenberg talks at Node.TLV 2020 about TC39, how it works, and some intersting proposals about dealing with numbers in JavaScript working their way through the process: BigInt and the newer BigDecimal.
Driver vs Driverless AI - Mark Landry, Competitive Data Scientist and Product...Sri Ambati
Presented at #H2OWorld 2017 in Mountain View, CA.
Enjoy the video: https://youtu.be/U-ENrMUQcJs.
Learn more about H2O.ai: https://www.h2o.ai/.
Follow @h2oai: https://twitter.com/h2oai.
- - -
Mark Landry is a competitive data scientist and a product manager at H2O.ai. He is well-trained in getting quick solutions to iterate over and enjoys testing ideas in Kaggle competitions, where his worldwide ranking stands in the top 0.03%. His first encounter with H2O.ai was while when he was hacking R. He reached out Arno Candel (CTO, H2O.ai) to team up in a Kaggle competition as he felt it would be exciting to work with the lead developers of the tool that contributed to his work in R. Mark holds a B.S. in Computer Science from Mississippi State University and was a Principal Engineer at Dell before joining H2O.ai. At Dell, he spearheaded data modeling and project support for the business transformation team, and also developed analytical tools and machine learning models to increase business efficiency.
Mark was the first Kaggle Grandmaster to be employed at H2O.ai and he enabled inroads into the Kaggle community for H2O. At H2O.ai, he has helped modernize the GBM algorithm and provided guidance on multiple projects before being pulled into one of H2O’s biggest projects. He holds interests in multi-model architectures and helps the world make fewer models that perform worse than the mean. He also has a number of publications to his name with multiple citations from the industry and academia alike.
"The DEBS Grand Challenge 2018" as presented in the 12th ACM International Conference on Distributed and Event-Based Systems (DEBS 2017), 25 - 29 June, 2017 held in Hammilton, New Zeland
This work was supported by grants from the EU H2020 Framework Programme provided for the project HOBBIT (GA no. 688227).
“Accident Reconstruction” by Aleksis Liekna from Scope Technologies at Auto f...DevClub_lv
When an accident occurs, it is vital to analyze the chain of events that led to such outcome, especially if the consequences are tragic. Involved parties, including participants themselves, their family members, legal institutions and insurance companies require information and we are doing our best to keep them informed.In this session we will present our advancements in accident analysis, starting with the basics of accident reconstruction and changes in market demands and ending with displaying geographic information in 3D space as well as using Google StreetView API to re-create realistic 3D environments.
Aleksis is a software developer in Scope Technologies with more than 10 years of experience in various software development platforms, currently focusing on .NET, JavaScript and ThreeJS.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
Toronto Virtual Meetup #11 - Reviewing Complex DataWeave Transformation Use-caseAlexandra N. Martinez
Alexandra guides us during a complex DataWeave transformation use-case and how to solve it using Tail Recursive functions and other core functions like map, reduce, etc.
Value Objects, Full Throttle (to be updated for spring TC39 meetings)Brendan Eich
Slides I prepared for the 29 January 2014 Ecma TC39 meeting, on Value Objects in JS, an ES7 proposal -- this one shotgunned the roadmap-space of declarative syntax, to find the right amount per TC39 (nearly zero, turns out).
Big Decimal: Avoid Rounding Errors on Decimals in JavaScriptIgalia
Daniel Ehrenberg talks at Node.TLV 2020 about TC39, how it works, and some intersting proposals about dealing with numbers in JavaScript working their way through the process: BigInt and the newer BigDecimal.
Driver vs Driverless AI - Mark Landry, Competitive Data Scientist and Product...Sri Ambati
Presented at #H2OWorld 2017 in Mountain View, CA.
Enjoy the video: https://youtu.be/U-ENrMUQcJs.
Learn more about H2O.ai: https://www.h2o.ai/.
Follow @h2oai: https://twitter.com/h2oai.
- - -
Mark Landry is a competitive data scientist and a product manager at H2O.ai. He is well-trained in getting quick solutions to iterate over and enjoys testing ideas in Kaggle competitions, where his worldwide ranking stands in the top 0.03%. His first encounter with H2O.ai was while when he was hacking R. He reached out Arno Candel (CTO, H2O.ai) to team up in a Kaggle competition as he felt it would be exciting to work with the lead developers of the tool that contributed to his work in R. Mark holds a B.S. in Computer Science from Mississippi State University and was a Principal Engineer at Dell before joining H2O.ai. At Dell, he spearheaded data modeling and project support for the business transformation team, and also developed analytical tools and machine learning models to increase business efficiency.
Mark was the first Kaggle Grandmaster to be employed at H2O.ai and he enabled inroads into the Kaggle community for H2O. At H2O.ai, he has helped modernize the GBM algorithm and provided guidance on multiple projects before being pulled into one of H2O’s biggest projects. He holds interests in multi-model architectures and helps the world make fewer models that perform worse than the mean. He also has a number of publications to his name with multiple citations from the industry and academia alike.
"The DEBS Grand Challenge 2018" as presented in the 12th ACM International Conference on Distributed and Event-Based Systems (DEBS 2017), 25 - 29 June, 2017 held in Hammilton, New Zeland
This work was supported by grants from the EU H2020 Framework Programme provided for the project HOBBIT (GA no. 688227).
“Accident Reconstruction” by Aleksis Liekna from Scope Technologies at Auto f...DevClub_lv
When an accident occurs, it is vital to analyze the chain of events that led to such outcome, especially if the consequences are tragic. Involved parties, including participants themselves, their family members, legal institutions and insurance companies require information and we are doing our best to keep them informed.In this session we will present our advancements in accident analysis, starting with the basics of accident reconstruction and changes in market demands and ending with displaying geographic information in 3D space as well as using Google StreetView API to re-create realistic 3D environments.
Aleksis is a software developer in Scope Technologies with more than 10 years of experience in various software development platforms, currently focusing on .NET, JavaScript and ThreeJS.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
Generating a custom Ruby SDK for your web service or Rails API using Smithyg2nightmarescribd
Have you ever wanted a Ruby client API to communicate with your web service? Smithy is a protocol-agnostic language for defining services and SDKs. Smithy Ruby is an implementation of Smithy that generates a Ruby SDK using a Smithy model. In this talk, we will explore Smithy and Smithy Ruby to learn how to generate custom feature-rich SDKs that can communicate with any web service, such as a Rails JSON API.
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Evolutionary Algorithms: The Key to Solving Complex Java Puzzles
1. Passion for Technologyb.knopper@ncim.nl @BWKnopper
EVOLUTIONARY ALGORITHMS
The key to solving complex Java puzzles
JavaOne [BOF2913]
#javaone #EvolutionaryAlgorithms @BWKnopper
2. Passion for Technologyb.knopper@ncim.nl @BWKnopper
Let me introduce myself…
• Bas W. Knopper
• Dutch
• Java Developer
• NCIM (IT Services Company)
• 9 years Java exp
• AI enthousiast
• Soft spot for Evolutionary Algorithms
Slide 2 of 68
3. Passion for Technologyb.knopper@ncim.nl @BWKnopper
Questions
• A lot of ground to cover in 45 mins.
• Ask questions anytime!
• But don’t take it personal if I have to move on…
• We’ll discuss it over a <insert beverage of choice>!
• If time permits it
• Question round at the end as well
Slide 3 of 68
5. Passion for Technologyb.knopper@ncim.nl @BWKnopper
NASA
• Space Technology 5 mission
• launched March 22, 2006, and completed June 20, 2006
• Three full service 25-kilogram-class spacecraft
Slide 5 of 68
6. Passion for Technologyb.knopper@ncim.nl @BWKnopper
NASA Continued
• Needs even smaller antenna
• That still functions according to spec
• Need for solution that’s not easy to engineer
• So they used an EA that made these:
Slide 6 of 68
9. Passion for Technologyb.knopper@ncim.nl @BWKnopper
Evolution - “Survival of the fittest”
Finite
Resources
Lifeforms
with a basic
instinct
towards
Reproduction
Natural
Selection
Slide 9 of 68
14. Passion for Technologyb.knopper@ncim.nl @BWKnopper
Travelling Salesman Problem
• Given n cities
• n = number of cities to visit
• Find (optimal) route for visiting all cities
• Visit every city only once
• Return to origin city
• Search space is huge
• For 30 cities there are 30! 10^32 possible routes
That’s 100.000.000.000.000.000.000.000.000.000.000 possible routes!
Brute force might not be the best solution…
Slide 14 of 68
15. Passion for Technologyb.knopper@ncim.nl @BWKnopper
Puzzle solving time!
• More down to earth example
• Travelling Salesman Problem
• Use case to show you
• Evolutionary Algorithm Design
• Plain Java Code
• Demo
Slide 15 of 68
16. Passion for Technologyb.knopper@ncim.nl @BWKnopper
Different EA’s
• Genetic Algorithms (GA’s)
• Evolution Strategies (ES’s)
• Evolutionary Programming (EP)
• Genetic Programming (GP)
• All have the same basis
Slide 16 of 68
17. Passion for Technologyb.knopper@ncim.nl @BWKnopper
EA Algorithm (Pseudocode)
INITIALISE population with random candidate solutions;
EVALUATE each candidate;
WHILE ( TERMINATION CONDITION is not satisfied ) {
1 SELECT parents;
2 RECOMBINE pairs of parents;
3 MUTATE the resulting offspring;
4 EVALUATE new candidates;
5 SELECT individuals for the next generation;
}
Slide 17 of 68
18. Passion for Technologyb.knopper@ncim.nl @BWKnopper
EA Algorithm (Pseudocode)
INITIALISE population with random candidate solutions;
EVALUATE each candidate;
WHILE ( TERMINATION CONDITION is not satisfied ) {
1 SELECT parents;
2 RECOMBINE pairs of parents;
3 MUTATE the resulting offspring;
4 EVALUATE new candidates;
5 SELECT individuals for the next generation;
}
Slide 18 of 68
19. Passion for Technologyb.knopper@ncim.nl @BWKnopper
Candidate Solution - Representation
• n = 6
• And base city 1
• Label cities 1,2,3,4,5,6
• Candidate Solution
• Signifying the route
• for n = 10
1563421
110947356821
Slide 19 of 68
21. Passion for Technologyb.knopper@ncim.nl @BWKnopper
EA Algorithm (Pseudocode)
INITIALISE population with random candidate solutions;
EVALUATE each candidate;
WHILE ( TERMINATION CONDITION is not satisfied ) {
1 SELECT parents;
2 RECOMBINE pairs of parents;
3 MUTATE the resulting offspring;
4 EVALUATE new candidates;
5 SELECT individuals for the next generation;
}
Slide 21 of 68
22. Passion for Technologyb.knopper@ncim.nl @BWKnopper
EA Algorithm (Pseudocode)
INITIALISE population with random candidate solutions;
EVALUATE each candidate;
WHILE ( TERMINATION CONDITION is not satisfied ) {
1 SELECT parents;
2 RECOMBINE pairs of parents;
3 MUTATE the resulting offspring;
4 EVALUATE new candidates;
5 SELECT individuals for the next generation;
}
Slide 22 of 68
23. Passion for Technologyb.knopper@ncim.nl @BWKnopper
Evaluation Function (Fitness Function)
• Summed distance:
• d1,2 + d2,4 + … + d5,1
• Minimize!
1563421
Slide 23 of 68
24. Passion for Technologyb.knopper@ncim.nl @BWKnopper
/**
* Calculates the total distance of the whole route and stores it as this
* candidate solution's fitness
*/
private void calculateFitness() {
/* initialize total distance */
double totalDistance = 0;
/*
* For all Cities in the route (except the last one) get the distance between this
* City and the next and add it to the totalDistance
*/
for (int i = 0; i < route.size() - 1; i++) {
City city = route.get(i);
City nextCity = route.get(i + 1);
totalDistance += city.calculateDistance(nextCity);
}
/* store totalDistance as this candidate solution's fitness */
this.fitness = totalDistance;
}
Slide 24 of 68
25. Passion for Technologyb.knopper@ncim.nl @BWKnopper
/**
* Calculates the total distance of the whole route and stores it as this
* candidate solution's fitness
*/
private void calculateFitness() {
/* initialize total distance */
double totalDistance = 0;
/*
* For all Cities in the route (except the last one) get the distance between this
* City and the next and add it to the totalDistance
*/
for (int i = 0; i < route.size() - 1; i++) {
City city = route.get(i);
City nextCity = route.get(i + 1);
totalDistance += city.calculateDistance(nextCity);
}
/* store totalDistance as this candidate solution's fitness */
this.fitness = totalDistance;
}
Slide 25 of 68
26. Passion for Technologyb.knopper@ncim.nl @BWKnopper
/**
* Calculates the total distance of the whole route and stores it as this
* candidate solution's fitness
*/
private void calculateFitness() {
/* initialize total distance */
double totalDistance = 0;
/*
* For all Cities in the route (except the last one) get the distance between this
* City and the next and add it to the totalDistance
*/
for (int i = 0; i < route.size() - 1; i++) {
City city = route.get(i);
City nextCity = route.get(i + 1);
totalDistance += city.calculateDistance(nextCity);
}
/* store totalDistance as this candidate solution's fitness */
this.fitness = totalDistance;
}
Slide 26 of 68
27. Passion for Technologyb.knopper@ncim.nl @BWKnopper
/**
* Calculates the total distance of the whole route and stores it as this
* candidate solution's fitness
*/
private void calculateFitness() {
/* initialize total distance */
double totalDistance = 0;
/*
* For all Cities in the route (except the last one) get the distance between this
* City and the next and add it to the totalDistance
*/
for (int i = 0; i < route.size() - 1; i++) {
City city = route.get(i);
City nextCity = route.get(i + 1);
totalDistance += city.calculateDistance(nextCity);
}
/* store totalDistance as this candidate solution's fitness */
this.fitness = totalDistance;
}
Slide 27 of 68
28. Passion for Technologyb.knopper@ncim.nl @BWKnopper
/**
* Calculates the total distance of the whole route and stores it as this
* candidate solution's fitness
*/
private void calculateFitness() {
/* initialize total distance */
double totalDistance = 0;
/*
* For all Cities in the route (except the last one) get the distance between this
* City and the next and add it to the totalDistance
*/
for (int i = 0; i < route.size() - 1; i++) {
City city = route.get(i);
City nextCity = route.get(i + 1);
totalDistance += city.calculateDistance(nextCity);
}
/* store totalDistance as this candidate solution's fitness */
this.fitness = totalDistance;
}
Slide 28 of 68
29. Passion for Technologyb.knopper@ncim.nl @BWKnopper
/**
* Calculates the total distance of the whole route and stores it as this
* candidate solution's fitness
*/
private void calculateFitness() {
/* initialize total distance */
double totalDistance = 0;
/*
* For all Cities in the route (except the last one) get the distance between this
* City and the next and add it to the totalDistance
*/
for (int i = 0; i < route.size() - 1; i++) {
City city = route.get(i);
City nextCity = route.get(i + 1);
totalDistance += city.calculateDistance(nextCity);
}
/* store totalDistance as this candidate solution's fitness */
this.fitness = totalDistance;
}
Slide 29 of 68
30. Passion for Technologyb.knopper@ncim.nl @BWKnopper
/**
* Calculates the total distance of the whole route and stores it as this
* candidate solution's fitness
*/
private void calculateFitness() {
/* initialize total distance */
double totalDistance = 0;
/*
* For all Cities in the route (except the last one) get the distance between this
* City and the next and add it to the totalDistance
*/
for (int i = 0; i < route.size() - 1; i++) {
City city = route.get(i);
City nextCity = route.get(i + 1);
totalDistance += city.calculateDistance(nextCity);
}
/* store totalDistance as this candidate solution's fitness */
this.fitness = totalDistance;
}
Slide 30 of 68
31. Passion for Technologyb.knopper@ncim.nl @BWKnopper
EA Algorithm (Pseudocode)
INITIALISE population with random candidate solutions;
EVALUATE each candidate;
WHILE ( TERMINATION CONDITION is not satisfied ) {
1 SELECT parents;
2 RECOMBINE pairs of parents;
3 MUTATE the resulting offspring;
4 EVALUATE new candidates;
5 SELECT individuals for the next generation;
}
Slide 31 of 68
32. Passion for Technologyb.knopper@ncim.nl @BWKnopper
Termination Condition
• EA’s are stochastic
• May never find optimum
• Combination
• Max number of runs (generations)
• Sure to terminate
• Either:
• Fitness threshold
• Fitness improvement remains under a threshold over runs
• Population diversity drops under a certain threshold
Slide 32 of 68
33. Passion for Technologyb.knopper@ncim.nl @BWKnopper
EA Algorithm (Pseudocode)
INITIALISE population with random candidate solutions;
EVALUATE each candidate;
WHILE ( TERMINATION CONDITION is not satisfied ) {
1 SELECT parents;
2 RECOMBINE pairs of parents;
3 MUTATE the resulting offspring;
4 EVALUATE new candidates;
5 SELECT individuals for the next generation;
}
Slide 33 of 68
34. Passion for Technologyb.knopper@ncim.nl @BWKnopper
Parent Selection
• Where x is the number of parents:
• Pick x best
• Random x
• Best x out of random y
• In our example:
• Best x out of random y
Slide 34 of 68
35. Passion for Technologyb.knopper@ncim.nl @BWKnopper
private List<CandidateSolution> parentSelection() {
List<CandidateSolution> tempPopulation = new ArrayList<CandidateSolution>(population);
List<CandidateSolution> randomCandidates = new ArrayList<CandidateSolution>();
/* create parent pool */
for(int i = 0; i < parentPoolSize; i++)
{
/* select a random candidate solution from the temp population */
int randomlySelectedIndex = random.nextInt(tempPopulation.size());
CandidateSolution randomSelection = tempPopulation.get(randomlySelectedIndex);
randomCandidates.add(randomSelection);
/* delete the candidate from the temp population, so we can't pick it again */
tempPopulation.remove(randomlySelectedIndex);
}
/* Sort the population so that the best candidates are up front */
Collections.sort(randomCandidates);
/* return a list with size parentSelectionSize with the best CandidateSolutions */
return randomCandidates.subList(0, parentSelectionSize);
}
Slide 35 of 68
36. Passion for Technologyb.knopper@ncim.nl @BWKnopper
private List<CandidateSolution> parentSelection() {
List<CandidateSolution> tempPopulation = new ArrayList<CandidateSolution>(population);
List<CandidateSolution> randomCandidates = new ArrayList<CandidateSolution>();
/* create parent pool */
for(int i = 0; i < parentPoolSize; i++)
{
/* select a random candidate solution from the temp population */
int randomlySelectedIndex = random.nextInt(tempPopulation.size());
CandidateSolution randomSelection = tempPopulation.get(randomlySelectedIndex);
randomCandidates.add(randomSelection);
/* delete the candidate from the temp population, so we can't pick it again */
tempPopulation.remove(randomlySelectedIndex);
}
/* Sort the population so that the best candidates are up front */
Collections.sort(randomCandidates);
/* return a list with size parentSelectionSize with the best CandidateSolutions */
return randomCandidates.subList(0, parentSelectionSize);
}
Slide 36 of 68
37. Passion for Technologyb.knopper@ncim.nl @BWKnopper
private List<CandidateSolution> parentSelection() {
List<CandidateSolution> tempPopulation = new ArrayList<CandidateSolution>(population);
List<CandidateSolution> randomCandidates = new ArrayList<CandidateSolution>();
/* create parent pool */
for(int i = 0; i < parentPoolSize; i++)
{
/* select a random candidate solution from the temp population */
int randomlySelectedIndex = random.nextInt(tempPopulation.size());
CandidateSolution randomSelection = tempPopulation.get(randomlySelectedIndex);
randomCandidates.add(randomSelection);
/* delete the candidate from the temp population, so we can't pick it again */
tempPopulation.remove(randomlySelectedIndex);
}
/* Sort the population so that the best candidates are up front */
Collections.sort(randomCandidates);
/* return a list with size parentSelectionSize with the best CandidateSolutions */
return randomCandidates.subList(0, parentSelectionSize);
}
Slide 37 of 68
38. Passion for Technologyb.knopper@ncim.nl @BWKnopper
private List<CandidateSolution> parentSelection() {
List<CandidateSolution> tempPopulation = new ArrayList<CandidateSolution>(population);
List<CandidateSolution> randomCandidates = new ArrayList<CandidateSolution>();
/* create parent pool */
for(int i = 0; i < parentPoolSize; i++)
{
/* select a random candidate solution from the temp population */
int randomlySelectedIndex = random.nextInt(tempPopulation.size());
CandidateSolution randomSelection = tempPopulation.get(randomlySelectedIndex);
randomCandidates.add(randomSelection);
/* delete the candidate from the temp population, so we can't pick it again */
tempPopulation.remove(randomlySelectedIndex);
}
/* Sort the population so that the best candidates are up front */
Collections.sort(randomCandidates);
/* return a list with size parentSelectionSize with the best CandidateSolutions */
return randomCandidates.subList(0, parentSelectionSize);
}
Slide 38 of 68
39. Passion for Technologyb.knopper@ncim.nl @BWKnopper
private List<CandidateSolution> parentSelection() {
List<CandidateSolution> tempPopulation = new ArrayList<CandidateSolution>(population);
List<CandidateSolution> randomCandidates = new ArrayList<CandidateSolution>();
/* create parent pool */
for(int i = 0; i < parentPoolSize; i++)
{
/* select a random candidate solution from the temp population */
int randomlySelectedIndex = random.nextInt(tempPopulation.size());
CandidateSolution randomSelection = tempPopulation.get(randomlySelectedIndex);
randomCandidates.add(randomSelection);
/* delete the candidate from the temp population, so we can't pick it again */
tempPopulation.remove(randomlySelectedIndex);
}
/* Sort the population so that the best candidates are up front */
Collections.sort(randomCandidates);
/* return a list with size parentSelectionSize with the best CandidateSolutions */
return randomCandidates.subList(0, parentSelectionSize);
}
Slide 39 of 68
40. Passion for Technologyb.knopper@ncim.nl @BWKnopper
private List<CandidateSolution> parentSelection() {
List<CandidateSolution> tempPopulation = new ArrayList<CandidateSolution>(population);
List<CandidateSolution> randomCandidates = new ArrayList<CandidateSolution>();
/* create parent pool */
for(int i = 0; i < parentPoolSize; i++)
{
/* select a random candidate solution from the temp population */
int randomlySelectedIndex = random.nextInt(tempPopulation.size());
CandidateSolution randomSelection = tempPopulation.get(randomlySelectedIndex);
randomCandidates.add(randomSelection);
/* delete the candidate from the temp population, so we can't pick it again */
tempPopulation.remove(randomlySelectedIndex);
}
/* Sort the population so that the best candidates are up front */
Collections.sort(randomCandidates);
/* return a list with size parentSelectionSize with the best CandidateSolutions */
return randomCandidates.subList(0, parentSelectionSize);
}
Slide 40 of 68
41. Passion for Technologyb.knopper@ncim.nl @BWKnopper
private List<CandidateSolution> parentSelection() {
List<CandidateSolution> tempPopulation = new ArrayList<CandidateSolution>(population);
List<CandidateSolution> randomCandidates = new ArrayList<CandidateSolution>();
/* create parent pool */
for(int i = 0; i < parentPoolSize; i++)
{
/* select a random candidate solution from the temp population */
int randomlySelectedIndex = random.nextInt(tempPopulation.size());
CandidateSolution randomSelection = tempPopulation.get(randomlySelectedIndex);
randomCandidates.add(randomSelection);
/* delete the candidate from the temp population, so we can't pick it again */
tempPopulation.remove(randomlySelectedIndex);
}
/* Sort the population so that the best candidates are up front */
Collections.sort(randomCandidates);
/* return a list with size parentSelectionSize with the best CandidateSolutions */
return randomCandidates.subList(0, parentSelectionSize);
}
Slide 41 of 68
42. Passion for Technologyb.knopper@ncim.nl @BWKnopper
private List<CandidateSolution> parentSelection() {
List<CandidateSolution> tempPopulation = new ArrayList<CandidateSolution>(population);
List<CandidateSolution> randomCandidates = new ArrayList<CandidateSolution>();
/* create parent pool */
for(int i = 0; i < parentPoolSize; i++)
{
/* select a random candidate solution from the temp population */
int randomlySelectedIndex = random.nextInt(tempPopulation.size());
CandidateSolution randomSelection = tempPopulation.get(randomlySelectedIndex);
randomCandidates.add(randomSelection);
/* delete the candidate from the temp population, so we can't pick it again */
tempPopulation.remove(randomlySelectedIndex);
}
/* Sort the population so that the best candidates are up front */
Collections.sort(randomCandidates);
/* return a list with size parentSelectionSize with the best CandidateSolutions */
return randomCandidates.subList(0, parentSelectionSize);
}
Slide 42 of 68
43. Passion for Technologyb.knopper@ncim.nl @BWKnopper
EA Algorithm (Pseudocode)
INITIALISE population with random candidate solutions;
EVALUATE each candidate;
WHILE ( TERMINATION CONDITION is not satisfied ) {
1 SELECT parents;
2 RECOMBINE pairs of parents;
3 MUTATE the resulting offspring;
4 EVALUATE new candidates;
5 SELECT individuals for the next generation;
}
Slide 43 of 68
44. Passion for Technologyb.knopper@ncim.nl @BWKnopper
Recombination
• In our example:
• half-half does not work
• “Cut-and-crossfill”
1653421
1421
1245631
15421 135421 1635421 1425631
1245631 1245631 1245631
Slide 44 of 68
45. Passion for Technologyb.knopper@ncim.nl @BWKnopper
public List<CandidateSolution> recombine(CandidateSolution otherParent) {
/* get routes of both parents */
List<City> parentRoute1 = getRoute();
List<City> parentRoute2 = otherParent.getRoute();
/* initialize the routes for the children */
List<City> childRoute1 = new ArrayList<City>();
List<City> childRoute2 = new ArrayList<City>();
/* randomize cutIndex for "cross-and-fill point" */
int cutIndex = new Random().nextInt(parentRoute1.size());
/* copy the first part of the parents cut into the children */
childRoute1.addAll(parentRoute1.subList(0, cutIndex));
childRoute2.addAll(parentRoute2.subList(0, cutIndex));
/* perform crossfill for both children */
crossFill(childRoute1, parentRoute2, cutIndex);
crossFill(childRoute2, parentRoute1, cutIndex);
/* create new children using the new children routes */
CandidateSolution child1 = new CandidateSolution(childRoute1);
CandidateSolution child2 = new CandidateSolution(childRoute2);
/* put the children in a list and return it (omitted for layout reasons) */
}
Slide 45 of 68
46. Passion for Technologyb.knopper@ncim.nl @BWKnopper
public List<CandidateSolution> recombine(CandidateSolution otherParent) {
/* get routes of both parents */
List<City> parentRoute1 = getRoute();
List<City> parentRoute2 = otherParent.getRoute();
/* initialize the routes for the children */
List<City> childRoute1 = new ArrayList<City>();
List<City> childRoute2 = new ArrayList<City>();
/* randomize cutIndex for "cross-and-fill point" */
int cutIndex = new Random().nextInt(parentRoute1.size());
/* copy the first part of the parents cut into the children */
childRoute1.addAll(parentRoute1.subList(0, cutIndex));
childRoute2.addAll(parentRoute2.subList(0, cutIndex));
/* perform crossfill for both children */
crossFill(childRoute1, parentRoute2, cutIndex);
crossFill(childRoute2, parentRoute1, cutIndex);
/* create new children using the new children routes */
CandidateSolution child1 = new CandidateSolution(childRoute1);
CandidateSolution child2 = new CandidateSolution(childRoute2);
/* put the children in a list and return it (omitted for layout reasons) */
}
Slide 46 of 68
47. Passion for Technologyb.knopper@ncim.nl @BWKnopper
public List<CandidateSolution> recombine(CandidateSolution otherParent) {
/* get routes of both parents */
List<City> parentRoute1 = getRoute();
List<City> parentRoute2 = otherParent.getRoute();
/* initialize the routes for the children */
List<City> childRoute1 = new ArrayList<City>();
List<City> childRoute2 = new ArrayList<City>();
/* randomize cutIndex for "cross-and-fill point" */
int cutIndex = new Random().nextInt(parentRoute1.size());
/* copy the first part of the parents cut into the children */
childRoute1.addAll(parentRoute1.subList(0, cutIndex));
childRoute2.addAll(parentRoute2.subList(0, cutIndex));
/* perform crossfill for both children */
crossFill(childRoute1, parentRoute2, cutIndex);
crossFill(childRoute2, parentRoute1, cutIndex);
/* create new children using the new children routes */
CandidateSolution child1 = new CandidateSolution(childRoute1);
CandidateSolution child2 = new CandidateSolution(childRoute2);
/* put the children in a list and return it (omitted for layout reasons) */
}
Slide 47 of 68
48. Passion for Technologyb.knopper@ncim.nl @BWKnopper
public List<CandidateSolution> recombine(CandidateSolution otherParent) {
/* get routes of both parents */
List<City> parentRoute1 = getRoute();
List<City> parentRoute2 = otherParent.getRoute();
/* initialize the routes for the children */
List<City> childRoute1 = new ArrayList<City>();
List<City> childRoute2 = new ArrayList<City>();
/* randomize cutIndex for "cross-and-fill point" */
int cutIndex = new Random().nextInt(parentRoute1.size());
/* copy the first part of the parents cut into the children */
childRoute1.addAll(parentRoute1.subList(0, cutIndex));
childRoute2.addAll(parentRoute2.subList(0, cutIndex));
/* perform crossfill for both children */
crossFill(childRoute1, parentRoute2, cutIndex);
crossFill(childRoute2, parentRoute1, cutIndex);
/* create new children using the new children routes */
CandidateSolution child1 = new CandidateSolution(childRoute1);
CandidateSolution child2 = new CandidateSolution(childRoute2);
/* put the children in a list and return it (omitted for layout reasons) */
}
Slide 48 of 68
49. Passion for Technologyb.knopper@ncim.nl @BWKnopper
public List<CandidateSolution> recombine(CandidateSolution otherParent) {
/* get routes of both parents */
List<City> parentRoute1 = getRoute();
List<City> parentRoute2 = otherParent.getRoute();
/* initialize the routes for the children */
List<City> childRoute1 = new ArrayList<City>();
List<City> childRoute2 = new ArrayList<City>();
/* randomize cutIndex for "cross-and-fill point" */
int cutIndex = new Random().nextInt(parentRoute1.size());
/* copy the first part of the parents cut into the children */
childRoute1.addAll(parentRoute1.subList(0, cutIndex));
childRoute2.addAll(parentRoute2.subList(0, cutIndex));
/* perform crossfill for both children */
crossFill(childRoute1, parentRoute2, cutIndex);
crossFill(childRoute2, parentRoute1, cutIndex);
/* create new children using the new children routes */
CandidateSolution child1 = new CandidateSolution(childRoute1);
CandidateSolution child2 = new CandidateSolution(childRoute2);
/* put the children in a list and return it (omitted for layout reasons) */
}
Slide 49 of 68
50. Passion for Technologyb.knopper@ncim.nl @BWKnopper
public List<CandidateSolution> recombine(CandidateSolution otherParent) {
/* get routes of both parents */
List<City> parentRoute1 = getRoute();
List<City> parentRoute2 = otherParent.getRoute();
/* initialize the routes for the children */
List<City> childRoute1 = new ArrayList<City>();
List<City> childRoute2 = new ArrayList<City>();
/* randomize cutIndex for "cross-and-fill point" */
int cutIndex = new Random().nextInt(parentRoute1.size());
/* copy the first part of the parents cut into the children */
childRoute1.addAll(parentRoute1.subList(0, cutIndex));
childRoute2.addAll(parentRoute2.subList(0, cutIndex));
/* perform crossfill for both children */
crossFill(childRoute1, parentRoute2, cutIndex);
crossFill(childRoute2, parentRoute1, cutIndex);
/* create new children using the new children routes */
CandidateSolution child1 = new CandidateSolution(childRoute1);
CandidateSolution child2 = new CandidateSolution(childRoute2);
/* put the children in a list and return it (omitted for layout reasons) */
}
Slide 50 of 68
51. Passion for Technologyb.knopper@ncim.nl @BWKnopper
/**
* Check the rest of the route in the crossing parent and add the cities
* that are not yet in the child (in the order of the route of the crossing
* parent)
*/
private void crossFill(List<City> childRoute, List<City> parentRoute,
int cutIndex) {
/* traverse the parent route from the cut index on and add every city not yet in the child to the child */
for (int i = cutIndex; i < parentRoute.size(); i++) {
City nextCityOnRoute = parentRoute.get(i);
if (!childRoute.contains(nextCityOnRoute)) {
childRoute.add(nextCityOnRoute);
}
}
/* traverse the parent route from the start of the route and add every city not yet in the child to the child */
for (int i = 0; i < cutIndex; i++) {
City nextCityOnRoute = parentRoute.get(i);
if (!childRoute.contains(nextCityOnRoute)) {
childRoute.add(nextCityOnRoute);
}
}
}
1425631
1425631
Slide 51 of 68
52. Passion for Technologyb.knopper@ncim.nl @BWKnopper
EA Algorithm (Pseudocode)
INITIALISE population with random candidate solutions;
EVALUATE each candidate;
WHILE ( TERMINATION CONDITION is not satisfied ) {
1 SELECT parents;
2 RECOMBINE pairs of parents;
3 MUTATE the resulting offspring;
4 EVALUATE new candidates;
5 SELECT individuals for the next generation;
}
Slide 52 of 68
53. Passion for Technologyb.knopper@ncim.nl @BWKnopper
1653421
Mutation
• Change of nr won’t work
• Infeasible candidate solution
• Swap to the rescue!
1653421 1253461
Slide 53 of 68
54. Passion for Technologyb.knopper@ncim.nl @BWKnopper
/**
* Mutates the current individual by swapping two random cities in its
* route.
*/
public void mutate() { 1653421
1653421
1253461
Random random = new Random();
/* randomly select two indices in the route */
int indexFirstCity = random.nextInt(route.size());
int indexSecondCity = random.nextInt(route.size());
/* Make sure they are different */
while (indexFirstCity == indexSecondCity) {
indexSecondCity = random.nextInt(route.size());
}
/* retrieve the Cities on the given indices */
City firstCity = route.get(indexFirstCity);
City secondCity = route.get(indexSecondCity);
/* Changer! */
route.set(indexFirstCity, secondCity);
route.set(indexSecondCity, firstCity);
}
Slide 54 of 68
55. Passion for Technologyb.knopper@ncim.nl @BWKnopper
EA Algorithm (Pseudocode)
INITIALISE population with random candidate solutions;
EVALUATE each candidate;
WHILE ( TERMINATION CONDITION is not satisfied ) {
1 SELECT parents;
2 RECOMBINE pairs of parents;
3 MUTATE the resulting offspring;
4 EVALUATE new candidates;
5 SELECT individuals for the next generation;
}
Slide 55 of 68
56. Passion for Technologyb.knopper@ncim.nl @BWKnopper
EA Algorithm (Pseudocode)
INITIALISE population with random candidate solutions;
EVALUATE each candidate;
WHILE ( TERMINATION CONDITION is not satisfied ) {
1 SELECT parents;
2 RECOMBINE pairs of parents;
3 MUTATE the resulting offspring;
4 EVALUATE new candidates;
5 SELECT individuals for the next generation;
}
Slide 56 of 68
58. Passion for Technologyb.knopper@ncim.nl @BWKnopper
/**
* Selects the survivors by removing the worst candidate
* solutions from the list, so we have the original
* population size again
*/
private void selectSurvivors() {
Collections.sort(population);
population = population.subList(0, populationSize);
}
Slide 58 of 68
59. Passion for Technologyb.knopper@ncim.nl @BWKnopper
Tuning…
• Mutation probability
• Population size
• Nr of offspring
• Termination condition (# runs or fitness)
• Parent selection
• Survival selection
• Initialisation
• Random
Slide 59 of 68
60. Passion for Technologyb.knopper@ncim.nl @BWKnopper
EA Behavior
Figures from “Introduction to Evolutionary Computing” by A.E. Eiben & J.E. Smith (Springer)
Slide 60 of 68
61. Passion for Technologyb.knopper@ncim.nl @BWKnopper
Demo!
• Used NASA World Wind to map route on
• https://github.com/ncim-tsp/JavaOneTSP.git
Slide 61 of 68
64. Passion for Technologyb.knopper@ncim.nl @BWKnopper
With great power comes great responsibility
• Can I find a solution using a brute-force approach?
• (within a reasonable amount of time)
• Am I facing an optimization or search problem?
• Can I encode a candidate solution to the problem?
• Representation possible?
• Can I determine the fitness of a candidate solution?
Slide 64 of 68
65. Passion for Technologyb.knopper@ncim.nl @BWKnopper
than a fool can learn from a wise answer”
– Bruce Lee
“A wise man can learn more from a foolish question
Slide 65 of 68
66. Passion for Technologyb.knopper@ncim.nl @BWKnopper
Additional questions?
• Contact me on @BWKnopper
• Google it!
• There’s lots to find…
• Papers
• Demo’s
• Aforementioned Frameworks/API’s
Slide 66 of 68