Does anyone know how to define dependent sets on Lingo? For example: A company has 5 plants. Each plant has a different number of machines, i.e., 3, 4, 5, 2, 3, respectively. The company gets 20 orders. They should assign each order to the plants and machines. Cost is only dependent on which plant the order is processed. How should I define the set for the machines that dependent on the plants?
If I use the model below, it will define that all plants have 17 machines. Meanwhile, what I want to set is that the 1st-3rd machines belong to the 1st plant and so on so that the 15th-17th machines belong to the 5th plant. Alternatively, the indices of the machines for each plant are 1..3, 1..4, 1..5, 1..2, and 1..3, respectively. How should I define the set for the machines?
Model:
Sets:
orders/1..20/:;
plants/1..5/:;
machines/1..17/:;
allocation(orders, plants): c;
assign(orders, plants, machines): x;
end sets
data:
c = 1 2 3 4 5
6 7 8 9 10
10 9 8 7 6
5 4 3 2 1
1 2 3 4 5
6 7 8 9 10
10 9 8 7 6
5 4 3 2 1
1 2 3 4 5
6 7 8 9 10
10 9 8 7 6
5 4 3 2 1
1 2 3 4 5
6 7 8 9 10
10 9 8 7 6
5 4 3 2 1
1 2 3 4 5
6 7 8 9 10
10 9 8 7 6
5 4 3 2 1;
end data
min = @sum(assign(i, j, k): c(i, j) * x(i, j, k));
@for(orders(i): @sum(plants(j): @sum(machines(k): x(i, j, k))) = 1);
@for(assign(i, j, k): @bin(x(i, j, k)));
end
Thank you, Tantrika