-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBinary Programming.txt
More file actions
56 lines (38 loc) · 1.01 KB
/
Binary Programming.txt
File metadata and controls
56 lines (38 loc) · 1.01 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---------------------------
Algebraic Notation
---------------------------
proc optmodel;
var x1 binary;
var x2 binary;
var x3 binary;
var x4 binary;
var x5 binary;
maximize z= 20*x1 + 40*x2 + 20*x3 + 15*x4 + 30*x5;
con c1: 5*x1 + 4*x2 + 3*x3 + 7*x4 + 8*x5 <= 25;
con c2: x1 + 7*x2 + 9*x3 + 4*x4 + 6*x5 <= 25;
con c3: 8*x1 + 10*x2 + 2*x3 + x4 + 10*x5 <= 25;
solve;
print x1 x2 x3 x4 x5 z;
quit;
------------------------------
Indexed Notation
------------------------------
proc optmodel;
set Years={'Y1','Y2','Y3'};
set Projects={'P1','P2','P3','P4','P5'};
number expenditure{Projects,Years}=[
5 1 8
4 7 10
3 9 2
7 4 1
8 6 10 ];
number return{Projects}=[20 40 20 15 30];
number available{Years}=[25 25 25];
var X {p in Projects} binary;
maximize Total_Return= sum {p in Projects} X[p]*return[p];
con Available_Funds {y in Years}:
sum {p in Projects} X[p]*expenditure[p,y] <= available[y];
solve;
print X Total_Return;
quit;
-------------------------------