yaroslavoliinyk / PointsDivider

The program, which divides 2 sets of dots with a line, which is represented as a polynomial. The best polynomial is searched using Genetic algorithm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PointsDivider using Genetic Algorithm

Created by Yaroslav Oliinyk

  • The purpose of the following program is to create a polinomium which will separate 2 sets of dots(RED dots from BLUE dots)

  • We have such polinomium: y = a + bx + cx2

  • Our genetic algorithm will find the best coefficients: a,b,c

POINTS DIVIDER ALGORITHM

Launching the program

  1. Download the repository
  2. Unzip the repository in "Downloads" folder
  3. You'll have the following package: PointsDivider-master
  4. Enter this package: "cd ~/Downloads/PointsDivider-master/"
  5. Run the next command to extract the program: "tar -xJf PointsDivider.tar.xz"
  6. Use the following command: "cd ~/Downloads/PointsDivider-master/PointsDivider/PointsDivider/src"
  7. Then this: "javac -cp jcommon-1.0.23.jar:jfreechart-1.0.19.jar: Main.java"
  8. Then: "java -cp jcommon-1.0.23.jar:jfreechart-1.0.19.jar: Main"
  9. Well done! The program is running.

Interface and controlling

  • The program will propose you to insert RED and BLUE dots by yourself or generate them.

Choice

  • In case of choosing insert by yourself you will need to write the coordinates of firstly RED points(which are also called POSITIVE)
  • For example you've entered 5 points and you want to stop, then write in the coordinate something that's not a number and you'll be switched to writing coordinates of BLUE points

Insert RED dots

  • After writing coordinates of BLUE(NEGATIVE) points simply as it was with RED points write smth, that's not a number to finish entering points.

Insert BLUE dots

  • In case you chose to generate points, they will be geneated right away without effort.

Generation

  • Then after all the points are entered, the algorithm starts to work and eventually you should receive a graph with polinomials, starting from the first generation to the last.

Example 1:

Graph 1

Example 2:

Graph 2

  • The last polinomial will be the best divider.
    • In Example 1 is a red polinomium
    • In Example 2 is a pink polinomium
  • Meanwhile in console you can observe the evolution of the population.
Staring population

Staring population

Evaluation

Evaluation population

Parents

Parents population

Crossover

Crossover population

Mutation

Mutation population

Evaluation of NEW population

Evaluation population

Have fun! 👍

All rights are reserved
	2019

About

The program, which divides 2 sets of dots with a line, which is represented as a polynomial. The best polynomial is searched using Genetic algorithm