A web-based calculator that optimizes metal purchasing decisions to minimize costs and waste. This tool determines the most cost-effective combination of metal lengths to purchase while providing detailed cutting plans.
The LMP-Optimizer uses a combination of mathematical approaches:
Minimize: Σ(Ci × Qi)
Subject to: Σ(Li × Qi) ≥ Σ(Pj × Qj)
Where:
- Ci = Cost per unit of option i
- Qi = Quantity of option i to purchase
- Li = Length of option i
- Pj = Length of required part j
- Qj = Quantity of required part j
The algorithm explores all possible combinations using:
- State Space: Each state represents a partial solution with remaining material needs
- Pruning: Eliminates branches where current cost exceeds the best known solution
- Optimization: Minimizes total cost while ensuring all parts can be produced
For each purchased piece, the algorithm:
- Sorts parts by length in descending order:
P1 ≥ P2 ≥ ... ≥ Pn - Fits parts using a greedy approach:
remaining_length ≥ part_length - Calculates waste:
waste = piece_length - Σ(used_parts) - Minimizes total waste across all pieces
- Cost per foot:
CPF = price / length - Waste percentage:
WP = (total_waste / total_purchased) × 100 - Material utilization:
MU = (total_used / total_purchased) × 100
#Use
- Enter the length of each part needed (in feet)
- Specify the quantity required
- Click "Add Part" to add to your list
- You can add unlimited parts
- Enter available metal lengths and their prices
- The calculator shows cost per foot for easy comparison
- Add multiple purchasing options from different suppliers
- Click "Calculate Optimal Purchase" to run the LMP-Optimizer
- View the optimal combination of metal to buy
- See detailed cutting instructions for each piece
- Purchase Plan: Shows exactly what to buy and total cost
- Cutting Plan: Visual guide for cutting each piece
- Material Summary: Total needed vs purchased vs excess
- Chart: Visual breakdown of material usage
The calculator uses the LMP-Optimizer algorithm that:
- Sorts Options: Orders purchasing options by cost per foot
- Explores Combinations: Tests different combinations of metal lengths
- Minimizes Cost: Finds the combination with the lowest total cost
- Allows Excess: Permits some excess material to find better deals
The cutting plan algorithm:
- Sorts Parts: Orders parts by length (largest first) for efficiency
- Fits Parts: Tries to fit as many parts as possible into each piece
- Minimizes Waste: Reduces scrap material through smart placement
- Visual Guide: Shows exactly how to cut each piece
- Parts Needed:
- 10 pieces of 8 ft metal
- 15 pieces of 6 ft metal
- 20 pieces of 4 ft metal
- Purchasing Options:
- 20 ft pieces at $50 each
- 12 ft pieces at $35 each
- 8 ft pieces at $25 each
The LMP-Optimizer will determine the optimal combination (e.g., 2×20ft + 3×12ft + 1×8ft) and show exactly how to cut each piece to minimize waste and cost.
- Compares cost per foot across all options
- Finds the best combination even if it means buying more than needed
- Considers bulk discounts and supplier variations
- Shows exact waste from each cut
- Calculates waste percentage
- Suggests uses for excess material
- Color-coded segments show different cuts
- Blue segments: Parts to be cut
- Red segments: Waste material
- Proportional sizing based on actual lengths
- Add/remove parts and options dynamically
- Instant recalculation when inputs change
- Live preview of cost implications
The application uses CSS custom properties that can be easily modified:
- Color scheme can be changed by updating CSS variables
- Layout can be adjusted for different screen sizes
- Typography can be customized for brand consistency
- Algorithm parameters can be adjusted for different optimization strategies
- Chart types can be changed for different data visualization needs
- Additional input validation can be added as needed
This is a standalone application designed for metal purchasing optimization. The code is well-documented and modular, making it easy to extend with additional features.
This project is open source and available for educational and commercial use.
LBO Metal Purchasing Calculator - Optimize your metal purchasing decisions with precision and efficiency using the LMP-Optimizer algorithm.