forked from qld-gov-au/spade
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.h
117 lines (93 loc) · 2.16 KB
/
common.h
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
// Copyright 2016 State of Queensland
// This file is part of SPADE
// See spade.c, COPYING, COPYING.LESSER
#ifndef SPADE_COMMON_H
#define SPADE_COMMON_H
#include "meschach/matrix.h"
#include "parameters.h"
// Whether to use MESCHACH for the solvers
#define MESCHACH 0
// Whether to use a quarter step in the numerics
#define QUARTER 0
// Whether to use the new objective funtion or not
#define NEWOBJ 0
// SGNM: Selection Grid Nodes Method
//
// Determines whether to create full-size matrices
// or to dynamically add and remove rows from the
// matrices.
//
// Set to 0 to use full-size matrices
// Set to 1 to dynamically add and remove rows
#define SGNM 0
// Whether to run grad_* methods concurrently
#define PTH 1
#define A1 8.588e-5
#define A2 0.00144
typedef struct {
Real stp;
Real ftol;
Real gtol;
Real xtol;
Real stpmin;
Real stpmax;
int maxfev;
} OptimControl;
typedef struct {
int nK; // number knots
int B;
VEC *knots_e; // knots effort
VEC *knots_c; // knots catch
VEC *splcoef_e; // knots effort
VEC *splcoef_c; // knots catch
int Nlf;
VEC *ln;
VEC *tl;
} NewData;
typedef struct {
VEC *eff;
VEC *cat;
Real **lf;
int n;
int *t_id;
int *t_sz;
int I,J,S;
Real k;
int Y; // Number of years of input data
} Data;
typedef struct {
Data *d;
VEC * eff;
Real k;
int S;
Parameters *parameters;
} Grad_Args_No_MESCHACH;
typedef struct {
MAT *x,*u,*xhh,*xh,*xn,*uh,*un;
VEC *Ui,*Uh,*Uhh;
IVEC *idxi;
} Solve_Core_Args;
typedef struct {
Data *d;
VEC * eff;
Real k;
int S;
Solve_Core_Args *core_args;
Parameters *parameters;
} Grad_Args;
Real iota1;
Real iota2;
Real phi;
Real eta1;
Real eta2;
Real h;
int J;
int interactive_mode_requested;
void request_interactive_mode(int a);
void spade_v_output(VEC* vec);
void data_read_ce(char * data_file_name, Data * data, int * N, Real k);
void data_read_lf(char * data_file_name, Data * data, int N, Real k, int minfish);
void data_read_ce_new(char * data_file_name, NewData * newdata);
void data_read_lf_new(char * data_file_name, NewData * newdata);
void optim_control_read(char * optim_file_name, OptimControl * optim);
#endif