Skip to content

Latest commit

Β 

History

History
116 lines (82 loc) Β· 2.87 KB

File metadata and controls

116 lines (82 loc) Β· 2.87 KB

🍐PEAR: Projected Error As Regret-gradient

Official implementation for Decision-Focused Learning via Tangent-Space Projection of Prediction Error

Main Figure

Setup

pip install -r requirements.txt
cd pkg && pip install -e .

Requires Gurobi with a valid license.

Project Structure

β”œβ”€β”€ projection/              # Core library
β”‚   β”œβ”€β”€ training/            # Trainers (MSE, SPO+, DBB, PFYL, Projection, LAVA)
β”‚   └── models/              # Network architectures
β”œβ”€β”€ experiments/
β”‚   β”œβ”€β”€ lp/                  # LP experiments (Shortest Path, Knapsack)
β”‚   β”œβ”€β”€ qp/                  # QP experiments (Mean-Variance Optimization)
β”‚   └── constraint_shift/    # Constraint shift experiments
β”œβ”€β”€ pkg/pyepo/               # Modified PyEPO library
β”œβ”€β”€ scripts/                 # Run scripts
β”œβ”€β”€ analyze/                 # Result analysis scripts
└── figures/                 # Generated figures

Experiments

1. LP Benchmarks (Shortest Path, Knapsack)

# Single run
python -m experiments.lp.run --prob sp --method projection --deg 8 --seed 0
python -m experiments.lp.run --prob ks --method projection --deg 8 --seed 0

# Full experiments (all methods, degrees, seeds)
bash scripts/run_lp.sh

Methods: mse, spo, dbb, pfyl, lava, projection

2. Noise Experiments

# Single run with noise
python -m experiments.lp.run --prob sp --method projection --deg 8 --noise 0.3 --seed 0

# Full noise experiments
bash scripts/run_noise.sh

3. Real-world QP Experiments (Mean-Variance Optimization)

# Single run
python -m experiments.qp.run --method projection --seed 0

# Full experiments
bash scripts/run_mvo.sh

# Evaluation
python -m experiments.qp.eval_portfolio
python -m experiments.qp.eval_regret

4. Constraint Shift Experiments

# Capacity generalization (Knapsack)
python -m experiments.constraint_shift.run_capacity_generalization --method projection --seed 0

# Direction generalization (Shortest Path)
python -m experiments.constraint_shift.run_direction_generalization --method projection --seed 0

# Full experiments
bash scripts/run_lp_and_constraint_shift.sh

Results Analysis

# LP results
python analyze/lp_results.py

# LP results with noise
python analyze/lp_results.py --noise

# MVO results
python analyze/mvo_results.py --all

# Constraint shift results
python analyze/constraint_shift_results.py

Visualization

python scripts/visualize_lp.py
python scripts/visualize_qp.py
python scripts/visualize_constraint_shift.py

License

MIT