% This is the main file to solve Self Optimizing Control Problems
% to find optimal measurement subsets using indicator constraint method 

% load EvaporatorData.mat; % To load the data for evaporator case study

load OriginalData.mat; % To load the data for a binary distillation column case study

% load DiffExample.mat;% To load the data for the toy problem

[ny,nu]=size(Gy)
bigHBD = [];

for i = 2 %:41
    i
    [H,loss,HGy,nmes,ct]= miqpex_HFull_indicator(Gy,Gdy,Juu,Jud,Wd,Wn,i)
     sset2{i,1}=nonzeros(nmes)';
    LF2(i-1) = loss;
    ctF2(i-1) = ct;
    H(:,int16(nmes));
    nmes'
end

no = 2:i;


figure(10)
plot(no,LF2,'b-*');
xlabel('No. of measurements');
ylabel('Loss');

% nc = 0;
% for zz = nu:ny
%     nc =  nchoosek(ny,zz);
%     ctes(zz) = nc*0.01; % We assume that loss calculation takes 0.01 sec for each alternative
% end


