This project involves implementing the Cutting Stock Problem using Python and dynamic programming. The Cutting Stock Problem is a classic optimization problem where the goal is to minimize the waste produced when cutting raw materials into smaller pieces to meet demand. This implementation uses the Django framework to provide a web-based interface for inputting data and viewing results.
The approach used to solve the Cutting Stock Problem in this project is dynamic programming. The dynamic programming algorithm efficiently determines the optimal way to cut the raw materials to minimize waste.
- Input raw material dimensions and required pieces through a web interface.
- Dynamic programming algorithm to calculate the optimal cutting pattern.
- Display results, including the optimal cutting pattern and waste produced.
- Django framework for a robust and scalable web application.
- Python 3.x
- Django 3.x
- Other dependencies listed in
requirements.txt
-
Clone the repository:
git clone https://github.com/yourusername/python-cutting-stock-operations-research.git cd python-cutting-stock-operations-research
-
Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install the dependencies:
pip install -r requirements.txt
-
Apply the database migrations:
python manage.py migrate
-
Run the development server:
python manage.py runserver
-
Access the application: Open your web browser and navigate to
http://127.0.0.1:8000
.
-
Input Data:
- Enter the dimensions of the raw materials.
- Enter the required dimensions and quantities of the pieces needed.
-
Calculate Optimal Cutting Pattern:
- Click on the "Calculate" button to run the dynamic programming algorithm.
- View the optimal cutting pattern and the amount of waste produced.
.github/workflows/
: GitHub Actions workflows.cutting_app/
: Django application directory containing the main logic.migrations/
: Database migration files.templates/
: HTML templates for the web interface.views.py
: Contains the view functions for handling requests and rendering templates.models.py
: Defines the database models.dynamic_programming.py
: Implementation of the dynamic programming algorithm for the Cutting Stock Problem.generate_patterns.py
: Functions to generate cutting patterns.
cutting_project/
: Django project directory..gitignore
: Git ignore file.README.md
: This README file.db.sqlite3
: SQLite database file.manage.py
: Django's command-line utility for administrative tasks.requirements.txt
: List of Python dependencies.
The dynamic programming algorithm used in this project follows these steps:
- Define the state and subproblems.
- Establish the recurrence relation.
- Use a table to store the solutions to subproblems.
- Build the solution to the original problem from the solutions to subproblems.
Contributions are welcome! Please fork the repository and submit a pull request with your changes. Ensure that your code follows the project's coding standards and includes appropriate tests.
This project is licensed under the MIT License. See the LICENSE file for details.
For questions or comments, please contact yourname@domain.com.