|
Porytiles
|
Abstract interface for palette packing algorithms. More...
#include <packing_strategy.hpp>
Public Member Functions | |
| virtual | ~PackingStrategy ()=default |
| virtual ChainableResult< PackingOutput > | pack (const PackingInput &input) const =0 |
| Packs tile colors into palettes according to the strategy's algorithm. | |
| virtual std::string | name () const =0 |
| Returns the human-readable name of this strategy. | |
Abstract interface for palette packing algorithms.
PackingStrategy defines the interface for algorithms that solve the "Pagination Problem" (Bin Packing with Overlapping Items, aka "VM packing"). Different strategies may use different approaches such as greedy algorithms (Best Fusion) or non-greedy algorithms with backtracking (Overload-and-Remove, Classic DFS, Classic BFS).
Implementations should be stateless - all state needed for packing is provided via the PackingInput parameter.
Definition at line 113 of file packing_strategy.hpp.
|
virtualdefault |
|
pure virtual |
Returns the human-readable name of this strategy.
Implemented in porytiles::BacktrackingStrategy, porytiles::BestFusionStrategy, and porytiles::OverloadAndRemoveStrategy.
|
pure virtual |
Packs tile colors into palettes according to the strategy's algorithm.
Attempts to assign all tiles from the input to palettes such that each tile's colors fit within at least one palette's capacity.
| input | The packing input containing tiles, hints, fixed slots, and constraints |
Implemented in porytiles::BacktrackingStrategy, porytiles::BestFusionStrategy, and porytiles::OverloadAndRemoveStrategy.