# whiskas.mod
#
# Written by Mike O'Sullivan & Cameron Walker 2004
#
# This file contains the linear programming model for
# determing the optimal recipe for 100g of Whiskas cat food.
#
# Last modified: 8/2/2004
model;
# The set of all possible ingredients for the cat food
set INGREDIENTS;
# The set of requirements for a can of cat food
set REQUIREMENTS;
# The data for the linear programme
# The cost (per gram) of the ingredients
param Cost {INGREDIENTS};
# The contribution per g of ingredients to requirements
param Contributes {REQUIREMENTS, INGREDIENTS};
param Lower {REQUIREMENTS} default -Infinity;
param Upper {r in REQUIREMENTS} >= Lower[r], default Infinity;
# The linear programme
# Decision variables: amount (g) of each ingredient used
var Amount {INGREDIENTS} >= 0;
# Objective: minimise the cost per can
minimize TotalCost: sum {i in INGREDIENTS} Cost[i] * Amount[i];
# Constraints: Meet the nutritional requirements
subject to MeetRequirements {r in REQUIREMENTS} :
Lower[r] <= sum {i in INGREDIENTS} Contributes[r, i] * Amount[i] <= Upper[r];