# Constructed list AIG, ListMax and Insert combination

I'm having a predefined list of devices (called Devices).
My goal is to always add the 1st when have a score >0 in A11a. Next randomly add max 3 of all other devices with list number 2 to 7, also when they have a score>0 in A11a.
Devices 15 = Importance. This should always be added in the first option and is not asked in any of the previous questions.

I have the following constructed list with Devices as parent list:

AIG (A11a,0)
REMOVE (Devices,1)
REMOVE (Devices,8,15)
RANDOMIZE ()
LISTMAX (3)
AIG (A11a,0)
REMOVE (Devices,2,15)
RANDOMIZE ()
INSERT (1,Devices,15)

This however doesn't show the needed list.

First, I am assuming your devices question is a grid, ranking or constant sum of some sort? AIG can only be used for these type of questions. See AIG in the Sawtooth HELP for a better explanation.

Looking at the above set of instructions, the only item left could possibly be item 1 if it is >0 and item 15. The remove instructions are eliminating all other items.

Here's a solution (if I am undertsanding your problem correctly) ...

Create a constructed list (DeviceConList) - this will get all devices 2-7 greater than 0 and select a maximum of 3 and randomise. Finally, it will add item 15 in position 1.

AIG(A11a,0)
Remove(Devices,1)
Remove(Devices,8,15)
Randomize()
ListMax(3)
INSERT (1,Devices,15)
answered Mar 12, 2013 by Platinum (98,670 points)
Yes indeed, A11a is a constant sum question. If I use your constructed list (DeviceConList) I will not add device 1 when A11a>0. That's why I added the second part. I think I need to make 3 lists:

1. DeviceConList1: randomly select 3 devices with A11a>0
AIG(A11a,0)
Remove(Devices,1)
Remove(Devices,8,15)
Randomize()
ListMax(3)

2. DeviceConList2: when device 1 is >0 in A11a, then always add to the list
AIG (A11a,0)
REMOVE (Devices,2,15)
RANDOMIZE ()

3. DeviceConList3: Merge 1 & 2 and add importance (device 15)