function[Phi_best,w_best]=Example2(B,t_max)
%Example 2 in the manuscript Harman, Bachrata, Filova: Heuristic construction of exact experimental designs under multiple resource constraints
%Quadratic model with simultaneous marginal and cost constraints
%input: 
%B: maximum possible cost of the experiment
%t_max: the length of time (in seconds) the heuristic is required to run
%output:
%Phi_best: the D-value of the design w_best
%w_best: D-efficient exact design found by the heuristic

%generate the matrix of regressors
F=zeros(6,54);
F(1,:)=ones(1,54);

F(4,1:3)=94.9;

for i=1:17
    for j=1:3
        F(4,3*i+j)=95.0+0.1*i;
    end;    
end;

F(4,:)=(F(4,:)-95.8)./0.9;

    
for i=1:18
   F(5,3*i-2)=-1;
   F(5,3*i)=1;
end  

F(2,:)=F(4,:).^2;
F(3,:)=F(5,:).^2;
F(6,:)=F(4,:).*F(5,:);

%generate the constraints
A=zeros(19,54);
for i=1:18
    for j=1:3
        A(i,3*i-j+1)=1;
    end;
    A(19,3*i-1)=10;
    A(19,3*i)=20; 
end;    

b=[1 3 14 59 52 29 25 32 36 29 36 38 12 10 8 2 3 3 B]';

%run the optimization

[Phi_best,w_best]=Hugo(F,A,b,zeros(54,1),-1,t_max);

end
