Skip to main content

GeneralDichotomy

A general and minimalist toolkit for multi-objective optimization

GeneralDichotomy is a library and a package to enumerate supported extreme solutions of general multi-objective optimization problems.

This package is independent of any single-objective optimization solver. The user implements the solving function that is called by the GeneralDichotomy algorithm. In return, the solving function provides to the algorithm the objective cost vector associated to the solution. Solution assignments are managed by the user and they can be associated to the objective cost vectors from their indices at the end of the search.

Internally, the GeneralDichotomy algorithm relies on polytope vertices enumeration to maintain a precise description of the convex hull of the Pareto front. Two polytope computation libraries can be currently used as backends: CDD and PPL. This organized search procedure provide an exhaustive set of supported (extreme) solutions when such set is enumerable. More generally, this tool can also be used with stochastic and heuristic optimizers to create a proxy of the Pareto convex hull.

The GeneralDichotomy core algorithm is implemented in C++. A C++ and a Python interface are available for the user-side (see examples). An additional Julia implementation interfaced with the JuMP package is also available.

Usage

The GeneralDichomy package can be used via the C++ or the Python programming interface. In both cases, the used creates a class where they can implement the call to their solver (which can be run from an external package for instance).

pygeneraldichotomy

Getting started

A simple example for solving linear assignment problems with cpmpy as single-objective optimization backend:

from pygeneraldichotomy import GeneralDichotomy, AbstractSolver
import cpmpy as cp
import numpy as np

class MyLapSolver(AbstractSolver):

    def __init__(self, instance):
        self.instance = instance

    def nobj(self):
        return self.instance.shape[0]

    def is_new(self, is_new_arg):
        ...

    def solve(self, weights, adj_solutions):
        nvar = self.instance.shape[1]
        x = cp.boolvar(shape=(nvar,nvar), name="x")
        weighted_obj = np.tensordot(weights, self.instance, axes=1)
        m = cp.Model([cp.sum(x[i])==1 for i in range(self.instance.shape[1])], minimize=cp.sum(weighted_obj*x))
        assert(m.solve())
        y = np.sum(x.value()*self.instance, (1,2))
        z = (y*weights).sum()
        assert(abs(m.objective_value() - z) <= 1e-3)
        return y.tolist(),z

obj1 = np.array([[3,6,4,5],
                [2,3,5,4],
                [3,5,4,2],
                [4,5,3,6]])
obj2 = np.array([[2,3,5,4],
                [5,3,4,3],
                [5,2,6,4],
                [4,5,2,5]])
obj3 = np.array([[4,2,4,2],
                [4,2,4,6],
                [4,2,6,3],
                [2,4,5,3]])

lapsolver = MyLapSolver(np.stack([obj1, obj2, obj3]))
gdalgorithm = GeneralDichotomy(lapsolver)

res = gdalgorithm.run(verbose=0)

print('solution cost vectors: ')
for elt in res[0]:
    print(elt)

install from releases

pygeneraldichotomy is available on pypi! It can be easily installed:

pip install pygeneraldichotomy

⚠️ We strongly recommend to install it in a virtual environment (conda, venv, ...) as it is still in a prototyping phase.

build from sources

Build and install from sources:

python -m build --wheel
pip install dist/*.whl

Build and test locally (for developers only):

cd "your_build_directory"
cmake .. [...]
cmake --build . -t pygdichotomy
export PYTHONPATH="your_build_directory"
python your_test_script.py

Or, in your python script:

import sys
sys.path.append("path_to_your_build_directory")

libgeneraldichotomy

libgeneraldichotomy is the C++ library

Library and package compilation

As a C++ library, the GeneralDichotomy development package must be compiled from its sources to be tested. Compilation instructions can be found on the dedicated wiki page [[Library compilation|Library-compilation]]. Note that the Python binding also needs a compilation step.

Examples

  • Linear assignment [cpp,ortools]

cmake --build . -t example_lap_cpp_otools

  • Linear assignment [cpp,toulbar2]

cmake --build . -t example_lap_cpp_tb2

  • Linear assignment [python,pytoulbar2]

This example depends on the python package pytoulbar2 (python binding of the toulbar2 solver). It can be installed via pip install pytoulbar2 in a python environment.

To run the example from the example/python_lap directory:

export PYTHONPATH="${PYTHONPATH}:generaldichotomy_build_dir/pygeneraldichotomy" && python3 python_lap.py

Metadata

Release files for pygeneraldichotomy 0.0.1.5

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

Source distribution (sdist)

Source distribution for pygeneraldichotomy 0.0.1.5
File Size Uploaded
pygeneraldichotomy-0.0.1.5.tar.gz 32.6 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pygeneraldichotomy 0.0.1.5
File
pygeneraldichotomy-0.0.1.5-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 Details
pygeneraldichotomy-0.0.1.5-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 Details
pygeneraldichotomy-0.0.1.5-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 Details
pygeneraldichotomy-0.0.1.5-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.24+ x86-64 Details
pygeneraldichotomy-0.0.1.5-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 Details
pygeneraldichotomy-0.0.1.5-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 Details
pygeneraldichotomy-0.0.1.5-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 Details
pygeneraldichotomy-0.0.1.5-cp38-cp38-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 Details

Total release size: 1.1 MB

Release files / pygeneraldichotomy-0.0.1.5.tar.gz

Download URL pygeneraldichotomy-0.0.1.5.tar.gz
Size 32.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7a4de221f4f8384e7515fff85f2141729c4cdf7c0489ae2c0d5b1ead62d5af12
BLAKE2b-256 checksum
How to use checksums
41fb01b6640a16a27eed6bf6a563e22cff860a4fea47b3b3469375a9597ba801
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / pygeneraldichotomy-0.0.1.5-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL pygeneraldichotomy-0.0.1.5-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 131.4 kB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b9813f280a82bb59a1617aa4f9582a5c51044191396b740c1bf698ecd06f1cfb
BLAKE2b-256 checksum
How to use checksums
4142ad2ae0a54656b768a35cf48224d84b3cda966f056735b0d7eec4e8877284
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / pygeneraldichotomy-0.0.1.5-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL pygeneraldichotomy-0.0.1.5-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 131.2 kB
Tags CPython 3.14 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
05517fd90510c723144a2b5ef98122d5f97f5141cbf23a2c16ba5e142e11ac09
BLAKE2b-256 checksum
How to use checksums
20c6e33e3a4fd7137cd5b4687307617a60af958b6809872fc7432af701c4223b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / pygeneraldichotomy-0.0.1.5-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL pygeneraldichotomy-0.0.1.5-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 131.2 kB
Tags CPython 3.13 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
c797b378f4dbf07e6de64539cb5df8500bddb7f712c683bd35aa28f7347ab2f3
BLAKE2b-256 checksum
How to use checksums
de12ed87cc1153339f5a3b00db840091f05df7bd546bfad628e637d11287e1e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / pygeneraldichotomy-0.0.1.5-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL pygeneraldichotomy-0.0.1.5-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 131.1 kB
Tags CPython 3.12 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
08b4b689a4235bbaf36c14d7bca6b32a50b2c6ac6cafb9b5dabfaeac40d7b825
BLAKE2b-256 checksum
How to use checksums
fb06ea2d5b8c8ba2a7a9a638ccc10c8ec6e5100a299c9f2c5c9ea7dbcebba336
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / pygeneraldichotomy-0.0.1.5-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL pygeneraldichotomy-0.0.1.5-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 131.1 kB
Tags CPython 3.11 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
072c98b072e86c028e8d7c7adbb8f9b5d20bd67b4659ab6bf39b40d6fafbdc7b
BLAKE2b-256 checksum
How to use checksums
36fe19fa99c317fa6cd1bb1dbb421ec7be737c95543d168011e61ca3b0f7aeea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / pygeneraldichotomy-0.0.1.5-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL pygeneraldichotomy-0.0.1.5-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 131.1 kB
Tags CPython 3.10 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
e53c47b2059313606880f0104f161b9119b31e315b682fbf5fb393c1876869ce
BLAKE2b-256 checksum
How to use checksums
0bdef468e974d450416cdd41f9fa1b74578a9672d2f9db74143ad242bea7a4f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / pygeneraldichotomy-0.0.1.5-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL pygeneraldichotomy-0.0.1.5-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 131.1 kB
Tags CPython 3.9 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
69120359ba4002b19e6b2ff2d658f019c1e8354e19254601723597cd7a0f8db8
BLAKE2b-256 checksum
How to use checksums
38f9bc1a52e5892818aea3745bb76c14473cb23bb893fe03bf57a671f4421807
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / pygeneraldichotomy-0.0.1.5-cp38-cp38-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL pygeneraldichotomy-0.0.1.5-cp38-cp38-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 130.8 kB
Tags CPython 3.8 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
84cb6f1a300581b66e8eb80213351b708c6e1eb9060a57e71d0a5cee57c079af
BLAKE2b-256 checksum
How to use checksums
0e4d2d5abd948157a3e1563efac12205fce03da8f2852d18c33c40d2028fd151
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release history Release notifications | RSS feed

This release

0.0.1.5 This release

9 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