Skip to content

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

License

Notifications You must be signed in to change notification settings

Hellisotherpeople/Genetic-Algorithims-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages