Spaces:
Runtime error
Runtime error
Commit ·
404a021
1
Parent(s): 1a6853a
App update
Browse files
app.py
CHANGED
|
@@ -32,14 +32,21 @@ def simplex_transport_memory_requirements(num_locations, num_products):
|
|
| 32 |
SIZE_OF_DOUBLE = 8 # Memory size for a double precision float
|
| 33 |
SIZE_OF_INT = 4 # Memory size for an integer
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
num_variables = num_products * num_locations * (num_locations - 1) / 2
|
| 36 |
-
num_constraints = 2 * num_products * num_locations
|
| 37 |
-
total_columns = num_variables + num_constraints + 1 # +1 for RHS
|
| 38 |
-
total_rows = num_constraints + 1 # +1 for the objective function row
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
total_memory =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
return total_memory
|
| 45 |
|
|
|
|
| 32 |
SIZE_OF_DOUBLE = 8 # Memory size for a double precision float
|
| 33 |
SIZE_OF_INT = 4 # Memory size for an integer
|
| 34 |
|
| 35 |
+
|
| 36 |
+
total_memory = 0
|
| 37 |
+
|
| 38 |
+
# Transport item p from i -->j, cannot do both, i --> j and j --> i for the same product
|
| 39 |
num_variables = num_products * num_locations * (num_locations - 1) / 2
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
+
# Check that transport for product p can go only in one direction
|
| 42 |
+
# 0 <= t_i,j,p + t_j,i,p < 2
|
| 43 |
+
total_memory += num_variables * 4 * SIZE_OF_INT
|
| 44 |
+
|
| 45 |
+
# min_stock <= t_i,j,p
|
| 46 |
+
# t_i,j,p <= max_stock
|
| 47 |
+
total_memory += num_variables * 2 * 2 * SIZE_OF_INT
|
| 48 |
+
|
| 49 |
+
total_memory += num_variables * SIZE_OF_DOUBLE # Cost function
|
| 50 |
|
| 51 |
return total_memory
|
| 52 |
|