A simulation framework that applies Quantum Approximate Optimization (QAOA) to the sawmill log-cutting problem, benchmarked against classical greedy packing. Based on FAO "Cost Estimation in Sawmilling Industries" parameters.
pip install qiskit qiskit-aer numpy matplotlib scipy
python main.pyThis runs the full pipeline: generates 50 synthetic logs, solves each with both the
classical greedy heuristic and the quantum (QAOA) solver, then produces comparison
charts in output/.
├── main.py # Entry point — runs full benchmark
├── data_generator.py # Synthetic 3D log & defect generation
├── qubo_formulation.py # QUBO / Ising Hamiltonian construction
├── classical_solver.py # Greedy packing baseline
├── quantum_solver.py # QAOA-based hybrid solver
├── visualize_results.py # Plotting & visualization
├── ARCHITECTURE.md # Mathematical model & design docs
└── SUMMARY.md # Results & analysis
- Log Generation — Cylindrical logs with realistic taper and stochastic 3D defect zones are synthesized.
- Board Candidate Enumeration — Feasible board placements are identified within the log cross-section, respecting sapwood boundaries.
- QUBO Construction — An objective function maximizes board value while penalizing spatial overlaps and defect intersections.
- Solving — Both a greedy classical solver and a QAOA quantum solver produce cutting patterns.
- Defect Re-optimization — When a cut reveals a hidden defect, the quantum solver dynamically re-plans the remaining volume.
- Benchmarking — 50-log batches compare value recovery, waste, and computation time across both approaches.