# 智能分单算法

+关注继续查看

### 算法描述

public class BusinessmenAndOrder {

private String id;//job标号
private String orderx;//订单坐标x
private String ordery;//订单坐标y

}

this.id=id;
this.orderx=orderx;
this.ordery=ordery;
}

public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
}
}
}
public String getOrderx() {
return orderx;
}
public void setOrderx(String orderx) {
this.orderx = orderx;
}
public String getOrdery() {
return ordery;
}
public void setOrdery(String ordery) {
this.ordery = ordery;
}

}

// 得到取件坐标和送达坐标（相当于商家和订单）
BusinessmenAndOrder bao40 = new BusinessmenAndOrder("商家订单40", "637.48", "549.33", "691.20", "291.10");

       baoList.add(bao1);
baoList.add(bao40);

public class Driver {
private String driverId;//骑士编号
private String driverx;//骑士坐标x
private String drivery;//骑士坐标y
public Driver(){

}
public Driver(String driverId,String driverx,String drivery){
this.driverId=driverId;
this.driverx=driverx;
this.drivery=drivery;
}
public String getDriverId() {
return driverId;
}
public void setDriverId(String driverId) {
this.driverId = driverId;
}
public String getDriverx() {
return driverx;
}
public void setDriverx(String driverx) {
this.driverx = driverx;
}
public String getDrivery() {
return drivery;
}
public void setDrivery(String drivery) {
this.drivery = drivery;
}
}


// 模拟骑士
List<Driver> driveList = new ArrayList<Driver>();
Driver driver1 = new Driver("driveA", "137.50", "575.78");
Driver driver2 = new Driver("driveB", "151.04", "534.10");
Driver driver3 = new Driver("driveC", "137.28", "558.01");
Driver driver4 = new Driver("driveD", "127.41", "634.78");
Driver driver5 = new Driver("driveE", "46.76", "285.75");
Driver driver6 = new Driver("driveF", "176.76", "485.75");
Driver driver7 = new Driver("driveG", "386.76", "405.75");
Driver driver8 = new Driver("driveH", "246.76", "685.75");

driveList.add(driver8);

List<DistributionSep> distList = new ArrayList<DistributionSep>();
distList = autoSeperateOrder(baoList, driveList);
for (DistributionSep distribution : distList) {
System.out.println("配送人员 "+distribution.getDriverName());
List<OrderSort> orderSet = distribution.getDist();
for (OrderSort order : orderSet) {
System.out.println(order.getOrder() + " " + order.getPors() + " " + order.getBussinessOrder());
}
}

### 结果查看

2017-06-30 14:49:38,888 INFO  [main] problem.VehicleRoutingProblem - setup problem: [fleetSize=FINITE][#jobs=40][#vehicles=8][#vehicleTypes=1][transportCost=[name=crowFlyCosts]][activityCosts=com.graphhopper.jsprit.core.problem.cost.WaitingTimeCosts@47d90b9e]
2017-06-30 14:49:38,970 INFO  [main] algorithm.VehicleRoutingAlgorithm - algorithm starts: [maxIterations=2000]
2017-06-30 14:49:38,972 INFO  [main] algorithm.InsertionInitialSolutionFactory - create initial solution
2017-06-30 14:49:39,823 INFO  [main] algorithm.VehicleRoutingAlgorithm - iterations start
2017-06-30 14:49:39,825 INFO  [main] algorithm.VehicleRoutingAlgorithm$Counter - iterations 1 2017-06-30 14:49:39,843 INFO [main] algorithm.VehicleRoutingAlgorithm$Counter - iterations 2
2017-06-30 14:49:39,910 INFO  [main] algorithm.VehicleRoutingAlgorithm$Counter - iterations 4 2017-06-30 14:49:40,032 INFO [main] algorithm.VehicleRoutingAlgorithm$Counter - iterations 8
2017-06-30 14:49:40,142 INFO  [main] algorithm.VehicleRoutingAlgorithm$Counter - iterations 16 2017-06-30 14:49:41,014 INFO [main] algorithm.VehicleRoutingAlgorithm$Counter - iterations 32
2017-06-30 14:49:41,194 INFO  [main] algorithm.VehicleRoutingAlgorithm$Counter - iterations 64 2017-06-30 14:49:41,728 INFO [main] algorithm.VehicleRoutingAlgorithm$Counter - iterations 128
2017-06-30 14:49:42,439 INFO  [main] algorithm.VehicleRoutingAlgorithm$Counter - iterations 256 2017-06-30 14:49:43,599 INFO [main] algorithm.VehicleRoutingAlgorithm$Counter - iterations 512
2017-06-30 14:49:45,723 INFO  [main] algorithm.VehicleRoutingAlgorithm\$Counter - iterations 1024
2017-06-30 14:49:49,703 INFO  [main] algorithm.VehicleRoutingAlgorithm - iterations end at 2000 iterations
2017-06-30 14:49:49,703 INFO  [main] algorithm.VehicleRoutingAlgorithm - took 10.732 seconds

+--------------------------------------------------------------------------------------------------------------------------------+
| detailed solution                                                                                                              |
+---------+----------------------+-----------------------+-----------------+-----------------+-----------------+-----------------+
| route   | vehicle              | activity              | job             | arrTime         | endTime         | costs           |
+---------+----------------------+-----------------------+-----------------+-----------------+-----------------+-----------------+
| 1       | driveA               | start                 | -               | undef           | 0               | 0               |
| 1       | driveA               | pickupShipment        | 商家订单25          | 4               | 4               | 4               |
| 1       | driveA               | deliverShipment       | 商家订单25          | 9               | 9               | 9               |
| 1       | driveA               | pickupShipment        | 商家订单21          | 20              | 20              | 20              |
| 1       | driveA               | pickupShipment        | 商家订单23          | 22              | 22              | 22              |
| 1       | driveA               | pickupShipment        | 商家订单22          | 30              | 30              | 30              |
| 1       | driveA               | pickupShipment        | 商家订单20          | 34              | 34              | 34              |
| 1       | driveA               | deliverShipment       | 商家订单22          | 38              | 38              | 38              |
| 1       | driveA               | deliverShipment       | 商家订单23          | 38              | 38              | 38              |
| 1       | driveA               | pickupShipment        | 商家订单18          | 70              | 70              | 70              |
| 1       | driveA               | deliverShipment       | 商家订单18          | 82              | 82              | 82              |
| 1       | driveA               | deliverShipment       | 商家订单21          | 102             | 102             | 102             |
| 1       | driveA               | deliverShipment       | 商家订单20          | 123             | 123             | 123             |
| 1       | driveA               | end                   | -               | 123             | undef           | 123             |
+---------+----------------------+-----------------------+-----------------+-----------------+-----------------+-----------------+
| 2       | driveB               | start                 | -               | undef           | 0               | 0               |
| 2       | driveB               | pickupShipment        | 商家订单7           | 24              | 24              | 24              |
| 2       | driveB               | deliverShipment       | 商家订单7           | 42              | 42              | 42              |
| 2       | driveB               | pickupShipment        | 商家订单19          | 68              | 68              | 68              |
| 2       | driveB               | deliverShipment       | 商家订单19          | 70              | 70              | 70              |
| 2       | driveB               | pickupShipment        | 商家订单15          | 96              | 96              | 96              |
| 2       | driveB               | deliverShipment       | 商家订单15          | 104             | 104             | 104             |
| 2       | driveB               | end                   | -               | 104             | undef           | 104             |
+---------+----------------------+-----------------------+-----------------+-----------------+-----------------+-----------------+
| 3       | driveC               | start                 | -               | undef           | 0               | 0               |
| 3       | driveC               | pickupShipment        | 商家订单1           | 4               | 4               | 4               |
| 3       | driveC               | pickupShipment        | 商家订单28          | 9               | 9               | 9               |
| 3       | driveC               | deliverShipment       | 商家订单1           | 17              | 17              | 17              |
| 3       | driveC               | deliverShipment       | 商家订单28          | 21              | 21              | 21              |
| 3       | driveC               | pickupShipment        | 商家订单12          | 26              | 26              | 26              |
| 3       | driveC               | pickupShipment        | 商家订单5           | 27              | 27              | 27              |
| 3       | driveC               | pickupShipment        | 商家订单6           | 35              | 35              | 35              |
| 3       | driveC               | pickupShipment        | 商家订单8           | 58              | 58              | 58              |
| 3       | driveC               | pickupShipment        | 商家订单11          | 61              | 61              | 61              |
| 3       | driveC               | deliverShipment       | 商家订单8           | 69              | 69              | 69              |
| 3       | driveC               | deliverShipment       | 商家订单6           | 73              | 73              | 73              |
| 3       | driveC               | deliverShipment       | 商家订单11          | 87              | 87              | 87              |
| 3       | driveC               | pickupShipment        | 商家订单24          | 101             | 101             | 101             |
| 3       | driveC               | pickupShipment        | 商家订单10          | 119             | 119             | 119             |
| 3       | driveC               | pickupShipment        | 商家订单3           | 127             | 127             | 127             |
| 3       | driveC               | pickupShipment        | 商家订单29          | 157             | 157             | 157             |
| 3       | driveC               | deliverShipment       | 商家订单29          | 192             | 192             | 192             |
| 3       | driveC               | deliverShipment       | 商家订单10          | 415             | 415             | 415             |
| 3       | driveC               | deliverShipment       | 商家订单5           | 418             | 418             | 418             |
| 3       | driveC               | deliverShipment       | 商家订单24          | 423             | 423             | 423             |
| 3       | driveC               | deliverShipment       | 商家订单12          | 425             | 425             | 425             |
| 3       | driveC               | deliverShipment       | 商家订单3           | 432             | 432             | 432             |
| 3       | driveC               | end                   | -               | 432             | undef           | 432             |
+---------+----------------------+-----------------------+-----------------+-----------------+-----------------+-----------------+
| 4       | driveD               | start                 | -               | undef           | 0               | 0               |
| 4       | driveD               | pickupShipment        | 商家订单27          | 0               | 0               | 0               |
| 4       | driveD               | pickupShipment        | 商家订单9           | 10              | 10              | 10              |
| 4       | driveD               | pickupShipment        | 商家订单13          | 55              | 55              | 55              |
| 4       | driveD               | deliverShipment       | 商家订单27          | 66              | 66              | 66              |
| 4       | driveD               | deliverShipment       | 商家订单9           | 78              | 78              | 78              |
| 4       | driveD               | pickupShipment        | 商家订单14          | 107             | 107             | 107             |
| 4       | driveD               | pickupShipment        | 商家订单30          | 132             | 132             | 132             |
| 4       | driveD               | deliverShipment       | 商家订单14          | 182             | 182             | 182             |
| 4       | driveD               | deliverShipment       | 商家订单13          | 233             | 233             | 233             |
| 4       | driveD               | pickupShipment        | 商家订单37          | 596             | 596             | 596             |
| 4       | driveD               | deliverShipment       | 商家订单30          | 760             | 760             | 760             |
| 4       | driveD               | pickupShipment        | 商家订单40          | 768             | 768             | 768             |
| 4       | driveD               | pickupShipment        | 商家订单39          | 768             | 768             | 768             |
| 4       | driveD               | pickupShipment        | 商家订单38          | 768             | 768             | 768             |
| 4       | driveD               | pickupShipment        | 商家订单2           | 971             | 971             | 971             |
| 4       | driveD               | deliverShipment       | 商家订单40          | 1255            | 1255            | 1255            |
| 4       | driveD               | pickupShipment        | 商家订单31          | 1325            | 1325            | 1325            |
| 4       | driveD               | deliverShipment       | 商家订单39          | 1734            | 1734            | 1734            |
| 4       | driveD               | deliverShipment       | 商家订单38          | 1875            | 1875            | 1875            |
| 4       | driveD               | deliverShipment       | 商家订单2           | 1936            | 1936            | 1936            |
| 4       | driveD               | deliverShipment       | 商家订单37          | 1972            | 1972            | 1972            |
| 4       | driveD               | deliverShipment       | 商家订单31          | 2017            | 2017            | 2017            |
| 4       | driveD               | end                   | -               | 2017            | undef           | 2017            |
+---------+----------------------+-----------------------+-----------------+-----------------+-----------------+-----------------+
| 5       | driveE               | start                 | -               | undef           | 0               | 0               |
| 5       | driveE               | pickupShipment        | 商家订单35          | 119             | 119             | 119             |
| 5       | driveE               | pickupShipment        | 商家订单34          | 192             | 192             | 192             |
| 5       | driveE               | pickupShipment        | 商家订单33          | 271             | 271             | 271             |
| 5       | driveE               | deliverShipment       | 商家订单35          | 382             | 382             | 382             |
| 5       | driveE               | pickupShipment        | 商家订单36          | 559             | 559             | 559             |
| 5       | driveE               | deliverShipment       | 商家订单36          | 628             | 628             | 628             |
| 5       | driveE               | deliverShipment       | 商家订单34          | 921             | 921             | 921             |
| 5       | driveE               | deliverShipment       | 商家订单33          | 993             | 993             | 993             |
| 5       | driveE               | end                   | -               | 993             | undef           | 993             |
+---------+----------------------+-----------------------+-----------------+-----------------+-----------------+-----------------+
| 6       | driveF               | start                 | -               | undef           | 0               | 0               |
| 6       | driveF               | pickupShipment        | 商家订单26          | 43              | 43              | 43              |
| 6       | driveF               | deliverShipment       | 商家订单26          | 81              | 81              | 81              |
| 6       | driveF               | pickupShipment        | 商家订单16          | 133             | 133             | 133             |
| 6       | driveF               | pickupShipment        | 商家订单17          | 166             | 166             | 166             |
| 6       | driveF               | deliverShipment       | 商家订单17          | 237             | 237             | 237             |
| 6       | driveF               | pickupShipment        | 商家订单4           | 249             | 249             | 249             |
| 6       | driveF               | deliverShipment       | 商家订单16          | 306             | 306             | 306             |
| 6       | driveF               | deliverShipment       | 商家订单4           | 329             | 329             | 329             |
| 6       | driveF               | end                   | -               | 329             | undef           | 329             |
+---------+----------------------+-----------------------+-----------------+-----------------+-----------------+-----------------+
| 7       | driveG               | start                 | -               | undef           | 0               | 0               |
| 7       | driveG               | pickupShipment        | 商家订单32          | 65              | 65              | 65              |
| 7       | driveG               | deliverShipment       | 商家订单32          | 204             | 204             | 204             |
| 7       | driveG               | end                   | -               | 204             | undef           | 204             |
+--------------------------------------------------------------------------------------------------------------------------------+

配送人员 driveA
1 取 商家订单25
2 送 商家订单25
3 取 商家订单21
4 取 商家订单23
5 取 商家订单22
6 取 商家订单20
7 送 商家订单22
8 送 商家订单23
9 取 商家订单18
10 送 商家订单18
11 送 商家订单21
12 送 商家订单20

1 取 商家订单7
2 送 商家订单7
3 取 商家订单19
4 送 商家订单19
5 取 商家订单15
6 送 商家订单15

1 取 商家订单1
2 取 商家订单28
3 送 商家订单1
4 送 商家订单28
5 取 商家订单12
6 取 商家订单5
7 取 商家订单6
8 取 商家订单8
9 取 商家订单11
10 送 商家订单8
11 送 商家订单6
12 送 商家订单11
13 取 商家订单24
14 取 商家订单10
15 取 商家订单3
16 取 商家订单29
17 送 商家订单29
18 送 商家订单10
19 送 商家订单5
20 送 商家订单24
21 送 商家订单12
22 送 商家订单3

1 取 商家订单27
2 取 商家订单9
3 取 商家订单13
4 送 商家订单27
5 送 商家订单9
6 取 商家订单14
7 取 商家订单30
8 送 商家订单14
9 送 商家订单13
10 取 商家订单37
11 送 商家订单30
12 取 商家订单40
13 取 商家订单39
14 取 商家订单38
15 取 商家订单2
16 送 商家订单40
17 取 商家订单31
18 送 商家订单39
19 送 商家订单38
20 送 商家订单2
21 送 商家订单37
22 送 商家订单31

1 取 商家订单35
2 取 商家订单34
3 取 商家订单33
4 送 商家订单35
5 取 商家订单36
6 送 商家订单36
7 送 商家订单34
8 送 商家订单33

1 取 商家订单26
2 送 商家订单26
3 取 商家订单16
4 取 商家订单17
5 送 商家订单17
6 取 商家订单4
7 送 商家订单16
8 送 商家订单4

1 取 商家订单32
2 送 商家订单32


### 总结

3D模型在智能设计领域以其可塑性，可编辑性有着属于自己的独特优势，扩展了2D设计的上限。但是其目前存在的局限性也是显而易见的：建模的效率，模型的数量，以及3D设计的成本。
58 0
【智能优化算法】基于败者淘汰机制的烟花算法LOTFWA求解单目标烟花优化问题附matlab代码
【智能优化算法】基于败者淘汰机制的烟花算法LOTFWA求解单目标烟花优化问题附matlab代码
54 0
【智能优化算法-灰狼算法】基于内存、进化算子和局部搜索的改进灰狼优化器附matlab代码
【智能优化算法-灰狼算法】基于内存、进化算子和局部搜索的改进灰狼优化器附matlab代码
50 0

38 0

100 0
《海量数据场景下的淘宝搜索智能——算法及实践》电子版地址

33 0
【智能优化算法】反对流定向算法MATLAB代码
【智能优化算法】反对流定向算法MATLAB代码
58 0
【智能优化算法-算术算法】基于算术优化算法 (MAOA)求解多目标优化问题附matlab代码
【智能优化算法-算术算法】基于算术优化算法 (MAOA)求解多目标优化问题附matlab代码
48 0
【智能优化算法-交配算法】基于进化交配算法求解单目标优化问题附matlab代码Evolutionary Mating Algorithm (EMA)
【智能优化算法-交配算法】基于进化交配算法求解单目标优化问题附matlab代码Evolutionary Mating Algorithm (EMA)
49 0
【智能优化算法】基于鲸鱼算法结合蚁群算法求解函数极值问题含Matlab代码
【智能优化算法】基于鲸鱼算法结合蚁群算法求解函数极值问题含Matlab代码
46 0
+关注
skyme张