File size: 1,171 Bytes
b4ce589
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/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()