0% found this document useful (0 votes)
8 views

You Are A Transporter Manager For T

Uploaded by

yaadavajay246
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

You Are A Transporter Manager For T

Uploaded by

yaadavajay246
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

You are a transporter manager for the logistics company that delivers packages

using trucks and vans. you need to determine the optimal allocation of vehicles of
different routes to minimize the total distance traveled van ensuring that all
packages are delivered on time.

Objective
Minimize the total distance traveled by the vehicles.

Details
- have 5 trucks and 3 vans for delivery.
- There are 10 delivery routes that needed to be covered.
- Each route has a different distance and requires a certain number of vehicles to
complete.
- Trucks can cover longer distances but require more fuel, while vans are more fuel
efficient but have a smaller capacity
- Each route must be covered by at least one vehicle.
- The total number of vehicles assigned to the route cannot exceed the
available feet size. write a program of python in simple way by following above
details

# Define the routes with their distances and required vehicle counts
routes = {
"Route 1": {"distance": 50, "required_vehicles": 2},
"Route 2": {"distance": 30, "required_vehicles": 1},
"Route 3": {"distance": 40, "required_vehicles": 2},
"Route 4": {"distance": 25, "required_vehicles": 1},
"Route 5": {"distance": 60, "required_vehicles": 3},
"Route 6": {"distance": 35, "required_vehicles": 2},
"Route 7": {"distance": 45, "required_vehicles": 2},
"Route 8": {"distance": 20, "required_vehicles": 1},
"Route 9": {"distance": 55, "required_vehicles": 3},
"Route 10": {"distance": 50, "required_vehicles": 2}
}

# Define vehicle capacities and fuel efficiencies


truck_capacity = 3
truck_fuel_efficiency = 1.2
van_capacity = 2
van_fuel_efficiency = 1.5

# Define the number of available trucks and vans


num_trucks = 5
num_vans = 3

# Initialize variables to keep track of assigned vehicles and total distance


traveled
assigned_trucks = 0
assigned_vans = 0
total_distance = 0

# Iterate through each route and assign vehicles


for route, details in routes.items():
distance = details["distance"]
required_vehicles = details["required_vehicles"]
# Calculate the total capacity needed for the route
total_capacity_needed = required_vehicles * (truck_capacity + van_capacity)

# Assign vehicles to the route


while total_capacity_needed > 0:
if assigned_trucks < num_trucks and assigned_vans < num_vans:
# Decide whether to assign a truck or a van based on the distance and
fuel efficiency
if distance * truck_fuel_efficiency <= distance * van_fuel_efficiency:
assigned_trucks += 1
total_capacity_needed -= truck_capacity
total_distance += distance
else:
assigned_vans += 1
total_capacity_needed -= van_capacity
total_distance += distance
elif assigned_trucks < num_trucks:
assigned_trucks += 1
total_capacity_needed -= truck_capacity
total_distance += distance
elif assigned_vans < num_vans:
assigned_vans += 1
total_capacity_needed -= van_capacity
total_distance += distance

# Output the results


print("Total distance traveled:", total_distance)
print("Number of trucks used:", assigned_trucks)
print("Number of vans used:", assigned_vans)

You might also like