23 lines
761 B
C#
23 lines
761 B
C#
namespace MiGu.Server.Configs;
|
|||
|
|
|
||
|
|
public record AvoidanceRule(string Id, string ZoneId, string Rule);
|
||
|
|
public record ZoneSpeedLimit(string ZoneId, double MaxSpeedMps);
|
||
|
|
|
||
|
|
public record RoutingPolicy(
|
||
|
|
string Algorithm,
|
||
|
|
Dictionary<string, double> Weights,
|
||
|
|
List<AvoidanceRule> Avoidance,
|
||
|
|
List<ZoneSpeedLimit> ZoneSpeedLimits)
|
||
|
|
{
|
||
|
|
public static RoutingPolicy Default() => new(
|
||
|
|
Algorithm: "astar",
|
||
|
|
Weights: new Dictionary<string, double>
|
||
|
|
{
|
||
|
|
["distance"] = 1.0,
|
||
|
|
["congestion"] = 0.5,
|
||
|
|
["turnPenalty"] = 0.2
|
||
|
|
},
|
||
|
|
Avoidance: new List<AvoidanceRule> { new("AV1", "Z-NORTH", "no-entry-while-loading") },
|
||
|
|
ZoneSpeedLimits: new List<ZoneSpeedLimit> { new("Z-NARROW", 0.5) });
|
||
|
|
}
|