Lets say we are packing smaller rectangles within a larger rectangle. Each time we pack the larger rectangle with smaller rectangles there is some area of the larger rectangle that is not packed. Is there a R code that could determine the area of the remainder and propose certain rectangular shapes and their dimensions that could come from the remainder? Do this given the large variety of different outcomes of a 2d bin packing problem. Using gbp package from .html I get several outputs that look like the following .png . Ideally I would be able to associate the amount of remaining bin with each package the program makes and i would be able to propose several rectangular like shapes and their dimensions from the remainder of the bin. Information i have available is the rectangular coordinates (x,y) of four points of each rectangle within the bin and the xy coordinates of the bin as well.
here is the code so far
library (gbp)
####Getting order into format for package
#getwd()
library(tidyverse)
df = read.csv("AFP_order.csv")
length1 = length(df$Quantity)
partlist = seq(1, length1)
df$Part_ID <- "AFP_Part"
df$Part_ID=paste0(df$Part_ID, " " )
df$Part_ID=paste0(df$Part_ID, partlist)
replication_times <- c()
for (i in df$Quantity){
replication_times <- append(replication_times,i)
}
replicated_df <- df[rep(row.names(df), times = replication_times), ]
amount = length(replicated_df$Quantity)
h = replicated_df$Quantity = replicated_df$Thickness
l = replicated_df$Length
d = replicated_df$Width
vec=c(1)
vecf = rep(vec, each=amount)
w = vecf
id = c(465782)
oid = rep(id, each = amount)
part = c("CIC")
sku = replicated_df$Part_ID
it <- data.table::data.table(
oid, sku, l,d,h,w
)
#it <- data.table::data.table(
# oid = c(465782, 465782, 465782, 465782,465782),
# sku = c("CIC001", "CIC002", "CIC003", "CIC004", "CIC005"),
# l = c(425, 106,106, 106,106),
# d = c(12, 34.5, 34.5, 34.5,34.5),
# h = c(8, 8, 8, 8,8),
# w = c(243.0000, 110.0000, 110.0000, 243.0000,243)
#)
knitr::kable(it)
##making lists representing optimal billet sizes and billet limitations
l = seq(384,552,by = 12)
amount2 = length(l/12)
billet_w=c(48)
d = rep(billet_w, each =amount2)
billet_thickness = c(8)
h = rep(billet_thickness, each =amount2)
billet_weight = c(2000)
w = rep(billet_weight, each =amount2)
id = seq(1,15)
bn <- data.table::data.table(
id ,
l ,
d ,
h ,
w
)
knitr::kable(bn)
sn <- gbp::bpp_solver(it = it, bn = bn)
sn$it
sn$bn
gbp::bpp_viewer(sn)
again this is from gbp package cran , thanks for the help [1]: .png
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744947780a4602728.html
评论列表(0条)