Skip to content

teja656/Resource-Allocation-Optimizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Resource Allocation Optimizer

A Flask-based web application that solves the 0/1 Knapsack Problem for optimal resource allocation in a company using Dynamic Programming.

Features

  • Input project details manually or via CSV file upload
  • Dynamic Programming solution for the 0/1 Knapsack Problem
  • Visual representation of results using matplotlib
  • Modern, responsive UI with Bootstrap
  • Real-time calculation and visualization

Setup Instructions

  1. Create a virtual environment (recommended):
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the application:
python app.py
  1. Open your browser and navigate to http://localhost:5000

CSV File Format

When uploading a CSV file, ensure it has the following columns:

  • cost: The cost of each project
  • return: The expected return (profit) of each project

Example CSV:

cost,return
1000,500
2000,800
3000,1200

Complexity Analysis

Time Complexity

  • The Dynamic Programming solution for the 0/1 Knapsack Problem has a time complexity of O(nW), where:
    • n is the number of projects
    • W is the budget (knapsack capacity)
  • The space complexity is also O(nW) for storing the DP table

Space Complexity

  • Main DP table: O(nW)
  • Additional space for selected items: O(n)
  • Total space complexity: O(nW)

Performance Considerations

  • The solution is optimal for the 0/1 Knapsack Problem
  • For very large datasets (n > 1000 or W > 1000000), consider using approximation algorithms
  • The visualization component adds O(n) time complexity for plotting

Project Structure

.
├── app.py              # Main Flask application
├── requirements.txt    # Python dependencies
├── templates/         # HTML templates
│   └── index.html     # Main page template
├── static/           # Static files (CSS, JS)
└── uploads/          # Temporary storage for uploaded files

Contributing

Feel free to submit issues and enhancement requests!

About

Interactive web application using Flask and Dynamic Programming to optimize resource allocation using the 0/1 Knapsack algorithm with data visualization.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors