Skip to main content

📦pycuga

Pycuga (PYthon CUda Genetic Algorithm) provides a package for performing island-based genetic algorithm on Python and CUDA.

  • Methods for migartion, selection and mutation are implemented already. Users only need to pick the method during initialisation.
  • User needs to define evaluation using Cuda code.

Motivation

  • When I worked on my previous project on Solving Maximum Satisfiability Problem using CUDA, I realised a lot of code could be reused, which save a lot of development time for solving other optimisation problems using genetic algorithm and CUDA.

Parameters

Methods currently supported
Selection Elitism, Roulette Wheel
Crossover One (point), Two (points), Uniform
Mutation Number
pip install pycuga
p1 = PyCUGA(constArr, chromosomeSize, stringPlaceholder, mutationNumber, selectionMode, crossoverMode)
p1. launchKernel(islandSize, blockSize , chromosomeNo, isTime, timeAllowed, migrationRounds, rounds)
  • constArr (numpy array): defines the details of the problem

  • chromosomeSize (int): number of variables in a chromosome

  • stringPlaceholder (string): defines the evalutaion method and other constants

  • mutationNumber (int): /

  • selectionMode (string): "elitism" or "roulettewheel"

  • crossoverMode (string): "one" or "two" or "uniform"

  • islandSize (int): size of an island

  • blockSize (int): Cuda block size

  • chromosomeNo (int): number of chromosomes

  • migrationRounds (int): number of rounds per migration

  • isTime (bool): stopped by time or number of rounds

  • timeAllowed (int): seconds allowed

  • rounds (int): total number of rounds

Examples here.

Colab MaxSat example here.

Limitations

  • Use multiples of 32 (for chromosome parameters) to avoid bugs and increase efficiency.
  • Island migration is limited to 1 item currently
  • Lack unit testing

❗Disclaimer

This is a mini project which I've put quite a lot of time and effort into, but I can't take responsibility for any bugs nor errors.

Metadata

Release files for pycuga 0.0.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for pycuga 0.0.14
File Interpreter ABI Platform
pycuga-0.0.14-py3-none-any.whl Python 3 none any Details

Release files / pycuga-0.0.14-py3-none-any.whl

Download URL pycuga-0.0.14-py3-none-any.whl
Size 20.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef65e42816c67f9acf64667daddfec71b4c3318f02d7d5bd41f20dc2b5f8c8fa
BLAKE2b-256 checksum
How to use checksums
7f17e5d358000f4745bded9600f9537308d317e6e790be8fa07ad625aa11c057
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release history Release notifications | RSS feed

This release

0.0.14 This release

1 release file

0.0.13

1 release file

0.0.12

1 release file

0.0.11

1 release file

0.0.10

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page