DISPLACE  1.0
A spatial model of fisheries to help sustainable fishing and maritime spatial planning
comstructs.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // DISPLACE: DYNAMIC INDIVIDUAL VESSEL-BASED SPATIAL PLANNING
3 // AND EFFORT DISPLACEMENT
4 // Copyright (c) 2012-2019 Francois Bastardie <fba@aqua.dtu.dk>
5 
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 
16 // You should have received a copy of the GNU General Public License along
17 // with this program; if not, write to the Free Software Foundation, Inc.,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 // --------------------------------------------------------------------------
20 
21 #ifndef COMSTRUCTS_H
22 #define COMSTRUCTS_H
23 
24 #include <idtypes.h>
25 #include <commons_global.h>
26 #include <options.h>
27 #include <cmath>
28 
29 namespace displace {
30 namespace commons {
31 
36  std::string biolsce;
37  std::string fleetsce;
40  int a_graph;
44  std::vector <double> graph_res;
47  bool use_dtrees;
48 
49  std::vector <int> tariff_pop;
51  std::vector <double> arbitary_breaks_for_tariff;
55 
56  std::string dt_go_fishing;
57  std::string dt_choose_ground;
58  std::string dt_start_fishing;
59  std::string dt_change_ground;
60  std::string dt_stop_fishing;
61  std::string dt_change_port;
62 
63 
64  friend bool operator == (const Scenario &s1, const Scenario &s2) {
65  return
66  s1.dyn_alloc_sce == s2.dyn_alloc_sce &&
67  s1.dyn_pop_sce == s2.dyn_pop_sce &&
68  s1.closure_opts == s2.closure_opts &&
69  s1.biolsce == s2.biolsce &&
70  s1.fleetsce == s2.fleetsce &&
71  s1.freq_do_growth == s2.freq_do_growth &&
73  s1.a_graph == s2.a_graph &&
74  s1.nrow_coord == s2.nrow_coord &&
75  s1.nrow_graph == s2.nrow_graph &&
76  s1.a_port == s2.a_port &&
77  check(s1.graph_res, s2.graph_res) &&
80  s1.use_dtrees == s2.use_dtrees &&
81 
82  s1.tariff_pop == s2.tariff_pop &&
86  std::abs((double)(s1.tariff_annual_hcr_percent_change - s2.tariff_annual_hcr_percent_change)) < 1e-3 &&
88 
89  s1.dt_go_fishing == s2.dt_go_fishing &&
95  }
96 
97  friend bool operator != (const Scenario &s1, const Scenario &s2) {
98  return !(s1 == s2);
99  }
100 
101 private:
102  static bool check(const std::vector<double> &c1 , const std::vector<double> &c2) {
103  if (c1.size() != c2.size()) return false;
104 
105  for (size_t i = 0; i < c1.size(); ++i) {
106  if (std::abs((double)(c1[i]-c2[i])) > 1e-3)
107  return false;
108  }
109  return true;
110  }
111 };
112 
113 }
114 }
115 
116 #endif // COMSTRUCTS_H
117 
Definition: options.h:151
bool check_all_stocks_before_going_fishing
Definition: comstructs.h:46
Definition: decisiontreemanager.h:13
std::string dt_change_ground
Definition: comstructs.h:59
DynAllocOptions dyn_alloc_sce
Definition: comstructs.h:33
bool operator !=(StrongType< T, TAG > lh, StrongType< T, TAG > rh)
Unequality operator for StrongType.
Definition: StrongType.h:57
std::string dt_start_fishing
Definition: comstructs.h:58
bool use_dtrees
Definition: comstructs.h:47
Definition: comstructs.h:32
ClosureOptions closure_opts
Definition: comstructs.h:35
std::string dt_change_port
Definition: comstructs.h:61
Definition: idtypes.h:52
std::string dt_go_fishing
Definition: comstructs.h:56
int total_amount_credited
Definition: comstructs.h:52
std::string biolsce
Definition: comstructs.h:36
Definition: options.h:163
std::vector< double > arbitary_breaks_for_tariff
Definition: comstructs.h:51
std::string dt_stop_fishing
Definition: comstructs.h:60
int update_tariffs_based_on_lpue_or_dpue_code
Definition: comstructs.h:54
std::string fleetsce
Definition: comstructs.h:37
std::vector< int > tariff_pop
Definition: comstructs.h:49
types::NodeId a_port
Definition: comstructs.h:43
int freq_redispatch_the_pop
Definition: comstructs.h:39
std::string dt_choose_ground
Definition: comstructs.h:57
int nrow_coord
Definition: comstructs.h:41
int a_graph
Definition: comstructs.h:40
Definition: options.h:157
PopSceOptions dyn_pop_sce
Definition: comstructs.h:34
double tariff_annual_hcr_percent_change
Definition: comstructs.h:53
int freq_do_growth
Definition: comstructs.h:38
bool operator==(const std::list< T > &o1, const std::list< T > &o2)
Definition: test_pathshop.cpp:35
bool is_individual_vessel_quotas
Definition: comstructs.h:45
int freq_update_tariff_code
Definition: comstructs.h:50
std::vector< double > graph_res
Definition: comstructs.h:44
int nrow_graph
Definition: comstructs.h:42
#define COMMONSSHARED_EXPORT
Definition: commons_global.h:23