Skip to main content

General-purpose MCDA methods (ELECTRE I, MAUT) built on mcda-core

Project description

mcda-methods

General-purpose MCDA methods built on mcda-core, maintained by the SMG research group. Currently provides ELECTRE I (choice problems) and MAUT (ranking by multi-attribute utility).

This library is a home for methods that do not yet have a dedicated library. When a method grows large enough to warrant its own package, it will be spun off into a separate repository.

Installation

pip install mcda-methods

Python ≥ 3.10.

Quick start

ELECTRE I

Selects a kernel — the best alternatives in a choice problem — via concordance and veto.

import numpy as np
from mcda_methods import ElectreI, PerformanceTable, ParametersElectre

table = PerformanceTable(
    values=np.array([
        [8.0, 3.0, 5.0],
        [6.0, 7.0, 4.0],
        [5.0, 6.0, 9.0],
        [7.0, 5.0, 6.0],
    ]),
    alternatives=["A", "B", "C", "D"],
    criteria=["C1", "C2", "C3"],
)

params = ParametersElectre(
    weights=np.array([0.4, 0.3, 0.3]),
    lambda_threshold=0.65,         # concordance threshold for outranking
    veto_thresholds=np.array([]),  # no veto (optional)
)

model = ElectreI(performance_table=table, parameters=params)
model.fit()

print(model.concordance)   # (n, n) concordance matrix
print(model.outranking)    # (n, n) binary outranking matrix
print(model.kernel)        # binary array: 1 = alternative is in the kernel

MAUT

Ranks alternatives via weighted piecewise-linear marginal utility functions.

import numpy as np
from mcda_methods import MAUT, PerformanceTable, ParametersMAUT

table = PerformanceTable(
    values=np.array([[80.0, 20.0], [65.0, 35.0], [90.0, 15.0]]),
    alternatives=["A", "B", "C"],
    criteria=["cost", "quality"],
)

params = ParametersMAUT(
    weights=np.array([0.6, 0.4]),
    breakpoints=[np.array([60.0, 80.0, 100.0]),   # breakpoints per criterion
                 np.array([10.0, 25.0,  40.0])],
    value_functions=[np.array([0.0, 0.5, 1.0]),   # utility at each breakpoint
                     np.array([0.0, 0.7, 1.0])],
)

model = MAUT(performance_table=table, parameters=params)
model.fit()

print(model.utilities)             # weighted utility score per alternative
print(model.ranking)               # indices sorted best → worst
print(model.mono_criterion_scores)     # unweighted marginal utilities (n × m)

Parameters can also be loaded from a JSON file:

import json
from mcda_methods import ParametersMAUT

with open("params.json") as f:
    params = ParametersMAUT.from_dict(json.load(f))

Expected JSON keys: "weights", "breakpoints", "value_functions".

API reference

ElectreI

attribute / property description
concordance (n, n) concordance matrix
veto (n, n) binary veto matrix
outranking (n, n) binary outranking matrix
kernel binary (n,) array — 1 = in kernel, or None if no kernel exists
result() returns outranking
is_valid_kernel(kernel) check whether a given set is a valid kernel

ParametersElectre

field type description
weights ndarray (m,) criterion weights
lambda_threshold float concordance threshold (typically 0.5–1.0)
veto_thresholds ndarray (m,) per-criterion veto threshold (empty = no veto)

MAUT

attribute / property description
utilities weighted utility score per alternative, shape (n,)
scores alias for utilities
ranking indices sorted best → worst
result() returns utilities
mono_criterion_scores unweighted marginal utilities, shape (n, m)
weighted_utility_difference(i, j) criterion-wise weighted utility difference, shape (m,)

ParametersMAUT

field type description
weights ndarray (m,) criterion weights
breakpoints list[ndarray] breakpoint values per criterion (ascending)
value_functions list[ndarray] utility at each breakpoint per criterion

MAUTLinear (mockup)

MAUTLinear is a simplified MAUT implementation with per-criterion affine (linear) value functions: a weighted sum of min-max normalized scores. It is included as a reference implementation to illustrate the ecosystem conventions (see notebooks/implementing_mcda_method.ipynb), not as a production-ready method. For real use cases, prefer MAUT with explicitly elicited value functions.

import numpy as np
from mcda_methods import MAUTLinear, PerformanceTable, ParametersMAUTLinear

table = PerformanceTable(
    values=np.array([[80.0, 20.0], [65.0, 35.0], [90.0, 15.0]]),
    alternatives=["A", "B", "C"],
    criteria=["cost", "quality"],
    directions=np.array([-1, 1]),  # cost: minimize, quality: maximize
)

params = ParametersMAUTLinear(
    weights=np.array([0.6, 0.4]),
    lb=table.values.min(axis=0),
    ub=table.values.max(axis=0),
)

model = MAUTLinear(performance_table=table, parameters=params)
model.fit()

print(model.scores)   # weighted utility score per alternative
print(model.ranking)  # indices sorted best -> worst

ParametersMAUTLinear

field type description
weights ndarray (m,) criterion weights
lb ndarray (m,) lower normalization bound per criterion (maximization space)
ub ndarray (m,) upper normalization bound per criterion (maximization space)
breakpoints tuple breakpoint positions for non-affine criteria (optional)
value_functions tuple utility values at each breakpoint for non-affine criteria (optional)

Ecosystem

Part of the modular MCDA Python ecosystem. See mcda-core for the full picture.

License

MIT — see LICENSE.

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

mcda_methods-0.2.0.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

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

mcda_methods-0.2.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file mcda_methods-0.2.0.tar.gz.

File metadata

  • Download URL: mcda_methods-0.2.0.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for mcda_methods-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ab9a8c053204542d4c595ba0a956588d3810ee067471bdfba97b26ae1bee3120
MD5 e116e8425c1b9eacca1e6db90df11be7
BLAKE2b-256 5c7ad853f854939e1194028605c77d4d7b6f809a9eec39f794f34b2dab6bee1f

See more details on using hashes here.

File details

Details for the file mcda_methods-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: mcda_methods-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for mcda_methods-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e5709ea59e213fb3b645774c80550cb456666ddc2656594d50258dad79edea14
MD5 8e5012b28d15536c108d2b59b6962bf2
BLAKE2b-256 ccc9285b8c6736028b621acf22301fa743b9af0855f23d67450d1b21dc486e84

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