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
cilpy can be installed using pip:
pip install cilpy
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.
The full documentation can be found in the docs/ folder and can be served
locally:
mkdocs serveWe 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.