GuillotineModels.PPG2KP.Enumeration
GuillotineModels.PPG2KP.Enumeration
— ModuleCollection of the methods used for generating the cuts and plates that make up the PP-G2KP model.
GuillotineModels.PPG2KP.Enumeration.ByproductPPG2KP
— TypeCollection of internal datastructures used to create the PP-G2KP model and needed to assemble the solution given by the values of the model variables.
cuts::Array{Tuple{P,P,P},1} where P
If
(pp, fc, sc)
is incuts
, thenpp
may be cut intofc
andsc
.cut_extraction::Array{D,1} where D
If hybridize-with-restricted, has the extracted piece for each
cuts
elem.first_vertical_cut_idx::Any
Every cut before this position is horizontal, the rest are vertical.
np::Array{Tuple{P,D},1} where P where D
If
(n, p)
is innp
then platen
may be sold as piecep
.pli_lwb::Array{Tuple{S,S,P},1} where P where S
Indexed by a plate index, values are the plate length, width, and bound.
d::Array{D,1} where D
The demand of the pieces.
l::Array{S,1} where S
The length of the pieces.
w::Array{S,1} where S
The width of the pieces.
L::Any
The length of the original plate.
W::Any
The width of the original plate.
mirror_plates::Bool
If all plates were rotated so length is never greater than width.
GuillotineModels.PPG2KP.Enumeration.discretize
— Methoddiscretize(d::[D], l::[S], w::[S], L::S, W::S; kwargs...) :: [S]
!!! Internal use.
Given the pieces demand, length, and width (d
, l
, w
), as well the plate dimensions (L
, W
), return a vector of all linear combinations (constrained by demand) of the length of pieces that fit the plate (the returned vector is sorted by increasing value and no value is greater than L
). To discretize the width just swap l
with w
and L
with W
.
Keyword arguments
All keyword arguments are of type Bool
and have false
as default.
only_single_pieces
: Instead of discretizing the length, return the piece lengths that exist only as the length of a piece and not as the combination of two or more smaller piece lengths.ignore_W
: Do not useW
to exclude pieces that do not fit the plate.ignore_d
: Do not used
emand information to discretize (consider an unlimited amount of each piece type available).
GuillotineModels.PPG2KP.Enumeration.filter_symm_pos
— Methodfilter_symm_pos(disc, dim, disc_copy = copy(disc)) -> disc_copy
!!! Internal use.
Implement the symmetry-breaking described in Section 2.1 of 10.1287/ijoc.2016.0710 (just after equation 10). Given a list of discretized lengths (or widths) disc
and the plate length (or width) dim
, return a copy of disc
without all positions i
in which disc[i] > div(dim/2) \land (\exists. disc[j] == dim - disc[i])
.
GuillotineModels.PPG2KP.Enumeration.fits_at_least_one
— Methodfits_at_least_one(sllw, L, W) :: Bool
!!! Internal use.
True if at least one piece in sllw
fits inside a L
xW
plate; false otherwise.
GuillotineModels.PPG2KP.Enumeration.gen_cuts
— Methodgen_cuts(::Type{P}, d, sllw, L, W; [kwargs])
!!! Internal use.
The main method responsible for generating all the cuts used to create both the original PP-G2KP model as its enhanced version (in this case, it generates the piece extractions too).
Arguments
Positional and required arguments
::Type{P}
: The type of the piece profits (and area).d::Vector{D}
: The pieces demand.sllw::SortedLinkedLW{D, S}
: The SortedLinkedLW containing the length and width of the pieces.L::S
: The plate length.W::S
: The plate width.
Keyword arguments
All keyword arguments are of type Bool
.
ignore_2th_dim
: Default: false. Ignore the dimension not being discretized during discretization.ignore_d
: Default: false. Ignore the demand information during discretization.round2disc
: Default: true. Round the size of the second child of a cut to a discretized position.faithful2furini2016
: Default: false. Tries to be the most faithful possible to the description in 10.1287/ijoc.2016.0710.no_redundant_cut
: Default: false. Disables the Redundant-Cut reduction described in 10.1287/ijoc.2016.0710.no_cut_position
: Default: false. Disables the Cut-Position reduction described in 10.1287/ijoc.2016.0710.no_furini_symmbreak
: Default: false. Ignored iffaithful2furini2016
isfalse
. Disables the symmetry-breaking used in 10.1287/ijoc.2016.0710 (consequently all discretized positions are used, none is removed).
Return
The return is a ByproductPPG2KP object.
GuillotineModels.PPG2KP.Enumeration.no_chance_to_fit_6_piece
— Methodno_chance_to_fit_6_piece(d, l, w, a, L, W, A; ignore_2th_dim = false)
Returns true if it is demonstrably impossible to fit six pieces into the plate; and false if there is some possibility (but no guarantee) of fitting six pieces in the plate.
If ignore_2th_dim
is true, w
and W
are ignored by the algorithm.
GuillotineModels.PPG2KP.Enumeration.reduce2fit_usl
— Methodreduce2fit_usl(sl, sli2pii, w, L, W) :: [S]
!!! Internal use.
Given a plate (L
, W
), and the pieces sorted by length (sl
, sli2pii
, w
), return an increasing vector of unique lengths that pertain to a piece that fits the plate. If two or more pieces share length and fit the plate, only one copy of that length is included in the returned vector.
Arguments
sl::Vector{S}
: The piece lengths sorted by increase-or-stay order.sli2pii::Vector{D}
: Ifsli2pii[i] == j
thensl[i]
andw[j]
correspond to the same item.w::Vector{S}
: The piece widths (in 'original' order).L::S
: The length of the plate.W::S
: The width of the plate.
GuillotineModels.PPG2KP.Enumeration.reflect!
— Methodreflect!(l, L)
!!! Internal use.
Change l
to the sorted union of [li ∈ l ∧ li ≤ L÷2 | li]
and `[li ∈ l ∧ li
L÷2 ∧ li < L | L - li]
; assumes
l` is in increase-or-stay order.
The new value of l
has an important property that: any pair of plates generated by a cut using the original l
will also be generated by some cut in the modified set, even with the modified set only having cuts in the first half of the plate. Note any values equal to or above L are discarded.
GuillotineModels.PPG2KP.Enumeration.should_extract_piece_from_plate
— Methodshould_extract_piece_from_plate(pii, L, W, sllw, symm = 0x03) :: Bool
!!! Internal use.
Considering the enhanced PP-G2KP model, it is necessary to known if there will be an 'extraction' variable representing the extraction of piece with index pii
from a plate with length L
and width L
.
A piece should be extracted from a plate if:
- The piece fits inside the plate.
- It is not possible to extract the piece in consideration together with any other piece (even other copy of the same piece) from the plate in consideration (for the cut orientations allowed by
symm
which by default are both vertical and horizontal).
Arguments
pii::D
: The index of the piece.L::S
: The length of the plate.W::S
: The width of the plate.sllw::SortedLinkedLW{D, S}
: The SortedLinkedLW struct for the pieces.symm::UInt8 = 0x03
: which cut orientations are allowed:0x01
means 'allow only horizontal cuts',0x02
means 'allow only vertical cuts', and0x03
means 'allow both kinds of cuts'.
GuillotineModels.PPG2KP.Enumeration.ub_num_pieces_fit
— Methodub_num_pieces_fit(d, l, w, a, L, W, A, cutoff; ignore_2th_dim = false)
!!! Internal use.
Given a piece set (defined by d
emand, l
ength, w
idth, and a
rea), and a plate (defined by L
ength, W
idth, and A
rea), returns the min
between cutoff
and an upper bound on the number of pieces that fit inside the plate. If ignore_2th_dim
is true, do not use w
and W
to filter pieces that do not even fit the plate when alone.
In other words, ub_num_pieces_fit(..., 6)
will return 6
if it is possible (but not guaranteed) for 6
or more pieces to fit in the plate, and will return x
if x < 6
is the greatest number of pieces that have yet some possibility of being packed together; x + 1
is already guaranteed to be impossible.