Computer-implemented method for allocating charging stations, the method comprising: a) receiving charging station data, the charging station data identifying one or more charging stations and charging station locations (lc1, lc2); b) receiving requests (R) to charge requesting vehicles, each request comprising data identifying a departure location (ls1, ls2) and an arrival location (lei, le2) of the respective requesting vehicle; c) receiving and/or determining detours data, the detours data indicating at least one charging station detour distance for a plurality of vehicles, the plurality of vehicles including the requesting vehicles; d) identifying charging station candidates for the requesting vehicles by optimizing an objective function (F) with linear constraints; and e) allocate at least some of the charging station candidates to the requesting vehicles; characterized in that optimizing the objective function (F) with linear constraints includes reducing a total detour distance, waiting times in queues and/or prices for charging for the requesting vehicles; and wherein the charging station detour distance is a difference in distance between a first distance (dsc1.1, dce1.1) of a path going from the departure location (ls1, ls2) to the arrival location (le1, le2) via the charging station locations (lc1, lc2), and a second distance (dse1, dse2) of a path going from the departure location (ls1, ls2) directly to the arrival location (le1, le2). a) receiving charging station data, the charging station data identifying one or more charging stations and charging station locations (lc1, lc2); b) receiving requests (R) to charge requesting vehicles, each request comprising data identifying a departure location (ls1, ls2) and an arrival location (lei, le2) of the respective requesting vehicle; c) receiving and/or determining detours data, the detours data indicating at least one charging station detour distance for a plurality of vehicles, the plurality of vehicles including the requesting vehicles; d) identifying charging station candidates for the requesting vehicles by optimizing an objective function (F) with linear constraints; and e) allocate at least some of the charging station candidates to the requesting vehicles; characterized in that optimizing the objective function (F) with linear constraints includes reducing a total detour distance, waiting times in queues and/or prices for charging for the requesting vehicles; and wherein the charging station detour distance is a difference in distance between a first distance (dsc1.1, dce1.1) of a path going from the departure location (ls1, ls2) to the arrival location (le1, le2) via the charging station locations (lc1, lc2), and a second distance (dse1, dse2) of a path going from the departure location (ls1, ls2) directly to the arrival location (le1, le2). characterized in that optimizing the objective function (F) with linear constraints includes reducing a total detour distance, waiting times in queues and/or prices for charging for the requesting vehicles; and wherein the charging station detour distance is a difference in distance between a first distance (dsc1.1, dce1.1) of a path going from the departure location (ls1, ls2) to the arrival location (le1, le2) via the charging station locations (lc1, lc2), and a second distance (dse1, dse2) of a path going from the departure location (ls1, ls2) directly to the arrival location (le1, le2). <EOS>