#!/bin/csh
# runmps
# If necessary, make this file executable via chmod +x runmps.
# Note that file names of the form fort.* may be machine-dependent.
#
# 30 May 1991: Original version written by Philip Gill for a DECstation 3100.
#              DECstation and Sun systems use names like fort.4.
# 15 Dec 1995: HP 9000 systems use names like ftn04.
# 23 Jul 2003: Executables no longer have .exe suffix.
# 12 Feb 2014: runmps created from minos551/test/run
# 28 Apr 2014: runmps revised for quadLP.


 set TOP = ..   # ROOT OF THE QUADLP INSTALLATION
 
 if ( $# < 3 ) then
    echo "  Script for running minos on an MPS file in $TOP/data/MPS"
    echo "./runmps  minos pilot4 lp1   runs  minos with pilot4.mps, lp1.spc"
    exit
 endif

 set SOLVER = $1
 set PROB   = $2
 set SPECS  = $3
 set MPS    = $TOP/data/MPS/$PROB

 if (! -e $MPS.mps) then
    echo Error: $MPS.mps  not found
    exit
 endif

 \cp -p   $SPECS.spc   fort.4
 \cp -p   $MPS.mps     fort.10	
 \cp -fp  $PROB.basis  fort.11  >& /dev/null
 ls -l {$PROB}*
 if ($SPECS != $PROB) then 
    ls  -l {$SPECS}*
 endif

# Run the specified executable
 echo "  Running $TOP/bin/$1"
                 $TOP/bin/$1

 \cp -fp fort.9  $PROB.out		
 \cp -fp fort.11 $PROB.basis     >& /dev/null
 \cp -fp fort.12 $PROB.newbasis  >& /dev/null

# \cp -fp fort.11 $TOP/code/qminos56/testFBA/$PROB.basis  >& /dev/null

 \rm fort.4	
 \rm fort.9	>& /dev/null
 \rm fort.10
 \rm fort.11	
 \rm fort.12	>& /dev/null
