1 c===========================================================================
3 c This file is part of TISEAN
5 c Copyright (c) 1998-2007 Rainer Hegger, Holger Kantz, Thomas Schreiber
7 c TISEAN is free software; you can redistribute it and/or modify
8 c it under the terms of the GNU General Public License as published by
9 c the Free Software Foundation; either version 2 of the License, or
10 c (at your option) any later version.
12 c TISEAN is distributed in the hope that it will be useful,
13 c but WITHOUT ANY WARRANTY; without even the implied warranty of
14 c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 c GNU General Public License for more details.
17 c You should have received a copy of the GNU General Public License
18 c along with TISEAN; if not, write to the Free Software
19 c Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 c===========================================================================
22 c part of the TISEAN randomize package for constraint surrogates
23 c permutation scheme that swaps to randomly chosen data points
24 c this may also be used as a template for your own attempts
25 c author T. Schreiber (1999)
27 c-------------------------------------------------------------------
28 c get permutation specific options
30 subroutine opts_permute()
34 common /permutecom/ mxclu, nxclu
36 call stcan('X',filex,' ')
38 if(filex.eq." ") return
39 open(10,file=filex,status="old",err=999)
40 1 read(10,*,err=999,end=998) nn
45 999 write(istderr(),'(a)') "permute: cannot open "//filex
49 c-------------------------------------------------------------------
50 c print version information on permutation scheme
52 subroutine what_permute()
53 call ptext("Permutation scheme: random pairs")
56 c-------------------------------------------------------------------
57 c print permutation specific usage message
59 subroutine usage_permute()
60 call ptext("Permutation options: [-X xfile]")
61 call popt("X", "list of indices excluded from permutation")
64 c-------------------------------------------------------------------
65 c initialise all that is needed for permutation scheme
67 subroutine permute_init()
70 common nmax,cost,temp,cmin,rate,x
72 if(nmax.gt.nx) stop "permute: make nx larger."
78 c-------------------------------------------------------------------
79 c find two indices n1, n2 to be exchanged, maybe using a parameter
80 c par provided by the cooling schedule
82 subroutine permute(n1,n2)
85 common /permutecom/ mxclu, nxclu
89 1 n1=min(int(rand(0.0)*nmax)+1,nmax)
91 10 if(n1.eq.nxclu(n)) goto 1
92 2 n2=min(int(rand(0.0)*nmax)+1,nmax)
95 20 if(n2.eq.nxclu(n)) goto 2
98 c-------------------------------------------------------------------
99 c given two indices n1, n2, actually perform the exchange
101 subroutine exch(n1,n2)
104 common nmax,cost,temp,cmin,rate,x