Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Quota Assignment

I have a list of 28 products which are ranked from top to bottom implying 1 is highest rated, 2 is 2nd best and so on. These products are categorised into 6 groups (not similarly sized). Each group has a defined quota. However, the aim of the quota is only to get a even distributions. I don't want to terminate the people once their allocated quota is filled, rather move them to next available data based on their selected choices.

For example:

Respondent chooses "1 XYZ", "2 ABC", and "13 PQR"
Highest rated product chosen is XYZ
However, quota for Product Group 1, which XYZ is aligned to, is full
Instead of terminating, Respondent is re-routed to the highest rated product they chose in the next highest numbered Product Group whose Quota is NOT full
Thus, "ABC" is skipped over, and Respondent sees "PQR" as their product for the rest of the survey and is assigned to Group 3

Please let me know if there is a way to do this.

Thanks in advance!
asked Feb 1 by Tarun

1 Answer

0 votes
In the quota question, create a quota cell for each of the six product groups.  The cell values should be one through six.

Each cell requires this qualification logic:

Begin Unverified Perl
my $productsList = 'productsList';
my $rankingQ = 'RankingQ';
my $quotaQ = 'QuotaQ';

my @groups = (
    [1, 2, 3, 4], # first product group / quota cell has product 1, product 2, product 3, and product 4
    [5, 6], # second product group / quota cell has product 5 and product 6
    [7, 8, 9] # third product group / quota cell has product 7, product 8, and product 9

my $best = 0;
my $bestRank = 9999;
for (my $i = 1; $i <= LISTLENGTH($productsList); $i++) {
    my $rank = GETVALUE($rankingQ . '_' . $i);
    if ($rank < $bestRank) {
        for (my $j = 1; $j <= scalar @groups; $j++) {
            if ($i ~~ @groups[$j - 1]) {
                if (ISQUOTACELLOPEN($quotaQ, $j)) {
                    $best = $j;
                    $bestRank = $rank;

return $best == 1;
End Unverified

Line 2 must be updated with the name of the list of products.  Lines 3 and 4 must be updated with the name of the ranking and quota question, respectively.

Lines 6-10 should be updated to reflect the nature of your product groups.  As is, the code has three product groups: one with the first four products, one with the middle two, and one with the final three.

Finally, line 29 should be updated with each cell's cell value.  So the first cell requires "$best == 1", the second requires "$best == 2", and so on.
answered Feb 1 by Zachary Platinum Sawtooth Software, Inc. (63,775 points)
Thanks Zachary for the reply. I guess I wasn't clear enough in stating the problem. I don't have any ranking question in the survey. 1-5, 6-10, 11-14, 15-22, 23-24,25-27 are the 6 product groups and their ranking is the serial number in which they appear in the question. So, say if one selects  products from group 1 , group 2 and group 6 and group 1 quota happens to be full, he should be rerouted to group 2 and so on.

If you need more clarity, let me know.

So this is a checkbox-type select question where respondents identify which products they use?
Yeah, it is a checkbox type select question.
That makes things a lot simpler.  Here's an example of the qualification logic that the first quota cell requires:

SelectQ_1 = 1 or SelectQ_2 = 1 or SelectQ_3 = 1 or SelectQ_4 = 1 or SelectQ_5 = 1

"SelectQ" being the name of the select question.

If you have large cell limits with respect to the number of respondents, this system can potentially create an uneven distribution of course.  If a respondent has used a random selection of products, they'll tend towards groups 1 or 2 rather than groups 5 or 6.
I don't think this will work. SelectQ has 27 option choices.
ProductQuota categorises them in 6 groups in a way you have described. Now, someone has selected products (1,6,8,14) that means as per the quota allocation, he should be given ProductQuota1 but if this quota  is already filled the code should look for next group (if selected) and allocates him to that group. In this case, ProductQuota2 and so on for the rest of the cases.

Hope this makes it clearer.
I believe my code behaves as you describe.  Quota cells are hierarchical.  So the code starts by testing cell 1.  If cell 1 passes, the respondent is put in that quota cell and that's the end.  If cell 1 fails (either because of the qualification logic or because the limit has been met), we check cell 2.  And then cell 3 and so on and so forth.  So if you use my qualification logic, each respondent will be put in the first non-empty group they qualify for.
Thanks Zach. I had coded in the same way. Just that I thought it's not sufficient :P. My bad! :|

Thanks a lot!