The objective function is the first part of the model formulation and is required. It starts with the keyword MAX or MIN depending on whether you want to maximize or minimize. You can also use the longer version of the keywords MAXIMIZE and MINIMIZE.
The name of the objective function is optional. It can be of any length, but cannot contain spaces or other delimiters. If you omit it, the name defaults to "Z". An equals sign follows the name. Finally, you enter the formula for the actual function.
You can extend the objective function over many lines. When it is complete, mark the end with a semicolon and/or the keyword SUBJECT TO.
You can use a constant value in the objective function. MPL places the constant directly into the generated objective function if the LP package supports that feature. If not, MPL will add the constant to the solution after optimizing.
Examples:
MAX 3x1 + 5x2 ; MIN Labor_Cost = 3.00 Shift1 + 3.45 Shift2 + 4.50 Extra1 + 5.18 Extra2 + 120000 ; ! fixed cost MAXIMIZE Profit = Revenues - TotalCost ; MINIMIZE Cost = SUM(products,months : InventoryCost) ;