|
Porytiles
|
Packing strategy that assigns tiles to palettes using overload-and-remove with multi-start. More...
#include <overload_and_remove_strategy.hpp>
Public Member Functions | |
| OverloadAndRemoveStrategy ()=default | |
| OverloadAndRemoveStrategy (gsl::not_null< const UserDiagnostics * > diag) | |
| Constructs in preset matrix mode with diagnostics support. | |
| OverloadAndRemoveStrategy (std::size_t max_attempts, std::uint64_t seed, ShuffleStrategy shuffle_strategy, const UserDiagnostics *diag=nullptr) | |
| Constructs with explicit parameters for single-configuration mode. | |
| ChainableResult< PackingOutput > | pack (const PackingInput &input) const override |
| Packs tiles into palettes using the Overload-And-Remove algorithm with multi-start. | |
| std::string | name () const override |
| Returns the name of this strategy. | |
Public Member Functions inherited from porytiles::PackingStrategy | |
| virtual | ~PackingStrategy ()=default |
Packing strategy that assigns tiles to palettes using overload-and-remove with multi-start.
Tiles are greedily assigned to the palette with the best color overlap. When a palette becomes overloaded (exceeds its color capacity), the worst-fitting tile is removed and re-queued with that palette marked as forbidden, guaranteeing termination. A multi-start loop retries with different tile orderings controlled by ShuffleStrategy to escape local optima that defeat a single FFD pass.
The strategy supports two modes:
This algorithm is based on insights and samples from:
Grange, A., Kacem, I., & Martin, S. (2018). Algorithms for the bin packing problem with overlapping items. Computers & Industrial Engineering, 115, 331–341. https://doi.org/10.1016/j.cie.2017.10.015 https://arxiv.org/pdf/1605.00558
Definition at line 40 of file overload_and_remove_strategy.hpp.
|
default |
|
inlineexplicit |
Constructs in preset matrix mode with diagnostics support.
Uses the full 17-configuration preset matrix (default behavior) and emits a remark via the provided diagnostics when a successful configuration is found.
| diag | Diagnostics interface for emitting remarks about successful search parameters. |
Definition at line 53 of file overload_and_remove_strategy.hpp.
|
inlineexplicit |
Constructs with explicit parameters for single-configuration mode.
When constructed with this constructor, the strategy runs a single multi-start search with the provided parameters instead of iterating through the preset configuration matrix.
| max_attempts | Maximum number of packing attempts (first uses FFD, subsequent use shuffled orderings). |
| seed | Base seed for the PRNG used to generate shuffle seeds. |
| shuffle_strategy | Strategy for generating tile orderings in retry attempts. |
| diag | Optional diagnostics interface for emitting remarks about successful search parameters. |
Definition at line 67 of file overload_and_remove_strategy.hpp.
|
inlineoverridevirtual |
Returns the name of this strategy.
Implements porytiles::PackingStrategy.
Definition at line 95 of file overload_and_remove_strategy.hpp.
|
overridevirtual |
Packs tiles into palettes using the Overload-And-Remove algorithm with multi-start.
In preset matrix mode, tries 17 search configurations (varying shuffle strategies, attempt counts, and seeds) until a valid assignment is found. In single-config mode, runs one multi-start search with the configured parameters. Returns the first successful result, or an error if all configurations fail.
| input | The packing input containing tiles, hints, fixed slots, and constraints. |
Implements porytiles::PackingStrategy.
Definition at line 172 of file overload_and_remove_strategy.cpp.