Overview
Comment:Trying to get optimisation to work with maxima.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | origin/optimise-algebraic-equations | trunk
Files: files | file ages | folders
SHA3-256: 2eee9281c76a94bed87a7219980a5e410c044ed0d31731c6b94bb13f12aa1097
User & Date: geraint@users.sourceforge.net on 2002-06-18 16:56:51.000
Other Links: branch diff | manifest | tags
Context
2002-06-21
13:30:59
Reformat input line for rates and outputs as well as algebraic equations. check-in: 0dbaa74d0a user: geraint@users.sourceforge.net tags: origin/optimise-algebraic-equations, trunk
2002-06-18
16:56:51
Trying to get optimisation to work with maxima. check-in: 2eee9281c7 user: geraint@users.sourceforge.net tags: origin/optimise-algebraic-equations, trunk
2002-06-06
17:10:25
Added a couple more simplification rules for pow. check-in: f3c3283818 user: geraint@users.sourceforge.net tags: origin/optimise-algebraic-equations, trunk
Changes
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
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



+



-
-
-
-
-





+
-
-
+
+









-
-
+
+




-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+



#! /bin/sh

set -e
set -x

filename="$1"

# get expression to optimise

lhs=`cat ${filename} | gawk '{ print $1 }'`
rhs=`cat ${filename} | gawk '{ print $2 }'`

# set work file names

tmp="$0.tmp"
log="$0.log"

optimise_with_reduce ()

cat <<EOF | reduce > $log
{
    cat <<EOF | reduce > $log
off echo$
load scope$
on double$
on noconvert$
on rounded$
off int$
off nat$

out "${tmp}"$
optimize mtt_tmp0 :=: ${rhs} iname mtt_tmp$
write "${lhs} := mtt_tmp0"$
optimize mtt_tmp0 :=: `cat ${filename} | gawk '{ print $2 }'` iname mtt_tmp$
write "`cat ${filename} | gawk '{ print $1 }'` := mtt_tmp0"$
shut "${tmp}"$

;end;
EOF

}

optimise_with_maxima ()
{
    cat ${filename}					|\
	tr "\t\n" "  "					|\
	sed -e 's/\ //g'				|\
	sed -e 's/\(MTTYz([0-9.]*,[0-9.]*)\)/\1 /'     	|\
	sed -e 's/[A-Za-z0-9_.:()]*(D2)\(.*\)/\1/'	|\
	sed -e 's/\([A-Za-z0-9_.:()]*\)(C3)/\1/g'	|\
	optimise_max2r.awk				|\
	tr "A-Z" "a-z"					> ${tmp}
}


optimise_with_maxima
#cat $filename
mv ${tmp} ${filename}

exit 0

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