
clc;  clear;  close
load ("data/Parameters.mat",'m');

II = 21;
dis1 = 0.05;
beta_ini = 0; 

JJ = 3;
dis2 = 0.5;
B_ini = 0.5;

%% The equilibrium
% Case 1: competition + prohibit
m.DataPolicy = 'prohibit';  % prohibit free
m.MarketStruct = 'competition';  % competition oligopoly monopoly 
m.Privacy = 'nonePrivacy';  % nonePrivacy privacyExternality

for j = 1:JJ
    for i = 1:II
        m.beta_c = beta_ini + dis1*(i-1);
        m.beta_u = m.beta_c; 
        m.B_c = B_ini + dis2*(j-1);
        m.B_u = 1;
    
        [wel1,Case11] = func_eqm_iter(m);
        Case1.wel_c(i,j) = Case11.wel_c;
        Case1.wel_u(i,j) = Case11.wel_u;
    end
end


% Case 2: competition + free
m.DataPolicy = 'free';  % prohibit free
m.MarketStruct = 'competition';  % competition oligopoly monopoly 
m.Privacy = 'nonePrivacy';  % nonePrivacy privacyExternality

for j = 1:JJ
    for i = 1:II
        m.beta_c = beta_ini + dis1*(i-1);
        m.beta_u = m.beta_c; 
        m.B_c = B_ini + dis2*(j-1);
        m.B_u = 1;
    
        [wel2,Case22] = func_eqm_iter(m);
        Case2.wel_c(i,j) = Case22.wel_c;
        Case2.wel_u(i,j) = Case22.wel_u;
    end
end

beta = beta_ini:dis1:beta_ini + dis1*(i-1);
beta = beta';
B = B_ini:dis2:B_ini+ dis2*(j-1);
B = B';
save ("data\Tech.mat", "Case1", "Case2","beta","B","m")

