function [r,n,min,xx1,yy1,xx2,yy2,app] = checkminNB4(a1,b1,a2,b2,a3,b3,a4,b4,a5,b5,s,ep1,area,count,st,ix1,iy1,ix2,iy2,iap) % checkminNB4 is a function to check the main inequality % Input % a1 and b1 are a lower bound and an upper bound of x1 % a2 and b2 are a lower bound and an upper bound of y1 % a3 and b3 are a lower bound and an upper bound of x2 % a4 and b4 are a lower bound and an upper bound of y2 % a5 and b5 are a lower bound and an upper bound of alpha % s is the bound which we want to prove % ep1 is tolerant % area is a initial area of box (0) % count is a initial times which satisfies the main inequality (0) % st, ix1, iy1, ix2, iy2 and iap are the initial guess of smallest area, % x1,y1,x2,y2 and alpha, respectively. %Output % r is a total area of box % n is the number of times which satisfies the main inequality % min, xx1, yy1, xx2, yy2 and aap are the smallest area, % x1,y1,x2,y2 and alpha, respectively. % define the box's point x1=(a1+b1)/2; y1=(a2+b2)/2; x2=(a3+b3)/2; y2=(a4+b4)/2; alpha=(a5+b5)/2; xx1=ix1; yy1=iy1; xx2=ix2; yy2=iy2; app=iap; min=st; % d_i is the length of the i box d1=(b1-a1)/2; d2=(b2-a2)/2; d3=(b3-a3)/2; d4=(b4-a4)/2; d5=(b5-a5)/2; n=count; r=area; [d,di]=max([d1 d2 d3 d4 d5]); % find the max d_i and index % the constants C1=0.212; C2=0.322; C3=0.326; C4=0.398; C5=0.134; % check the tolerant if d< ep1 disp('error'); r=-1; end if cvh(x1,y1,x2,y2,alpha) - C1*d1 - C2*d2 - C3*d3 - C4*d4 - C5*d5 > s r=r+32*d1*d2*d3*d4*d5; % find total area of box n=n+1; return; else if cvh(x1,y1,x2,y2,alpha)< min % find the smallest area min=cvh(x1,y1,x2,y2,alpha); xx1=x1; yy1=y1; xx2=x2; yy2=y2; app=alpha; end % create a new box which has a maximum length switch di case 1 % d1 is a max for i=0:1 if r>=0 [r,n,min,xx1,yy1,xx2,yy2,app] = checkminNB4(a1+d1 * i, a1+d1*(i+1),a2, b2,a3,b3, a4, b4,a5, b5,s,ep1,r,n,min,xx1,yy1,xx2,yy2,app); end end case 2 % d2 is a max for j=0:1 if r>=0 [r,n,min,xx1,yy1,xx2,yy2,app] = checkminNB4(a1, b1, a2+d2*j, a2+d2*(j+1),a3, b3, a4, b4,a5, b5,s,ep1,r,n,min,xx1,yy1,xx2,yy2,app); end end case 3 % d3 is a max for k=0:1 if r>=0 [r,n,min,xx1,yy1,xx2,yy2,app] = checkminNB4(a1, b1, a2, b2, a3+d3*k,a3+d3*(k+1), a4, b4,a5, b5,s,ep1,r,n,min,xx1,yy1,xx2,yy2,app); end end case 4 % d4 is a max for l=0:1 if r>=0 [r,n,min,xx1,yy1,xx2,yy2,app] = checkminNB4(a1, b1, a2, b2, a3, b3,a4+d4*l, a4 + d4*(l+1),a5, b5,s,ep1,r,n,min,xx1,yy1,xx2,yy2,app); end end case 5 % d5 is a max for m=0:1 if r>=0 [r,n,min,xx1,yy1,xx2,yy2,app] = checkminNB4(a1, b1, a2, b2, a3, b3,a4, b4,a5+d5*m, a5+d5*(m+1),s,ep1,r,n,min,xx1,yy1,xx2,yy2,app); end end otherwise error('Unknown method.'); end % print the results for every 1000000 steps if rem(n,1000000)==0 disp([num2str ((100*r)/0.00036801) ' %' ' count =' num2str(n)]); end end end