(!****************************************************** Mosel Example Problems ====================== file prodmix.mos ```````````````` TYPE: Product mix (single period production planning) DIFFICULTY: 1 FEATURES: simple LP problem DESCRIPTION: A firm has 3 workshops, each working 40 hours per week, in which it can produce two products. A unit of each product requires a given number of hours in the workshops and a given number of man hours. The hourly labor cost and the unit sales prices are known. The objective is to determine the most profitable operation. FURTHER INFO: "Applications of optimization with Xpress-MP", Section 2.3 "Simple resource constraints" (c) 2001 Dash Associates author: S. Heipcke *******************************************************!) model Workshop uses "mmxprs" ! Use Xpress-Optimizer declarations NProd = 2 ! Number of products NShop = 3 ! Number of workshops RP = 1..NProd RS = 1..NShop WMAX = 40 ! Maximum weekly working time LABOR = 5 ! Hourly labor cost DUR: array(RP,RS) of integer ! Duration of product p in shop s RES: array(RP) of integer ! Man hours per unit PRICE: array(RP) of integer ! Selling price per unit make: array(RP) of mpvar ! Amount of product p end-declarations DUR := [ 5, 9, 7, 10, 2, 5] RES := [10, 8] PRICE:= [108, 84] ! Objective: Maximize Benefit MaxBen:= sum(p in RP) (PRICE(p)-LABOR*RES(p)) * make(p) forall(s in RS) ! Limit on weekly working hours Capacity(s):= sum(p in RP) DUR(p,s)*make(p) <= WMAX maximize(MaxBen) writeln("Objective: ", getobjval) forall(p in RP) write("Product ", p, ":", getsol(make(p)), " ") writeln end-model