-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdraw_decision_landscape.m
89 lines (86 loc) · 2.92 KB
/
draw_decision_landscape.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
%% DRAW_DECISION_LANDSCAPE - draw decision landscape
% Description:
% Draw solution landcape according to Theorems III.1 and III.2 in [1].
% Outputs: none
% Assumptions and limitations:
% - k_ref = 0
% Other m-files required:
% - gamma_n_arcs_individual.m
% MAT-files required:
% - network.mat (generated with generate_network.m)
% - prices.mat (computed with n_arcs_pricing.mat)
% Toolboxes required: none
% Authors: Leonardo Pedroso, W.P.M.H. (Maurice) Heemels, Mauro Salazar
% Revision history:
% 05/02/2024 - Leonardo Pedroso
% * Added final publication reference to [1]
% 13/03/2023 - Leonardo Pedroso
% * Initial implementation
% References:
% [1] L. Pedroso, W.P.M.H. Heemels and M. Salazar, "Urgency-Aware Routing
% in Single Origin-Destination Itineraries Through Artificial
% Currencies," 2023 62nd IEEE Conference on Decision and Control (CDC),
% Singapore, Singapore, 2023, pp. 4142-4149,
% doi: 10.1109/CDC49753.2023.10383739.
%% Initialization
clear;
% Load illustrative network
load('network.mat','n','M','s_min','s_bar','s_max','P_home','P_go','T',...
'alpha','beta','d0','kappa','d','c0','c','x_star','d_star');
% Load prices
load ('prices.mat','p');
%% Draw solution to individual users' problem
% Assumption k_ref = 0
k_ref = 0;
% Range of k
k = (-p(1):.1:k_ij(1,1,k_ref,p,T)+p(1))';
% Compute gamma_j, j = 1,...,n with gamma_n_arcs_individual
gamma = gamma_n_arcs_individual(d_star,T,p,k,k_ref,s_min,s_bar,s_max);
% Decision Evolution
figure('Position',4*[0 0 192 144]);
hold on;
grid on;
box on;
set(gca,'FontSize',20);
set(gca, 'Layer', 'top');
set(gca,'TickLabelInterpreter','latex')
k_inf = max([0,k_ij(n,n,k_ref,p,T)]);
feasible_mask = k >= k_inf;
unfeasible_mask = k <= k_inf;
for j = 1:n
if j == 1
% Decision 1
aux_x = k(feasible_mask);
aux_y = (s_max/s_bar)*ones(size(k(feasible_mask),1),1);
area(aux_x,aux_y,'LineWidth',2);
else
% Decision 2-n
aux_x = k(feasible_mask);
aux_y = gamma(j-1,feasible_mask);
area(aux_x,aux_y,'LineWidth',2);
end
end
% Unfeasible
aux_x = k(unfeasible_mask);
aux_y = (s_max/s_bar)*ones(size(k(unfeasible_mask),1),1);
area(aux_x,aux_y,'LineWidth',2,'FaceColor',[0 0 0],'FaceAlpha',0.3);
% Lines for a pretty plot
plot(k_inf*ones(2,1),[(s_min/s_bar);(s_max/s_bar)],'LineWidth',2,...
'Color','black')
legend({' Arc 1',' Arc 2',' Arc 3',' Arc 4',' Arc 5',' Unfeasible',},...
'Interpreter','latex','Location','northeast');
ylabel('$s/\bar{s}$','Interpreter','latex');
xlabel('$k$','Interpreter','latex');
xlim([k(1) k(end)]);
ylim([(s_min/s_bar) (s_max/s_bar)]);
hold off;
% Save figure to .fig and .eps formats
savefig('./fig/decision_landscape.fig')
set(gcf,'renderer','Painters')
saveas(gca,'./fig/decision_landscape.eps','epsc');
clear;
%% Auxiliary functions
% Karma thresholds for unitary decisions, i.e., [y_bar]_j = 1 for some j
function k_ij = k_ij(i,j,k_ref,p,T)
k_ij = k_ref+p(i)+T*p(j);
end