clear all
close all
clc

%% Load
addpath('../Exogenous_information')
load('sample_path.mat')
plot_settings

%% Simple policy

%parameter array
low_price = linspace(0,300,11)
plus_price = linspace(10,100,10)

%Computation of expected total cost 
for i = 1:size(low_price,2)
for k = 1:size(plus_price,2)
P_low = low_price(i);
P_plus = plus_price(k);
P_high = P_low + P_plus;
Avg_Cost(i,k) = PFA_a_cost(S0,sample_path,P_high,P_low);
end
end
%% Policy search
mini = min(min(Avg_Cost)) %minimum expected total cost
[x,y]=find(Avg_Cost==mini);
plus = plus_price(y);
low = low_price(x); % theta low
high = low + plus;  % theta high

%% Ploting
Font = 30;

plot_settings
figure()
surf(plus_price,low_price,Avg_Cost);
hold on
plot3(plus_price(y),low_price(x),min(min(Avg_Cost)),'-o','Color','r','MarkerSize',20,'MarkerFaceColor','r')

xlabel('$\theta^{plus}$','FontSize',Font)
ylabel('$\theta^{low}$','FontSize',Font)
zlabel('Expected Cost[NOK]','FontSize',Font)
set(gca,'FontSize',Font)
