Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -69,8 +69,8 @@ def optimize_dishes_for_budget(city, daily_budget):
|
|
| 69 |
A_ub = [costs] # Sum of costs * portions <= daily_budget
|
| 70 |
b_ub = [daily_budget]
|
| 71 |
|
| 72 |
-
# Bounds for each dish
|
| 73 |
-
bounds = [(
|
| 74 |
|
| 75 |
# Solve the optimization problem
|
| 76 |
result = linprog(c, A_ub=A_ub, b_ub=b_ub, bounds=bounds, method='highs')
|
|
@@ -78,7 +78,7 @@ def optimize_dishes_for_budget(city, daily_budget):
|
|
| 78 |
if result.success:
|
| 79 |
selected_dishes = []
|
| 80 |
for i, qty in enumerate(result.x):
|
| 81 |
-
if qty
|
| 82 |
dish_name = list(nutritional_data.keys())[i]
|
| 83 |
selected_dishes.append({
|
| 84 |
"dish": dish_name,
|
|
|
|
| 69 |
A_ub = [costs] # Sum of costs * portions <= daily_budget
|
| 70 |
b_ub = [daily_budget]
|
| 71 |
|
| 72 |
+
# Bounds for each dish: minimum 1 portion
|
| 73 |
+
bounds = [(1, None) for _ in costs] # Minimum 1 portion for each dish
|
| 74 |
|
| 75 |
# Solve the optimization problem
|
| 76 |
result = linprog(c, A_ub=A_ub, b_ub=b_ub, bounds=bounds, method='highs')
|
|
|
|
| 78 |
if result.success:
|
| 79 |
selected_dishes = []
|
| 80 |
for i, qty in enumerate(result.x):
|
| 81 |
+
if qty >= 1:
|
| 82 |
dish_name = list(nutritional_data.keys())[i]
|
| 83 |
selected_dishes.append({
|
| 84 |
"dish": dish_name,
|