semvec/pypi-packages huggingface dataset:
model-comparator 1.0.2
Une bibliothèque Python pour comparer différents modèles d'ajustement de données.
Requires Python: >=3.7

# Model Comparator

Model Comparator est une bibliothÃ¨que Python permettant de comparer diffÃ©rents modÃ¨les d'ajustement (linÃ©aire, exponentiel, etc.) pour un ensemble de donnÃ©es.

## Installation

```bash
pip install model-comparator
pulp2mat 0.1.5
convert pulp model into matrix formulation for scipy.optimize.milp
Requires Python: >=3.9

# pulp2mat

Convert pulp model into matrix formulation.

It can be easily thrown to scipy.optimize.milp function.


# How to install

```
$ pip install pulp2mat
```

Without poetry, please look at pyproject.toml and install all dependencies manually. 

# Quick Example

For example, the binpacking problem can be formulated with pulp as below;

```python
import pulp as pl
import numpy as np

item_sizes = np.array([7, 3, 3, 1, 6, 8, 4, 9, 5, 2])
num_items = len(item_sizes)
num_bins = len(item_sizes)
bin_size = 10

# Variables * must be defined as dictionaries
x = {
    (i, j): pl.LpVariable("x_{}_{}".format(i, j), cat=pl.LpBinary)
    for i in range(num_items)
    for j in range(num_bins)
}
y = {
    j: pl.LpVariable("y_{}".format(j), cat=pl.LpBinary)
    for j in range(num_bins)
}

problem = pl.LpProblem()

# Bin size constraint for each bin
for j in range(num_bins):
    problem += (
        pl.lpSum(
            x[i, j] * item_sizes[i] for i in range(num_items)
        )
        <= bin_size * y[j]
    )
# One-hot constraint for each item
for i in range(num_items):
    problem += pl.lpSum(x[i, j] for j in range(num_bins)) == 1

# Objective: minimize number of bins used.
problem += pl.lpSum(y[j] for j in range(num_bins))
```

the ```pulp.LpProblem``` object and the list of variable dictionaries can be converted to the matrix format for ```scipy.optimize.milp```.

```python
import pulp2mat
from scipy.optimize import milp
c, integrality, constraints, bounds = pulp2mat.convert_all(problem)
result = milp(c, integrality=integrality, constraints=constraints, bounds=bounds)
```