## Example: ClothCo¶

ClothCo is capable of manufacturing three types of clothing: shirts, shorts, and pants. Each type of clothing requires that ClothCo have the appropriate type of machine available. The machines can be rented at a fixed weekly cost. The manufacture of each type of clothing also requires some amount of cloth and labor, and returns some profit, indicated below. Each week, 150 hours of labor and 160 sq yd of cloth are available. How should ClothCo tune its production to maximize profits? Note: If we don't produce a particular item, we can save on the rental cost!

Clothing item Labor per item Cloth per item Profit per item Machine rental
Shirt 3 hours 4 \$6 \$200/wk
Shorts 2 hours 3 \$4 \$150/wk
Pants 6 hours 4 \$7 \$100/wk
In [7]:
using JuMP, Cbc

m = Model(solver = CbcSolver())

@variable(m, x[1:3] >= 0)
@variable(m, z[1:3], Bin)

@constraint(m, 3x[1] + 2x[2] + 6x[3] <= 150)  # labor budget
@constraint(m, 4x[1] + 3x[2] + 4x[3] <= 160)  # cloth budget
@constraint(m, x .<= 50*z)                    # if x>0 then z=1

@objective(m, Max, 6x[1] + 4x[2] + 7x[3] - 200z[1] - 150z[2] - 100z[3])

solve(m)

xopt = getvalue(x)
println(xopt[1], " shirts")
println(xopt[2], " shorts")
println(xopt[3], " pants" )
println()
println("\$", getobjectivevalue(m), " of net profit")  0.0 shirts 0.0 shorts 25.0 pants$75.0 of net profit

In [ ]: