Closed MaC-Perez closed 1 year ago
I'm guessing that "run the tpl" means compiling the program?
i.e. the error you show is the output from
admb hydra_sim
Works for me. Suspect this is an issue of not having admb and compilers linked properly. Are you able to compile the simple example? Are you able to compile a basic c++ program? What version of ADMB are you using? (am running on 12.3)
Hi @gavinfay I checked my admb with other examples and it is working. I also tried to compile the hydra_sim.tpl file in a different computer and I got the same error
hydra_sim.cpp:1812:34: error: 'isinf' was not declared in this scope if(isinf(value(sum(nll_survey)))) { ^
@gavinfay it is working now.... I just commented the lines ...
//if(isinf(value(sum(nll_survey)))) { // cout << " INFINITE OBJ FUN" << endl; // gavjunk << survey_q << endl; // gavjunk << ln_survey_q << endl; // gavjunk << "survey biomass data, predicted, residual, nll" << endl; //for (int i=1;i<=Nsurvey_obs;i++) // gavjunk << obs_survey_biomass(i) << " " << pred_survey_index(i) << " " << resid_survey(i) << " " << nll_survey(i) << endl; //exit(-1); //}
That doesn't interfere with the rest of the code right?
I think this almost certainly suggests that your installation is not linked properly. Whether it is your ADMB or your C++ compiler is probably not
Basically your installation can't find the required header file. You'll need to ensure you are pointing to your cmath.h
so I would start by looking at the definition for the various environmental variables and also seeing where cmath.h
is located on your machine.
Note that if the examples you have tried don't use things from the cmath header file (which is where isinf() is located) then you won't pick up on this through that.
Which versions of ADMB & C++ are you using? When did you last run Hydra on these machines? Have you changed C++ compilers or environmental variables to install other software?
Don't edit the .cpp file. If you want to make this change, do it in the relevant part of the .tpl file. Otherwise you will have to repeat this step again and again each time you recompile.
@gavinfay I changed the tpl file not the cpp
I was using and older version of the .tpl file and the difference between both was exactly what you mentioned "cmath.h" in line 55
mmmm I think I change some things the day we try to install docker desktop for the MEBM class.... my admb was working properly before that day.
Glad you were able to resolve. My advice towards mitigating the problem of using an older version of a file is to only have the one version on your computer (rely on the version control system we have set up with Git and GitHub).
e.g. for the hydra_sim.tpl
, there's no need to have this outside of the location on your computer where the hydra-sim
repository resides.
@gavinfay well I didn't fix it I just delete those lines, but I am not sure if that interfere with the rest of the code... I think it does because even when I manage to compile it I am having more issues when I try to run it.
my cmath file is in C:\ADMB-12.3\utilities\mingw64\include\c++\8.3.0
these are the lines I deleted // cmath.h
//if(isinf(value(sum(nll_survey)))) { // cout << " INFINITE OBJ FUN" << endl; // gavjunk << survey_q << endl; // gavjunk << ln_survey_q << endl; // gavjunk << "survey biomass data, predicted, residual, nll" << endl; //for (int i=1;i<=Nsurvey_obs;i++) // gavjunk << obs_survey_biomass(i) << " " << pred_survey_index(i) << " " << resid_survey(i) << " " << nll_survey(i) << endl; //exit(-1); //}
@gavinfay I asked Sarah if she was able to run the model with the hydra_sim_GBself_5bin input files but she is also getting an error when she try to compile it. Also she mentioned there is 3 more phase variables that need to be added to the .dat file after line 258 that have been added since she made the input files:
-1
-1
-1
I am not tagging her here because she is really busy finishing some reports.
Yep. See hydra_sim
commit #fe36d04
These are changes you can easily make and are only associated with the pin and dat files (so don't need to be incorporated into the generation of the simulated ts.dat files).
thanks @gavinfay ... I changed both files but I get this
q par map -2 0 0 matrix bound exceeded -- row index too low in imatrix::operator[]value was-1
I got the same thing with my executable. This may be a problem with the 4 species data input but I won't be able to diagnose until next week, apologies
Doesn't look like your dat file matches the correct format, because it is thinking there should be -2 catchability parameters. Cross-check you have a complete data file with the working examples in the hydra_sim GB-inputs folder.
(e.g. hydra_sim_GB_5bin_1978_inpN_noM1.dat
)
The dat file still has the M1 and other food inputs (these are moved to the pin file). Comment out these lines in the dat file and that does the trick.
I got the same thing with my executable. This may be a problem with the 4 species data input but I won't be able to diagnose until next week, apologies
sure, do not worry Sarah I appreciate that you tried to run it. Thanks!!
@gavinfay I checked my .dat files with those in the GB-inputs folder, I also I tried several different things but I keep getting the same error. I left the files that I am using in the "model" folder. I do not want to change the original files until I am sure everything works.
q par map -2 0 0
@MaC-Perez You haven't commented out the M1 and OtherFood entries. As mentioned above, this fixes your problem.
@gavinfay sorry, I didn't see that comment. It finally worked
Thanks again!
Hi @gavinfay I am trying to run the model with the new dat files that Sarah sent me but I get an error when I run the .tpl file (I took the .tpl file from the hydra_sim folder) maybe I am not using the correct version.
The tpl dat and pin files are in the folder Hydra_self_testing --> input
hydra_sim.cpp: In member function 'void model_parameters::evaluate_the_objective_function()': hydra_sim.cpp:1812:34: error: 'isinf' was not declared in this scope if(isinf(value(sum(nll_survey)))) { ^ hydra_sim.cpp:1812:34: note: suggested alternative: In file included from hydra_sim.cpp:4:0: c:/gnu/GCC492-win64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/cmath:828:5: note: 'std::isinf' isinf(_Tp __f) ^