%% comparison of speed up for simplify methods for MPC
clear;clc;
close all;
%EXAMPE
% load mo'del reduction'\MRWCE_E1;
% load chan'ging prediction horizon'\PHWCE_E1;
% load move' blocking'\MBWCE_E1;

% load mo'del reduction'\MRWCE_E2;
% load chan'ging prediction horizon'\PHWCE_E2;
% load move' blocking'\MBWCE_E2;

load mo'del reduction'\MRWCE_E3;
load chan'ging prediction horizon'\PHWCE_E3;
load move' blocking'\MBWCE_E3;

% speedup = (8^3*(16+2)^3)/(8^3*(16+2)^3);

%% plots

% plot1
figure;
G = cell(5,1);
G{1,1} = 'b';
G{2,1} = 'g';
G{3,1} = 'r';
G{4,1} = 'c';
G{5,1} = 'k';
x = 1:4;
objvalsum = {MRobjvalsum,Pobjvalsum,IBobjvalsum,DIBobjvalsum};
set(gca,'XLim',[0.5 4.5]); % rozsah pre ktory to chces robit
set(gca,'XTick',[1:4]);
axe = ['MR ';'CPH';'IB ';'DIB'];
set(gca,'XTickLabel',axe);

    for i = 1:length(x)
     
        hold on;
        bar(x(i),objvalsum{i}, G{i,1});
        xlabel('Simplify methods for MPC');
        ylabel('worst-case error (outputs)');
        legend('Model reduction','Changing prediction horizon','Input blocking','Delta input blocking');
        grid on;
    end

% plot2
figure;
G = cell(5,1);
G{1,1} = 'b';
G{2,1} = 'r';
G{3,1} = 'c';
G{4,1} = 'g';
G{5,1} = 'k';
x = 1:3;
objvalsum = {MRobjvalsum,IBobjvalsum,DIBobjvalsum};
set(gca,'XLim',[0.5 3.5]); % rozsah pre ktory to chces robit
set(gca,'XTick',[1:3]);
axe = ['MR ';'IB ';'DIB'];
set(gca,'XTickLabel',axe);



    for i = 1:length(x)
     
        hold on;
        bar(x(i),objvalsum{i}, G{i,1});
        xlabel('Simplify methods for MPC');
        ylabel('worst-case error (outputs)');
        legend('Model ruduction','Input blocking','Delta input blocking');
        grid on;
    end

