%%%%%% Testing different tank sizes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This program runs main.m with different volumes and modes, then stores 
% the resulting minimum temperature-violation and cost in a .mat-file.
%  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

bo = 0;                                                        % back-off
vlist = [800,400,250,200,150,100,60]';           % Volumes to be compared
modes = [1,2,3];                                   % Cases to be compared
Tresult = zeros(length(vlist),max(modes));          % empty result matrix
Jresult = zeros(length(vlist),max(modes));
for i=1:length(vlist)              % run main.m for all volumes and modes
    for j=modes
        [Tresult(i,j),Jresult(i,j)] = main(j,vlist(i),1,[],bo);
    end
end

%% naming the saved file
if bo >0
    addon = ['_BO',num2str(bo)];
else
    addon = '';
end;
temp = num2str(modes);                             % turn modes into list
name = ['_TJ_data_V',num2str(min(vlist)),'-', num2str(max(vlist)), ...
        '_m',temp(1:3:end),addon]; 
save(name,'Tresult','Jresult','vlist')        % save restult to .mat file