Top Brass Trophy Company makes large championship trophies for youth athletic leagues. At the moment, they are planning production for fall sports: football and soccer. Each football trophy has a wood base, an engraved plaque, a large brass football on top, and returns \$12 in profit. Soccer trophies are similar except that a brass soccer ball is on top, and the unit profit is only \$9. Since the football has an asymmetric shape, its base requires 4 board feet of wood; the soccer base requires only 2 board feet. At the moment there are 1000 brass footballs in stock, 1500 soccer balls, 1750 plaques, and 4800 board feet of wood. What trophies should be produced from these supplies to maximize total profit assuming that all that are made can be sold?
# the types of trophies produced sports = [:football, :soccer] # wood required for each type of trophy (in board feet) wood = Dict( :football => 4, :soccer => 2) # plaques required for each type of trophy plaques = Dict( :football => 1, :soccer => 1) # profit made for each trophy profit = Dict( :football => 12, :soccer => 9) # quantities in stock for each ingredient num_wood = 4800 num_plaques = 1750 num_football = 1000 num_soccer = 1500 ;
using JuMP, Clp m = Model(solver = ClpSolver()) @variable(m, trophies[sports] >= 0 ) # "trophies" is a dictionary indexed over sports @expression(m, tot_plaques, sum(trophies[i] * plaques[i] for i in sports) ) @expression(m, tot_wood, sum(trophies[i] * wood[i] for i in sports) ) @expression(m, tot_profit, sum(trophies[i] * profit[i] for i in sports) ) @constraint(m, trophies[:soccer] <= num_soccer ) # maximum number of soccer balls @constraint(m, trophies[:football] <= num_football ) # maximum number of footballs @constraint(m, tot_plaques <= num_plaques ) # maximum number of plaques @constraint(m, tot_wood <= num_wood ) # maximum amount of wood @objective(m, Max, tot_profit) solve(m) println(getvalue(trophies)) println("Total profit will be \$", getvalue(tot_profit)) println("Total wood used is ", getvalue(tot_wood), " board feet") println("Total number of plaques used is ", getvalue(tot_plaques))
trophies: 1 dimensions: [football] = 650.0 [ soccer] = 1100.0 Total profit will be $17700.0 Total wood used is 4800.0 board feet Total number of plaques used is 1750.0