Study 8H11 Main

# Dealing with Constraints

by Richard Pavlicek

Have you ever faced the problem of escaping handcuffs after a police bust? Or removing ankle chains during a prison break? Or just getting out of a straightjacket at your local ward? Well, you’ve found the right place! Dealing with constraints requires foresight and a scientific mind. Always carry an up-to-date set of lock picks, a tube of salve, and a copy of my latest book The Bust Stops Here.

Oh, wait. My bad. This study is about creating bridge deals with constraints. For example, deals where West has six hearts, or North has a balanced hand, or East has a two-suiter — but otherwise truly random. The simple solution, undeniably perfect, is to create plain random deals and select only those that meet the desired criteria.

The deal-and-select method, however, runs into problems when the constraints become stringent, e.g., if South requires a 9-card suit, or if multiple hands must be constrained. The simple method may work, but it could take thousands (millions) of attempts to produce one deal. Indeed, extreme constraints could take a lifetime — or a million lifetimes for that matter.

Years ago, circa 1999, I devised a “solution” to this problem (Randomization Techniques) to create bidding practice deals. While serving a useful practical purpose, it missed the mark on being truly random, because it did not properly account for interdependence between hand patterns and HCP. Close is not good enough for theoretical work, so if at first you don’t succeed…

## Pattern Dealing

There are many ways to create a random deal. Most obvious is to form an array of 52 elements representing each card by position, with 13 assignments for each player. For example:

W W W W W W W W W W W W W N N N N N N N N N N N N N E E E E E E E E E E E E E S S S S S S S S S S S S S

Then simply randomize the order. This is unquestionably perfect, as long as the random number source is perfect.*

*Arguably there is no such thing, but this study is not about random number generators and will assume a reliable source.

When dealing with constraints, the above method is virtually useless. Instead, the process is to determine the pattern of each constrained hand. To illustrate, suppose you want to create random deals where West has nine spades — a good way to boost your bidding confidence or land you in the nut house (pick one). First make a list of the specific West patterns that comply, including the number of hands for each, as shown in the following table:

### West Hands with 9 Spades

The next step is to select the pattern. To do this fairly, the chance of selecting each pattern must be weighted by the number of hands it represents, which is calculated as shown. Obtain a random number from 0 to T-1, where T is the total number of hands, then find where this number lies in the cumulative totals. If the random number is less than 9425130 select 9=2=1=1; if less than 18850260 select 9=1=2=1, etc. Intuitively, this will choose a random pattern by exact theoretical odds.

If that’s the only constraint, the rest is easy. Suppose West’s pattern was chosen to be 9=1=2=1. Complete the West hand by randomly selecting nine spade ranks, one heart, two diamonds and one club. Whatever cards remain are distributed randomly among the other three hands, and you’re done — a truly random deal with West having nine spades.

### Constraining Two Hands

That was easy. Now suppose an additional constraint is for East to be 6-6 in the minors. It is not sufficient to choose the West hand first with nine spades and work from there, because of the interaction of the two conditions; i.e., each affects the probabilities of the other. Instead, the list must pair each West pattern with each East pattern, including the combinations thereof, as shown below:

West 9 Spades and East 6-6 Minors
CaseWestEastCalculationCombinationsCumulative Total
19=2=1=11=0=6=613c9·13c2·13c1·13c1·4c1·11c0·12c6·12c632,187,799,163,52032,187,799,163,520
29=2=1=10=1=6=613c9·13c2·13c1·13c1·4c0·11c1·12c6·12c688,516,447,699,680120,704,246,863,200
39=1=2=11=0=6=613c9·13c1·13c2·13c1·4c1·12c0·11c6·12c616,093,899,581,760136,798,146,444,960
49=1=2=10=1=6=613c9·13c1·13c2·13c1·4c0·12c1·11c6·12c648,281,698,745,280185,079,845,190,240
59=1=1=21=0=6=613c9·13c1·13c1·13c2·4c1·12c0·12c6·11c616,093,899,581,760201,173,744,772,000
69=1=1=20=1=6=613c9·13c1·13c1·13c2·4c0·12c1·12c6·11c648,281,698,745,280249,455,443,517,280
79=2=2=01=0=6=613c9·13c2·13c2·13c0·4c1·11c0·11c6·13c613,794,771,070,080263,250,214,587,360
89=2=2=00=1=6=613c9·13c2·13c2·13c0·4c0·11c1·11c6·13c637,935,620,442,720301,185,835,030,080
99=2=0=21=0=6=613c9·13c2·13c0·13c2·4c1·11c0·13c6·11c613,794,771,070,080314,980,606,100,160
109=2=0=20=1=6=613c9·13c2·13c0·13c2·4c0·11c1·13c6·11c637,935,620,442,720352,916,226,542,880
119=0=2=21=0=6=613c9·13c0·13c2·13c2·4c1·13c0·11c6·11c63,713,976,826,560356,630,203,369,440
129=0=2=20=1=6=613c9·13c0·13c2·13c2·4c0·13c1·11c6·11c612,070,424,686,320368,700,628,055,760
139=3=1=01=0=6=613c9·13c3·13c1·13c0·4c1·10c0·12c6·13c616,860,275,752,320385,560,903,808,080
149=3=1=00=1=6=613c9·13c3·13c1·13c0·4c0·10c1·12c6·13c642,150,689,380,800427,711,593,188,880
159=3=0=11=0=6=613c9·13c3·13c0·13c1·4c1·10c0·13c6·12c616,860,275,752,320444,571,868,941,200
169=3=0=10=1=6=613c9·13c3·13c0·13c1·4c0·10c1·13c6·12c642,150,689,380,800486,722,558,322,000
179=1=3=01=0=6=613c9·13c1·13c3·13c0·4c1·12c0·10c6·13c63,831,880,852,800490,554,439,174,800
189=1=3=00=1=6=613c9·13c1·13c3·13c0·4c0·12c1·10c6·13c611,495,642,558,400502,050,081,733,200
199=1=0=31=0=6=613c9·13c1·13c0·13c3·4c1·12c0·13c6·10c63,831,880,852,800505,881,962,586,000
209=1=0=30=1=6=613c9·13c1·13c0·13c3·4c0·12c1·13c6·10c611,495,642,558,400517,377,605,144,400
219=0=3=11=0=6=613c9·13c0·13c3·13c1·4c1·13c0·10c6·12c62,063,320,459,200519,440,925,603,600
229=0=3=10=1=6=613c9·13c0·13c3·13c1·4c0·13c1·10c6·12c66,705,791,492,400526,146,717,096,000
239=0=1=31=0=6=613c9·13c0·13c1·13c3·4c1·13c0·12c6·10c62,063,320,459,200528,210,037,555,200
249=0=1=30=1=6=613c9·13c0·13c1·13c3·4c0·13c1·12c6·10c66,705,791,492,400534,915,829,047,600
259=4=0=01=0=6=613c9·13c4·13c0·13c0·4c1·9c0·13c6·13c66,021,527,054,400540,937,356,102,000
269=4=0=00=1=6=613c9·13c4·13c0·13c0·4c0·9c1·13c6·13c613,548,435,872,400554,485,791,974,400
279=0=4=01=0=6=613c9·13c0·13c4·13c0·4c1·13c0·9c6·13c6294,760,065,600554,780,552,040,000
289=0=4=00=1=6=613c9·13c0·13c4·13c0·4c0·13c1·9c6·13c6957,970,213,200555,738,522,253,200
299=0=0=41=0=6=613c9·13c0·13c0·13c4·4c1·13c0·13c6·9c6294,760,065,600556,033,282,318,800
309=0=0=40=1=6=613c9·13c0·13c0·13c4·4c0·13c1·13c6·9c6957,970,213,200T = 556,991,252,532,000

Note that the basis for calculating the second hand (East) changes from 13 to the number of available cards in each suit when paired with that West shape. The combinations now represent sides rather than hands, but the principle is the same. Each of the 30 possible sides is weighted exactly by its probability of occurring, so a random number from 0 to T-1 will make a fair selection. Suppose the random number is 277777777777777. Going down the right column, the first time this is less than the cumulative total occurs at Case 8, so West is 9=2=2=0 and East is 0=1=6=6. Each suit is filled randomly, and whatever cards remain are split randomly between North and South.

The order of the paired hands is irrelevant. For example, in Case 1 if East (6-6 minors) is calculated first, the combinatorials become 13c1·13c0·13c6·13c6·12c9·13c2·7c1·7c1 = 32187799163520, which is exactly the same as the table. Hence, the weightings and total (T) will be identical.

It is feasible to extend the pattern-dealing method to constrain a third hand, however, the effort is rarely beneficial. (Even two hands can produce extensive listings if common shapes are involved.) More practical is to pattern-deal according to the two most-constrained hands, then select only those deals that fit the third hand conditions.

## HCP Constraints

Applying HCP constraints to random dealing is difficult, because HCP in theory is not a “number” like a hand’s spade length, but various combinations of specific cards to comprise that number. I am always looking for shortcuts, but I don’t think there is a theoretically correct way to generalize the application of HCP constraints. To create a truly random deal, it is necessary to enumerate all hands that qualify and make a random selection thereof — the same procedure as above but more complex.

First consider the application of HCP constraints alone, regardless of hand pattern. Suppose you want to create random deals where North has 3 HCP. Each possible arrangement of specific high cards must be enumerated, as shown in the following table:

North Hands with 3 HCP
CaseHigh CardsCalculationNumber of HandsCumulative Total
1 K36c121,251,677,7001,251,677,700
2 Q J36c11600,805,2961,852,482,996
3 Q J36c11600,805,2962,453,288,292
4 Q J36c11600,805,2963,054,093,588
5 Q J36c11600,805,2963,654,898,884
6 J Q36c11600,805,2964,255,704,180
7 J J J36c10254,186,8564,509,891,036
8 J J J36c10254,186,8564,764,077,892
9 J Q36c11600,805,2965,364,883,188
10 J J J36c10254,186,8565,619,070,044
11 J Q36c11600,805,2966,219,875,340
12 K36c121,251,677,7007,471,553,040
13 Q J36c11600,805,2968,072,358,336
14 Q J36c11600,805,2968,673,163,632
15 Q J36c11600,805,2969,273,968,928
16 J Q36c11600,805,2969,874,774,224
17 J J J36c10254,186,85610,128,961,080
18 J Q36c11600,805,29610,729,766,376
19 K36c121,251,677,70011,981,444,076
20 Q J36c11600,805,29612,582,249,372
21 Q J36c11600,805,29613,183,054,668
22 J Q36c11600,805,29613,783,859,964
23 K36c121,251,677,70015,035,537,664
24 Q J36c11600,805,296T = 15,636,342,960

Only one combinatorial is required in each case; 36 is the total number of spot cards (non-HCP) which is followed by the number of additional cards necessary to fill the hand. The rest is straightforward. Obtain a random number from 0 to T-1 and see where it falls in the cumulative totals. Suppose the random number happens to be 8673163632, which looks very familiar to Case 14. No! It must be below the cumulative total, so Case 15 is selected. North gets the Q and J, and the rest of his hand is filled randomly from the 36 spot cards. All unused cards (including high cards) are then distributed randomly to West, South and East.

### Constraining Two Hands

Now suppose two hands require HCP constraints. The general strategy is the same, though the listing gets longer, and the numbers larger, because the enumeration represents sides rather than hands. To keep the list friendly, consider a trivial case where North requires 2 HCP and South 0-1 HCP — a good way to practice your grand-slam defense, or feed an inferiority complex. Here is the table:

North 2 HCP and South 0-1 HCP
CaseNorthSouthCalculationCombinationsCumulative Total
1 Q36c12·24c133,124,367,780,788,8003,124,367,780,788,800
2 Q J36c12·24c123,384,731,762,521,2006,509,099,543,310,000
3 Q J36c12·24c123,384,731,762,521,2009,893,831,305,831,200
4 Q J36c12·24c123,384,731,762,521,20013,278,563,068,352,400
5 Q J36c12·24c123,384,731,762,521,20016,663,294,830,873,600
6 J J36c11·25c133,124,367,780,788,80019,787,662,611,662,400
7 J J J36c11·25c123,124,367,780,788,80022,912,030,392,451,200
8 J J J36c11·25c123,124,367,780,788,80026,036,398,173,240,000
9 J J36c11·25c133,124,367,780,788,80029,160,765,954,028,800
10 J J J36c11·25c123,124,367,780,788,80032,285,133,734,817,600
11 J J J36c11·25c123,124,367,780,788,80035,409,501,515,606,400
12 J J36c11·25c133,124,367,780,788,80038,533,869,296,395,200
13 J J J36c11·25c123,124,367,780,788,80041,658,237,077,184,000
14 J J J36c11·25c123,124,367,780,788,80044,782,604,857,972,800
15 Q36c12·24c133,124,367,780,788,80047,906,972,638,761,600
16 Q J36c12·24c123,384,731,762,521,20051,291,704,401,282,800
17 Q J36c12·24c123,384,731,762,521,20054,676,436,163,804,000
18 Q J36c12·24c123,384,731,762,521,20058,061,167,926,325,200
19 Q J36c12·24c123,384,731,762,521,20061,445,899,688,846,400
20 J J36c11·25c133,124,367,780,788,80064,570,267,469,635,200
21 J J J36c11·25c123,124,367,780,788,80067,694,635,250,424,000
22 J J J36c11·25c123,124,367,780,788,80070,819,003,031,212,800
23 J J36c11·25c133,124,367,780,788,80073,943,370,812,001,600
24 J J J36c11·25c123,124,367,780,788,80077,067,738,592,790,400
25 J J J36c11·25c123,124,367,780,788,80080,192,106,373,579,200
26 Q36c12·24c133,124,367,780,788,80083,316,474,154,368,000
27 Q J36c12·24c123,384,731,762,521,20086,701,205,916,889,200
28 Q J36c12·24c123,384,731,762,521,20090,085,937,679,410,400
29 Q J36c12·24c123,384,731,762,521,20093,470,669,441,931,600
30 Q J36c12·24c123,384,731,762,521,20096,855,401,204,452,800
31 J J36c11·25c133,124,367,780,788,80099,979,768,985,241,600
32 J J J36c11·25c123,124,367,780,788,800103,104,136,766,030,400
33 J J J36c11·25c123,124,367,780,788,800106,228,504,546,819,200
34 Q36c12·24c133,124,367,780,788,800109,352,872,327,608,000
35 Q J36c12·24c123,384,731,762,521,200112,737,604,090,129,200
36 Q J36c12·24c123,384,731,762,521,200116,122,335,852,650,400
37 Q J36c12·24c123,384,731,762,521,200119,507,067,615,171,600
38 Q J36c12·24c123,384,731,762,521,200T = 122,891,799,377,692,800

Note that the combinatorial for the second hand (South) is based on the remaining spot cards, rather than 36. As with pattern dealing, the order of the two hands makes no difference; e.g., if South were chosen first in Case 1, the combinatorials would be 36c13·23c11, which produce the same 16-digit product. Simply fetch a random number between 0 and T-1, find where it falls in the cumulative totals, and bingo, a truly random deal with the given HCP constraints.

## Pattern and HCP Constraints

Now suppose you want to apply both pattern and HCP constraints. No problem, though it requires more enumeration. Each possible pattern must be listed with each possible high-card arrangement. To illustrate, suppose you want to create random deals where East is 5-3-3-2 with 34 HCP — call it slam-bidding practice for morons. The table becomes:

East 5-3-3-2 with 34 HCP
CasePatternHigh CardsCalculationHandsTotal
15=3=3=2 A-K-Q-J A-K-Q A-K-Q A-Q9c1·9c0·9c0·9c099
25=3=3=2 A-K-Q-J A-K-Q A-K-J A-K9c1·9c0·9c0·9c0918
35=3=3=2 A-K-Q-J A-K-J A-K-Q A-K9c1·9c0·9c0·9c0927
45=3=3=2 A-K-Q A-K-Q A-K-Q A-K9c2·9c0·9c0·9c03663
55=3=2=3 A-K-Q-J A-K-Q A-K A-K-J9c1·9c0·9c0·9c0972
65=3=2=3 A-K-Q-J A-K-Q A-Q A-K-Q9c1·9c0·9c0·9c0981
75=3=2=3 A-K-Q-J A-K-J A-K A-K-Q9c1·9c0·9c0·9c0990
85=3=2=3 A-K-Q A-K-Q A-K A-K-Q9c2·9c0·9c0·9c036126
95=2=3=3 A-K-Q-J A-K A-K-Q A-K-J9c1·9c0·9c0·9c09135
105=2=3=3 A-K-Q-J A-K A-K-J A-K-Q9c1·9c0·9c0·9c09144
115=2=3=3 A-K-Q-J A-Q A-K-Q A-K-Q9c1·9c0·9c0·9c09153
125=2=3=3 A-K-Q A-K A-K-Q A-K-Q9c2·9c0·9c0·9c036189
133=5=3=2 A-K-Q A-K-Q-J A-K-Q A-Q9c0·9c1·9c0·9c09198
143=5=3=2 A-K-Q A-K-Q-J A-K-J A-K9c0·9c1·9c0·9c09207
153=5=3=2 A-K-Q A-K-Q A-K-Q A-K9c0·9c2·9c0·9c036243
163=5=3=2 A-K-J A-K-Q-J A-K-Q A-K9c0·9c1·9c0·9c09252
173=5=2=3 A-K-Q A-K-Q-J A-K A-K-J9c0·9c1·9c0·9c09261
183=5=2=3 A-K-Q A-K-Q-J A-Q A-K-Q9c0·9c1·9c0·9c09270
193=5=2=3 A-K-Q A-K-Q A-K A-K-Q9c0·9c2·9c0·9c036306
203=5=2=3 A-K-J A-K-Q-J A-K A-K-Q9c0·9c1·9c0·9c09315
213=3=5=2 A-K-Q A-K-Q A-K-Q-J A-Q9c0·9c0·9c1·9c09324
223=3=5=2 A-K-Q A-K-Q A-K-Q A-K9c0·9c0·9c2·9c036360
233=3=5=2 A-K-Q A-K-J A-K-Q-J A-K9c0·9c0·9c1·9c09369
243=3=5=2 A-K-J A-K-Q A-K-Q-J A-K9c0·9c0·9c1·9c09378
253=3=2=5 A-K-Q A-K-Q A-K A-K-Q9c0·9c0·9c0·9c236414
263=3=2=5 A-K-Q A-K-Q A-Q A-K-Q-J9c0·9c0·9c0·9c19423
273=3=2=5 A-K-Q A-K-J A-K A-K-Q-J9c0·9c0·9c0·9c19432
283=3=2=5 A-K-J A-K-Q A-K A-K-Q-J9c0·9c0·9c0·9c19441
293=2=5=3 A-K-Q A-K A-K-Q-J A-K-J9c0·9c0·9c1·9c09450
303=2=5=3 A-K-Q A-K A-K-Q A-K-Q9c0·9c0·9c2·9c036486
313=2=5=3 A-K-Q A-Q A-K-Q-J A-K-Q9c0·9c0·9c1·9c09495
323=2=5=3 A-K-J A-K A-K-Q-J A-K-Q9c0·9c0·9c1·9c09504
333=2=3=5 A-K-Q A-K A-K-Q A-K-Q9c0·9c0·9c0·9c236540
343=2=3=5 A-K-Q A-K A-K-J A-K-Q-J9c0·9c0·9c0·9c19549
353=2=3=5 A-K-Q A-Q A-K-Q A-K-Q-J9c0·9c0·9c0·9c19558
363=2=3=5 A-K-J A-K A-K-Q A-K-Q-J9c0·9c0·9c0·9c19567
372=5=3=3 A-K A-K-Q-J A-K-Q A-K-J9c0·9c1·9c0·9c09576
382=5=3=3 A-K A-K-Q-J A-K-J A-K-Q9c0·9c1·9c0·9c09585
392=5=3=3 A-K A-K-Q A-K-Q A-K-Q9c0·9c2·9c0·9c036621
402=5=3=3 A-Q A-K-Q-J A-K-Q A-K-Q9c0·9c1·9c0·9c09630
412=3=5=3 A-K A-K-Q A-K-Q-J A-K-J9c0·9c0·9c1·9c09639
422=3=5=3 A-K A-K-Q A-K-Q A-K-Q9c0·9c0·9c2·9c036675
432=3=5=3 A-K A-K-J A-K-Q-J A-K-Q9c0·9c0·9c1·9c09684
442=3=5=3 A-Q A-K-Q A-K-Q-J A-K-Q9c0·9c0·9c1·9c09693
452=3=3=5 A-K A-K-Q A-K-Q A-K-Q9c0·9c0·9c0·9c236729
462=3=3=5 A-K A-K-Q A-K-J A-K-Q-J9c0·9c0·9c0·9c19738
472=3=3=5 A-K A-K-J A-K-Q A-K-Q-J9c0·9c0·9c0·9c19747
482=3=3=5 A-Q A-K-Q A-K-Q A-K-Q-J9c0·9c0·9c0·9c19T = 756

Combinatorial calculations are now based on 9 (not 13) because only spot cards (2-10) are involved. Each ace, king, queen and jack is assigned by individual cases. Note how the presence of fixed high cards affects the combinatorial of each suit, as fewer spot cards are required to fill out the remainder — indeed, very few (if any) in this extreme example. Also note the surprisingly low total compared to previous tables, because only 756 hands out of 635+ billion fit the constraints. The rest is routine. Obtain a random number from 0-755 to select the case, randomly fill a spot card or two, and randomly deal the other hands.

If a second hand is to be constrained for pattern and HCP, each possible makeup of the first hand must be paired with each possible makeup of the second hand. Considering that there are 560 specific hand patterns and up to 4658 ways to distribute high cards for a given total, this can get messy, but that’s what computers are for. Hey, ‘puter! I spilled my drink. Clean it up!

### Useful Tricks

Fortunately, the process adapts well to computerization. There are 16 high cards, which neatly allows a 16-bit word to contain all possible arrangements. Ordering the representation by suit then rank works best, so the bitmap I use is: A-K-Q-J A-K-Q-J A-K-Q-J A-K-Q-J. Of the 65,536 bitmaps, 137 are thrown out as impossible (requiring 14+ cards) which leaves 65,399 possible arrangements. These are sorted by their HCP total and split accordingly into 38 lookup lists. The bitmap respresentation also makes it easy to check which arrangements are possible for the second hand. The first bitmap is logically Anded with future prospects, and only zero results are eligible; i.e., any common bit means impossible.

Another trick I use is an array of lookup tables, not just the usual two-dimensional combinatorials but indexed thirdly by a suit’s HCP bitmap. This way, the proper factor including the adjustment for the number of fixed high cards (if any) is obtained instantly. Further, this eliminates the overhead of checking for viability, as impossible cases simply return a factor of zero, killing that case with multiplication. This may not make sense to everyone, but for a computer CPU it is heaven.

The greatest shortcut of all is that the enumeration need only be done once. After that, all it takes is successive random numbers (0 to T-1) to produce true random deals from the given constraints.

Currently I allow listings up to 64 million cases (actually 64 MB). Each case takes 16 bytes* of data, so the size can reach 1 GB. Being an old-fashioned assembly programmer (16-bit x86), memory storage is out of the question, so the listing is written to a file at 64K intervals. An index is kept in memory to speed up access for each random number chosen.

*Storage includes the cumulative total which can reach 6+ sextillion (52c13·39c13) requiring 73 bits; two pattern indexes 0-559 (560 = off) requiring 10 bits each; and two high-card bitmaps (0FFFFh = off) requiring 16 bits each. These add to 125 bits (16 bytes = 128 bits).

## Testing the Algorithms

Judging the randomness of a bridge deal — or even hundreds of deals — is impossible by appearance. Therefore, I ran various batches of 10,485,760 deals each to test and debug* the algorithms, using my deal statistics analyzer to tabulate the results. Click on the links to see the complete stats.

*Debug indeed, as for days I was getting 10 million deals of crap, until I found a faulty byte in a lookup table. Amazing how much one typo can ruin.

Club Length 0-13 — Effectively no setting but useful to zero the balance scale. Even though West’s pattern was always chosen first and North’s second, with the dregs going to South and East, the evenness of the stats confirms that pattern dealing is sound in theory.

Nine Spades opp. 6-6 Minors — A complete run of my second example. Odds against West having nine spades and East being 6-6 in the minors are over 9 million to 1. Pattern dealing spews out a valid random deal on every shot.

Balanced 28-30 opp. Major — Transfer bidding practice for cardracks. This collection revived memories of the late Jacq van Gelder of South Florida, a clever anagram fanatic, who once christened me “Heil! VIP Cardrack.”

Flannery Misfits — Need to cure partners of Flannery? Send them these hands for bidding practice. After bidding ad infinitum without ever finding a major fit, they’ll switch to your weak 2 bid a heartbeat. Proselytized by PavCo — works every time.

Flat 10-12 opp. 11-15 Three-Suiter — This one barely fit my size limitation, requiring a table of some 62 million cases. To verify that order is irrelevant, I ran it a second time with the three-suiter defined first, and totals were identical.

 Study 8H11 Main Top Dealing with Constraints