Rectangle packing in smallest possible area












1














I have written a Java Program to place a bunch of rectangles
into the smallest possible rectangluar area(no overlapping and rotating).



Here is a short summary:



I calculate minArea and maxArea:



minArea: minArea is sum up all given rectangle areas.



maxArea: put all given rectangles side by side, maxArea is rectangle area in which all given rectangles fit in.



Between minArea and maxArea must exist the smallest rectangular area, in which all given rectangles fit in.



For each rectangular area between minArea and maxArea I try recursiv, if all given rectangles fit in the rectangular area.



Example input/output:



(height,width of rectangles)

2,3
4,4
5,5
7,2
1,1
9,3

1 1 1 2 2 2 2 6 6 6
1 1 1 2 2 2 2 6 6 6
4 4 5 2 2 2 2 6 6 6
4 4 0 2 2 2 2 6 6 6
4 4 3 3 3 3 3 6 6 6
4 4 3 3 3 3 3 6 6 6
4 4 3 3 3 3 3 6 6 6
4 4 3 3 3 3 3 6 6 6
4 4 3 3 3 3 3 6 6 6


0 represents free space, all other numbers are for differentiating rectangles.



RectanglePacking.java:



import java.util.ArrayList;
import java.util.Scanner;
import java.awt.Point;
import java.io.IOException;


class Rectangle {

public int id;
public int width;
public int height;

public Rectangle(int height, int width, int id) {
this.width = width;
this.height = height;
this.id = id;
}
}

public class RectanglePacking {

private ArrayList<Rectangle> rectangleList = new ArrayList<Rectangle>();
private int minArea;
private int maxArea;


private int getMinArea() {

for (Rectangle r : rectangleList) {
minArea = minArea + r.height * r.width;
}
return minArea;
}


private int getMaxArea() {

int totalWidth = 0;
int height = 0;
int maxHeight = 0;

for (Rectangle r : rectangleList) {
totalWidth = totalWidth + r.width;
height = r.height;

if (height >= maxHeight) {
maxHeight = height;
}
}

maxArea = totalWidth * maxHeight;
return maxArea;
}


private ArrayList<Point> possiblePlaces(int field, int id) {

ArrayList<Point> places = new ArrayList<Point>();

for (int i = 0; i < field.length; i++) {

for (int j = 0; j < field[0].length; j++) {

if (isEmpty(field, i, j, rectangleList.get(id).height, rectangleList.get(id).width)) {
places.add(new Point(i, j));
}

}
}
return places;
}


public boolean isEmpty(int field, int x, int y, int height, int width) {

for (int i = x; i < x + height; i++) {
for (int j = y; j < y + width; j++) {

if (i > field.length - 1 || j > field[0].length - 1 || field[i][j] != 0) {
return false;
}
}
}
return true;
}


private int markRectangle(int field, int x, int y, int height, int width, int id) {

id = id + 1;

for (int i = x; i < x + height; i++) {
for (int j = y; j < y + width; j++) {

field[i][j] = id;
}
}
return field;
}


private void removeRectangle(int field, int x, int y, int height, int width) {
for (int i = x; i < x + height; i++) {
for (int j = y; j < y + width; j++) {

field[i][j] = 0;
}
}
}


private void placeRectangles(int field, int id) {

if (id == rectangleList.size()) {
printSolution(field);
System.exit(0);
}

ArrayList<Point> possiblePlaces = possiblePlaces(field, id);

for (int i = 0; i < possiblePlaces.size(); i++) {

Point p = possiblePlaces.get(i);
field = markRectangle(field, p.x, p.y, rectangleList.get(id).height, rectangleList.get(id).width, id);

placeRectangles(field, id + 1);
removeRectangle(field, p.x, p.y, rectangleList.get(id).height, rectangleList.get(id).width);

}
}


private ArrayList<Point> calcPossibleAreas() {

ArrayList<Point> possibleAreas= new ArrayList<Point>();
ArrayList<Point> factors = new ArrayList<Point>();

for (int i = getMinArea(); i <= getMaxArea(); i++) {

factors = calcFactors(i);

for (int j = 0; j < factors.size(); j++) {
possibleAreas.add(new Point(factors.get(j).x, factors.get(j).y));
}

}
return possibleAreas;
}


private ArrayList<Point> calcFactors(int number) {

ArrayList<Point> factors = new ArrayList<Point>();

for (int i = 1; i <= number; i++) {

if (number % i == 0) {
factors.add(new Point(i, number/i));
factors.add(new Point(number/i, i));
}

}
return factors;
}


private void calcMinArea() {

ArrayList<Point> possibleAreas = calcPossibleAreas();
int field;

for (int i = 0; i < possibleAreas.size(); i++) {

int x = possibleAreas.get(i).x;
int y = possibleAreas.get(i).y;

field = new int[x][y];
placeRectangles(field, 0);
}
}


private void printSolution(int field) {
System.out.println("Solution:");
for (int i = 0; i < field.length; i++) {
for (int j = 0; j < field[0].length; j++) {

System.out.print(" "+field[i][j] + " ");

}
System.out.println();
}
}

public static void main(String args) throws IOException {

RectanglePacking r = new RectanglePacking();
Scanner input = new Scanner(System.in);

int id = 1;

try {

while (true) {

String line = input.nextLine();

if (line.equals("")) {
break;
}

String split = line.split(",");

int height = Integer.parseInt(split[0]);
int width = Integer.parseInt(split[1]);

r.rectangleList.add(new Rectangle(height, width, id));
id++;
}

input.close();
} catch (Exception ex) {
ex.printStackTrace();
}

r.calcMinArea();
}
}


How can I improve my code?



Any help is really appreciated.










share|improve this question



























    1














    I have written a Java Program to place a bunch of rectangles
    into the smallest possible rectangluar area(no overlapping and rotating).



    Here is a short summary:



    I calculate minArea and maxArea:



    minArea: minArea is sum up all given rectangle areas.



    maxArea: put all given rectangles side by side, maxArea is rectangle area in which all given rectangles fit in.



    Between minArea and maxArea must exist the smallest rectangular area, in which all given rectangles fit in.



    For each rectangular area between minArea and maxArea I try recursiv, if all given rectangles fit in the rectangular area.



    Example input/output:



    (height,width of rectangles)

    2,3
    4,4
    5,5
    7,2
    1,1
    9,3

    1 1 1 2 2 2 2 6 6 6
    1 1 1 2 2 2 2 6 6 6
    4 4 5 2 2 2 2 6 6 6
    4 4 0 2 2 2 2 6 6 6
    4 4 3 3 3 3 3 6 6 6
    4 4 3 3 3 3 3 6 6 6
    4 4 3 3 3 3 3 6 6 6
    4 4 3 3 3 3 3 6 6 6
    4 4 3 3 3 3 3 6 6 6


    0 represents free space, all other numbers are for differentiating rectangles.



    RectanglePacking.java:



    import java.util.ArrayList;
    import java.util.Scanner;
    import java.awt.Point;
    import java.io.IOException;


    class Rectangle {

    public int id;
    public int width;
    public int height;

    public Rectangle(int height, int width, int id) {
    this.width = width;
    this.height = height;
    this.id = id;
    }
    }

    public class RectanglePacking {

    private ArrayList<Rectangle> rectangleList = new ArrayList<Rectangle>();
    private int minArea;
    private int maxArea;


    private int getMinArea() {

    for (Rectangle r : rectangleList) {
    minArea = minArea + r.height * r.width;
    }
    return minArea;
    }


    private int getMaxArea() {

    int totalWidth = 0;
    int height = 0;
    int maxHeight = 0;

    for (Rectangle r : rectangleList) {
    totalWidth = totalWidth + r.width;
    height = r.height;

    if (height >= maxHeight) {
    maxHeight = height;
    }
    }

    maxArea = totalWidth * maxHeight;
    return maxArea;
    }


    private ArrayList<Point> possiblePlaces(int field, int id) {

    ArrayList<Point> places = new ArrayList<Point>();

    for (int i = 0; i < field.length; i++) {

    for (int j = 0; j < field[0].length; j++) {

    if (isEmpty(field, i, j, rectangleList.get(id).height, rectangleList.get(id).width)) {
    places.add(new Point(i, j));
    }

    }
    }
    return places;
    }


    public boolean isEmpty(int field, int x, int y, int height, int width) {

    for (int i = x; i < x + height; i++) {
    for (int j = y; j < y + width; j++) {

    if (i > field.length - 1 || j > field[0].length - 1 || field[i][j] != 0) {
    return false;
    }
    }
    }
    return true;
    }


    private int markRectangle(int field, int x, int y, int height, int width, int id) {

    id = id + 1;

    for (int i = x; i < x + height; i++) {
    for (int j = y; j < y + width; j++) {

    field[i][j] = id;
    }
    }
    return field;
    }


    private void removeRectangle(int field, int x, int y, int height, int width) {
    for (int i = x; i < x + height; i++) {
    for (int j = y; j < y + width; j++) {

    field[i][j] = 0;
    }
    }
    }


    private void placeRectangles(int field, int id) {

    if (id == rectangleList.size()) {
    printSolution(field);
    System.exit(0);
    }

    ArrayList<Point> possiblePlaces = possiblePlaces(field, id);

    for (int i = 0; i < possiblePlaces.size(); i++) {

    Point p = possiblePlaces.get(i);
    field = markRectangle(field, p.x, p.y, rectangleList.get(id).height, rectangleList.get(id).width, id);

    placeRectangles(field, id + 1);
    removeRectangle(field, p.x, p.y, rectangleList.get(id).height, rectangleList.get(id).width);

    }
    }


    private ArrayList<Point> calcPossibleAreas() {

    ArrayList<Point> possibleAreas= new ArrayList<Point>();
    ArrayList<Point> factors = new ArrayList<Point>();

    for (int i = getMinArea(); i <= getMaxArea(); i++) {

    factors = calcFactors(i);

    for (int j = 0; j < factors.size(); j++) {
    possibleAreas.add(new Point(factors.get(j).x, factors.get(j).y));
    }

    }
    return possibleAreas;
    }


    private ArrayList<Point> calcFactors(int number) {

    ArrayList<Point> factors = new ArrayList<Point>();

    for (int i = 1; i <= number; i++) {

    if (number % i == 0) {
    factors.add(new Point(i, number/i));
    factors.add(new Point(number/i, i));
    }

    }
    return factors;
    }


    private void calcMinArea() {

    ArrayList<Point> possibleAreas = calcPossibleAreas();
    int field;

    for (int i = 0; i < possibleAreas.size(); i++) {

    int x = possibleAreas.get(i).x;
    int y = possibleAreas.get(i).y;

    field = new int[x][y];
    placeRectangles(field, 0);
    }
    }


    private void printSolution(int field) {
    System.out.println("Solution:");
    for (int i = 0; i < field.length; i++) {
    for (int j = 0; j < field[0].length; j++) {

    System.out.print(" "+field[i][j] + " ");

    }
    System.out.println();
    }
    }

    public static void main(String args) throws IOException {

    RectanglePacking r = new RectanglePacking();
    Scanner input = new Scanner(System.in);

    int id = 1;

    try {

    while (true) {

    String line = input.nextLine();

    if (line.equals("")) {
    break;
    }

    String split = line.split(",");

    int height = Integer.parseInt(split[0]);
    int width = Integer.parseInt(split[1]);

    r.rectangleList.add(new Rectangle(height, width, id));
    id++;
    }

    input.close();
    } catch (Exception ex) {
    ex.printStackTrace();
    }

    r.calcMinArea();
    }
    }


    How can I improve my code?



    Any help is really appreciated.










    share|improve this question

























      1












      1








      1







      I have written a Java Program to place a bunch of rectangles
      into the smallest possible rectangluar area(no overlapping and rotating).



      Here is a short summary:



      I calculate minArea and maxArea:



      minArea: minArea is sum up all given rectangle areas.



      maxArea: put all given rectangles side by side, maxArea is rectangle area in which all given rectangles fit in.



      Between minArea and maxArea must exist the smallest rectangular area, in which all given rectangles fit in.



      For each rectangular area between minArea and maxArea I try recursiv, if all given rectangles fit in the rectangular area.



      Example input/output:



      (height,width of rectangles)

      2,3
      4,4
      5,5
      7,2
      1,1
      9,3

      1 1 1 2 2 2 2 6 6 6
      1 1 1 2 2 2 2 6 6 6
      4 4 5 2 2 2 2 6 6 6
      4 4 0 2 2 2 2 6 6 6
      4 4 3 3 3 3 3 6 6 6
      4 4 3 3 3 3 3 6 6 6
      4 4 3 3 3 3 3 6 6 6
      4 4 3 3 3 3 3 6 6 6
      4 4 3 3 3 3 3 6 6 6


      0 represents free space, all other numbers are for differentiating rectangles.



      RectanglePacking.java:



      import java.util.ArrayList;
      import java.util.Scanner;
      import java.awt.Point;
      import java.io.IOException;


      class Rectangle {

      public int id;
      public int width;
      public int height;

      public Rectangle(int height, int width, int id) {
      this.width = width;
      this.height = height;
      this.id = id;
      }
      }

      public class RectanglePacking {

      private ArrayList<Rectangle> rectangleList = new ArrayList<Rectangle>();
      private int minArea;
      private int maxArea;


      private int getMinArea() {

      for (Rectangle r : rectangleList) {
      minArea = minArea + r.height * r.width;
      }
      return minArea;
      }


      private int getMaxArea() {

      int totalWidth = 0;
      int height = 0;
      int maxHeight = 0;

      for (Rectangle r : rectangleList) {
      totalWidth = totalWidth + r.width;
      height = r.height;

      if (height >= maxHeight) {
      maxHeight = height;
      }
      }

      maxArea = totalWidth * maxHeight;
      return maxArea;
      }


      private ArrayList<Point> possiblePlaces(int field, int id) {

      ArrayList<Point> places = new ArrayList<Point>();

      for (int i = 0; i < field.length; i++) {

      for (int j = 0; j < field[0].length; j++) {

      if (isEmpty(field, i, j, rectangleList.get(id).height, rectangleList.get(id).width)) {
      places.add(new Point(i, j));
      }

      }
      }
      return places;
      }


      public boolean isEmpty(int field, int x, int y, int height, int width) {

      for (int i = x; i < x + height; i++) {
      for (int j = y; j < y + width; j++) {

      if (i > field.length - 1 || j > field[0].length - 1 || field[i][j] != 0) {
      return false;
      }
      }
      }
      return true;
      }


      private int markRectangle(int field, int x, int y, int height, int width, int id) {

      id = id + 1;

      for (int i = x; i < x + height; i++) {
      for (int j = y; j < y + width; j++) {

      field[i][j] = id;
      }
      }
      return field;
      }


      private void removeRectangle(int field, int x, int y, int height, int width) {
      for (int i = x; i < x + height; i++) {
      for (int j = y; j < y + width; j++) {

      field[i][j] = 0;
      }
      }
      }


      private void placeRectangles(int field, int id) {

      if (id == rectangleList.size()) {
      printSolution(field);
      System.exit(0);
      }

      ArrayList<Point> possiblePlaces = possiblePlaces(field, id);

      for (int i = 0; i < possiblePlaces.size(); i++) {

      Point p = possiblePlaces.get(i);
      field = markRectangle(field, p.x, p.y, rectangleList.get(id).height, rectangleList.get(id).width, id);

      placeRectangles(field, id + 1);
      removeRectangle(field, p.x, p.y, rectangleList.get(id).height, rectangleList.get(id).width);

      }
      }


      private ArrayList<Point> calcPossibleAreas() {

      ArrayList<Point> possibleAreas= new ArrayList<Point>();
      ArrayList<Point> factors = new ArrayList<Point>();

      for (int i = getMinArea(); i <= getMaxArea(); i++) {

      factors = calcFactors(i);

      for (int j = 0; j < factors.size(); j++) {
      possibleAreas.add(new Point(factors.get(j).x, factors.get(j).y));
      }

      }
      return possibleAreas;
      }


      private ArrayList<Point> calcFactors(int number) {

      ArrayList<Point> factors = new ArrayList<Point>();

      for (int i = 1; i <= number; i++) {

      if (number % i == 0) {
      factors.add(new Point(i, number/i));
      factors.add(new Point(number/i, i));
      }

      }
      return factors;
      }


      private void calcMinArea() {

      ArrayList<Point> possibleAreas = calcPossibleAreas();
      int field;

      for (int i = 0; i < possibleAreas.size(); i++) {

      int x = possibleAreas.get(i).x;
      int y = possibleAreas.get(i).y;

      field = new int[x][y];
      placeRectangles(field, 0);
      }
      }


      private void printSolution(int field) {
      System.out.println("Solution:");
      for (int i = 0; i < field.length; i++) {
      for (int j = 0; j < field[0].length; j++) {

      System.out.print(" "+field[i][j] + " ");

      }
      System.out.println();
      }
      }

      public static void main(String args) throws IOException {

      RectanglePacking r = new RectanglePacking();
      Scanner input = new Scanner(System.in);

      int id = 1;

      try {

      while (true) {

      String line = input.nextLine();

      if (line.equals("")) {
      break;
      }

      String split = line.split(",");

      int height = Integer.parseInt(split[0]);
      int width = Integer.parseInt(split[1]);

      r.rectangleList.add(new Rectangle(height, width, id));
      id++;
      }

      input.close();
      } catch (Exception ex) {
      ex.printStackTrace();
      }

      r.calcMinArea();
      }
      }


      How can I improve my code?



      Any help is really appreciated.










      share|improve this question













      I have written a Java Program to place a bunch of rectangles
      into the smallest possible rectangluar area(no overlapping and rotating).



      Here is a short summary:



      I calculate minArea and maxArea:



      minArea: minArea is sum up all given rectangle areas.



      maxArea: put all given rectangles side by side, maxArea is rectangle area in which all given rectangles fit in.



      Between minArea and maxArea must exist the smallest rectangular area, in which all given rectangles fit in.



      For each rectangular area between minArea and maxArea I try recursiv, if all given rectangles fit in the rectangular area.



      Example input/output:



      (height,width of rectangles)

      2,3
      4,4
      5,5
      7,2
      1,1
      9,3

      1 1 1 2 2 2 2 6 6 6
      1 1 1 2 2 2 2 6 6 6
      4 4 5 2 2 2 2 6 6 6
      4 4 0 2 2 2 2 6 6 6
      4 4 3 3 3 3 3 6 6 6
      4 4 3 3 3 3 3 6 6 6
      4 4 3 3 3 3 3 6 6 6
      4 4 3 3 3 3 3 6 6 6
      4 4 3 3 3 3 3 6 6 6


      0 represents free space, all other numbers are for differentiating rectangles.



      RectanglePacking.java:



      import java.util.ArrayList;
      import java.util.Scanner;
      import java.awt.Point;
      import java.io.IOException;


      class Rectangle {

      public int id;
      public int width;
      public int height;

      public Rectangle(int height, int width, int id) {
      this.width = width;
      this.height = height;
      this.id = id;
      }
      }

      public class RectanglePacking {

      private ArrayList<Rectangle> rectangleList = new ArrayList<Rectangle>();
      private int minArea;
      private int maxArea;


      private int getMinArea() {

      for (Rectangle r : rectangleList) {
      minArea = minArea + r.height * r.width;
      }
      return minArea;
      }


      private int getMaxArea() {

      int totalWidth = 0;
      int height = 0;
      int maxHeight = 0;

      for (Rectangle r : rectangleList) {
      totalWidth = totalWidth + r.width;
      height = r.height;

      if (height >= maxHeight) {
      maxHeight = height;
      }
      }

      maxArea = totalWidth * maxHeight;
      return maxArea;
      }


      private ArrayList<Point> possiblePlaces(int field, int id) {

      ArrayList<Point> places = new ArrayList<Point>();

      for (int i = 0; i < field.length; i++) {

      for (int j = 0; j < field[0].length; j++) {

      if (isEmpty(field, i, j, rectangleList.get(id).height, rectangleList.get(id).width)) {
      places.add(new Point(i, j));
      }

      }
      }
      return places;
      }


      public boolean isEmpty(int field, int x, int y, int height, int width) {

      for (int i = x; i < x + height; i++) {
      for (int j = y; j < y + width; j++) {

      if (i > field.length - 1 || j > field[0].length - 1 || field[i][j] != 0) {
      return false;
      }
      }
      }
      return true;
      }


      private int markRectangle(int field, int x, int y, int height, int width, int id) {

      id = id + 1;

      for (int i = x; i < x + height; i++) {
      for (int j = y; j < y + width; j++) {

      field[i][j] = id;
      }
      }
      return field;
      }


      private void removeRectangle(int field, int x, int y, int height, int width) {
      for (int i = x; i < x + height; i++) {
      for (int j = y; j < y + width; j++) {

      field[i][j] = 0;
      }
      }
      }


      private void placeRectangles(int field, int id) {

      if (id == rectangleList.size()) {
      printSolution(field);
      System.exit(0);
      }

      ArrayList<Point> possiblePlaces = possiblePlaces(field, id);

      for (int i = 0; i < possiblePlaces.size(); i++) {

      Point p = possiblePlaces.get(i);
      field = markRectangle(field, p.x, p.y, rectangleList.get(id).height, rectangleList.get(id).width, id);

      placeRectangles(field, id + 1);
      removeRectangle(field, p.x, p.y, rectangleList.get(id).height, rectangleList.get(id).width);

      }
      }


      private ArrayList<Point> calcPossibleAreas() {

      ArrayList<Point> possibleAreas= new ArrayList<Point>();
      ArrayList<Point> factors = new ArrayList<Point>();

      for (int i = getMinArea(); i <= getMaxArea(); i++) {

      factors = calcFactors(i);

      for (int j = 0; j < factors.size(); j++) {
      possibleAreas.add(new Point(factors.get(j).x, factors.get(j).y));
      }

      }
      return possibleAreas;
      }


      private ArrayList<Point> calcFactors(int number) {

      ArrayList<Point> factors = new ArrayList<Point>();

      for (int i = 1; i <= number; i++) {

      if (number % i == 0) {
      factors.add(new Point(i, number/i));
      factors.add(new Point(number/i, i));
      }

      }
      return factors;
      }


      private void calcMinArea() {

      ArrayList<Point> possibleAreas = calcPossibleAreas();
      int field;

      for (int i = 0; i < possibleAreas.size(); i++) {

      int x = possibleAreas.get(i).x;
      int y = possibleAreas.get(i).y;

      field = new int[x][y];
      placeRectangles(field, 0);
      }
      }


      private void printSolution(int field) {
      System.out.println("Solution:");
      for (int i = 0; i < field.length; i++) {
      for (int j = 0; j < field[0].length; j++) {

      System.out.print(" "+field[i][j] + " ");

      }
      System.out.println();
      }
      }

      public static void main(String args) throws IOException {

      RectanglePacking r = new RectanglePacking();
      Scanner input = new Scanner(System.in);

      int id = 1;

      try {

      while (true) {

      String line = input.nextLine();

      if (line.equals("")) {
      break;
      }

      String split = line.split(",");

      int height = Integer.parseInt(split[0]);
      int width = Integer.parseInt(split[1]);

      r.rectangleList.add(new Rectangle(height, width, id));
      id++;
      }

      input.close();
      } catch (Exception ex) {
      ex.printStackTrace();
      }

      r.calcMinArea();
      }
      }


      How can I improve my code?



      Any help is really appreciated.







      java performance recursion






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 54 mins ago









      Marten

      1586




      1586



























          active

          oldest

          votes











          Your Answer





          StackExchange.ifUsing("editor", function () {
          return StackExchange.using("mathjaxEditing", function () {
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
          });
          });
          }, "mathjax-editing");

          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "196"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f210711%2frectangle-packing-in-smallest-possible-area%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Code Review Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f210711%2frectangle-packing-in-smallest-possible-area%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Morgemoulin

          Scott Moir

          Souastre