Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 

kotlin-genetic-algorithm

Problem

Description

Every product has a name, price and size. With 6 products, find a combination with higher value/price and lowest size. Considering mutation rate, limit of generations and size population.

Observation

When size it's bigger than MAX_SIZE (5.0), the sumValues/rating is defined as 1.0

Output

Max size: 5.0

# PRODUCTS
'Zenphone 5Z' is $ 1700.0 and size 1.0
'Iphone X' is $ 6000.0 and size 1.0
'Samsung Note 9' is $ 7000.0 and size 1.0
'Cartão de Memória' is $ 300.0 and size 0.5
'Capinha' is $ 15.0 and size 0.5
'Mi2' is $ 800.0 and size 2.5


G: 0	 -> $: 1115.0	 and has 3.5	|	Chromossome: [false, false, false, true, true, true]
G: 1	 -> $: 1.0	 and has 5.5	|	Chromossome: [true, false, true, true, true, true]
G: 2	 -> $: 13000.0	 and has 2.0	|	Chromossome: [false, true, true, false, false, false]
G: 3	 -> $: 1.0	 and has 5.5	|	Chromossome: [false, true, true, true, true, true]
G: 4	 -> $: 2515.0	 and has 4.0	|	Chromossome: [true, false, false, false, true, true]
G: 5	 -> $: 6000.0	 and has 1.0	|	Chromossome: [false, true, false, false, false, false]
G: 6	 -> $: 7800.0	 and has 3.5	|	Chromossome: [false, false, true, false, false, true]
G: 7	 -> $: 8000.0	 and has 2.5	|	Chromossome: [true, true, false, true, false, false]



### BEST CASE GENERATION 2 ###
### PRODUCTS:
'Iphone X' is $ 6000.0 and size 1.0
'Samsung Note 9' is $ 7000.0 and size 1.0

Chromosome:        [false, true, true, false, false, false]

Sum values: 13000.0
Sum sizes: 2.0

Developed with programming language Kotlin using IntelliJ Community Edition

About

No description, website, or topics provided.

Resources

Packages

No packages published

Languages