[Python] Can anyone help me to fix this problem according to my project? (Line coverage using...

Discussão em 'Python' iniciado por Stack, Outubro 24, 2024.

  1. Stack

    Stack Membro Participativo

    I am working on a project, and i wrote an algorithm according to it. UAVs in this algorithm should cover the required edges and use the deadhead for just the shortest path to achieve servicing the required edges. uav will start from the depot to go to the closest edge to cover , using Dijkstra algorithm. it move from depot to the required edges and cover it and then go to the next closest edges to cover again and continue untill cover all the edges , but according to the time limit and battery capacity it checks, if it does not have energy , it must back to the depot.and next uav go to cover again.

    So, according to this , the time limit is 1800(second) and the battery capacity for each uavs is 900 Wh. other parameters ,

    # Set parameters
    service_speed = 5 # 5 m/s (18 km/h)
    deadhead_speed = 8 # 8 m/s (28.8 km/h)

    # Energy consumption per km
    service_energy_per_km = 100 # Wh/km
    deadhead_energy_per_km = 50 # Wh/km

    # Convert energy per km to energy per meter
    service_energy_per_m = service_energy_per_km / 1000 # 0.1 Wh/m
    deadhead_energy_per_m = deadhead_energy_per_km / 1000 # 0.05 Wh/m




    after I run this algorithm, even though i defined the time limit and capacity , but I get this result for each UAVs , while , I think for example the first UAV, use all its energy and limit and then back to the depot and next UAV continue covering again. but here the uavs run out energy fast and back to the depot earlier even though according to the result they did not use all their energy or time limit for each! Can anyone help me please???

    this is the part of the algorithm according to it :

    # Check UAV energy and time constraints
    if uav.energy_consumed >= uav.battery_capacity or uav.time_taken >= time_limit:
    uav.inactive = True # Mark UAV as inactive
    return_to_depot(uav, graph, vertices)
    uav_index += 1
    continue

    Continue reading...

Compartilhe esta Página