车辆路线问题中的最小车辆数量

时间:2019-05-22 07:51:40

标签: or-tools

是否有可能在使用最少车辆的情况下向整体模型添加约束?我正在为C#使用dotnet nuget软件包。 我从同事那里得到的一个建议是:

for (int i = 0; i < minvehicles; i++)
{
    start = model.NextVar(model.Start(i));
    var end = model.End(i);
    start.RemoveValue(end);
}

不幸的是,在测试此求解器时,求解器花费的时间成倍增加,并且它不会使用所需的最少数量的车辆。

以下结果日志:

starting test #0
creating the routingModel with 100 locations and 50 vehicles with minimum of 0
solution time 1.177255392074585 seconds
counting the number of vehicles used.
test #0 used 15 vehicles
starting test #1
creating the routingModel with 100 locations and 50 vehicles with minimum of 1
solution time 2.842360019683838 seconds
counting the number of vehicles used.
test #1 used 15 vehicles
starting test #2
creating the routingModel with 100 locations and 50 vehicles with minimum of 2
solution time 4.520026445388794 seconds
counting the number of vehicles used.
test #2 used 15 vehicles
...
starting test #22
creating the routingModel with 100 locations and 50 vehicles with minimum of 22
solution time 40.16919469833374 seconds
counting the number of vehicles used.
test #22 used 15 vehicles
starting test #23
creating the routingModel with 100 locations and 50 vehicles with minimum of 23
solution time 42.224249601364136 seconds
counting the number of vehicles used.
test #23 used 15 vehicles
starting test #24
creating the routingModel with 100 locations and 50 vehicles with minimum of 24
solution time 44.01835751533508 seconds
counting the number of vehicles used.
test #24 used 15 vehicles

0 个答案:

没有答案
相关问题