Skip to main content

PyPI PyPI - License PyPI - Downloads codecov

Evobench

Evobench is a collection of benchmark problems dedicated for optimization problems (both synthetic and practical). Please note that Python isn't still best tool for solving optimization problems, as loops are still slow. This might change in a next couple of years. Our main intention is to provide easily accessible package for PoC, research or teaching purposes.

Getting started

pip install evobench
import evobench


trap = evobench.discrete.Trap(blocks=[4, 4, 4])

population = trap.initialize_population(population_size=1e3)
trap.evaluate_population(population)

Fitness evaluation produces side effect of defining solution's fitness.

print(population.solutions[0].fitness)

You can also evaluate single solution.

fitness = trap.evaluate_solution(population.solutions[0])

Every time you evaluate undefined solution we increment ffe counter. Solution is not evaluated again, if it didn't change. You can access it through a benchmark instance.

print(trap.ffe)

Overview

This package exposes following problems.

Practical

  • TSP
  • cVRP

Discrete

  • Trap
  • Step Trap
  • Bimodal
  • Step Bimodal
  • HIFF
  • Ising Spin Glass

Continuous

  • Trap
  • Step Trap
  • Multimodal
  • Step Multimodal
  • Sawtooth

Compound Benchmark

Creating your own compound benchmarks is really easy. You just need to define your sub-benchmarks and pass them as a list. All other fuctions work just the same as with the normal Benchmark.

from evobench import CompoundBenchmark, continuous, discrete


benchmark = CompoundBenchmark(
    benchmarks=[
        discrete.Trap(blocks=[5, 2, 4]),
        continuous.Trap(blocks=[3, 6, 4])
    ],
    use_shuffle=True,
    multiprocessing=True,
    verbose=1
)

population = benchmark.initialize_population(population_size=1000)
benchmark.evaluate_population(population)

Ising Spin Glass

To instantiate ISG you need to pass specific problem configuration.

from evobench.discrete import IsingSpinGlass


isg = IsingSpinGlass('IsingSpinGlass_pm_16_0')

You can find 5,000 instances at evobench\discrete\isg\data folder. Instances vary in length and complexity.

How to implement your own benchmark

Inherit Benchmark class from evobench.benchmark. Then implement:

  • def _evaluate_solution(self, solution: Solution) -> float
  • def random_solutions(self, population_size: int) -> List[Solution]

Partially separable

You need to inherit Separable class from evobench.separable. Then just implement:

  • def evaluate_block(self, block: np.ndarray) -> int.

Best follow evobench.discrete.trap implementation.

Linkage quality

Linkage quality metrics are located at evobench.linkage.metrics. Available metrics:

  • Mean Reciprocal Ranking @K
  • Mean Average Precision @K
  • NDCG @K $B
  • Fill Quality

Coming soon

We'll be adding more problems in the near future. If you're looking for any particular problem, please mail us or open an issue. We're working on linkage quality metrics. Once they're published, we'll be incorporating them to this package.

Release files for evobench 0.5.2

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

Source distribution (sdist)

Source distribution for evobench 0.5.2
File Size Uploaded
evobench-0.5.2.tar.gz 21.9 kB Details

Built distribution (wheel)

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

Total release size: 12.9 MB

Release files / evobench-0.5.2.tar.gz

Download URL evobench-0.5.2.tar.gz
Size 21.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2f7ca61e77f08e4a3e14e3b657eb67e910a9a8ffc6cbed19b364a18e6df00608
BLAKE2b-256 checksum
How to use checksums
9787aa542f8eeead79baeefdaa83608bd0cb54511f253e51a1e002c30181258b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.1.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.7.10

Release files / evobench-0.5.2-py3-none-any.whl

Download URL evobench-0.5.2-py3-none-any.whl
Size 12.9 MB
Tags Python 3
SHA-256 checksum
How to use checksums
83013c6a9a81740d192d53f945caca90c807f20430d80c695d2fbaf7dbd49e7e
BLAKE2b-256 checksum
How to use checksums
29842bb23d259de4a8be26721f6aecf3ef36f9742a7c94271b2ca95f1c6d4c26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.1.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.7.10

Release history Release notifications | RSS feed

This release

0.5.2 This release

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

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