File: run_optimize_test

package info (click to toggle)
frobby 0.9.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 11,616 kB
  • sloc: cpp: 30,134; sh: 1,184; makefile: 306; ansic: 102; lisp: 10
file content (125 lines) | stat: -rwxr-xr-x 4,235 bytes parent folder | download | duplicates (6)
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
#!/bin/bash

testHelper=../testScripts/testhelper
frobby=../../bin/frobby
test="$1"
shift

if [ -e "$test.optVector" ];
then
  inputFile="$test.test $test.optVector"
else
  inputFile="$test.test"
fi

if [ "$1" = "_full" ]; then
  shift;

  tmpFile="/tmp/frobby_optTmp"
  # Check that -canon agrees with transform. Transform does not understand
  # the value at the end, so generate a file without that.
  $frobby optimize < "$inputFile" > $tmpFile 2> /dev/null \
    -canon -displayLevel 2 -displayValue off
  $testHelper transform $tmpFile $tmpFile -canon
  if [ $? != 0 ]; then exit 1; fi
  rm -f $tmpFile

  # And again with -maxStandard.
  $frobby optimize < "$inputFile" > $tmpFile 2> /dev/null \
    -canon -displayLevel 2 -displayValue off -maxStandard
  $testHelper transform $tmpFile $tmpFile -canon
  if [ $? != 0 ]; then exit 1; fi
  rm -f $tmpFile

  # and again for minimizing.
  $frobby optimize < "$inputFile" > $tmpFile 2> /dev/null \
    -canon -displayLevel 2 -displayValue off -minValue
  $testHelper transform $tmpFile $tmpFile -canon
  if [ $? != 0 ]; then exit 1; fi
  rm -f $tmpFile

  # And again for minimizing with -maxStandard.
  $frobby optimize < "$inputFile" > $tmpFile 2> /dev/null \
    -canon -displayLevel 2 -displayValue off -maxStandard -minValue
  $testHelper transform $tmpFile $tmpFile -canon
  if [ $? != 0 ]; then exit 1; fi
  rm -f $tmpFile

  # ****************************************************************
  # Check that the right value is found even when only looking for a
  # single optimal vector. This is relevant since it allows more
  # aggresive use of the bound.

  # maximize, irreducible
  tail -n 1 < $test.opt_irr > $tmpFile # pick out value at end
  $testHelper optimize "$inputFile" $tmpFile -displayLevel 0 -displayValue \
	  $* -maxStandard off -minValue off
  if [ $? != 0 ]; then exit 1; fi
  rm -f $tmpFile

  # maximize, msm
  tail -n 1 < $test.opt_std > $tmpFile # pick out value at end
  $testHelper optimize "$inputFile" $tmpFile -displayLevel 0 -displayValue \
	  $* -maxStandard on -minValue off
  if [ $? != 0 ]; then exit 1; fi
  rm -f $tmpFile

  # minimize, irreducible
  tail -n 1 < $test.opt_irr_min > $tmpFile # pick out value at end
  $testHelper optimize "$inputFile" $tmpFile -displayLevel 0 -displayValue \
	  $* -maxStandard off -minValue
  if [ $? != 0 ]; then exit 1; fi
  rm -f $tmpFile

  # minimize, msm
  tail -n 1 < $test.opt_std_min > $tmpFile # pick out value at end
  $testHelper optimize "$inputFile" $tmpFile -displayLevel 0 -displayValue \
	  $* -maxStandard on -minValue
  if [ $? != 0 ]; then exit 1; fi
  rm -f $tmpFile

  # ****************************************************************
  # Solve the problems without using the bound, thus increasing
  # confidence that a bug in the bound code is not causing
  # miscalculation of the value or solutions.

  # maximize, irreducible
  $testHelper optimize "$inputFile" $test.opt_irr \
	  $* -canon -displayLevel 2 -bound off
  if [ $? != 0 ]; then exit 1; fi

  # maximize, msm
  $testHelper optimize "$inputFile" $test.opt_std \
	  $* -canon -displayLevel 2 -maxStandard -bound off
  if [ $? != 0 ]; then exit 1; fi

  # minimize, irreducible
  $testHelper optimize "$inputFile" $test.opt_irr_min \
	  $* -canon -displayLevel 2 -bound off -minValue
  if [ $? != 0 ]; then exit 1; fi

  # minimize, msm
  $testHelper optimize "$inputFile" $test.opt_std_min \
	  $* -canon -displayLevel 2 -maxStandard -bound off -minValue
  if [ $? != 0 ]; then exit 1; fi
fi

# Solve the maximize irreducible decomposition program.
$testHelper optimize "$inputFile" $test.opt_irr \
  $* -canon -displayLevel 2
if [ $? != 0 ]; then exit 1; fi

# Solve the maximize maximal standard monomial program.
$testHelper optimize "$inputFile" $test.opt_std \
  $* -canon -displayLevel 2 -maxStandard
if [ $? != 0 ]; then exit 1; fi

# Solve the minimize irreducible decomposition program.
$testHelper optimize "$inputFile" $test.opt_irr_min \
  $* -canon -displayLevel 2 -minValue
if [ $? != 0 ]; then exit 1; fi

# Solve the minimize maximal standard monomial program.
$testHelper optimize "$inputFile" $test.opt_std_min \
  $* -canon -displayLevel 2 -maxStandard -minValue
if [ $? != 0 ]; then exit 1; fi