Hellisotherpeople / Genetic-Algorithims-Python

Some fun code I wrote. One file does string matching and another one solves the Knapsack problem.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Genetic-Algorithims-Python

Some fun code I wrote. One file does string matching and another one solves the Knapsack problem.

The Knapsack problem is solved using a python implementation of bitarrays. Each gene is repersented with as an array of actual bits, not bloated bools or worse yet, ints. Such a design decision was made because I am solving the 0-1 knapsack problem. It's trivial to replace these bitarrays with normal lists and convert this GA To one that can solve the more general knapsack problem.

I also used techniques like pre-allocating memory in my lists of bitarrays (I know the size ahead of time and want to avoid repeated appends).

I'm impressed by the results I can achieve and may use this to make my Skyrim runs more fun :)

About

Some fun code I wrote. One file does string matching and another one solves the Knapsack problem.

License:GNU General Public License v3.0


Languages

Language:Python 100.0%