File: ex3.zpl

package info (click to toggle)
zimpl 3.7.0%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,772 kB
  • sloc: ansic: 21,719; yacc: 993; lex: 370; sh: 349; makefile: 278
file content (41 lines) | stat: -rw-r--r-- 1,086 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Page 15

# products
set PROD  := { "bands", "coils", "plate" };

# stages
set STAGE := { "reheat", "roll" };

# tons per hour in each stage
param rate[PROD * STAGE] := 
<"bands","reheat">  200, 
<"bands","roll">    200,
<"coils","reheat">  200,
<"coils","roll">    140,
<"plate","reheat">  200,
<"plate","roll">    160;

# profit per ton
param profit[PROD] := <"bands">   25, <"coils">   30, <"plate">   29;

# lower limit on tons sold in week
param commit[PROD] := <"bands"> 1000, <"coils">  500, <"plate">  750;

# upper limit on tons sold in week
param market[PROD] := <"bands"> 6000, <"coils"> 4000, <"plate"> 3500;

# hours available/week in each stage
param avail[STAGE] := <"reheat"> 35, <"roll"> 40;

# tons produced
var Make[<p> in PROD] real >= commit[p] <= market[p]; # tons produced

# Objective: total profits from all products
maximize total_profit: sum <p> in PROD : profit[p] * Make[p];

# In each stage: total of hours usd by all
# products may not exceed hour available
subto Time: forall <s> in STAGE : 
   sum <p> in PROD : (1/rate[p,s]) * Make[p] <= avail[s];