-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathplot_p_dec_v_gammaprime.m
More file actions
39 lines (33 loc) · 1.12 KB
/
plot_p_dec_v_gammaprime.m
File metadata and controls
39 lines (33 loc) · 1.12 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
function plot_p_dec_v_gammaprime(gp,numScen,pWorst)
% plot_p_dec_v_gammaprime plots the probability of a decrease in cost
% agains the value gammaprime output for LRLP-2.
lgp = length(gp);
lns = length(numScen);
N = sum(numScen);
pMLE = numScen/N;
pMLE = pMLE(:);
numAtoms = length(numScen);
prob_dec = zeros(size(gp));
% Nl stores the upper bound probabilty of decrease, sum(numscen with
% decrease)/numsamples
Nl = zeros(size(gp));
for ii=1:length(gp)
dec_cost = ( pMLE > (N+1)/N*pWorst(:,ii) )';
prob_dec(ii) = prob_dec_cost( numScen, dec_cost, gp(ii) );
Nl(ii) = sum(dec_cost.*numScen)/N;
end
plot( gp,prob_dec,'k.', 'MarkerSize',10)
hold on
% plot( gp,prob_dec_test,'ro')
% plot(gp,prob_dec_primal,'ro' )
plot(gp,Nl,'r--', 'LineWidth',2)
hold off
xlabel( '\gamma''', 'FontSize',16 )
ylabel( 'Probability of Cost Decrease', 'FontSize',16)
legend( 'Prob. of Cost Decrease', 'N_L/N' )
title( [ num2str(numAtoms) ' scenarios, ' num2str(N) ' samples'], ...
'FontSize',16)
% figure(2)
% plot( gp,gp_pworst,'bo', gp,gp,'k--' )
% xlabel( '\gamma''', 'FontSize',16 )
% ylabel( '\gamma'' of worst case distribution', 'FontSize',16 )