Metadata-Version: 2.4
Name: pyfitradeoff
Version: 1.0.0
Summary: An implementation of classic and alternative versions of FITradeoff Multiple-criteria Decision Analysis (MCDA) method.
Author-email: Elia Balugani <elia.balugani@unimore.it>
License: MIT
License-File: LICENSE
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.12
Requires-Dist: hopsy
Requires-Dist: matplotlib
Requires-Dist: numpy
Requires-Dist: ortools
Requires-Dist: scikit-learn
Requires-Dist: scipy
Provides-Extra: notebook
Requires-Dist: ipympl; extra == 'notebook'
Requires-Dist: ipywidgets; extra == 'notebook'
Requires-Dist: jupyterlab; extra == 'notebook'
Requires-Dist: pandas; extra == 'notebook'
Requires-Dist: statsmodels; extra == 'notebook'
Description-Content-Type: text/markdown

# Pyfitradeoff
Pyfitradeoff is a Python library that implements the Flexible and Interactive
Tradeoff (FITradeoff) multi-criteria decision analysis (MCDA) method.
This implementation includes the original FITradeoff heuristic and two
optimized variants, LR (Logistic Regression) FITradeoff and FR (Full Recall)
FITradeoff, designed to minimize the number of questions required from a
Decision Maker (DM) to reach a final recommendation.

The library is based on the research presented in:
*Efficient preference elicitation in FITradeoff: a sampling and machine
learning-based query selection approach*.

## Key Features
- **Standard FITradeoff**: Implementation of the original method using the
traditional distance heuristic.
- **LR FITradeoff**: An optimized variant using MCMC sampling and a Logistic
Regression classifier to select questions that maximize information gain
in the weights vector space.
- **FR FITradeoff**: An optimized variant utilizing an ad-hoc classifier
designed to maximize query recall and the separation of potentially optimal
alternatives.
- **Simulation Tools**: A script to run repeatable randomized experiments and
compare the proposed methods.

## Installation
```bash
pip install pyfitradeoff
```

## Usage
The solver provides a consistent interface for all variants. If a weights
vector is provided during initialization, the `step()` method automatically
simulates the decision-maker response. The solver raises a 
`BestAlternativeFound` exception when the preference elicitation process 
identifies a unique optimal alternative.
```python
import numpy as np
from pyfitradeoff import FITradeoff, OptFITradeoff, BestAlternativeFound

n_alternatives = 10
n_criteria = 5

consequences = np.random.rand(n_alternatives, n_criteria)
weights = np.array([0.35, 0.25, 0.20, 0.15, 0.05])

solver = OptFITradeoff(consequences=consequences, weights=weights, method="FR")
try:
    while True:
        solver.step()
except BestAlternativeFound as e:
    print(e)
```

## Experiment
To replicate the experiments described in the associated paper, the library
includes a script:

```python
from pyfitradeoff.experiments import randomized_experiment

randomized_experiment.main()
```

## Citation
If you use this library in your research, please cite:
```text
Zhao, Q., Balugani, E., Lolli, F., & Gamberini, R. (2026). 
Efficient preference elicitation in FITradeoff: a sampling and machine
learning-based query selection approach.
```

## License
This project is licensed under the MIT License.
