# Optimization problem

**URL:** https://discourse.julialang.org/t/optimization-problem/33026
**Category:** Optimization (Mathematical)
**Created:** [January 6, 2020, 3:12pm UTC](https://discourse.julialang.org/t/optimization-problem/33026 "2020-01-06T15:12:21Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Caterina\_Cerutti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/caterina_cerutti/32/11096_2.png) [@Caterina\_Cerutti](https://discourse.julialang.org/u/Caterina_Cerutti)
#### Post date: [January 6, 2020, 3:12pm UTC](https://discourse.julialang.org/t/optimization-problem/33026/1 "2020-01-06T15:12:21Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)
#### Post date: [January 6, 2020, 4:34pm UTC](https://discourse.julialang.org/t/optimization-problem/33026/2 "2020-01-06T16:34:10Z")

</div>

If you look up the termination status:

```julia
julia> termination_status(model4)
INFEASIBLE::TerminationStatusCode = 2

```

you will see that it is infeasible. Is this what you mean by doesn’t run?

Should read: [Query Solutions · JuMP](https://www.juliaopt.org/JuMP.jl/v0.20.0/solutions/)

p.s., You should read [this PSA](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757) about how to format your code.

p.p.s., this looks like a homework question. If so, while people may help you with JuMP syntax, you should be mindful of your schools homework policy.
