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
|
nmatrix=`mtt_getsize $system y` ;;
*)
exit $E_REP_NOT_SUPPORTED;;
esac
# Generate a command of the form
# optimise mtt?(1,1) :=: mtt?(1,1), mtt?(2,1) :=: mtt?(2,1), ..., INAME mtt_tmp$
command="optimize"
counter=1
while [ $counter -le $nmatrix ]; do
command="$command mtt$matrix($counter,1) :=: mtt$matrix($counter,1),"
counter=`expr $counter + 1`
done
command="$command INAME mtt_tmp$"
logfile=${system}_${representation}_global_optimisation.log
tmpfile=${system}_${representation}_global_optimisation.tmp
outfile=${system}_${representation}.r
if [ ! -f $outfile ]; then
exit $E_FILE_NOT_EXIST
fi
# Use Reduce to perform the optimisation
${SYMBOLIC:-reduce} <<EOF > $logfile 2>&1
off nat$
in "${system}_def.r"$
matrix mtt$matrix($nmatrix,1)$
in "$outfile"$
load scope$
out "$tmpfile"$
$command
shut "$tmpfile"$
$end$
EOF
cp $outfile $outfile.unoptimised
cp $tmpfile $outfile.tmp
cat $tmpfile | mtt_fix_integers > $outfile
#cp $tmpfile $outfile
echo ";end;" >> $outfile
|
>
|
|
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
|
|
<
|
|
|
|
|
|
|
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
|
nmatrix=`mtt_getsize $system y` ;;
*)
exit $E_REP_NOT_SUPPORTED;;
esac
# Generate a command of the form
# optimise mtt?(1,1) :=: mtt?(1,1), mtt?(2,1) :=: mtt?(2,1), ..., INAME mtt_tmp$
if [ $nmatrix -gt 0 ]; then
command="optimize"
counter=1
while [ $counter -le $nmatrix ]; do
command="$command mtt$matrix($counter,1) :=: mtt$matrix($counter,1),"
counter=`expr $counter + 1`
done
command="$command INAME mtt_tmp"
else
command=""
fi
# Generate matrix declaration
if [ $nmatrix -gt 0 ]; then
matrix_declaration="matrix mtt$matrix($nmatrix,1)"
else
matrix_declaration="matrix mtt$matrix"
fi
logfile=${system}_${representation}_global_optimisation.log
tmpfile=${system}_${representation}_global_optimisation.tmp
outfile=${system}_${representation}.r
if [ ! -f $outfile ]; then
exit $E_FILE_NOT_EXIST
fi
# Use Reduce to perform the optimisation
${SYMBOLIC:-reduce} <<EOF > $logfile 2>&1
off nat;
in "${system}_def.r";
in "$outfile";
load scope;
out "$tmpfile";
$command;
shut "$tmpfile";
$end;
EOF
cp $outfile $outfile.unoptimised
cp $tmpfile $outfile.tmp
cat $tmpfile | mtt_fix_integers > $outfile
#cp $tmpfile $outfile
echo ";end;" >> $outfile
|