[Developers] Scripts for MSVC+MacOS, manual, bin, examples
Arni Magnusson
arnima at hafro.is
Sun May 31 20:14:19 PDT 2009
On Sun, 31 May 2009, Hans Julius Skaug wrote:
> Hi Arni,
>
> Should these scripts be made part of all admb installers /
> bin-directories? If you agree I will suggest this on the developers list
> and update the ADMB-RE docs.
Yes, it would be nice to replace the old scripts with the new ones in the
next ADMB release. I have released adcomp/adlink/admb trios for Linux GCC,
Windows GCC, and Windows Borland. This trio is still missing for Windows
MSVC and I'm not sure if the Linux GCC scripts will run on Mac OS as is.
The new scripts use -r to compile random effects, instead of the
two-character -re flag described in the ADMB-RE manual. If everyone is
happy with the single-character flags -d -r -s, the ADMB-RE manual could
be updated when the new scripts are released as part of ADMB. By the way,
the -s flag does not only add bound checks, but also embeds debugging
symbols, since bound checks are mainly used while a model is being
developed and tested. The -s binaries are considerably larger and slower.
I also used the opportunity when releasing ADMB-IDE to clean up the bin
directory a bit, deleting all the old scripts, sed1.exe, sedcmd, sedcmd2,
sedcmd3, and sedflex. As you can see inside
http://admb-project.googlecode.com/files/admb-ide-345-4.zip, the new bin
directory contains a total of 12 files,
adcomp.bat, adlink.bat, admb.bat
seddf1b2, seddf1b3, seddf1b4
sedf1b2a, sedf1b2c, sedf1b2d
sed.exe, tpl2cpp.exe, tpl2rem.exe
instead of 26 files in the current
http://admb-project.googlecode.com/files/admb-9.0.202-mingw-gcc3.4.5.zip.
A similar cleanup could be done for other releases.
Finally, a couple of points regarding the examples. I suggest renaming the
'simple' example from the ADMB-RE to 'simpler' and include it in the
examples directory of the main distribution. Likewise, I would also vote
for including the 'simpdll' example from the manual. This would be a lone
file simpdll.tpl, since the data are R objects. I have used these examples
to successfully test admb -r (all compilers) and admb -d (Windows GCC
only).
Cheers,
Arni
-------------- next part --------------
DATA_SECTION
init_int nobs
init_vector Y(1,nobs)
init_vector X(1,nobs)
PARAMETER_SECTION
init_number a
init_number b
init_number mu
vector pred_Y(1,nobs)
init_bounded_number sigma_Y(0.000001,10)
init_bounded_number sigma_x(0.000001,10)
random_effects_vector x(1,nobs)
objective_function_value f
PROCEDURE_SECTION // This section is pure C++
f = 0;
pred_Y=a*x+b; // Vectorized operations
// Prior part for random effects x
f += -nobs*log(sigma_x) - 0.5*norm2((x-mu)/sigma_x);
// Likelihood part
f += -nobs*log(sigma_Y) - 0.5*norm2((pred_Y-Y)/sigma_Y);
f += -0.5*norm2((X-x)/0.5);
f *= -1; // ADMB does minimization!
-------------- next part --------------
# number of observations
10
# observed Y values
1.4 4.7 5.1 8.3 9.0 14.5 14.0 13.4 19.2 18
# observed x values
-1 0 1 2 3 4 5 6 7 8
-------------- next part --------------
DATA_SECTION
dll_int nvar
PARAMETER_SECTION
dll_init_vector x(1,nvar)
dll_number freturn
objective_function_value f
PROCEDURE_SECTION
f=square(x(1)-1.0);
for (int i=1;i<nvar;i++)
{
f+=square(x(i+1)-x(i));
}
freturn=f;
More information about the Developers
mailing list