Pārlūkot izejas kodu

二维装箱禁忌搜索算法

24282 1 gadu atpakaļ
vecāks
revīzija
a7cf1f71a4

+ 4 - 10
sd-framework/src/main/java/com/sd/framework/util/packing/Application.java

@@ -69,24 +69,18 @@ public class Application extends javafx.application.Application {
 
     private void plot(Solution solution) {
         System.out.println(solution);
-
-        // 绘制里面的矩形
-//        List<PlaceSquare> placeSquareList = solution.getPlaceSquareList();
-//        System.out.println(placeSquareList.size());
-//        for (PlaceSquare placeSquare : placeSquareList) {
-//            canvas = draw(canvas,placeSquare.getX(),placeSquare.getY(),placeSquare.getL(),placeSquare.getW());
-//        }
     }
 
-    private void draw(Canvas canvas, double x, double y, double l, double w) {
+    private void draw(Canvas canvas, double x, double y, double length, double width) {
         GraphicsContext gc = canvas.getGraphicsContext2D();
         // 边框
         gc.setStroke(Color.BLACK);
         gc.setLineWidth(2);
-        gc.strokeRect(x, y, l, w);
+        gc.strokeRect(x, y, length, width);
         // 填充
         gc.setFill(new Color(new Random().nextDouble(), new Random().nextDouble(), new Random().nextDouble(), new Random().nextDouble()));
-        gc.fillRect(x, y, l, w);
+        gc.fillRect(x, y, length, width);
     }
+
 }
 

+ 1 - 1
sd-framework/src/main/java/com/sd/framework/util/packing/model/TabuSearch.java

@@ -148,7 +148,7 @@ public class TabuSearch {
             PlacePoint placePoint = placePointList.get(i);
             double maxMark = -1.0d;
             int maxIndex = -1;
-            double isRotate = -1, curMarks = -1;
+            double isRotate = -1, curMarks;
             for (int j = 0; j < squareList.size(); j++) {
                 Square square = squareList.get(j);
                 double[] arr = getMarks(placePoint, square, placeSquareList);