# Sailco problem¶

Sailco manufactures sailboats. During the next 4 months the company must meet the following demands for their sailboats:

Month 1 2 3 4
Number of boats 40 60 70 25

At the beginning of Month 1, Sailco has 10 boats in inventory. Each month it must determine how many boats to produce. During any month, Sailco can produce up to 40 boats with regular labor and an unlimited number of boats with overtime labor. Boats produced with regular labor cost \$400 each to produce, while boats produced with overtime labor cost \$450 each. It costs \\$20 to hold a boat in inventory from one month to the next. Find the production and inventory schedule that minimizes the cost of meeting the next 4 months' demands.

### Solution¶

In [1]:
using JuMP, Clp

d = [40 60 70 25]                   # monthly demand for boats

m = Model(solver=ClpSolver())

@variable(m, 0 <= x[1:4] <= 40)       # boats produced with regular labor
@variable(m, y[1:4] >= 0)             # boats produced with overtime labor
@variable(m, h[1:5] >= 0)             # boats held in inventory
@constraint(m, h[1] == 10)
@constraint(m, flow[i in 1:4], h[i]+x[i]+y[i]==d[i]+h[i+1])     # conservation of boats
@objective(m, Min, 400*sum(x) + 450*sum(y) + 20*sum(h))         # minimize costs

solve(m)

println("Build ", Array{Int}(getvalue(x')), " using regular labor")
println("Build ", Array{Int}(getvalue(y')), " using overtime labor")
println("Inventory: ", Array{Int}(getvalue(h')))

Build [40 40 40 25] using regular labor
Build [0 10 30 0] using overtime labor
Inventory: [10 10 0 0 0]

In [ ]: