In this repository we implemented and experimented several optimization
models for the minimum covariate imbalance problem. The problem is proven
to be NP-hard when
We focused on some fast methods for the case
We employed several different tools in order to evaluate the best one for the problem. All the code is written in Python, with the support of some NumPy functions here and there. We used the following optimization engines:
- Gurobi
- Google OR-Tools
- NetworkX (Minimum Cost Network Flow solver)
We consider a so-called treatment sample of size
where
- MIP model ([1], Section 2)
- Gurobi
- Alternative MIP model ([1], Section 3)
- Gurobi
- MCNF model ([1], Section 4)
- Gurobi
- NetworkX
- Google OR-Tools
- General (
q != n
) MCNF model ([1], Section 6)- NetworkX
- Gurobi
First of all we generate randomly a problem using the utility functions inside
the module utils
:
from utils import generate_problems
n = 5
n_prime = 15
k0 = k1 = 5
l, L_prime = generate_problems(n, n_prime, k0, k1)
You can now use any method from the modules in the repository in order to solve the problem:
# brute force solver
from brute_force import brute_force
brute_force(l, L_prime)
# MIP model
from mip_formulation import min_imbalance_solver, min_imbalance_solver_alt, min_imbalance_solver_mcnf
min_imbalance_solver(l, L_prime)
min_imbalance_solver_alt(l, L_prime)
min_imbalance_solver_mcnf(l, L_prime)
# MCNF model
from minimum_network_flow import min_imbalance_solver_networkx, min_imbalance_solver_google
min_imbalance_solver_networkx(l, L_prime)
min_imbalance_solver_google(l, L_prime)
- Gurobi:
Integer
: MIP formulation in [1]Integer
: Alternative MIP formulation in [1]Integer MCNF
: MCNF formulation implemented like a MIP
- Google OR-Tools:
MCNF OR
: MCFN formulation
- NetworkX:
MCNF NX
: MCFN formulation
[1] Network flow methods for the minimum covariate imbalance problem
Dorit S. Hochbaum, Xu Rao, Jason Sauppe