Project OOP Backup

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 22

Genetic Algorithm

To solve Travelling Salesman Problem


Group 1’s member:
• Hoang Van An 20204864
• Nguyen The An 20204865
• Nguyen Phuc Truong An 20200005
• Nguyen Truong Truong An 20204865
ASSIGNMENT
Hoang Van An: • components package (20%): – Design package – toString method •
Construct class diagram (30%) • geneticalgorithm package (30%) – UpdateFitness method
– Try different strategies for algorithms • gui package (60%) – Create Help button with
guidelines for the application. – Create Print route button. – Improve GUI class
(ButtonListener, color, size) – Improve Draw class (color, size, experiment the proper scale
to fit the frame) – Create class RoundJTextField, Instructions. • presentation slide (90%) •
report (20%)
Nguyen Truong Truong An: • Construct use case diagram (40%) • components package
(10%) • presentation slide (10%) • report (20%)
Nguyen The An: • Construct class diagram (60%) • Construct use case diagram (60%) •
components package (70%): – Design package – Create classes Node, Individual, Route,
Population • geneticalgorithm package (70%) – Design package – GeneticOperator class –
Selection, CrossOVer, Mutation class – TournamentSelection, TwoPointCrossOver,
TwoPointSwappingMutation class • gui package (40%) – Create Draw class – Create initial
GUI class – Implement Timer in GUI • report (50%)
Nguyen Phuc Truong An: • Construct class diagram (10%) • components package (10%):
comparator method • geneticalgorithm package (10%): Handle Exception • report (10%) :
Conclusion
TABLE OF
CONTENT

Problem Diagram OOP Demo and


statement techniques further work
Overview of TSP and Use case diagram, Explanation of OOP Demo the application
Genetic algorithm General and detailed techniques in our with GUI and some
class diagram design more explanation
Problem statement

Travelling salesman problem


(TSP):
Given a set of cities and
distances between every pair of
cities, the problem is to find the
shortest possible route that
visits every city exactly once
and returns to the starting point.

Optimal route!!!
Problem statement
Genetic Algorithm (GA) can determine
the (near) optimal route.
Problem statement
Genetic Algorithm (GA) can determine
the (near) optimal route.
Genetic algorithm (GA) is a
metaheuristic inspired by the process of
natural selection operators such as
mutation, crossover and selection.
Diagrams

01 02 03
Use case General Class Class diagram
diagram diagram for packages
Use case
diagram
General Class diagram
Components Class Diagram
GA Class Diagram
GUI Class
Diagram
OOP TECHNIQUES
EXPLANATION

Encapsulation Polymorphism

Abstraction Aggregation

Inheritance Composition
Encapsulation & Abstraction

Components Class Diagram


Encapsulation & Abstraction

Genetic Algorithm Class Diagram


Encapsulation & Abstraction

Abstract class

Child classes
(not abstract)

“ga” package
Inheritance and Polymorphism
Abstract class
GeneticOperator
with a protected Selection,
attribute crossover,
population and mutation
public abstract will inherit the
method execute. attribute population
and method
execute.

For each genetic operator, there are many strategies to do.


Example: we can do tournament selection or Boltzmann
selection
Inheritance and Polymorphism

Override compare method


Compare 2 individuals by their
fitness in selection operator and sorting
the populatuion
Inheritance and Polymorphism

Override paintComponent
and paintBorder methods
Create a text field in shape of
round border rectangle

Override paint method


Draw the process of finding the best
route through nodes (cities).
Association, Aggregation, Composition
City 2 City 3

Route 2 3

is a composition Route: 0-2-1-3-0


of Nodes
1
0
Start: city 0 City 1

Population
is a composition
of Individuals
GUI Demonstration

Visit link: https://tinyurl.com/2zhh22j6


Thank you for listening
Group 1’s member:
• Hoang Van An 20204864
• Nguyen The An 20204865
• Nguyen Phuc Truong An 20200005
• Nguyen Truong Truong An 20204865

You might also like