Skip to content

Commit

Permalink
Working on workarounds for Issue #107.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnoel committed Feb 10, 2023
1 parent 9fcb6d6 commit cf39a3e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 33 deletions.
4 changes: 3 additions & 1 deletion tests/issue-107/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ all:
../../admb pella_t_modified2
cp pella_t_modified.dat pella_t_modified2.dat
-./pella_t_modified2 > out2
diff --side-by-side --width 140 out out2

diff:
diff --side-by-side --width=200 -w out out2
clean:
@rm -vf admodel.cov
@rm -vf admodel.dep
Expand Down
16 changes: 7 additions & 9 deletions tests/issue-107/pella_t_modified.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ PARAMETER_SECTION
number c_tmp;
objective_function_value ff;
PRELIMINARY_CALCS_SECTION
// get the data out of the data matrix into
obs_catch=column(data,2);
cpue=column(data,3);
// get the data out of the data matrix into
obs_catch=column(data,2);
cpue=column(data,3);
// divide the catch by the cpue to get the effort
effort=elem_div(obs_catch,cpue);
// normalize the effort and save the average
Expand Down Expand Up @@ -77,12 +77,10 @@ PROCEDURE_SECTION
<<" sum(effort_devs): "<<sum(effort_devs)<<endl;

/*
if (count == 45)
{
ad_exit(1);
}
if (initial_params::current_phase == 4)
if (count == 577)
{
cout << value(effort_devs) << endl;
cout << sum(value(effort_devs)) << endl;
ad_exit(1);
}
*/
Expand Down Expand Up @@ -159,7 +157,7 @@ FUNCTION calculate_the_objective_function
log(norm2(log(obs_catch)-log(1.e-10+pred_catch))
+0.1*norm2(effort_devs));
}
else
else
{
ff= .5*( size_count(obs_catch)+size_count(effort_devs)
+size_count(k_devs) )*
Expand Down
36 changes: 13 additions & 23 deletions tests/issue-107/pella_t_modified2.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -45,31 +45,19 @@ PARAMETER_SECTION
number c_tmp;
objective_function_value ff;
PRELIMINARY_CALCS_SECTION
// get the data out of the data matrix into
obs_catch=column(data,2);
cpue=column(data,3);
// get the data out of the data matrix into
obs_catch=column(data,2);
cpue=column(data,3);
// divide the catch by the cpue to get the effort
effort=elem_div(obs_catch,cpue);
// normalize the effort and save the average
double avg_effort=mean(effort);
effort/=avg_effort;
cout << " beta" << beta << endl;
PROCEDURE_SECTION
/*
if (initial_params::current_phase >= 3)
{
cout << "A. effort_devs: " << value(effort_devs) << endl;
}
*/
dvariable s = mean(effort_devs);
if (initial_params::current_phase >= 3)
{
cout << "B. effort_devs: " << value(effort_devs) << endl;
}
effort_devs -= s;
if (initial_params::current_phase >= 3)
{
cout << "C. effort_devs: " << value(effort_devs) << endl;
effort_devs -= mean(effort_devs);
}

// calculate the fishing mortality
Expand All @@ -93,13 +81,10 @@ PROCEDURE_SECTION
<<" mean: " << mean(value(effort_devs))
<<" sum(effort_devs): "<<sum(effort_devs)<<endl;
/*
if (count == 45)
{
ad_exit(1);
}
if (initial_params::current_phase == 4)
if (count == 577)
{
cout << value(effort_devs) << endl;
cout << sum(value(effort_devs)) << endl;
ad_exit(1);
}
*/
Expand Down Expand Up @@ -176,7 +161,7 @@ FUNCTION calculate_the_objective_function
log(norm2(log(obs_catch)-log(1.e-10+pred_catch))
+0.1*norm2(effort_devs));
}
else
else
{
ff= .5*( size_count(obs_catch)+size_count(effort_devs)
+size_count(k_devs) )*
Expand All @@ -189,3 +174,8 @@ FUNCTION calculate_the_objective_function
{
ff+=1000.*square(log(mean(f)/.4));
}
BETWEEN_PHASES_SECTION
if (initial_params::current_phase == 4)
{
effort_devs -= mean(value(effort_devs));
}

0 comments on commit cf39a3e

Please sign in to comment.