For more details on the task and to access the evaluation platform, please refer to the SmartHack 2024 Challenge repository on GitHub
Linear programming (LP), also called linear optimization, is a method to achieve the best outcome (such as maximum profit or lowest cost) in a mathematical model whose requirements and objective are represented by linear relationships.
In a transportation problem, we aim to determine the optimal flow of units from supply nodes to demand nodes. Here, the decision variables are the arcs connecting these nodes. Specifically, we need to decide the amount of fuel to transport from each refinery to tank storage and from tank storage to customers.
We define separate arcs for the refinery → tank
and tank → customer
flows, as they incur different costs per unit distance.
Let:
These variables represent the quantity of fuel pushed from one node to another in the network.
Where:
Where tolerance
is empirically set to adjust needs
Meaning you can not push more than your current stock or max output
And at least one move should be made
=======
A* is a graph traversal and pathfinding algorithm that is used in many fields of computer science due to its completeness, optimality, and optimal efficiency.
The data has been formatted as dictionaries. Connections have been minimized to an adjacency list of node ID hashes. This approach has optimized data access in memory.
After multiple runs, we observed a repeated trend of exceeding the upper limit of a refinery. We attempted to minimize this penalty as much as possible. In this process, additional penalties arose, but we did our best to address them.
With minimum paths generated from each refinery to the required client, we selected the path originating from the refinery with the minimum total_capacity - current_capacity
. To balance the refineries, the fuel expected to be produced beyond the limit is distributed as much as possible in tanks.
This project requires several Python packages to function correctly. Follow the instructions below to set up your environment and install the necessary dependencies.
To install all the required Python packages listed in requirements.txt
, run the following command in your terminal:
pip install -r requirements.txt
If you add any new packages or make changes to your environment, you can update your requirements.txt
file with the following command:
Warning
BUT only after running the above command
pip freeze > requirements.txt
Or you can enter them by hand