Let's start by adding two quota questions to your survey, split by a page break. Each one's "do not qualify skip" can be set to whatever other question in your survey. In both quota questions, we're going to add six quota cells. Give them all a cell limit of 99999 or so.
In the first quota question, set the qualification logic to this:
Begin Unverified Perl
# Parameters
my $firstQuotaQ = 'QuotaQ1';
my $secondQuotaQ = 'QuotaQ2';
my $thisCell = 1;
# Run
my @bestCells = ();
my $bestScore = 9999999;
for (my $i = $thisCell; $i <= 6; $i++) {
my $ithScore = QUOTACELLCOMPLETES($firstQuotaQ, $i) + QUOTACELLCOMPLETES($secondQuotaQ, $i);
if ($ithScore < $bestScore) {
@bestCells = ($i);
$bestScore = $ithScore;
}
elsif ($ithScore == $bestScore) {
push(@bestCells, $i);
}
}
return $bestCells[rand(@bestCells)] == $thisCell;
End Unverified
Lines 3 and 4 should be updated with the names of the first and second quota questions, respectively. Line 5 should be updated with which quota cell the code is being placed into: 1 in the first quota cell, 2 in the second, etc.
In the second quota question, set the qualification logic to this:
Begin Unverified Perl
# Parameters
my $firstQuotaQ = 'QuotaQ1';
my $secondQuotaQ = 'QuotaQ2';
my $thisCell = 1;
# Run
my $firstQuotaQValue = GETVALUE($firstQuotaQ);
my @bestCells = ();
my $bestScore = 9999999;
for (my $i = $thisCell; $i <= 6; $i++) {
if ($i == $firstQuotaQValue) {
next;
}
my $ithScore = QUOTACELLCOMPLETES($firstQuotaQ, $i) + QUOTACELLCOMPLETES($secondQuotaQ, $i);
if ($ithScore < $bestScore) {
@bestCells = ($i);
$bestScore = $ithScore;
}
elsif ($ithScore == $bestScore) {
push(@bestCells, $i);
}
}
return $bestCells[rand(@bestCells)] == $thisCell;
End Unverified
Update lines 3 through 5 like we did before.
The values recorded for these two quota questions should be the two items that have been "least fill" selected for the current respondent. You can use the values directly with Sawtooth Script, or integrate them into a constructed list, or anything else.