Features • Demo • Installation • Usage • Algorithm • Contributing
- 🎯 Two-stage guillotine optimization - Vertical column partitioning followed by horizontal strip packing
- 📐 NFDH Algorithm - Next Fit Decreasing Height heuristic with proven approximation ratio
- 🔄 90° Rotation support - Automatic piece rotation for optimal placement
- 🪚 Kerf compensation - Configurable saw blade width (0-10mm)
- 📊 Multiple export formats - PDF, PNG, SVG for production-ready plans
- 🌍 Bilingual - Full support for English and French
- ⚡ Fast computation - O(n log n) complexity, <100ms for typical workloads
- 📱 Responsive design - Works on desktop, tablet, and mobile devices
Try the live demo at gomory-optimizer.vercel.app
- 📐 Visual board layout with color-coded pieces
- ✂️ Red dashed lines showing optimal cut positions
- 📊 Real-time utilization statistics
- 📱 Fully responsive interface
- Node.js 20+
- npm or yarn or pnpm
# Clone the repository
git clone https://github.com/rmzlb/gomory.git
cd gomory
# Install dependencies
npm install
# Start development server
npm run dev
# Open http://localhost:3000# Build for production
npm run build
# Start production server
npm start# Build Docker image
docker build -t gomory .
# Run container
docker run -p 3000:3000 gomory-
Configure your board dimensions
- Width: 2800mm (default)
- Height: 2070mm (default)
- Kerf: 3mm (saw blade width)
-
Add pieces to cut
- Click "Add piece"
- Enter dimensions and quantity
- Enable rotation if desired
-
Optimize
- Choose optimization objective (minimize waste/cuts/balanced)
- Click "Optimize cutting"
- View results and utilization rate
-
Export
- Download individual boards as PNG/SVG
- Generate complete PDF cutting plan
- Print production-ready documents
import { optimizeCutting } from 'gomory'
const result = await optimizeCutting({
board: { width: 2800, height: 2070 },
pieces: [
{ width: 600, height: 400, quantity: 5 },
{ width: 800, height: 300, quantity: 3 },
],
options: {
kerf: 3,
allowRotation: true,
objective: 'waste',
},
})
console.log(`Utilization: ${result.utilization}%`)
console.log(`Boards needed: ${result.boards.length}`)The Gomory cutting optimizer implements a two-stage guillotine cutting algorithm:
Minimize: z = Σ(yi) where yi = 1 if board i is used
Subject to:
- Guillotine constraint: Each cut spans entire dimension
- Non-overlapping constraint
- Demand satisfaction: All pieces must be placed
- Time Complexity: O(n log n) for sorting + O(n) for packing = O(n log n)
- Space Complexity: O(n) where n = number of pieces
- Approximation Ratio: 2.5 for two-stage guillotine
- Preprocessing - Sort pieces by decreasing height
- Column Generation - Create vertical columns using first-fit
- Shelf Packing - Apply NFDH within each column
- Optimization - Local search improvements and rotation
- Framework: Next.js 15 with App Router
- Language: TypeScript 5
- Styling: Tailwind CSS v3
- Animation: Motion (Framer Motion)
- PDF Generation: jsPDF
- Canvas: html2canvas
- Bundler: Turbopack
| Pieces | Time | Memory | Utilization |
|---|---|---|---|
| 10 | 8ms | 2MB | 82% |
| 100 | 45ms | 8MB | 78% |
| 1000 | 95ms | 35MB | 75% |
Average utilization: 70-85% depending on piece variety
We welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
# Install dependencies
npm install
# Run tests
npm test
# Run linter
npm run lint
# Type check
npm run type-check
# Format code
npm run format- We use ESLint and Prettier for code formatting
- Follow the existing patterns in the codebase
- Write tests for new features
- Update documentation as needed
- Gomory, R. E. (1958). "Outline of an algorithm for integer solutions to linear programs"
- Coffman Jr, E. G., et al. (1980). "Performance bounds for level-oriented two-dimensional packing algorithms"
- Lodi, A., et al. (2002). "Two-dimensional packing problems: A survey"
MIT License - see LICENSE for details
- Ralph E. Gomory for the foundational cutting stock algorithm
- The open-source community for invaluable feedback and contributions
- All contributors who have helped improve this project
If you find this project useful, please consider:
- ⭐ Starring the repository
- 🐛 Reporting bugs
- 💡 Suggesting new features
- 📖 Improving documentation
- ☕ Buying me a coffee
Created by @rmzlb
Project Link: https://github.com/rmzlb/gomory