Thursday, November 6, 2008

Infeasible initial point: reporting

This model parses a listing file and produces a sorted list of the infeasibilities of the initial point. Note that you need to set OPTION LIMROW to a large number for this to work.

No need to set LIMCOL: all variables are always feasible.


$ontext

If a calibration is not correct, the benchmark solve
with LIMROW set to a large number may produce many
infeasibilities. This script will produce a sorted
list of these infeasibilities so it is easy to find the
largest ones.

Erwin Kalvelagen, nov 2005
Updated, oct 2007

$offtext

$set LISTING china.lst
$set UNSORTED unsorted.txt
$set SORTED sorted.txt
$set SCRIPT infes.awk


$onecho > %SCRIPT%

/^Equation\ Listing/ {
eqlisting=1
}

/^.*\.\./ {
if (eqlisting==1) {
equation = $1
gsub(/\./,"",equation)
}
}

/INFES\ =\ [0-9A-Z.]*\ \*\*\*/ {
if (eqlisting==0) {
next
}

match($0,"(INFES = )([0-9A-Z.]*)",arr)
print equation " " arr[2]
print equation " " arr[2] >> "%UNSORTED%"
}


/^Model Statistics/ {
exit
}


$offecho

execute '=rm -f %UNSORTED%';
execute '=rm -f %SORTED%';
execute '=awk -f %SCRIPT% %LISTING%';
execute '=gsort -n -k 2 -r -o %SORTED% %UNSORTED%';
execute 'echo inspect %SORTED%';