| | |
| | | @Async |
| | | public void startUpdateLineAsync(JkSketch model) { |
| | | try { |
| | | int maxnum =100; |
| | | int maxnum =100,distance = 500; |
| | | try { |
| | | maxnum = Integer.parseInt(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.JK_PLAN_MAX_CLUSTER).getCode()); |
| | | distance = Integer.parseInt(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.JK_PLAN_DISTANCECLUSTER).getCode()); |
| | | }catch (Exception e){ |
| | | |
| | | } |
| | | List<JkSketchCustomer> allCustomerList = model.getCustomerList(); |
| | | //两公里内数据客户合并 |
| | | // List<SketchCateModel> customerList =Clustering.clusterPoints(allCustomerList,1000); |
| | | List<SketchCateModel> customerList = new ClusterCustomKMeans().clusterPoints(allCustomerList,maxnum,500); |
| | | List<SketchCateModel> customerList = new ClusterCustomKMeans().clusterPoints(allCustomerList,maxnum,distance); |
| | | List<JkLine> lineList = model.getLineList(); |
| | | TspSolver.DataModel dataModel = new TspSolver.DataModel(); |
| | | int vehicleNumber1 = lineList.size();//线路数量 |
| | |
| | | if(customerList == null ||customerList.size() ==0){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"该线路客户信息为空,不满足优化条件!"); |
| | | } |
| | | int maxnum =100; |
| | | int maxnum =100,distance = 500; |
| | | try { |
| | | maxnum = Integer.parseInt(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.JK_PLAN_MAX_CLUSTER).getCode()); |
| | | distance = Integer.parseInt(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.JK_PLAN_DISTANCECLUSTER).getCode()); |
| | | }catch (Exception e){ |
| | | |
| | | } |
| | | int totalNum = 0; |
| | | for(JkSketchLine line : lineList){ |
| | |
| | | //逐个路线优化 |
| | | List<JkSketchCustomer> allCustomerListParam = line.getCustomerList() ; |
| | | // List<SketchCateModel> customerListParam = Clustering.clusterPoints(allCustomerListParam,1000); |
| | | List<SketchCateModel> customerListParam = new ClusterCustomKMeans().clusterPoints(allCustomerListParam,maxnum,500); |
| | | List<SketchCateModel> customerListParam = new ClusterCustomKMeans().clusterPoints(allCustomerListParam,maxnum,distance); |
| | | TspSolver.DataModel dataModel = new TspSolver.DataModel(); |
| | | int vehicleNumber1 = 1;//线路数量 |
| | | long[] vehicleCapacities1=new long[]{line.getMaxOrder()};//每辆车的最大订单量限制 |