This file is indexed.

/usr/bin/tablix2_plot is in tablix2 0.3.5-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
#!/bin/bash

set -e

VERSION="0.3.5"

GNUPLOT="gnuplot"
IDID='$Id: tablix2_plot,v 1.8 2007-07-03 11:22:25 avian Exp $'

CMD=`basename $0`

cat >&2 <<END
TABLIX data plotter $VERSION, Copyright (C) 2002-2006 Tomaz Solc
$IDID

END

function syntax {
	cat <<END
Following plots are supported:

$CMD --conv-fitness [ --scale SCALE ] [ PREFIX ] ...

	Plot population convergence graph using convergence data in files
	"conv*.txt" in the current directory. One line is drawn for each 
	node. It shows the fitness of the best timetable versus generation 
	count. Use the PREFIX option, if you used the "-o" option with 
	Tablix. Use the SCALE option to adjust the vertical scale. You can 
	use more than one PREFIX option to plot multiple convergence graphs 
	in one window. 

$CMD --fit-fitness [ --scale SCALE ] [ PREFIX ] ...

	Same as "--conv-fitness", except that an exponential function is also 
	drawn on the graph using least squares fitting. This can be used to
	get a rough estimate of the time required to find a solution. The
	SCALE parameter is used to adjust the horizontal scale in this case.

$CMD --functions [ --scale SCALE ] CONVFILE

	Plot the return value of each fitness function versus generation 
	count. Return values of mandatory fitness functions are plotted
	with thicker lines. CONVFILE must be a file with Tablix population 
	convergence data (usually named "conv*.txt"). Use the SCALE option 
	to adjust the vertical scale.

Prepend "EPSOUTPUT" to print the graph to an encapsulated postscript file:

	EPSOUTPUT="example.eps" $CMD ...

Prepend "SVGOUTPUT" to print the graph to an scalable vector graphics file:

	SVGOUTPUT="example.svg" $CMD ...
END
}

function test_gnuplot {
	if ! which $GNUPLOT > /dev/null; then
		echo "gnuplot not found."
		exit 1
	fi
}

function set_output {
	if [ $EPSOUTPUT ]; then
		echo "set term postscript eps monochrome solid"
		echo "set output \"$EPSOUTPUT\""
	elif [ $SVGOUTPUT ]; then
		echo "set term svg"
		echo "set output \"$SVGOUTPUT\""
	fi
}

function fit_plot {
	CMDFILE=`mktemp _plot__XXXXXX`

	set_output >> $CMDFILE
	echo "set xlabel \"Generations\"" >> $CMDFILE
	echo "set ylabel \"Fitness\"" >> $CMDFILE
	echo "set grid" >> $CMDFILE

	B=1
	for C in $PREFIX; do
	        NAMES=${C}conv*.txt
	
	        L=-1
	        for A in $NAMES; do
        	        CUR=`tail -1 $A | awk '{ print $1 }'`
	
	                if [ $CUR -gt $L ]; then
	                        L=$CUR
	                        BEST=$A
	                fi
	        done

	        echo "f$B(x)=a$B*exp(b$B*x)+c$B" >> $CMDFILE
	        echo "a$B=40000" >> $CMDFILE
	        echo "b$B=-0.001" >> $CMDFILE
	        echo "c$B=1000" >> $CMDFILE
	        echo "fit f$B(x) \"$BEST\" via a$B, b$B, c$B" >> $CMDFILE
	        B=$(($B+1))
	done

	echo -n "plot [0:$SCALE] [0:] " >> $CMDFILE

	E=1
	B=0
	for C in $PREFIX; do
        	NAMES=${C}conv*.txt

	        if [ $B != 0 ]; then
        	        echo -n ", " >> $CMDFILE
	        fi

	        echo -n "f$E(x) title \"$C prediction\" with lines lt $E lw 2" >> $CMDFILE

		D="a"
	        for A in $NAMES; do
        	        echo -n ", \"$A\"" >> $CMDFILE

			if [ $D = "a" ]; then
				echo -n " title \"$C\"" >> $CMDFILE
			else
				echo -n " notitle" >> $CMDFILE
			fi

			echo -n " with lines lt $E" >> $CMDFILE
	                B=$(($B+1))
			D="b"
	        done
	        E=$(($E+1))
	done

	echo >> $CMDFILE
	echo "quit" >> $CMDFILE
	
	gnuplot -persist $CMDFILE 2> /dev/null

	rm $CMDFILE
}

function conv_plot {
	CMDFILE=`mktemp _plot__XXXXXX`

	set_output >> $CMDFILE
	echo "set xlabel \"Generations\"" >> $CMDFILE
	echo "set ylabel \"Fitness\"" >> $CMDFILE
	echo "set grid" >> $CMDFILE

	echo -n "plot [:] [0:$SCALE] " >> $CMDFILE

	E=1
	B=0
	for C in $PREFIX; do
	        NAMES=${C}conv*.txt
		D="a"

        	for NAME in $NAMES; do
	                if [ $B != 0 ]; then
	                        echo -n ", " >> $CMDFILE
	                fi

	                echo -n "\"$NAME\"" >> $CMDFILE

			if [ $D = "a" ]; then
				echo -n " title \"$C\"" >> $CMDFILE
			else
				echo -n " notitle" >> $CMDFILE
			fi
			
			echo -n " with lines lt $E" >> $CMDFILE

	                B=$(($B+1))
			D="b"
	        done
	        E=$(($E+1))
	done

	echo >> $CMDFILE
	echo quit >> $CMDFILE

	$GNUPLOT -persist $CMDFILE

	rm $CMDFILE
}

function module_plot {
	CMDFILE=`mktemp _plot__XXXXXX`

	set_output >> $CMDFILE
	echo "set xlabel \"Generations\"" >> $CMDFILE
	echo "set ylabel \"Number of errors\"" >> $CMDFILE
	echo "set grid" >> $CMDFILE
	echo -n "plot [:] [:$SCALE]" >> $CMDFILE

	C=0;
	for FITNESS in `grep '^#' $CONVFILE | head -n1 | sed 's/.*OK\t//' | sed 's/ /_/g'`; do
        	if [ $C -gt 0 ]; then
        		echo -n ", " >> $CMDFILE
        	fi

		FITNESS2=`echo $FITNESS | sed 's/_/ /g'`

        	echo -n "\"$CONVFILE\" using 1:$(($C+4))" >> $CMDFILE
		echo -n " title \"$FITNESS2\" with lines" >> $CMDFILE

		if echo $FITNESS | egrep '\(M\)' > /dev/null; then
			echo -n " lw 2" >> $CMDFILE
		fi

        	C=$(($C+1))
	done

	echo >> $CMDFILE
	echo quit >> $CMDFILE

	gnuplot -persist $CMDFILE

	rm $CMDFILE
}

if [ $# -lt 1 ]; then 
	syntax
	exit 1
fi

test_gnuplot

case "$1" in
	--fit-*|--conv-*)
		SCALE=""
		if [ $# -ge 3 ]; then
			if [ $2 = "--scale" ]; then
				SCALE=$3
			fi
		fi

		PREFIX=`echo $@ | sed 's/--[a-z]*-[a-z]*//;s/ *--scale [0-9]* *//'`
		
		if [ -z "$PREFIX" ]; then
			PREFIX="./"
		fi

		case "$1" in
			--fit-fitness)
				fit_plot
				;;
			--conv-fitness)
				conv_plot
				;;
			*)
				syntax
				exit 1
				;;
		esac
		;;
	--functions)
		SCALE=""
		if [ $# -eq 4 ]; then
			if [ $2 = "--scale" ]; then
				SCALE=$3
				CONVFILE=$4
			else
				syntax
				exit 1
			fi
		elif [ $# -eq 2 ]; then
			CONVFILE=$2
		else
			syntax
			exit 1
		fi

		module_plot
		;;
	*)
		syntax
		exit 1
esac