Skip to main content

A computational intelligence library for Python.

Project description

cilpy logo

cilpy: A Computational Intelligence Library for Python.


cilpy is a Python library for computational intelligence, with a focus on nature-inspired optimization algorithms. It provides a flexible and extensible framework for researchers and practitioners to experiment with various optimization problems, including constrained, multi-objective, and many- objective optimization.

cilpy is structured into distinct components for problem generation (cilpy.problem), solving (cilpy.solver), and algorithm comparison (cilpy.compare). Users can easily introduce new problems or solvers by implementing the provided abstract interfaces. These interfaces were designed with the ability to solve a wide variety of optimization problems in mind, including:

  • Single and multi-objective optimization
  • Constrained and unconstrained problems
  • Static and dynamic optimization problems

Installing cilpy

cilpy can be installed from source:

git clone git@git.cs.sun.ac.za:Computer-Science/rw771/2025/24717274-AE4-src.git
cd 24717274-AE4-src
python3 -m pip install -e .

Usage Example

Here is a basic pseudocode example of how to set up and run an experiment with cilpy. This demonstrates how to define a problem, configure a solver, and use the ExperimentRunner (which orchestrates interaction between the problem and the solver) to execute the optimization task.

from cilpy.runner import ExperimentRunner
from cilpy.problem import SomeProblem
from cilpy.solver import SomeSolver

# --- 1. Define the Problems ---
dim = 3
dom = (-5.12, 5.12)
problems_to_run = [
    SomeProblem(dimension=dim, domain=dom)
]

# --- 2. Define the Solvers and their parameters ---
# Note: Although the `solver` interface requires the `problem` to be specified
# during solver initialization, it is omitted here as the runner will assign it.
solver_configs = [
    {
        "class": SomeSolver,
        "params": {
            "name": "MySolver",
            # Other solver parameters
        }
    },
]

# --- 3. Define the Experiment parameters ---
number_of_runs = 30 # how many times an experiment should be repeated
max_iter = 5000     # how many iterations per experiment

# --- 4. Create and run the experiments ---
runner = ExperimentRunner(
    problems=problems_to_run,
    solver_configurations=solver_configs,
    num_runs=number_of_runs,
    max_iterations=max_iter
)
runner.run_experiments()

See examples for actual examples of how cilpy is used.

Documentation

The full documentation can be found in the docs/ folder and can be built and served locally:

mkdocs build
mkdocs serve

Contributing

We welcome contributions to cilpy! If you are interested in contributing, please read our contributing guidelines for details on our code of conduct and the process for submitting pull requests.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cilpy-0.0.1.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cilpy-0.0.1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file cilpy-0.0.1.tar.gz.

File metadata

  • Download URL: cilpy-0.0.1.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for cilpy-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b777c65fc5cbd730947fe3a9ea6f62ecca3b2f0fb40681e7fc1db6b8510856d7
MD5 dbf46c88d90f46902c2692305e510522
BLAKE2b-256 f98af7b6cf8399cf94242714c143c40c0c8f0ea68b174a9992cae525af3c5714

See more details on using hashes here.

File details

Details for the file cilpy-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: cilpy-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for cilpy-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 72f579a4db0bdd1bc4c3b5495b1021028459d62131fa396aa1316c0115f8a709
MD5 2f50cb50000acaffc800a94240e1a893
BLAKE2b-256 27e15867e05c6657a36a8ef84b5ceaf55e5616470ea6dd09ee74dcd36a0c63ee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page