GuillotineModels.PPG2KP
GuillotineModels.PPG2KP.VarInvIndexes
— TypeAuxiliar struct used to build the PPG2KP model.
Aggregates the inverted indexes that indicate the variables with non-zero coefficients in model constraints.
pii2pair::Array{Array{P,1},1} where P
If indexed by a piece index, returns the indexes of all extraction variables (picuts/np) that extract that piece from some plate.
pli2pair::Array{Array{P,1},1} where P
If indexed by a plate index, returns the indexes of all extraction variables (picuts/np) that extract some piece from that plate.
child2cut::Array{Array{P,1},1} where P
If indexed by a plate index, returns the indexes of all cut variables (cuts_made/cuts) that have that plate as either first or second child (i.e., one of the plates generated by the cut).
parent2cut::Array{Array{P,1},1} where P
If indexed by a plate index, returns the indexes of all cut variables (cuts_made/cuts) that have that plate as the parent of the cut (i.e., the plate that is being cut).
GuillotineModels.PPG2KP.VarInvIndexes
— MethodVarInvIndexes(bp :: ByproductPPG2KP{D, S, P}) :: VarInvIndexes{P}
Utility constructor that creates the struct from a ByproductPPG2KP.
GuillotineModels.PPG2KP.VarInvIndexes
— MethodVarInvIndexes(num_piece_types, num_plate_types, np, cuts)
Utility constructor that creates the struct from a ByproductPPG2KP.
GuillotineModels.PPG2KP.cuts_and_extractions_from_2_staged_solution
— Methodcuts_and_extractions_from_2_staged_solution(pattern, bp, bm)
Given a 2-staged pattern
and a PPG2KP model bp
(byproduct), returns the cuts (bp.cuts
indexes) and extractions (bp.np
indexes) that make up a valid solution representing such pattern
. Note: this is intended to be called over non-priced PPG2KP models; if the model is priced the variables assumed to exist in this code may not exit anymore (especially if Furini's multistep pricing is used).
The pattern
parameter has many restrictions:
- It is 2-staged, what is enforced by being a vector of vectors.
- Each inner vector is a vertical stripe with the width of the first piece inside such inner vector. No horizontal stripes allowed. No piece inside an inner vector has width larger than the first piece of the inner vector.
- The first inner vector has the largest stripe width.
- No inner vectors should be empty. Every number is a valid piece type index.
GuillotineModels.PPG2KP.mip_start_by_heuristic!
— Methodmip_start_by_heuristic!(model, seed, p, bp, bm)
TODO: document. Returns two tuples, the first is the result of internal fast_iterated_greedy
the second tuple contain the last four arguments of the rawmipstart! used to MIP-start the model (this way unsetmipstart! can be easily called over the model).
GuillotineModels.PPG2KP.raw_mip_start!
— Methodraw_mip_start!(model, nz_pe_idxs, nz_pe_vals, nz_cm_idxs, nz_cm_vals)
TODO: document.
GuillotineModels.PPG2KP.save_mip_start
— Methodsave_mip_start(model)
TODO: document. Returns the four last arguments of rawmipstart!
GuillotineModels.PPG2KP.unset_mip_start!
— Methodunset_mip_start!(model, nz_pe_idxs, nz_cm_idxs)
TODO: document. Just take the first and third returned values from save_mip_start!
(or the first and third parameters of raw_mip_start!
because the specific values of the old start are irrelevant).
GuillotineModels.build_model
— Methodbuild_model(::Val{:G2CSP}, ::Val{:PPG2KP}, instance::G2KP, model[, options])
Build a PPG2KP-style model for a G2CSP instance
inside model
.
Changes model
by adding variables and constraints. options
takes arguments described in Utilities.Args.accepted_arg_list(::Val{:PPG2KP})
.
This is a convenience method that takes a G2KP instance. It allows easily testing G2CSP over the same instances used commonly for Knapsack Problem (G2KP). If options["quiet"]
is not passed, this method will always show a warnig, as the instance type is not ideal.
GuillotineModels.build_model
— Methodbuild_model(::Val{:G2CSP)}, ::Val{:PPG2KP}, instance::SSSCSP, model[, options])
Build a PPG2KP-style model for a G2CSP instance
inside model
.
Changes model
by adding variables and constraints. options
takes arguments described in Utilities.Args.accepted_arg_list(::Val{:PPG2KP})
.
GuillotineModels.build_model
— Methodbuild_model(::Val{:G2KP)}, ::Val{:PPG2KP}, instance::G2KP, model[, options])
Build a PPG2KP-style model for a G2KP instance
inside model
.
Changes model
by adding variables and constraints. options
takes arguments described in Utilities.Args.accepted_arg_list(::Val{:PPG2KP})
.
GuillotineModels.build_model
— Methodbuild_model(::Val{:G2KP}, ::Val{:PPG2KP}, instance::SLOPP, model[, options])
Build a PPG2KP-style model for a G2KP instance
inside model
.
Changes model
by adding variables and constraints. options
takes arguments described in Utilities.Args.accepted_arg_list(::Val{:PPG2KP})
.
This is a convenience method that takes a SLOPP instance. It errors if the SLOPP
object has a non-zero value in the dlb
field. It is the same as calling with a G2KP
instance but with the dub
field being used as the d
field (of G2KP
).
GuillotineModels.build_model
— Methodbuild_model(::Val{:G2KP}, ::Val{:PPG2KP}, instance::SSSCSP, model[, options])
Build a PPG2KP-style model for a G2OPP instance
inside model
.
Changes model
by adding variables and constraints. options
takes arguments described in Utilities.Args.accepted_arg_list(::Val{:PPG2KP})
.
THIS IS A HACK THAT SHOULD BE DELETED AFTER. It gets a SSSCSP instance, and does not interpret it as a G2CSP/G2BPP instance, but instead as a G2OPP instance and then it transforms it in a G2KP problem with unitaty profits, so the G2OPP (a decision problem) is true if obj matches the sum(d), and is false if obj is smaller than sum(d) (a value larger than sum(d) is impossible).
GuillotineModels.build_model
— Methodbuild_model(::Val{:G2MKP}, ::Val{:PPG2KP}, instance::MHLOPPW, model[, options])
Build a PPG2KP-style model for a G2MKP instance
inside model
.
Changes model
by adding variables and constraints. options
takes arguments described in Utilities.Args.accepted_arg_list(::Val{:PPG2KP})
.
For now, this is the only format accepted by G2MKP, even if the G2MKP refers to the homogeneous variant and, therefore, does not accept large objects of different dimensions (just multiple copies of the same large objects). A method accepting a more adequate format (i.e., that only allow a single type of large object) could be implemented.
GuillotineModels.build_model
— Methodbuild_model(::Val{:G2OPP}, ::Val{:PPG2KP}, instance::SSSCSP, model[, options])
Build a PPG2KP-style model for a G2OPP instance
inside model
.
Changes model
by adding variables and constraints. options
takes arguments described in Utilities.Args.accepted_arg_list(::Val{:PPG2KP})
.