How tanmoyie/location-allocation-using-mip works
Main Components
• Inputs: The “Inputs” folder holds raw data files (Excel and text) that contain spill information, location data, and other necessary datasets.
• Optimization Models: The heart of the project lies in the optimization models – with the main engine in “model_PAMIP.py” and additional modules such as “model_analysis.py” and “model_mclp.py” potentially representing different modeling approaches or analyses.
• Core Application Logic: “main.py” serves as the driver that ties the optimization engine, data input, and output generation together, leveraging custom functions from “custom_functions.py” to streamline repeated logic.
• Visualization: “data_visualization.py” contains the code to generate the figures that showcase the outputs, including the tradeoff and analysis graphs.
• Outputs: All resultant files (CSV, LP model file, etc.) are stored in the “Outputs” directory and represent the system’s feedback and results.
• Dependencies & Documentation: “requirement.txt” (for Python package dependencies) and “main_predictive_analytics_and_modeling.pdf” (which might detail further project insights or methodology) are fundamental for setup and documentation.
Relationships and Interactions
• Data Flow: Raw data is read from the “Inputs” folder by main.py and possibly by supporting modules. This input data is processed and fed into the optimization engine (primarily in model_PAMIP.py) where the MIP model is executed.
• Processing & Custom Functions: The “custom_functions.py” module encapsulates any repetitive or utility logic called from the main program or the optimization modules.
• Outputs & Visualization: Results from the optimization (e.g., optimal facility locations, tradeoff information) are output as CSV files and a model file, and these outputs are further visualized using functions from “data_visualization.py.”
• Documentation Linkage: The PDF and the README provide critical context on methodology and expected results; they can be included as reference nodes in the architecture.
Important Architectural Patterns and Design Principles
• Separation of Concerns: There is a clear separation between data handling (Inputs and Outputs), business logic (optimization model and analysis scripts), and presentation (visualization).
• Modularity: The use of separate modules for custom functions, various aspects of the optimization (different models), and visualizations indicates a modular design.
• Pipeline Architecture: The project essentially follows a linear pipeline—from reading inputs, processing data through the optimization engine, and finally producing outputs and visualizations.
• From Inputs → Main Application Controller.
• From Main Application Controller → Optimization Engine.
• From Optimization Engine → Custom Functions (if applicable) and then to Outputs.
• From Outputs → Visualization Module.
• External Dependencies: Optionally, include additional nodes noting “Python Packages (requirement.txt)” and “Documentation (README & PDF)” indicating supporting resources.
Instructing the Principal Software Engineer
• A descriptive label for each component, e.g., “Data Input – Reads Excel and Text Files,” “Optimization Engine – MIP Model Execution,” “Visualization – Generates Figures from Outputs.”
• Do not hesitate to create sub-components if needed. For instance, consider splitting “Optimization Engine” into its submodules (model_PAMIP.py, model_analysis.py, model_mclp.py) to capture their distinct roles if more granular detail is needed.