/NP-Complete-2-Partitions-with-Genetic-Algorithms

Genetic Algorithm project based off of the NP-Complete Partition problem

Primary LanguageJava

2-Partition

What is the 2-Partition NP-Complete Problem?

In number theory and computer science, the partition problem, or number partitioning,[1] is the task of deciding whether a given multiset S of positive integers can be partitioned into two subsets S1 and S2 such that the sum of the numbers in S1 equals the sum of the numbers in S2

2-Partition Link

Running The Program

Change into the src folder

cd src/

Compile the files

javac *.java

Run the program with the specified input and output files one at a time Each class is composed of a different phase.

  • Phase 1: BruteForce
  • Phase 2: Random
  • Phase 3: Genetic Algorithm
  • Brute Force Phase

    java BruteForce -i input.txt -o output.txt

    java BruteForce -i input2.txt -o output.txt

    java BruteForce -i input3.txt -o output.txt

    Random Phase

    java Random -i input.txt -o output.txt

    java Random -i input2.txt -o output.txt

    java Random -i input3.txt -o output.txt

    Genetic Algorithm Phase

    java GeneticAlgorithm -i input.txt -o output.txt

    java GeneticAlgorithm -i input2.txt -o output.txt

    java GeneticAlgorithm -i input3.txt -o output.txt