-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtestOC.m
42 lines (35 loc) · 858 Bytes
/
testOC.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
correct = 0;
f=[];
%for v=1:50
%for n=1:50
varlist = {'N','F','i','w','p','q','c','V0','Vn','l'};
clear(varlist{:});
N = 12;
F = 3+ceil(abs(5*randn(1,N)))/100;
g=1e4;
F=F'*g;
i = abs(10000+500*randn(1,N));
w = abs(10000+500*randn(1,N));
p = @(x) 0.00;
q = @(x) 0.01;
c = 0;
V0 = 100000*randi(10)*rand(1);
Vn = ceil(2*rand*V0);
l = ceil(rand(1,N)*(V0+Vn)*0.2);
[d, e, fval] = optimizeContracts(1,12,F,i,w,q,p,c,V0,Vn,l);
%f(v,n) = fval;
if(~isempty([d' e' fval]))
plotConstraints(d,e,i,w,V0,Vn,l);
end
%end
%end
% f = sum(f)/size(f,1);
%
% figure;
% loglog(2.^((1:50)-1),f);
% title('Average Contribution of Injection and Withdrawal Constraints to Optimal Value');
% xlabel('Constraint Relaxation Factor')
% hold on;
% loglog(2.^((1:50)-1),(2.^((1:50)-1)).^(1))
% ylabel('Optimal Value of Objective')
% legend({'f', 'O(x)'},'Location','southeast')