Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """ | |
| Debug script for demand generation | |
| """ | |
| from fleet_optimizer import FleetOptimizer | |
| import random | |
| def debug_demand_generation(): | |
| """Debug the demand generation logic""" | |
| print("🔍 Debugging Demand Generation") | |
| print("=" * 40) | |
| optimizer = FleetOptimizer() | |
| print(f"Initial demands: {len(optimizer.demands)}") | |
| # Test demand generation directly | |
| for i in range(10): | |
| print(f"\nStep {i+1}:") | |
| print(f" Simulation time: {optimizer.simulation_time}") | |
| print(f" Hour: {optimizer.simulation_time.hour}") | |
| # Call demand generation | |
| optimizer.generate_demand() | |
| print(f" Demands after generation: {len(optimizer.demands)}") | |
| if optimizer.demands: | |
| latest_demand = optimizer.demands[-1] | |
| print(f" Latest demand: ID={latest_demand.id}, Status={latest_demand.status}, Priority={latest_demand.priority}") | |
| # Advance time | |
| optimizer.simulation_time = optimizer.simulation_time.replace(hour=(optimizer.simulation_time.hour + 1) % 24) | |
| if __name__ == "__main__": | |
| debug_demand_generation() | |