Task for developing a program for material cutting optimization in Python
Goal
To develop a program for optimizing material cutting, similar in functionality to CutOptimizer Pro, but without a graphical interface. The program should accept input data from another program, perform calculations, and return:
1. The optimal layout of elements on the field.
2. Information about the field's occupancy.
Functional requirements
1. Input data:
- Material dimensions (width, length).
- List of parts for cutting (width, length of each part, quantity).
- Minimum gap between parts and consideration of cut thickness.
- Type of cut: straight or indirect (must be taken into account in calculations).
2. Output data:
- Layout scheme of parts in text or another convenient format (for example, JSON).
- Percentage of material usage.
3. Algorithm:
- Use an efficient cutting algorithm (for example, "First Fit" or "Best Fit" for one-dimensional cutting, or nesting algorithms for two-dimensional).
- Ensure minimization of material leftovers.
- Consider the type of cut (straight or indirect) when constructing the cutting scheme.
4. Integration:
- The program should run as a function or module that accepts input data in JSON format.
- The result should be returned in JSON format.
Example of program operation
1. Input data:
```json
{
"material": {
"width": 2000,
"height": 1000
},
"details": [
{"width": 400, "height": 200, "quantity": 10},
{"width": 600, "height": 400, "quantity": 5}
],
"kerf": 5,
"cut_type": "straight"
}
```
2. Expected result:
```json
{
"layout": [
{"x": 0, "y": 0, "width": 400, "height": 200},
{"x": 400, "y": 0, "width": 400, "height": 200},
...
],
"material_usage": 85.5
}
```
Additional requirements
- The code must be well-structured and commented.
- The algorithm must be optimized for fast operation on large datasets.
- Use standard Python libraries or popular third-party ones (for example, numpy, scipy).
Acceptance criteria
1. The code meets all functional requirements.
2. Correctly handles various input data options.
3. The calculation results meet expectations.
Deadline
10 days.
Price is negotiable
The Python file is an example of the program's operation, but it only accepts 1 size instead of multiple sizes of products.