
How to Play Patches¶
Pathes is a game adapted from Shikaku (四角に切れ, shikaku ni kire), a japanese puzzle created by the puzzle-specialized publisher Nikoli on 2011.
Shikaku is played on a grid. Some of the squares on the grid contain numbers. The goal is to divide the grid into rectangular pieces such that each piece contains exactly one number, which represents the area of

Figure 1:Example of a Shikaku grid. Source: Shikaku of the Day

Figure 2:Solution of a Shikaku example. Source: Shikaku of the Day
The Patches’ grid contains some colored patch seeds that may state some features about the rectangles to be drawn on the grid, such as the required area (optional) or required shape (which can be a vertical rectangle, a horizontal rectangle, a square or any shape).
Figure 3:Example of Patches mini game. Source: LinkedIn Patches
- Objective
- Partition the grid into non-overlapping rectangular patches so that each patch meets the prescriptions on their respective seeds.
- Rules
- Each seed must be covered by only one patch that attends its prescriptions;
- A patch must cover only one seed.
Problem Modeling¶
Ranges¶
Basically, we’ll have three ranges for defining all the next components: a range for rows, columns and rectangles.
- The row range, where is the total amount of rows on game grid.
- The column range, where is the total amount of columns on game grid.
- Range of all patches to be drawn on grid game, where is the total of patch seeds on grid.
Sets¶
From , and ranges, we can define the following sets:
- Set of all grid squares, that is just the Cartesian product between sets and .
- Set of all squares that carry a seed about a patch .
- Set of required vertical patches, i. e., patches whose height is greater than its width.
- Set of required horizontal patches, i. e., patches whose width is greater than its height.
- Set of required square patches, i. e., patches whose width is equal to its height.
- Set of patches with a required area .
Decision Variables¶
For Patches game, it’ll have seven sets of decision varibles.
Integer Variables¶
The following integer variables will be used to define the position and dimensions of the patches, which are the set of variables that solves the game:
- Index of the leftmost column of the patch .
- Index of the top row of the patch .
- Width of the patch .
- Height of the patch .
Binary Variables¶
However, in order to ensure the rectangularity and continuity of the geometric shapes and their required areas, it is necessary to use the following auxiliary binary variables:
- , if the row passes through the patch
- , otherwise
- , if the column passes through the patch
- , otherwise
- , if the square will be covered by patch .
- , otherwise
Parameters¶
- Required area for the patch .
Objective Function¶
Since we only want to find a solution that satisfies all the rules of the game, the objective function of Patches’ model is a constant. Therefore, the LOP is a feasibility problem, whose objective function consists of maximizing (or minimizing) an arbitrary constant.
Constraints¶
- Domain Constraints
First, let’s settle the sets of constraints for the domain of decision variables.
- Integrity Constraints
- The main decision variables must be integers.
- Binarity Constraints
- The auxiliary decision variables must be binary.
- Unique-Patch-Per-Square Constraints
Each grid square must be covered by only one patch .
- Grid-Boundaries Constraints
These sets of constraints ensure that any patch lies within the grid’s row and column boundaries.
- Top-Row-Position Constraints
- For each patch , the position of its top row must be equal or greater than 1.
- Bottom-Row-Position Constraints
- For each patch , the position of its bottom row, given by the expression , must be equal or less than the total amount of rows .
- Leftmost-Column-Position Constraints
- For each patch , the position of its leftmost column must be equal or greater than 1.
- Rightmost-Column-Position Constraints
- For each patch , the position of its rightmost column, given by the expression , must be equal or less than the total amount of columns .
- Patch-Boundaries Constraints
These sets of constraints uses the Big strategy to ensure that any row and column that passes through a patch lies within its boundaries.
- Top-Boundary Constraints
- if a row passes through a patch , then the index must be equal or greater than its top row’s index .
- Bottom-Boundary Constraints
- if a square is covered by patch , then the index must be equal or less than the patch’s bottom row’s index, given by .
- Leftmost-Boundary Constraints
- if a colum passes through patch , then the index must be equal or greater than patch’s rightmost column’s index .
- Rightmost-Boundary Constraints
- if a colum passes through patch , then the index must be equal or less the patch’s last column’s index, given by .
- Patch Dimensions constraints
These constraints are important to ensure that there’ll not be any gap inside the patches.
- Height Constraints
- The sum of all selected rows for a patch must be equal to its height.
- Width Constraints
- The sum of all selected columns for a patch must be equal to its width.
- McCormick Linearization Constraints
These sets of constraints translates the non-linear contraint between the binary varibles in the model into three sets of linear constraints. They will ensure that if a row and a column pass through a patch , then the square will must be covered by that patch . Also, if or , then must be zero, which will ensure that if a row or column does not pass through a patch, then the square will not be covered by it.
- Cutout-Row Constraints
- If a row doesn’t pass through a patch , then all squares in that row must not be covered by that patch.
- Cutout-Column Constraints
- If a column doesn’t pass through a patch , then all squares in that column must not be covered by that patch.
- Square-Activator Constraints
- If both row and column pass the patch , then the square at this intersection must be covered by that patch.
- Seed Square Constraints
These sets of constraints deal with prescriptions required by the seed squares.
- Seed Square Coverage Constraints
- For each square with a seed about patch , it must be covered by .
- Area Constraints
- For each patch with a predefined area , the sum of its covered squares must be equal to
- Vertical Patch Constraints
- For each vertical patch , its height must be greater than its width .
- Horizontal Patch Constraints
- For each horizontal patch , its width must be greater than its height .
- Square Patch Constraints
- For each square patch , its width must be equal to its height .
Concrete model¶
The Patches game to be solved will be the No. 16, published on April 2nd, 2026.

Figure 4:Patches problem instance used in this article. Source: LinkedIn Patches
And you concrete model is as the following:
S.t.:
- Unique-Patch-Per-Square Constraints
- Square (1,1)
- Square (1,2)
- Square (1,3)
- Square (1,4)
- Square (1,5)
- Square (1,6)
- Square (2,1)
- Square (2,2)
- Square (2,3)
- Square (2,4)
- Square (2,5)
- Square (2,6)
- Square (3,1)
- Square (3,2)
- Square (3,3)
- Square (3,4)
- Square (3,5)
- Square (3,6)
- Square (4,1)
- Square (4,2)
- Square (4,3)
- Square (4,4)
- Square (4,5)
- Square (4,6)
- Square (5,1)
- Square (5,2)
- Square (5,3)
- Square (5,4)
- Square (5,5)
- Square (5,6)
- Square (6,1)
- Square (6,2)
- Square (6,3)
- Square (6,4)
- Square (6,5)
- Square (6,6)
- Top Row Constraints
- Yellow Patch
- Teal Patch
- Purple Patch
- Green Patch
- Orange Patch
- Red Patch
- Blue Patch
- Magenta Patch
- Brick Patch
- Brown Patch
- Bottom Row Constraints
- Yellow Patch
- Teal Patch
- Purple Patch
- Green Patch
- Orange Patch
- Red Patch
- Blue Patch
- Magenta Patch
- Brick Patch
- Brown Patch
- Leftmost Column Constraints
- Yellow Patch
- Teal Patch
- Purple Patch
- Green Patch
- Orange Patch
- Red Patch
- Blue Patch
- Magenta Patch
- Brick Patch
- Brown Patch
- Rightmost Column Constraints
- Yellow Patch
- Teal Patch
- Purple Patch
- Green Patch
- Orange Patch
- Red Patch
- Blue Patch
- Magenta Patch
- Brick Patch
- Brown Patch
- Top Boundary Constraints
- Row 1, Yellow Patch
- Row 2, Yellow Patch
- Row 3, Yellow Patch
- Row 4, Yellow Patch
- Row 5, Yellow Patch
- Row 6, Yellow Patch
- Row 1, Tealbox Patch
- Row 2, Tealbox Patch
- Row 3, Tealbox Patch
- Row 4, Tealbox Patch
- Row 5, Tealbox Patch
- Row 6, Tealbox Patch
- Row 1, Purple Patch
- Row 2, Purple Patch
- Row 3, Purple Patch
- Row 4, Purple Patch
- Row 5, Purple Patch
- Row 6, Purple Patch
- Row 1, Green Patch
- Row 2, Green Patch
- Row 3, Green Patch
- Row 4, Green Patch
- Row 5, Green Patch
- Row 6, Green Patch
- Row 1, Orange Patch
- Row 2, Orange Patch
- Row 3, Orange Patch
- Row 4, Orange Patch
- Row 5, Orange Patch
- Row 6, Orange Patch
- Row 1, Red Patch
- Row 2, Red Patch
- Row 3, Red Patch
- Row 4, Red Patch
- Row 5, Red Patch
- Row 6, Red Patch
- Row 1, Blue Patch
- Row 2, Blue Patch
- Row 3, Blue Patch
- Row 4, Blue Patch
- Row 5, Blue Patch
- Row 6, Blue Patch
- Row 1, Magenta Patch
- Row 2, Magenta Patch
- Row 3, Magenta Patch
- Row 4, Magenta Patch
- Row 5, Magenta Patch
- Row 6, Magenta Patch
- Row 1, Brick Patch
- Row 2, Brick Patch
- Row 3, Brick Patch
- Row 4, Brick Patch
- Row 5, Brick Patch
- Row 6, Brick Patch
- Row 1, Brown Patch
- Row 2, Brown Patch
- Row 3, Brown Patch
- Row 4, Brown Patch
- Row 5, Brown Patch
- Row 6, Brown Patch
- Bottom Boundary Constraints
- Row 1, Yellow Patch
- Row 2, Yellow Patch
- Row 3, Yellow Patch
- Row 4, Yellow Patch
- Row 5, Yellow Patch
- Row 6, Yellow Patch
- Row 1, Tealbox Patch
- Row 2, Tealbox Patch
- Row 3, Tealbox Patch
- Row 4, Tealbox Patch
- Row 5, Tealbox Patch
- Row 6, Tealbox Patch
- Row 1, Purple Patch
- Row 2, Purple Patch
- Row 3, Purple Patch
- Row 4, Purple Patch
- Row 5, Purple Patch
- Row 6, Purple Patch
- Row 1, Green Patch
- Row 2, Green Patch
- Row 3, Green Patch
- Row 4, Green Patch
- Row 5, Green Patch
- Row 6, Green Patch
- Row 1, Orange Patch
- Row 2, Orange Patch
- Row 3, Orange Patch
- Row 4, Orange Patch
- Row 5, Orange Patch
- Row 6, Orange Patch
- Row 1, Red Patch
- Row 2, Red Patch
- Row 3, Red Patch
- Row 4, Red Patch
- Row 5, Red Patch
- Row 6, Red Patch
- Row 1, Blue Patch
- Row 2, Blue Patch
- Row 3, Blue Patch
- Row 4, Blue Patch
- Row 5, Blue Patch
- Row 6, Blue Patch
- Row 1, Magenta Patch
- Row 2, Magenta Patch
- Row 3, Magenta Patch
- Row 4, Magenta Patch
- Row 5, Magenta Patch
- Row 6, Magenta Patch
- Row 1, Brick Patch
- Row 2, Brick Patch
- Row 3, Brick Patch
- Row 4, Brick Patch
- Row 5, Brick Patch
- Row 6, Brick Patch
- Row 1, Brown Patch
- Row 2, Brown Patch
- Row 3, Brown Patch
- Row 4, Brown Patch
- Row 5, Brown Patch
- Row 6, Brown Patch
- Left Boundary Constraints
- Column 1, Yellow Patch
- Column 2, Yellow Patch
- Column 3, Yellow Patch
- Column 4, Yellow Patch
- Column 5, Yellow Patch
- Column 6, Yellow Patch
- Column 1, Tealbox Patch
- Column 2, Tealbox Patch
- Column 3, Tealbox Patch
- Column 4, Tealbox Patch
- Column 5, Tealbox Patch
- Column 6, Tealbox Patch
- Column 1, Purple Patch
- Column 2, Purple Patch
- Column 3, Purple Patch
- Column 4, Purple Patch
- Column 5, Purple Patch
- Column 6, Purple Patch
- Column 1, Green Patch
- Column 2, Green Patch
- Column 3, Green Patch
- Column 4, Green Patch
- Column 5, Green Patch
- Column 6, Green Patch
- Column 1, Orange Patch
- Column 2, Orange Patch
- Column 3, Orange Patch
- Column 4, Orange Patch
- Column 5, Orange Patch
- Column 6, Orange Patch
- Column 1, Red Patch
- Column 2, Red Patch
- Column 3, Red Patch
- Column 4, Red Patch
- Column 5, Red Patch
- Column 6, Red Patch
- Column 1, Blue Patch
- Column 2, Blue Patch
- Column 3, Blue Patch
- Column 4, Blue Patch
- Column 5, Blue Patch
- Column 6, Blue Patch
- Column 1, Magenta Patch
- Column 2, Magenta Patch
- Column 3, Magenta Patch
- Column 4, Magenta Patch
- Column 5, Magenta Patch
- Column 6, Magenta Patch
- Column 1, Brick Patch
- Column 2, Brick Patch
- Column 3, Brick Patch
- Column 4, Brick Patch
- Column 5, Brick Patch
- Column 6, Brick Patch
- Column 1, Brown Patch
- Column 2, Brown Patch
- Column 3, Brown Patch
- Column 4, Brown Patch
- Column 5, Brown Patch
- Column 6, Brown Patch
- Right Boundary Constraints
- Column 1, Yellow Patch
- Column 2, Yellow Patch
- Column 3, Yellow Patch
- Column 4, Yellow Patch
- Column 5, Yellow Patch
- Column 6, Yellow Patch
- Column 1, Tealbox Patch
- Column 2, Tealbox Patch
- Column 3, Tealbox Patch
- Column 4, Tealbox Patch
- Column 5, Tealbox Patch
- Column 6, Tealbox Patch
- Column 1, Purple Patch
- Column 2, Purple Patch
- Column 3, Purple Patch
- Column 4, Purple Patch
- Column 5, Purple Patch
- Column 6, Purple Patch
- Column 1, Green Patch
- Column 2, Green Patch
- Column 3, Green Patch
- Column 4, Green Patch
- Column 5, Green Patch
- Column 6, Green Patch
- Column 1, Orange Patch
- Column 2, Orange Patch
- Column 3, Orange Patch
- Column 4, Orange Patch
- Column 5, Orange Patch
- Column 6, Orange Patch
- Column 1, Red Patch
- Column 2, Red Patch
- Column 3, Red Patch
- Column 4, Red Patch
- Column 5, Red Patch
- Column 6, Red Patch
- Column 1, Blue Patch
- Column 2, Blue Patch
- Column 3, Blue Patch
- Column 4, Blue Patch
- Column 5, Blue Patch
- Column 6, Blue Patch
- Column 1, Magenta Patch
- Column 2, Magenta Patch
- Column 3, Magenta Patch
- Column 4, Magenta Patch
- Column 5, Magenta Patch
- Column 6, Magenta Patch
- Column 1, Brick Patch
- Column 2, Brick Patch
- Column 3, Brick Patch
- Column 4, Brick Patch
- Column 5, Brick Patch
- Column 6, Brick Patch
- Column 1, Brown Patch
- Column 2, Brown Patch
- Column 3, Brown Patch
- Column 4, Brown Patch
- Column 5, Brown Patch
- Column 6, Brown Patch
- Height Constraints
- Yellow Patch_
- Teal Patch_
- Purple Patch_
- Green Patch_
- Orange Patch_
- Red Patch_
- Blue Patch_
- Magenta Patch_
- Brick Patch_
- Brown Patch_
- Width Constraints
- Yellow Patch_
- Teal Patch_
- Purple Patch_
- Green Patch_
- Orange Patch_
- Red Patch_
- Blue Patch_
- Magenta Patch_
- Brick Patch_
- Brown Patch_
- Cutout-Rows Constraints
- Row 1, Yellow Patch
- Row 2, Yellow Patch
- Row 3, Yellow Patch
- Row 4, Yellow Patch
- Row 5, Yellow Patch
- Row 6, Yellow Patch
- Row 1, Teal
- Row 2, Teal
- Row 3, Teal
- Row 4, Teal
- Row 5, Teal
- Row 6, Teal
- Row 1, Purple Patch
- Row 2, Purple Patch
- Row 3, Purple Patch
- Row 4, Purple Patch
- Row 5, Purple Patch
- Row 6, Purple Patch
- Row 1, Green Patch
- Row 2, Green Patch
- Row 3, Green Patch
- Row 4, Green Patch
- Row 5, Green Patch
- Row 6, Green Patch
- Row 1, Orange Patch
- Row 2, Orange Patch
- Row 3, Orange Patch
- Row 4, Orange Patch
- Row 5, Orange Patch
- Row 6, Orange Patch
- Row 1, Red Patch
- Row 2, Red Patch
- Row 3, Red Patch
- Row 4, Red Patch
- Row 5, Red Patch
- Row 6, Red Patch
- Row 1, Blue Patch
- Row 2, Blue Patch
- Row 3, Blue Patch
- Row 4, Blue Patch
- Row 5, Blue Patch
- Row 6, Blue Patch
- Row 1, Magenta Patch
- Row 2, Magenta Patch
- Row 3, Magenta Patch
- Row 4, Magenta Patch
- Row 5, Magenta Patch
- Row 6, Magenta Patch
- Row 1, Brick Patch
- Row 2, Brick Patch
- Row 3, Brick Patch
- Row 4, Brick Patch
- Row 5, Brick Patch
- Row 6, Brick Patch
- Row 1, Brown Patch
- Row 2, Brown Patch
- Row 3, Brown Patch
- Row 4, Brown Patch
- Row 5, Brown Patch
- Row 6, Brown Patch
- Cutout-Columns Constraints
- Column 1, Yellow Patch
- Column 2, Yellow Patch
- Column 3, Yellow Patch
- Column 4, Yellow Patch
- Column 5, Yellow Patch
- Column 6, Yellow Patch
- Column 1, Teal
- Column 2, Teal
- Column 3, Teal
- Column 4, Teal
- Column 5, Teal
- Column 6, Teal
- Column 1, Purple Patch
- Column 2, Purple Patch
- Column 3, Purple Patch
- Column 4, Purple Patch
- Column 5, Purple Patch
- Column 6, Purple Patch
- Column 1, Green Patch
- Column 2, Green Patch
- Column 3, Green Patch
- Column 4, Green Patch
- Column 5, Green Patch
- Column 6, Green Patch
- Column 1, Orange Patch
- Column 2, Orange Patch
- Column 3, Orange Patch
- Column 4, Orange Patch
- Column 5, Orange Patch
- Column 6, Orange Patch
- Column 1, Red Patch
- Column 2, Red Patch
- Column 3, Red Patch
- Column 4, Red Patch
- Column 5, Red Patch
- Column 6, Red Patch
- Column 1, Blue Patch
- Column 2, Blue Patch
- Column 3, Blue Patch
- Column 4, Blue Patch
- Column 5, Blue Patch
- Column 6, Blue Patch
- Column 1, Magenta Patch
- Column 2, Magenta Patch
- Column 3, Magenta Patch
- Column 4, Magenta Patch
- Column 5, Magenta Patch
- Column 6, Magenta Patch
- Column 1, Brick Patch
- Column 2, Brick Patch
- Column 3, Brick Patch
- Column 4, Brick Patch
- Column 5, Brick Patch
- Column 6, Brick Patch
- Column 1, Brown Patch
- Column 2, Brown Patch
- Column 3, Brown Patch
- Column 4, Brown Patch
- Column 5, Brown Patch
- Column 6, Brown Patch
- Square Coverage Constraints
- Square (1, 1), Yellow Patch
- Square (1, 2), Yellow Patch
- Square (1, 3), Yellow Patch
- Square (1, 4), Yellow Patch
- Square (1, 5), Yellow Patch
- Square (1, 6), Yellow Patch
- Square (2, 1), Yellow Patch
- Square (2, 2), Yellow Patch
- Square (2, 3), Yellow Patch
- Square (2, 4), Yellow Patch
- Square (2, 5), Yellow Patch
- Square (2, 6), Yellow Patch
- Square (3, 1), Yellow Patch
- Square (3, 2), Yellow Patch
- Square (3, 3), Yellow Patch
- Square (3, 4), Yellow Patch
- Square (3, 5), Yellow Patch
- Square (3, 6), Yellow Patch
- Square (4, 1), Yellow Patch
- Square (4, 2), Yellow Patch
- Square (4, 3), Yellow Patch
- Square (4, 4), Yellow Patch
- Square (4, 5), Yellow Patch
- Square (4, 6), Yellow Patch
- Square (5, 1), Yellow Patch
- Square (5, 2), Yellow Patch
- Square (5, 3), Yellow Patch
- Square (5, 4), Yellow Patch
- Square (5, 5), Yellow Patch
- Square (5, 6), Yellow Patch
- Square (6, 1), Yellow Patch
- Square (6, 2), Yellow Patch
- Square (6, 3), Yellow Patch
- Square (6, 4), Yellow Patch
- Square (6, 5), Yellow Patch
- Square (6, 6), Yellow Patch
- Square (1, 1), Tealbox Patch
- Square (1, 2), Tealbox Patch
- Square (1, 3), Tealbox Patch
- Square (1, 4), Tealbox Patch
- Square (1, 5), Tealbox Patch
- Square (1, 6), Tealbox Patch
- Square (2, 1), Tealbox Patch
- Square (2, 2), Tealbox Patch
- Square (2, 3), Tealbox Patch
- Square (2, 4), Tealbox Patch
- Square (2, 5), Tealbox Patch
- Square (2, 6), Tealbox Patch
- Square (3, 1), Tealbox Patch
- Square (3, 2), Tealbox Patch
- Square (3, 3), Tealbox Patch
- Square (3, 4), Tealbox Patch
- Square (3, 5), Tealbox Patch
- Square (3, 6), Tealbox Patch
- Square (4, 1), Tealbox Patch
- Square (4, 2), Tealbox Patch
- Square (4, 3), Tealbox Patch
- Square (4, 4), Tealbox Patch
- Square (4, 5), Tealbox Patch
- Square (4, 6), Tealbox Patch
- Square (5, 1), Tealbox Patch
- Square (5, 2), Tealbox Patch
- Square (5, 3), Tealbox Patch
- Square (5, 4), Tealbox Patch
- Square (5, 5), Tealbox Patch
- Square (5, 6), Tealbox Patch
- Square (6, 1), Tealbox Patch
- Square (6, 2), Tealbox Patch
- Square (6, 3), Tealbox Patch
- Square (6, 4), Tealbox Patch
- Square (6, 5), Tealbox Patch
- Square (6, 6), Tealbox Patch
- Square (1, 1), Purple Patch
- Square (1, 2), Purple Patch
- Square (1, 3), Purple Patch
- Square (1, 4), Purple Patch
- Square (1, 5), Purple Patch
- Square (1, 6), Purple Patch
- Square (2, 1), Purple Patch
- Square (2, 2), Purple Patch
- Square (2, 3), Purple Patch
- Square (2, 4), Purple Patch
- Square (2, 5), Purple Patch
- Square (2, 6), Purple Patch
- Square (3, 1), Purple Patch
- Square (3, 2), Purple Patch
- Square (3, 3), Purple Patch
- Square (3, 4), Purple Patch
- Square (3, 5), Purple Patch
- Square (3, 6), Purple Patch
- Square (4, 1), Purple Patch
- Square (4, 2), Purple Patch
- Square (4, 3), Purple Patch
- Square (4, 4), Purple Patch
- Square (4, 5), Purple Patch
- Square (4, 6), Purple Patch
- Square (5, 1), Purple Patch
- Square (5, 2), Purple Patch
- Square (5, 3), Purple Patch
- Square (5, 4), Purple Patch
- Square (5, 5), Purple Patch
- Square (5, 6), Purple Patch
- Square (6, 1), Purple Patch
- Square (6, 2), Purple Patch
- Square (6, 3), Purple Patch
- Square (6, 4), Purple Patch
- Square (6, 5), Purple Patch
- Square (6, 6), Purple Patch
- Square (1, 1), Green Patch
- Square (1, 2), Green Patch
- Square (1, 3), Green Patch
- Square (1, 4), Green Patch
- Square (1, 5), Green Patch
- Square (1, 6), Green Patch
- Square (2, 1), Green Patch
- Square (2, 2), Green Patch
- Square (2, 3), Green Patch
- Square (2, 4), Green Patch
- Square (2, 5), Green Patch
- Square (2, 6), Green Patch
- Square (3, 1), Green Patch
- Square (3, 2), Green Patch
- Square (3, 3), Green Patch
- Square (3, 4), Green Patch
- Square (3, 5), Green Patch
- Square (3, 6), Green Patch
- Square (4, 1), Green Patch
- Square (4, 2), Green Patch
- Square (4, 3), Green Patch
- Square (4, 4), Green Patch
- Square (4, 5), Green Patch
- Square (4, 6), Green Patch
- Square (5, 1), Green Patch
- Square (5, 2), Green Patch
- Square (5, 3), Green Patch
- Square (5, 4), Green Patch
- Square (5, 5), Green Patch
- Square (5, 6), Green Patch
- Square (6, 1), Green Patch
- Square (6, 2), Green Patch
- Square (6, 3), Green Patch
- Square (6, 4), Green Patch
- Square (6, 5), Green Patch
- Square (6, 6), Green Patch
- Square (1, 1), Orange Patch
- Square (1, 2), Orange Patch
- Square (1, 3), Orange Patch
- Square (1, 4), Orange Patch
- Square (1, 5), Orange Patch
- Square (1, 6), Orange Patch
- Square (2, 1), Orange Patch
- Square (2, 2), Orange Patch
- Square (2, 3), Orange Patch
- Square (2, 4), Orange Patch
- Square (2, 5), Orange Patch
- Square (2, 6), Orange Patch
- Square (3, 1), Orange Patch
- Square (3, 2), Orange Patch
- Square (3, 3), Orange Patch
- Square (3, 4), Orange Patch
- Square (3, 5), Orange Patch
- Square (3, 6), Orange Patch
- Square (4, 1), Orange Patch
- Square (4, 2), Orange Patch
- Square (4, 3), Orange Patch
- Square (4, 4), Orange Patch
- Square (4, 5), Orange Patch
- Square (4, 6), Orange Patch
- Square (5, 1), Orange Patch
- Square (5, 2), Orange Patch
- Square (5, 3), Orange Patch
- Square (5, 4), Orange Patch
- Square (5, 5), Orange Patch
- Square (5, 6), Orange Patch
- Square (6, 1), Orange Patch
- Square (6, 2), Orange Patch
- Square (6, 3), Orange Patch
- Square (6, 4), Orange Patch
- Square (6, 5), Orange Patch
- Square (6, 6), Orange Patch
- Square (1, 1), Red Patch
- Square (1, 2), Red Patch
- Square (1, 3), Red Patch
- Square (1, 4), Red Patch
- Square (1, 5), Red Patch
- Square (1, 6), Red Patch
- Square (2, 1), Red Patch
- Square (2, 2), Red Patch
- Square (2, 3), Red Patch
- Square (2, 4), Red Patch
- Square (2, 5), Red Patch
- Square (2, 6), Red Patch
- Square (3, 1), Red Patch
- Square (3, 2), Red Patch
- Square (3, 3), Red Patch
- Square (3, 4), Red Patch
- Square (3, 5), Red Patch
- Square (3, 6), Red Patch
- Square (4, 1), Red Patch
- Square (4, 2), Red Patch
- Square (4, 3), Red Patch
- Square (4, 4), Red Patch
- Square (4, 5), Red Patch
- Square (4, 6), Red Patch
- Square (5, 1), Red Patch
- Square (5, 2), Red Patch
- Square (5, 3), Red Patch
- Square (5, 4), Red Patch
- Square (5, 5), Red Patch
- Square (5, 6), Red Patch
- Square (6, 1), Red Patch
- Square (6, 2), Red Patch
- Square (6, 3), Red Patch
- Square (6, 4), Red Patch
- Square (6, 5), Red Patch
- Square (6, 6), Red Patch
- Square (1, 1), Blue Patch
- Square (1, 2), Blue Patch
- Square (1, 3), Blue Patch
- Square (1, 4), Blue Patch
- Square (1, 5), Blue Patch
- Square (1, 6), Blue Patch
- Square (2, 1), Blue Patch
- Square (2, 2), Blue Patch
- Square (2, 3), Blue Patch
- Square (2, 4), Blue Patch
- Square (2, 5), Blue Patch
- Square (2, 6), Blue Patch
- Square (3, 1), Blue Patch
- Square (3, 2), Blue Patch
- Square (3, 3), Blue Patch
- Square (3, 4), Blue Patch
- Square (3, 5), Blue Patch
- Square (3, 6), Blue Patch
- Square (4, 1), Blue Patch
- Square (4, 2), Blue Patch
- Square (4, 3), Blue Patch
- Square (4, 4), Blue Patch
- Square (4, 5), Blue Patch
- Square (4, 6), Blue Patch
- Square (5, 1), Blue Patch
- Square (5, 2), Blue Patch
- Square (5, 3), Blue Patch
- Square (5, 4), Blue Patch
- Square (5, 5), Blue Patch
- Square (5, 6), Blue Patch
- Square (6, 1), Blue Patch
- Square (6, 2), Blue Patch
- Square (6, 3), Blue Patch
- Square (6, 4), Blue Patch
- Square (6, 5), Blue Patch
- Square (6, 6), Blue Patch
- Square (1, 1), Magenta Patch
- Square (1, 2), Magenta Patch
- Square (1, 3), Magenta Patch
- Square (1, 4), Magenta Patch
- Square (1, 5), Magenta Patch
- Square (1, 6), Magenta Patch
- Square (2, 1), Magenta Patch
- Square (2, 2), Magenta Patch
- Square (2, 3), Magenta Patch
- Square (2, 4), Magenta Patch
- Square (2, 5), Magenta Patch
- Square (2, 6), Magenta Patch
- Square (3, 1), Magenta Patch
- Square (3, 2), Magenta Patch
- Square (3, 3), Magenta Patch
- Square (3, 4), Magenta Patch
- Square (3, 5), Magenta Patch
- Square (3, 6), Magenta Patch
- Square (4, 1), Magenta Patch
- Square (4, 2), Magenta Patch
- Square (4, 3), Magenta Patch
- Square (4, 4), Magenta Patch
- Square (4, 5), Magenta Patch
- Square (4, 6), Magenta Patch
- Square (5, 1), Magenta Patch
- Square (5, 2), Magenta Patch
- Square (5, 3), Magenta Patch
- Square (5, 4), Magenta Patch
- Square (5, 5), Magenta Patch
- Square (5, 6), Magenta Patch
- Square (6, 1), Magenta Patch
- Square (6, 2), Magenta Patch
- Square (6, 3), Magenta Patch
- Square (6, 4), Magenta Patch
- Square (6, 5), Magenta Patch
- Square (6, 6), Magenta Patch
- Square (1, 1), Brick Patch
- Square (1, 2), Brick Patch
- Square (1, 3), Brick Patch
- Square (1, 4), Brick Patch
- Square (1, 5), Brick Patch
- Square (1, 6), Brick Patch
- Square (2, 1), Brick Patch
- Square (2, 2), Brick Patch
- Square (2, 3), Brick Patch
- Square (2, 4), Brick Patch
- Square (2, 5), Brick Patch
- Square (2, 6), Brick Patch
- Square (3, 1), Brick Patch
- Square (3, 2), Brick Patch
- Square (3, 3), Brick Patch
- Square (3, 4), Brick Patch
- Square (3, 5), Brick Patch
- Square (3, 6), Brick Patch
- Square (4, 1), Brick Patch
- Square (4, 2), Brick Patch
- Square (4, 3), Brick Patch
- Square (4, 4), Brick Patch
- Square (4, 5), Brick Patch
- Square (4, 6), Brick Patch
- Square (5, 1), Brick Patch
- Square (5, 2), Brick Patch
- Square (5, 3), Brick Patch
- Square (5, 4), Brick Patch
- Square (5, 5), Brick Patch
- Square (5, 6), Brick Patch
- Square (6, 1), Brick Patch
- Square (6, 2), Brick Patch
- Square (6, 3), Brick Patch
- Square (6, 4), Brick Patch
- Square (6, 5), Brick Patch
- Square (6, 6), Brick Patch
- Square (1, 1), Brown Patch
- Square (1, 2), Brown Patch
- Square (1, 3), Brown Patch
- Square (1, 4), Brown Patch
- Square (1, 5), Brown Patch
- Square (1, 6), Brown Patch
- Square (2, 1), Brown Patch
- Square (2, 2), Brown Patch
- Square (2, 3), Brown Patch
- Square (2, 4), Brown Patch
- Square (2, 5), Brown Patch
- Square (2, 6), Brown Patch
- Square (3, 1), Brown Patch
- Square (3, 2), Brown Patch
- Square (3, 3), Brown Patch
- Square (3, 4), Brown Patch
- Square (3, 5), Brown Patch
- Square (3, 6), Brown Patch
- Square (4, 1), Brown Patch
- Square (4, 2), Brown Patch
- Square (4, 3), Brown Patch
- Square (4, 4), Brown Patch
- Square (4, 5), Brown Patch
- Square (4, 6), Brown Patch
- Square (5, 1), Brown Patch
- Square (5, 2), Brown Patch
- Square (5, 3), Brown Patch
- Square (5, 4), Brown Patch
- Square (5, 5), Brown Patch
- Square (5, 6), Brown Patch
- Square (6, 1), Brown Patch
- Square (6, 2), Brown Patch
- Square (6, 3), Brown Patch
- Square (6, 4), Brown Patch
- Square (6, 5), Brown Patch
- Square (6, 6), Brown Patch
- Seed Square Coverage Constraints
- Yellow Square
- Teal Square
- Purple Square
- Green Square
- Orange Square
- Red Square
- Blue Square
- Magenta Square
- Brick Square
- Brown Square
- Required Area Constraints
- Yellow Patch
- Teal Patch
- Purple Patch
- Green Patch
- Orange Patch
- Red Patch
- Blue Patch
- Magenta Patch
- Brick Patch
- Brown Patch
- Vertical-Patch Constraints
- Orange Patch
- Square-Patch Constraints
- Red Patch
- Integrity Constraints
- Yellow Patch
- Teal Patch
- Purple Patch
- Green Patch
- Orange Patch
- Red Patch
- Blue Patch
- Magenta Patch
- Brick Patch
- Brown Patch
- Yellow Patch
- Teal Patch
- Purple Patch
- Green Patch
- Orange Patch
- Red Patch
- Blue Patch
- Magenta Patch
- Brick Patch
- Brown Patch
- Yellow Patch
- Teal Patch
- Purple Patch
- Green Patch
- Orange Patch
- Red Patch
- Blue Patch
- Magenta Patch
- Brick Patch
- Brown Patch
- Yellow Patch
- Teal Patch
- Purple Patch
- Green Patch
- Orange Patch
- Red Patch
- Blue Patch
- Magenta Patch
- Brick Patch
- Brown Patch
- Binarity Constraints
- Row 1, Yellow Patch
- Row 2, Yellow Patch
- Row 3, Yellow Patch
- Row 4, Yellow Patch
- Row 5, Yellow Patch
- Row 6, Yellow Patch
- Row 1, Tealbox Patch
- Row 2, Tealbox Patch
- Row 3, Tealbox Patch
- Row 4, Tealbox Patch
- Row 5, Tealbox Patch
- Row 6, Tealbox Patch
- Row 1, Purple Patch
- Row 2, Purple Patch
- Row 3, Purple Patch
- Row 4, Purple Patch
- Row 5, Purple Patch
- Row 6, Purple Patch
- Row 1, Green Patch
- Row 2, Green Patch
- Row 3, Green Patch
- Row 4, Green Patch
- Row 5, Green Patch
- Row 6, Green Patch
- Row 1, Orange Patch
- Row 2, Orange Patch
- Row 3, Orange Patch
- Row 4, Orange Patch
- Row 5, Orange Patch
- Row 6, Orange Patch
- Row 1, Red Patch
- Row 2, Red Patch
- Row 3, Red Patch
- Row 4, Red Patch
- Row 5, Red Patch
- Row 6, Red Patch
- Row 1, Blue Patch
- Row 2, Blue Patch
- Row 3, Blue Patch
- Row 4, Blue Patch
- Row 5, Blue Patch
- Row 6, Blue Patch
- Row 1, Magenta Patch
- Row 2, Magenta Patch
- Row 3, Magenta Patch
- Row 4, Magenta Patch
- Row 5, Magenta Patch
- Row 6, Magenta Patch
- Row 1, Brick Patch
- Row 2, Brick Patch
- Row 3, Brick Patch
- Row 4, Brick Patch
- Row 5, Brick Patch
- Row 6, Brick Patch
- Row 1, Brown Patch
- Row 2, Brown Patch
- Row 3, Brown Patch
- Row 4, Brown Patch
- Row 5, Brown Patch
- Row 6, Brown Patch
- Column 1, Yellow Patch
- Column 2, Yellow Patch
- Column 3, Yellow Patch
- Column 4, Yellow Patch
- Column 5, Yellow Patch
- Column 6, Yellow Patch
- Column 1, Tealbox Patch
- Column 2, Tealbox Patch
- Column 3, Tealbox Patch
- Column 4, Tealbox Patch
- Column 5, Tealbox Patch
- Column 6, Tealbox Patch
- Column 1, Purple Patch
- Column 2, Purple Patch
- Column 3, Purple Patch
- Column 4, Purple Patch
- Column 5, Purple Patch
- Column 6, Purple Patch
- Column 1, Green Patch
- Column 2, Green Patch
- Column 3, Green Patch
- Column 4, Green Patch
- Column 5, Green Patch
- Column 6, Green Patch
- Column 1, Orange Patch
- Column 2, Orange Patch
- Column 3, Orange Patch
- Column 4, Orange Patch
- Column 5, Orange Patch
- Column 6, Orange Patch
- Column 1, Red Patch
- Column 2, Red Patch
- Column 3, Red Patch
- Column 4, Red Patch
- Column 5, Red Patch
- Column 6, Red Patch
- Column 1, Blue Patch
- Column 2, Blue Patch
- Column 3, Blue Patch
- Column 4, Blue Patch
- Column 5, Blue Patch
- Column 6, Blue Patch
- Column 1, Magenta Patch
- Column 2, Magenta Patch
- Column 3, Magenta Patch
- Column 4, Magenta Patch
- Column 5, Magenta Patch
- Column 6, Magenta Patch
- Column 1, Brick Patch
- Column 2, Brick Patch
- Column 3, Brick Patch
- Column 4, Brick Patch
- Column 5, Brick Patch
- Column 6, Brick Patch
- Column 1, Brown Patch
- Column 2, Brown Patch
- Column 3, Brown Patch
- Column 4, Brown Patch
- Column 5, Brown Patch
- Column 6, Brown Patch
- Square (1,1), Yellow Patch
- Square (1,2), Yellow Patch
- Square (1,3), Yellow Patch
- Square (1,4), Yellow Patch
- Square (1,5), Yellow Patch
- Square (1,6), Yellow Patch
- Square (2,1), Yellow Patch
- Square (2,2), Yellow Patch
- Square (2,3), Yellow Patch
- Square (2,4), Yellow Patch
- Square (2,5), Yellow Patch
- Square (2,6), Yellow Patch
- Square (3,1), Yellow Patch
- Square (3,2), Yellow Patch
- Square (3,3), Yellow Patch
- Square (3,4), Yellow Patch
- Square (3,5), Yellow Patch
- Square (3,6), Yellow Patch
- Square (4,1), Yellow Patch
- Square (4,2), Yellow Patch
- Square (4,3), Yellow Patch
- Square (4,4), Yellow Patch
- Square (4,5), Yellow Patch
- Square (4,6), Yellow Patch
- Square (5,1), Yellow Patch
- Square (5,2), Yellow Patch
- Square (5,3), Yellow Patch
- Square (5,4), Yellow Patch
- Square (5,5), Yellow Patch
- Square (5,6), Yellow Patch
- Square (6,1), Yellow Patch
- Square (6,2), Yellow Patch
- Square (6,3), Yellow Patch
- Square (6,4), Yellow Patch
- Square (6,5), Yellow Patch
- Square (6,6), Yellow Patch
- Square (1,1), Teal
- Square (1,2), Teal
- Square (1,3), Teal
- Square (1,4), Teal
- Square (1,5), Teal
- Square (1,6), Teal
- Square (2,1), Teal
- Square (2,2), Teal
- Square (2,3), Teal
- Square (2,4), Teal
- Square (2,5), Teal
- Square (2,6), Teal
- Square (3,1), Teal
- Square (3,2), Teal
- Square (3,3), Teal
- Square (3,4), Teal
- Square (3,5), Teal
- Square (3,6), Teal
- Square (4,1), Teal
- Square (4,2), Teal
- Square (4,3), Teal
- Square (4,4), Teal
- Square (4,5), Teal
- Square (4,6), Teal
- Square (5,1), Teal
- Square (5,2), Teal
- Square (5,3), Teal
- Square (5,4), Teal
- Square (5,5), Teal
- Square (5,6), Teal
- Square (6,1), Teal
- Square (6,2), Teal
- Square (6,3), Teal
- Square (6,4), Teal
- Square (6,5), Teal
- Square (6,6), Teal
- Square (1,1), Purple Patch
- Square (1,2), Purple Patch
- Square (1,3), Purple Patch
- Square (1,4), Purple Patch
- Square (1,5), Purple Patch
- Square (1,6), Purple Patch
- Square (2,1), Purple Patch
- Square (2,2), Purple Patch
- Square (2,3), Purple Patch
- Square (2,4), Purple Patch
- Square (2,5), Purple Patch
- Square (2,6), Purple Patch
- Square (3,1), Purple Patch
- Square (3,2), Purple Patch
- Square (3,3), Purple Patch
- Square (3,4), Purple Patch
- Square (3,5), Purple Patch
- Square (3,6), Purple Patch
- Square (4,1), Purple Patch
- Square (4,2), Purple Patch
- Square (4,3), Purple Patch
- Square (4,4), Purple Patch
- Square (4,5), Purple Patch
- Square (4,6), Purple Patch
- Square (5,1), Purple Patch
- Square (5,2), Purple Patch
- Square (5,3), Purple Patch
- Square (5,4), Purple Patch
- Square (5,5), Purple Patch
- Square (5,6), Purple Patch
- Square (6,1), Purple Patch
- Square (6,2), Purple Patch
- Square (6,3), Purple Patch
- Square (6,4), Purple Patch
- Square (6,5), Purple Patch
- Square (6,6), Purple Patch
- Square (1,1), Green Patch
- Square (1,2), Green Patch
- Square (1,3), Green Patch
- Square (1,4), Green Patch
- Square (1,5), Green Patch
- Square (1,6), Green Patch
- Square (2,1), Green Patch
- Square (2,2), Green Patch
- Square (2,3), Green Patch
- Square (2,4), Green Patch
- Square (2,5), Green Patch
- Square (2,6), Green Patch
- Square (3,1), Green Patch
- Square (3,2), Green Patch
- Square (3,3), Green Patch
- Square (3,4), Green Patch
- Square (3,5), Green Patch
- Square (3,6), Green Patch
- Square (4,1), Green Patch
- Square (4,2), Green Patch
- Square (4,3), Green Patch
- Square (4,4), Green Patch
- Square (4,5), Green Patch
- Square (4,6), Green Patch
- Square (5,1), Green Patch
- Square (5,2), Green Patch
- Square (5,3), Green Patch
- Square (5,4), Green Patch
- Square (5,5), Green Patch
- Square (5,6), Green Patch
- Square (6,1), Green Patch
- Square (6,2), Green Patch
- Square (6,3), Green Patch
- Square (6,4), Green Patch
- Square (6,5), Green Patch
- Square (6,6), Green Patch
- Square (1,1), Orange Patch
- Square (1,2), Orange Patch
- Square (1,3), Orange Patch
- Square (1,4), Orange Patch
- Square (1,5), Orange Patch
- Square (1,6), Orange Patch
- Square (2,1), Orange Patch
- Square (2,2), Orange Patch
- Square (2,3), Orange Patch
- Square (2,4), Orange Patch
- Square (2,5), Orange Patch
- Square (2,6), Orange Patch
- Square (3,1), Orange Patch
- Square (3,2), Orange Patch
- Square (3,3), Orange Patch
- Square (3,4), Orange Patch
- Square (3,5), Orange Patch
- Square (3,6), Orange Patch
- Square (4,1), Orange Patch
- Square (4,2), Orange Patch
- Square (4,3), Orange Patch
- Square (4,4), Orange Patch
- Square (4,5), Orange Patch
- Square (4,6), Orange Patch
- Square (5,1), Orange Patch
- Square (5,2), Orange Patch
- Square (5,3), Orange Patch
- Square (5,4), Orange Patch
- Square (5,5), Orange Patch
- Square (5,6), Orange Patch
- Square (6,1), Orange Patch
- Square (6,2), Orange Patch
- Square (6,3), Orange Patch
- Square (6,4), Orange Patch
- Square (6,5), Orange Patch
- Square (6,6), Orange Patch
- Square (1,1), Red Patch
- Square (1,2), Red Patch
- Square (1,3), Red Patch
- Square (1,4), Red Patch
- Square (1,5), Red Patch
- Square (1,6), Red Patch
- Square (2,1), Red Patch
- Square (2,2), Red Patch
- Square (2,3), Red Patch
- Square (2,4), Red Patch
- Square (2,5), Red Patch
- Square (2,6), Red Patch
- Square (3,1), Red Patch
- Square (3,2), Red Patch
- Square (3,3), Red Patch
- Square (3,4), Red Patch
- Square (3,5), Red Patch
- Square (3,6), Red Patch
- Square (4,1), Red Patch
- Square (4,2), Red Patch
- Square (4,3), Red Patch
- Square (4,4), Red Patch
- Square (4,5), Red Patch
- Square (4,6), Red Patch
- Square (5,1), Red Patch
- Square (5,2), Red Patch
- Square (5,3), Red Patch
- Square (5,4), Red Patch
- Square (5,5), Red Patch
- Square (5,6), Red Patch
- Square (6,1), Red Patch
- Square (6,2), Red Patch
- Square (6,3), Red Patch
- Square (6,4), Red Patch
- Square (6,5), Red Patch
- Square (6,6), Red Patch
- Square (1,1), Blue Patch
- Square (1,2), Blue Patch
- Square (1,3), Blue Patch
- Square (1,4), Blue Patch
- Square (1,5), Blue Patch
- Square (1,6), Blue Patch
- Square (2,1), Blue Patch
- Square (2,2), Blue Patch
- Square (2,3), Blue Patch
- Square (2,4), Blue Patch
- Square (2,5), Blue Patch
- Square (2,6), Blue Patch
- Square (3,1), Blue Patch
- Square (3,2), Blue Patch
- Square (3,3), Blue Patch
- Square (3,4), Blue Patch
- Square (3,5), Blue Patch
- Square (3,6), Blue Patch
- Square (4,1), Blue Patch
- Square (4,2), Blue Patch
- Square (4,3), Blue Patch
- Square (4,4), Blue Patch
- Square (4,5), Blue Patch
- Square (4,6), Blue Patch
- Square (5,1), Blue Patch
- Square (5,2), Blue Patch
- Square (5,3), Blue Patch
- Square (5,4), Blue Patch
- Square (5,5), Blue Patch
- Square (5,6), Blue Patch
- Square (6,1), Blue Patch
- Square (6,2), Blue Patch
- Square (6,3), Blue Patch
- Square (6,4), Blue Patch
- Square (6,5), Blue Patch
- Square (6,6), Blue Patch
- Square (1,1), Magenta Patch
- Square (1,2), Magenta Patch
- Square (1,3), Magenta Patch
- Square (1,4), Magenta Patch
- Square (1,5), Magenta Patch
- Square (1,6), Magenta Patch
- Square (2,1), Magenta Patch
- Square (2,2), Magenta Patch
- Square (2,3), Magenta Patch
- Square (2,4), Magenta Patch
- Square (2,5), Magenta Patch
- Square (2,6), Magenta Patch
- Square (3,1), Magenta Patch
- Square (3,2), Magenta Patch
- Square (3,3), Magenta Patch
- Square (3,4), Magenta Patch
- Square (3,5), Magenta Patch
- Square (3,6), Magenta Patch
- Square (4,1), Magenta Patch
- Square (4,2), Magenta Patch
- Square (4,3), Magenta Patch
- Square (4,4), Magenta Patch
- Square (4,5), Magenta Patch
- Square (4,6), Magenta Patch
- Square (5,1), Magenta Patch
- Square (5,2), Magenta Patch
- Square (5,3), Magenta Patch
- Square (5,4), Magenta Patch
- Square (5,5), Magenta Patch
- Square (5,6), Magenta Patch
- Square (6,1), Magenta Patch
- Square (6,2), Magenta Patch
- Square (6,3), Magenta Patch
- Square (6,4), Magenta Patch
- Square (6,5), Magenta Patch
- Square (6,6), Magenta Patch
- Square (1,1), Brick Patch
- Square (1,2), Brick Patch
- Square (1,3), Brick Patch
- Square (1,4), Brick Patch
- Square (1,5), Brick Patch
- Square (1,6), Brick Patch
- Square (2,1), Brick Patch
- Square (2,2), Brick Patch
- Square (2,3), Brick Patch
- Square (2,4), Brick Patch
- Square (2,5), Brick Patch
- Square (2,6), Brick Patch
- Square (3,1), Brick Patch
- Square (3,2), Brick Patch
- Square (3,3), Brick Patch
- Square (3,4), Brick Patch
- Square (3,5), Brick Patch
- Square (3,6), Brick Patch
- Square (4,1), Brick Patch
- Square (4,2), Brick Patch
- Square (4,3), Brick Patch
- Square (4,4), Brick Patch
- Square (4,5), Brick Patch
- Square (4,6), Brick Patch
- Square (5,1), Brick Patch
- Square (5,2), Brick Patch
- Square (5,3), Brick Patch
- Square (5,4), Brick Patch
- Square (5,5), Brick Patch
- Square (5,6), Brick Patch
- Square (6,1), Brick Patch
- Square (6,2), Brick Patch
- Square (6,3), Brick Patch
- Square (6,4), Brick Patch
- Square (6,5), Brick Patch
- Square (6,6), Brick Patch
- Square (1,1), Brown Patch
- Square (1,2), Brown Patch
- Square (1,3), Brown Patch
- Square (1,4), Brown Patch
- Square (1,5), Brown Patch
- Square (1,6), Brown Patch
- Square (2,1), Brown Patch
- Square (2,2), Brown Patch
- Square (2,3), Brown Patch
- Square (2,4), Brown Patch
- Square (2,5), Brown Patch
- Square (2,6), Brown Patch
- Square (3,1), Brown Patch
- Square (3,2), Brown Patch
- Square (3,3), Brown Patch
- Square (3,4), Brown Patch
- Square (3,5), Brown Patch
- Square (3,6), Brown Patch
- Square (4,1), Brown Patch
- Square (4,2), Brown Patch
- Square (4,3), Brown Patch
- Square (4,4), Brown Patch
- Square (4,5), Brown Patch
- Square (4,6), Brown Patch
- Square (5,1), Brown Patch
- Square (5,2), Brown Patch
- Square (5,3), Brown Patch
- Square (5,4), Brown Patch
- Square (5,5), Brown Patch
- Square (5,6), Brown Patch
- Square (6,1), Brown Patch
- Square (6,2), Brown Patch
- Square (6,3), Brown Patch
- Square (6,4), Brown Patch
- Square (6,5), Brown Patch
- Square (6,6), Brown Patch
Solving Patches¶
Let’s import the Patches class from linkedin_games library that was design to solve the Patches game by using LOP modeling with Pyomo.
The Patches is a child of Shikaku class and needs two inputs to be instantiated:
size- The side length of the Patches game.
seeds- A dictionary of patch seeds on the grid, which must follow the bellow structure:
{
(row, column) : {
"color": "color name or its hex code",
"area": int | None
"shape": "vertical" | "horizontal" | "square" | "any" | None
}, ...
}from linkedin_games import Patches
seeds = {
(1,2): {"color": "#846A0B", "area": 2},
(1,4): {"color": "#096B78", "area": 6},
(2,6): {"color": "#5A3DB1", "area": 2},
(3,1): {"color": "#0A7541", "area": 6},
(3,3): {"color": "#EF6C00", "area": 2, "shape":"vertical"},
(4,4): {"color": "#E30102", "area": 4, "shape":"square"},
(4,6): {"color": "#097BB1", "area": 2},
(5,1): {"color": "#A01E4E", "area": 2},
(6,3): {"color": "#9B3C1C", "area": 6},
(6,5): {"color": "#503B36", "area": 4},
}
patches = Patches(6, seeds)The solve() method calls a modeler to structure the Linear Optimization logic behind the Patches’ game before solving it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154import pyomo.environ as pyo from .._shared.optimization.modeler.opt_modeler import OptModeler from ._game_grid import ShikakuGrid class ShikakuOptModeler(OptModeler[ShikakuGrid]): def _set_range_sets(self) -> None: super()._set_range_sets() self._model.K = pyo.Set(initialize=self._game.seeds.keys()) # Rectangles def _set_composite_sets(self) -> None: super()._set_composite_sets() self._model.E = pyo.Set( # Rectangle Seeds initialize=[(*seed["square"], color) for color, seed in self._game.seeds.items()] ) self._model.A = pyo.Set( # Rectangles with required area initialize=[color for color, seed in self._game.seeds.items() if seed.get("area")], domain=self._model.K ) def _set_decision_variables(self) -> None: self.__set_rectangle_shape_decision_variables() self.__set_grid_square_decision_variables() def __set_rectangle_shape_decision_variables(self) -> None: self._model.t = pyo.Var( # Index of the top row of the rectangle k self._model.K, domain=pyo.PositiveIntegers, initialize=1, bounds=(1, self._model.m) ) self._model.l = pyo.Var( # Index of the leftmost column of the rectangle k self._model.K, domain=pyo.PositiveIntegers, initialize=1, bounds=(1, self._model.n) ) self._model.h = pyo.Var( # Height of rectangle k self._model.K, domain=pyo.PositiveIntegers, initialize=1, bounds=(1, self._model.m) ) self._model.w = pyo.Var( # Width of rectangle k self._model.K, domain=pyo.PositiveIntegers, initialize=1, bounds=(1, self._model.n) ) def __set_grid_square_decision_variables(self) -> None: self._model.u = pyo.Var( # u_ik = 1 if row i passes through rectangle k self._model.I, self._model.K, domain=pyo.Binary, initialize=0 ) self._model.v = pyo.Var( # v_jk = 1 if column j passes through rect k self._model.J, self._model.K, domain=pyo.Binary, initialize=0 ) self._model.x = pyo.Var( # x_ijk = 1 if square (i,j) is covered by rect k self._model.I, self._model.J, self._model.K, domain=pyo.Binary, initialize=0 ) def _set_parameters(self) -> None: self._model.a = pyo.Param( # Required areas self._model.K, domain=pyo.PositiveIntegers, initialize={ color: seed["area"] for color, seed in self._game.seeds.items() if seed.get("area") } ) def _set_constraints(self) -> None: self._set_non_overlapping_rectangles_constraints() self._set_game_grid_boundaries_constraints() self._set_rectangle_boundaries_constraints() self._set_rectangle_dimensions_constraints() self._set_mccormick_linearization_constraints() self._set_rectangle_seed_constraints() def _set_non_overlapping_rectangles_constraints(self) -> None: self._model.unique_rectangle_per_square_constraints = pyo.Constraint( self._model.S, rule=lambda model, i, j: pyo.quicksum(model.x[i, j, k] for k in model.K) == 1 ) def _set_game_grid_boundaries_constraints(self) -> None: self._model.bottom_row_constraints = pyo.Constraint( self._model.K, rule=lambda model, k: model.t[k] + model.h[k] - 1 <= model.m ) self._model.rightmost_column_constraints = pyo.Constraint( self._model.K, rule=lambda model, k: model.l[k] + model.w[k] - 1 <= model.n ) def _set_rectangle_boundaries_constraints(self) -> None: self._model.top_boundary_constraints = pyo.Constraint( self._model.I, self._model.K, rule=lambda model, i, k: model.t[k] - i <= model.m * (1 - model.u[i,k]) ) self._model.bottom_boundary_constraints = pyo.Constraint( self._model.I, self._model.K, rule=lambda model, i, k: i - (model.t[k] + model.h[k] - 1) <= model.m * (1 - model.u[i,k]) ) self._model.left_boundary_constraints = pyo.Constraint( self._model.J, self._model.K, rule=lambda model, j, k: model.l[k] - j <= model.n * (1 - model.v[j,k]) ) self._model.right_boundary_constraints = pyo.Constraint( self._model.J, self._model.K, rule=lambda model, j, k: j - (model.l[k] + model.w[k] - 1) <= model.n * (1 - model.v[j,k]) ) def _set_rectangle_dimensions_constraints(self) -> None: self._model.height_constraints = pyo.Constraint( self._model.K, rule=lambda model, k: pyo.quicksum(model.u[i,k] for i in model.I) == model.h[k] ) self._model.width_constraints = pyo.Constraint( self._model.K, rule=lambda model, k: pyo.quicksum(model.v[j,k] for j in model.J) == model.w[k] ) def _set_mccormick_linearization_constraints(self) -> None: self._model.cutout_row_constraints = pyo.Constraint( self._model.I, self._model.K, rule=lambda model, i, k: pyo.quicksum(model.x[i,j,k] for j in model.J) <= model.n * model.u[i,k] ) self._model.cutout_column_constraints = pyo.Constraint( self._model.J, self._model.K, rule=lambda model, j, k: pyo.quicksum(model.x[i,j,k] for i in model.I) <= model.m * model.v[j,k] ) self._model.square_coverage_constraints = pyo.Constraint( self._model.I, self._model.J, self._model.K, rule=lambda model, i, j, k: model.x[i,j,k] >= model.u[i,k] + model.v[j,k] - 1 ) def _set_rectangle_seed_constraints(self) -> None: self._model.seed_square_constraints = pyo.Constraint( self._model.E, rule=lambda model, i, j, k: model.x[i,j,k] == 1 ) self._model.area_constraints = pyo.Constraint( # Required areas self._model.A, rule=lambda model, k: pyo.quicksum(model.x[i, j, k] for (i, j) in model.S) == model.a[k] )
Program 1:Shikaku’s modeler with Pyomo components.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46import pyomo.environ as pyo from ..shikaku._opt_modeler import ShikakuOptModeler from ._shape import PatchShape class PatchesOptModeler(ShikakuOptModeler): def _set_composite_sets(self) -> None: super()._set_composite_sets() self._model.V = pyo.Set( # Vertical rectangles initialize=[ color for color, seed in self._game.seeds.items() if seed["shape"] == PatchShape.VERTICAL ], domain=self._model.K ) self._model.H = pyo.Set( # Horizontal rectangles initialize=[ color for color, seed in self._game.seeds.items() if seed["shape"] == PatchShape.HORIZONTAL ], domain=self._model.K ) self._model.Q = pyo.Set( # Squared rectangles initialize=[ color for color, seed in self._game.seeds.items() if seed["shape"] == PatchShape.SQUARE ], domain=self._model.K ) def _set_rectangle_seed_constraints(self) -> None: super()._set_rectangle_seed_constraints() self._model.vertical_rectangles_constraints = pyo.Constraint( self._model.V, rule=lambda model, k: model.h[k] >= model.w[k] + 1 ) self._model.horizontal_rectangles_constraints = pyo.Constraint( self._model.H, rule=lambda model, k: model.w[k] >= model.h[k] + 1 ) self._model.square_rectangles_constraints = pyo.Constraint( self._model.Q, rule=lambda model, k: model.h[k] == model.w[k] )
Program 2:Patches’ modeler inherits the Shikaku’s modeler to implement additional constraints.
The method display(), in its turn, calls a renderer to plot the Patches’ grid.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44import matplotlib.pyplot as plt import networkx as nx from .._shared.visualization.renderer.renderer import GameRenderer from ._game_grid import ShikakuGrid class ShikakuRenderer(GameRenderer[ShikakuGrid]): def _set_grid(self) -> None: self._grid = nx.grid_2d_graph(*self._game.dims) nx.set_node_attributes( self._grid, name="color", values={(i-1, j-1): k for (i, j), k in self._game.squares.items()} ) nx.set_node_attributes( self._grid, name="seed_area", values={ tuple(i-1 for i in seed["square"]): seed["area"] for seed in self._game.seeds.values() } ) def display(self) -> None: plt.figure(figsize=(self._width, self._height)) nx.draw( self._grid, pos={(i, j): (j, -i) for (i, j) in self._grid.nodes()}, with_labels=True, labels= { tuple(i-1 for i in seed["square"]): seed["area"] if seed.get("area") else "" for seed in self._game.seeds.values() }, node_size=1100, node_shape="s", node_color= list(nx.get_node_attributes(self._grid, "color").values()), width=0, arrows=False, edgecolors="black", linewidths=1 ) plt.show()
Program 3:The Shikaku’s renderer.
So to solve the game and display its results, just call the public methods solve() and display(), at this order.
patches.solve().display()Game solved successfully!

Running above block, the method show() returns the solved game, which matches the official solution of Patches No. 16, as expected.

Figure 5:Solved instance visualization.