function obj= objmixed(Design,rho,kC,kn) p2=kC(1)+kn; % number of 2-level factors p3=kC(2)+kC(3); % number of 3-level factors N=2^p2*3^p3; p=p2+p3; n=size(Design,1); %U is the full model matrix %R is the full correlation matrix %points is all the candidates U2=[1,-1;1,1]; % the model matrix for qualitative 3-level factor U3=[1,-(1.5)^0.5,0.5^0.5; 1, 0, -2^0.5; 1, 1.5^0.5, 0.5^0.5]; % the model matrix for quantitative 3-level factor R2=[1,0; 0,(1-rho)/(1+rho)]; % correlation matrix for 3-level qualitative factor R31=[1, 0, 0; 0, (1-rho)/(1+2*rho), 0; 0, 0, (1-rho)/(1+2*rho)]; % correlation matrix for 3-level quantitative factor tempvalue=3+4*rho+2*rho^4; R32=[1, 0, -2^0.5*(rho-rho^4)/tempvalue; 0, 3*(1-rho^4)/tempvalue, 0; -2^0.5*(rho-rho^4)/tempvalue, 0, (rho^4-4*rho+3)/tempvalue]; D2=[-1,1]'; D3=[-1,0,1]'; tempU=1; tempR=1; points=[-1,1]'; for i=1:p2 tempU=kron(U2,tempU); tempR=kron(R2,tempR); end for i=2:p2 points=[kron([1,1]',points),kron(D2,ones(size(points,1),1))]; end for i=1:kC(2) tempU=kron(U3,tempU); tempR=kron(R31,tempR); points=[kron([1,1,1]',points),kron(D3,ones(size(points,1),1))]; end for i=1:kC(3) tempU=kron(U3,tempU); tempR=kron(R32,tempR); points=[kron([1,1,1]',points),kron(D3,ones(size(points,1),1))]; end U=tempU; R=tempR; %flag: indicates the number of control and noise factors in a term flag=1; wt=zeros(1,N); for i=1:kn flag=kron([1,2],flag); end for i=1:kC(1) flag=kron([1,1],flag); end for i=1:p3 flag=kron([1,1,1],flag); end wt(flag==2)=1; D=zeros(n,1); for l=1:n for i=1:N if sum(Design(l,:)==points(i,:))==p D(l)=i; end end end UD=U(D,:); fai=UD*R*UD'; V=R*UD'*inv(fai)*UD*R; obj=wt*diag(V)/(wt*diag(R));