-
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add callback for more complex constraints. Fixes #60
- Loading branch information
Showing
5 changed files
with
89 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
/** | ||
* Box packing (3D bin packing, knapsack problem) | ||
* @package BoxPacker | ||
* @author Doug Wright | ||
*/ | ||
namespace DVDoug\BoxPacker; | ||
|
||
/** | ||
* An item to be packed where additional constraints need to be considered. Only implement this interface if you actually | ||
* need this additional functionality as it will slow down the packing algorithm | ||
* @author Doug Wright | ||
* @package BoxPacker | ||
*/ | ||
interface ConstrainedItem extends Item | ||
{ | ||
|
||
/** | ||
* Hook for user implementation of item-specific constraints, e.g. max <x> batteries per box | ||
* | ||
* @param ItemList $alreadyPackedItems | ||
* @param Box $box | ||
* | ||
* @return bool | ||
*/ | ||
public function canBePackedInBox(ItemList $alreadyPackedItems, Box $box); | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters