-
Notifications
You must be signed in to change notification settings - Fork 0
/
atfgoa2011.htp
209 lines (206 loc) · 5.31 KB
/
atfgoa2011.htp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#if !defined(_atfgoa2011_)
# define _atfgoa2011_
class model_data : public ad_comm{
ofstream * pad_post;
data_int styr;
data_int endyr;
data_int styr_fut;
data_int endyr_fut;
data_vector M;
data_int phase_F40;
data_number median_rec;
data_int median_rec_yrs;
data_int nages_read;
data_int nages;
data_int nselages;
data_int nselages_srv1;
data_int monot_sel;
data_int monot_sel_srv1;
data_int phase_logistic_sel;
data_int phase_selcoffs;
data_int phase_logistic_sel_srv1;
data_int phase_selcoffs_srv1;
data_vector wt_like;
data_int nlen_r;
data_int nobs_fish;
data_ivector yrs_fish;
data_matrix nsamples_fish;
data_int nobs_srv1;
data_ivector yrs_srv1;
data_int nobs_srv1_length;
data_ivector yrs_srv1_length;
data_matrix nsamples_srv1_length;
data_int nobs_srv1_age;
data_ivector yrs_srv1_age;
data_vector like_wght;
data_matrix nsamples_srv1_age;
data_3array obs_p_srv1_len_r;
data_3array obs_p_srv1_age_read;
data_3array obs_p_fish_r;
data_vector catch_bio;
data_vector obs_srv1;
data_vector obs_srv1_sd;
data_matrix wt;
data_vector maturity;
data_3array lenage;
int styr_rec;
dvector cv_srv1;
int i;
int j;
int k;
int ii;
int m;
int nlen;
d3_array obs_p_srv1_age;
d3_array obs_p_srv1_age_r;
d3_array obs_p_srv1_length;
d3_array obs_p_fish;
dvector obs_sexr;
dvector obs_sexr_srv1;
dvector obs_sexr_srv1_l;
~model_data();
model_data(int argc,char * argv[]);
friend class model_parameters;
};
class model_parameters : public model_data ,
public function_minimizer
{
public:
~model_parameters();
void preliminary_calculations(void);
void set_runtime(void);
virtual void * mycast(void) {return (void*)this;}
static int mc_phase(void)
{
return initial_params::mc_phase;
}
static int mceval_phase(void)
{
return initial_params::mceval_phase;
}
static int sd_phase(void)
{
return initial_params::sd_phase;
}
static int current_phase(void)
{
return initial_params::current_phase;
}
static int last_phase(void)
{
return (initial_params::current_phase
>=initial_params::max_number_phases);
}
static prevariable current_feval(void)
{
return *objective_function_value::pobjfun;
}
private:
ivector integer_control_flags;
dvector double_control_flags;
param_init_bounded_number q1;
param_init_number mean_log_rec;
param_init_bounded_dev_vector rec_dev;
param_init_number log_avg_fmort;
param_init_bounded_dev_vector fmort_dev;
param_init_matrix log_selcoffs_fish;
param_init_matrix log_selcoffs_srv1;
param_init_bounded_number fish_slope_f;
param_init_bounded_number fish_sel50_f;
param_init_bounded_number fish_slope_m;
param_init_bounded_number fish_sel50_m;
param_init_bounded_number srv1_slope_f;
param_init_bounded_number srv1_sel50_f;
param_init_bounded_number srv1_slope_m;
param_init_bounded_number srv1_sel50_m;
param_init_bounded_number sexr_param_fish;
param_init_bounded_number sexr_param_srv;
param_init_bounded_number F40;
param_init_bounded_number F35;
param_matrix log_sel_fish;
param_matrix log_sel_srv1;
param_matrix sel;
param_matrix sel_srv1;
param_vector avgsel_fish;
param_vector avgsel_srv1;
param_matrix popn;
param_matrix totn_srv1;
param_vector explbiom;
param_vector pred_bio;
param_vector fspbio;
param_vector pred_srv1;
param_3array pred_p_fish;
param_3array pred_p_srv1_age;
param_3array pred_p_srv1_len;
param_vector pred_catch;
param_3array natage;
param_3array catage;
param_3array natlength;
param_3array Z;
param_3array F;
param_3array S;
param_vector fmort;
param_number rbar;
param_vector surv;
param_vector offset;
param_number rec_like;
param_number rec_like2;
param_number catch_like;
param_vector age_like;
param_vector sel_like;
param_number fpen;
param_number surv_like;
param_stddev_vector recruits;
param_stddev_vector biomassrep;
param_stddev_vector fspbiorep;
param_stddev_number endbiom;
param_stddev_number depletion;
param_number prior_function_value;
param_number likelihood_function_value;
objective_function_value f;
param_number tmp;
param_vector pred_sexr;
param_vector preds_sexr;
param_number sigmar;
param_number ftmp;
param_number SB0;
param_number SBF40;
param_number SBF35;
param_number sprpen;
param_matrix Nspr;
param_3array nage_future;
param_matrix fspbiom_fut;
param_3array F_future;
param_3array Z_future;
param_3array S_future;
param_3array catage_future;
param_number avg_rec_dev_future;
param_vector avg_F_future;
param_matrix catch_future;
param_stddev_matrix future_biomass;
param_vector explbiom_fut;
param_number maxsel_fish;
param_vector maxsel_srv1;
param_number B0;
param_number B40;
param_number B35;
param_number AMeanRec;
param_number like_natm;
param_number like_q;
public:
virtual void userfunction(void);
virtual void report(const dvector& gradients);
virtual void final_calcs(void);
model_parameters(int sz,int argc, char * argv[]);
virtual void initializationfunction(void);
void WriteMCMC(void);
void get_growthmatrix(void);
void get_selectivity(void);
void get_mortality(void);
void get_numbers_at_age(void);
void get_catch_at_age(void);
void Future_projections(void);
void compute_spr_rates(void);
void evaluate_the_objective_function(void);
};
#endif