program generate c c Generate predefined data sets. c implicit integer(a-z) include 'character.h' character*1 xclass,xset real perturbation(4) include 'seeds.h' data perturbation/0.02,0.1,0.25,0.5/ if(iargc().eq.1)then call getarg(1,filename) include 'read.h' sizer=searchnum(n,size,maxprob) class=searchlet(xclass,13) set=searchlet(xset,9) if(sizer.eq.0.or.class.eq.0.or.set.eq.0)then go to 2 else seed=seeds(sizer,class,set) c print '(1x,a,2x,i20)',filename,seed open(1,file=filename,status='unknown') include 'writen.h' if(class.eq.1)then class a - random do i=1,n do j=1,n if(i.ne.j)then row(j)=uniform(1,1000,seed) else row(j)=infinity endif enddo write(1,200)(row(j),j=1,n) enddo else top=int(1000.*perturbation((class+1)/3)+0.5) if(mod(class,3).eq.2)then class b - almost symmetric random do i=1,n do j=i,n if(i.ne.j)then a(i,j)=uniform(1,1000,seed) a(j,i)=a(i,j) else a(i,i)=infinity endif enddo enddo do i=1,n do j=1,n if(i.ne.j)then row(j)=a(i,j)+uniform(1,top,seed) else row(j)=infinity endif enddo write(1,200)(row(j),j=1,n) enddo elseif(mod(class,3).eq.0)then class c - almost euclidean random do i=1,n x(i)=uniform(0,1000,seed) y(i)=uniform(0,1000,seed) enddo call euclidean(infinity,n,x,y,row,top,seed) elseif(mod(class,3).eq.1)then class d - almost euclidean clustered random point=0 do i=1,5 cenx=uniform(0,1000,seed) ceny=uniform(0,1000,seed) do j=1,n/5 point=point+1 x(point)=uniform(cenx-71,cenx+71,seed) y(point)=uniform(ceny-71,ceny+71,seed) enddo enddo call euclidean(infinity,n,x,y,row,top,seed) endif endif close(1) endif go to 1 endif 2 call error(size,maxprob) 1 call exit(0) include 'format.h' end subroutine euclidean(infinity,n,x,y,row,top,seed) implicit integer(a-z) integer x(*),y(*),row(*) do i=1,n do j=1,n if(i.ne.j)then row(j)=int(sqrt(float((x(i)-x(j))**2+(y(i)-y(j))**2)))+ * uniform(1,top,seed) else row(j)=infinity endif enddo write(1,200)(row(j),j=1,n) enddo include 'format.h' end subroutine error(size,maxprob) implicit integer (a-z) character*27 format integer size(*) include 'data.h' write(format(6:7),'(i2)')maxprob-1 print 1 print format,(size(i),i=1,maxprob) print 2 return 1 format( *'*** ERROR: ONE argument of the form xxx.yz is required, where:'// *'xxx: Problem SIZE. Must be in the set ',$) 2 format( *'y: Problem CLASS. Must be in the set', *' {a,b,c,d,e,f,g,h,i,j,k,l,m}'/ *'z: Problem INSTANCE. Must be in the set', *' {a,b,c,d,e,f,g,h,i}'// *'The problem classes are:'/ *'a: RND - Random'/ *'b: S02 - Symmetric: 02% perturbation'/ *'c: E02 - Euclidean: 02% perturbation'/ *'d: C02 - Euclidean Clustered: 02% perturbation'/ *'e: S10 - Symmetric: 10% perturbation'/ *'f: E10 - Euclidean: 10% perturbation'/ *'g: C10 - Euclidean Clustered: 10% perturbation'/ *'h: S25 - Symmetric: 25% perturbation'/ *'i: E25 - Euclidean: 25% perturbation'/ *'j: C25 - Euclidean Clustered: 25% perturbation'/ *'k: S50 - Symmetric: 50% perturbation'/ *'l: E50 - Euclidean: 50% perturbation'/ *'m: C50 - Euclidean Clustered: 50% perturbation') end