[ADMB Users] Determining Hessian status from script

Arni Magnusson arnima at hafro.is
Mon Apr 2 12:44:10 PDT 2012

Hi Curry,

I can think of two relatively simple ways to determine which model runs 
got positive definite Hessian.

1. After each model run, move key output files to run-specific name:

   model -ind run001.txt
   move model.cor run001.cor
   move model.rep run001.rep

   model -ind run002.txt
   move model.cor run002.cor
   move model.rep run002.rep

You will get run*.rep files from all model runs, but you will only get 
run*.cor files from the ones that got positive definite Hessian.

2. Use the exit status, %ERRORLEVEL% in Dos or $? in Bash, to determine 

   model -ind run001.dat > run001.log
   if %ERRORLEVEL%==0 (echo run001 done) else (echo run001 FAILED)

   model -ind run002.dat > run002.log
   if %ERRORLEVEL%==0 (echo run002 done) else (echo run002 FAILED)

Some mixture of this stuff should do the trick. Depending on your 
scripting skills (and mental pain threshold), you could employ loops or 
other techniques to make the script shorter and to avoid typos. You could 
also use another program, like R or Emacs, to write a long and plain 
script programmatically.


On Mon, 2 Apr 2012, Curry Cunningham wrote:

> [...]
> Essentially, I'm running a batch file which executes a series of run 
> reconstruction models for Bristol Bay, Alaska and returns the results in 
> an output file containing all of the necessary parameter values and 
> statistics. I'm wondering if there is some way to return whether the 
> hessian matrix is or is not positive definite in my output file.
> This would save me much time in scrolling through the command line 
> printout and recording whether the "hessian matrix may not be positive 
> definite" error is thrown in each of the 47 years.
> Thank you very much for your time,
> Curry J. Cunningham

More information about the Users mailing list