-
Notifications
You must be signed in to change notification settings - Fork 0
/
A1_G_17.m
90 lines (82 loc) · 2.29 KB
/
A1_G_17.m
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
% Optmizing cost for production of given amount of electiricity demand
% using optimization methods.
% Morning-slot optimization
% Z = 8000*x1 + 3900*x2 + 12300x3
% -2*x1 + -1*x2 + -3*x3 <= -21
% 1*x1 <= 5
% 1*x2 <= 8
% 1*x3 <= 3
f = [8000 3900 12300];
A = [-2 -1 -3; 1 0 0; 0 1 0; 0 0 1];
b = [-21 5 8 3];
Aeq = [];
beq = [];
lb = [0 0 0];
ub = [];
[x, z] = linprog(f,A,b,Aeq,beq,lb,ub);
statement = 'optimized data for morning slot';
disp(statement);
disp('Number of generators of g-I, g-II and g-III are as follows --> ');
disp(x);
disp('Total optimized cost for the production of given electricity demand is -->');
disp(z);
% Afternoon slot optimization
% Z = 8000*x1 + 3900*x2 + 12300x3
% -2*x1 + -1*x2 + -3*x3 <= -27
% 1*x1 <= 5
% 1*x2 <= 8
% 1*x3 <= 3
f = [8000 3900 12300];
A = [-2 -1 -3; 1 0 0; 0 1 0; 0 0 1];
b = [-27 5 8 3];
Aeq = [];
beq = [];
lb = [0 0 0];
ub = [];
[x, z] = linprog(f,A,b,Aeq,beq,lb,ub);
statement = 'optimized data for Afternoon slot';
disp(statement);
disp('Number of generators of g-I, g-II and g-III are as follows --> ');
disp(x);
disp('Total optimized cost for the production of given electricity demand is -->');
disp(z);
% Evening slot optimization
% Z = 8000*x1 + 3900*x2 + 12300x3
% -2*x1 + -1*x2 + -3*x3 <= -18
% 1*x1 <= 5
% 1*x2 <= 8
% 1*x3 <= 3
f = [8000 3900 12300];
A = [-2 -1 -3; 1 0 0; 0 1 0; 0 0 1];
b = [-18 5 8 3];
Aeq = [];
beq = [];
lb = [0 0 0];
ub = [];
[x, z] = linprog(f,A,b,Aeq,beq,lb,ub);
statement = 'optimized data for evening slot';
disp(statement);
disp('Number of generators of g-I, g-II and g-III are as follows --> ');
disp(x);
disp('Total optimized cost for the production of given electricity demand is -->');
disp(z);
% Mid-night slot optimization
% Z = 8000*x1 + 3900*x2 + 12300x3
% -2*x1 + -1*x2 + -3*x3 <= -12
% 1*x1 <= 5
% 1*x2 <= 8
% 1*x3 <= 3
f = [8000 3900 12300];
A = [-2 -1 -3; 1 0 0; 0 1 0; 0 0 1];
b = [-12 5 8 3];
Aeq = [];
beq = [];
lb = [0 0 0];
ub = [];
[x, z] = linprog(f,A,b,Aeq,beq,lb,ub);
statement = 'optimized data for mid-night slot';
disp(statement);
disp('Number of generators of g-I, g-II and g-III are as follows --> ');
disp(x);
disp('Total optimized cost for the production of electricity demand is -->');
disp(z)