git clone <REPO_URL>
cd REPO_NAME_HERE
code .Run the data generator to create three delivery optimization scenarios:
python delivery_generator.py
# You may need to run python3 delivery_generator.pyThis will create:
scenarios/package_prioritization.json- 50 deliveries with time windowsscenarios/truck_loading.json- 100 packages with weights and prioritiesscenarios/driver_assignment.json- 60 deliveries to assign to drivers
Open greedy_optimizer.py and complete the three greedy functions:
maximize_deliveries()- Activity selection problemoptimize_truck_load()- Fractional knapsack problemminimize_drivers()- Interval scheduling problem
Uncomment the test functions in the __main__ block:
if __name__ == "__main__":
test_package_prioritization() # Verify activity selection works
test_truck_loading() # Verify fractional knapsack works
test_driver_assignment() # Verify interval scheduling works
benchmark_scenarios() # Test on realistic delivery dataThen run:
python greedy_optimizer.py
# or python3 greedy_optimizer.pyScenario: You have 50 deliveries with time windows. You can only do one delivery at a time. Which deliveries should you schedule to maximize the total number completed?
Greedy strategy: Choose the delivery that finishes earliest among remaining options.
Scenario: You have 100 packages with different weights and priority values. Your truck can carry 500 lbs. You can deliver partial packages. How do you maximize total priority value delivered?
Greedy strategy: Sort packages by priority-to-weight ratio, take packages in order (taking fractions if needed).
Scenario: You have 60 deliveries with time windows. Each driver can handle multiple deliveries if they don't overlap. What's the minimum number of drivers needed?
Greedy strategy: Assign each delivery to the first driver who is available, or add a new driver if no one is available.
Submit two files:
- Your completed Python file (rename to
greedy_optimizer.py) - Written analysis document (Google Doc or Word) containing:
- Greedy Property Justification section (250-300 words)
- Complexity Analysis section (150-200 words)
- Total: 400-500 words