STIN3084-A192-GENETIC-ALGORITHM / LAB-TEST

0 stars 0 forks source link

LAB TEST 1 #1

Open azmanyasin opened 4 years ago

azmanyasin commented 4 years ago

INSTRUCTION

A192 - TEST LAB 1 – STIN3084 - 5 JULY 2020

Suppose a genetic algorithm uses chromosomes of the form x = abcdefgh with a fixed length of eight genes. Each gene can be any digit between 0 and 9. Let the fitness of individual x be calculated as: f(x) = (a + b) − (c + d) + (e + f) − (g + h) , and let the initial population consist of four individuals with the following chromosomes: x1 = 6 5 4 1 3 5 3 2 x2 = 8 7 1 2 6 6 0 1 x3 = 2 3 9 2 1 2 8 5 x4 = 4 1 8 5 2 0 9 4

Write your program into the following smaller pieces and test each of the functions listed below separately: • randomNumber(length) returns a random genome number of a given length. • makePopulation(size, length) returns a new randomly created population of the specified size, represented as a list of genomes of the specified length. • fitness(genome) returns the fitness value of a genome. • evaluateFitness(population) returns a pair of values: the average fitness of the population as a whole and the fitness of the best individual in the population. Arrange them in order with the fittest first and the least fit last.

SUBMISSION

  1. Java Coding
  2. Output
  3. Please submit your github link ONLY for posting here
  4. Due date: 5 July 2020 (10.00 am)
wilsonkhor1997 commented 4 years ago

https://github.com/wilsonkhor1997/GA-Test/issues/1#issue-650985416 https://github.com/wilsonkhor1997/GA-Test/issues/2#issue-650985503

aizathakimi97 commented 4 years ago

test.GA.rar.zip

abraranuar commented 4 years ago

labtest.zip

Jayyijianyi commented 4 years ago

test1.txt