EXERCISE:

A municipalized company must purchase rubbish bins in an area of the city. There are n types of bins on the market, each characterized by a ci cost and a Ki capacity (i = 1, …, n). M collection points have been identified in the area where the bins can be positioned and for which the quantity of waste produced Qj is known (j = 1, …, m). Determine the location of the bins at the collection points, so that it is possible to collect all the waste and that the overall cost is minimal. Write the mathematical model of the problem.

bins=[1,2,3,4]

points=[1,2,3,4,5,6,7]

capacity_bin=[8,6,5,3]

cost=[200,160,150,100]

quantity_point=[9,4,7,9,6,12,5]

model4=Model(with_optimizer(Cbc.Optimizer))

@variable(model4, x[1:4, 1:7], Bin)

@objective(model4, Min, sum(x[i,j]*cost[i] for i=1:4,j=1:7))

@constraint(model4, collection[j=1:7], sum(x[i,j] for i=1:4)==1)

@constraint(model4, Capacity[i=1:4], sum(x[i,j]*quantity_point[j] for j=1:7)<=capacity_bin[I])

optimize!(model4)

I can’t understand why it doesn’t run. Someone can help me please?