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] # ingredients involved ingredients = [:wood, :plaque, :brass_football, :brass_soccer] # profits returned (for each sport) profit = Dict( zip( sports, [ 12, 9 ] ) ) # quantities available (for each ingredient) quant_avail = Dict( zip( ingredients, [ 4800, 1750, 1000, 1500 ] ) ) # recipes (sport, ingredient) using NamedArrays recipe_mat = [ 4 1 1 0 2 1 0 1 ] recipe = NamedArray( recipe_mat, (sports,ingredients), ("sport","ingredient",) ) ;
using JuMP, Clp m = Model(solver = ClpSolver()) @variable(m, trophies[sports] >= 0 ) @expression(m, total_profit, sum( profit[s]*trophies[s] for s in sports) ) @constraint(m, constr[i in ingredients], sum( recipe[s,i]*trophies[s] for s in sports ) <= quant_avail[i] ) @objective(m, Max, total_profit ) solve(m) println(getvalue(trophies)) println("Total profit is: \$", getvalue(total_profit))
trophies: 1 dimensions: [football] = 650.0 [ soccer] = 1100.0 Total profit is: $17700.0