Overview
Comment:Does not now attempt optimisation if matrix has zero length.
Declaration of matrix size is left to def.r.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | origin/global-optimisation | trunk
Files: files | file ages | folders
SHA3-256: a3d8883875f903b720583e8d6e1f7304edcb11f90619fb932af228bf9ed12d5b
User & Date: geraint@users.sourceforge.net on 2002-09-05 11:47:09.000
Other Links: branch diff | manifest | tags
Context
2002-09-10
22:09:14
Fixed presentation of globally optimised equations (ode view). check-in: 9b1fb2c9a9 user: geraint@users.sourceforge.net tags: origin/global-optimisation, trunk
2002-09-05
11:47:09
Does not now attempt optimisation if matrix has zero length.
Declaration of matrix size is left to def.r.
check-in: a3d8883875 user: geraint@users.sourceforge.net tags: origin/global-optimisation, trunk
2002-09-04
10:44:59
Added option to specify number of tmp variables declared (-ntmpvar <N>). check-in: 534206b77a user: geraint@users.sourceforge.net tags: origin/global-optimisation, trunk
Changes
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
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$"
    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"$
off nat;
in "${system}_def.r";
matrix mtt$matrix($nmatrix,1)$
in "$outfile"$
load scope$
out "$tmpfile"$
$command
shut "$tmpfile"$
$end$
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

MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]