Choosing where to refuel

import numpy as np petrol_stations = np.array([ # distance (km), fuel price/liter ($), perceived fuel quality (0-100, historic) [3.45, 1.65, 74], [4.4, 1.6, 82], [5.3, 1.7, 89], [3.7, 1.65, 77], [4.3, 1.55, 67], [4.1, 1.62, 73], [3.9, 1.68, 77], [3.7, 1.6, 79], [2.7, 1.8, 57], [2.85, 1.75, 80] ]) petrol_station_names = 'ABCDEFGHIJ' max_distance = max(petrol_stations[:,0]) max_fuel_price_per_liter = max(petrol_stations[:,1]) # Ranking criteria: Minimize this function def f(station_data): distance, fuel_price_per_liter, perceived_fuel_quality100 = station_data dist = distance / max_distance fuel_price = fuel_price_per_liter / max_fuel_price_per_liter quality = 1 - perceived_fuel_quality100 / 100 return dist * fuel_price * quality results = np.array([f(petrol_station) for petrol_station in petrol_stations]) min_idx = np.argmin(results) station_name = petrol_station_names[min_idx] dist, price, quality = petrol_stations[min_idx] print(''' Best station: {0} Distance from it: {1}km Fuel price/liter: {2}$ Perceived quality: {3}/100 '''.format(station_name, dist, price, int(quality))) """ Best station: C Distance from it: 5.3km Fuel price/liter: 1.7$ Perceived quality: 89/100 """

Note: To be used as a model only. Your data and ranking criteria will vary.