DISPLACE  1.0
A spatial model of fisheries to help sustainable fishing and maritime spatial planning
main.cpp File Reference
#include <idtypes.h>
#include "sqlitestorage.h"
#include "storage/sqliteoutputstorage.h"
#include "storage/tables/vesseldeftable.h"
#include "storage/tables/vesselvmslikefpingsonlytable.h"
#include "storage/tables/nodesdeftable.h"
#include "storage/tables/poptable.h"
#include "storage/modelmetadataaccessor.h"
#include <helpers.h>
#include <assert.h>
#include <utils/CrashHandler.h>
#include <getrss.h>
#include <unistd.h>
#include <thread_vessels.h>
#include <dtree/decisiontreemanager.h>
#include <comstructs.h>
#include <simulation.h>
#include <tseries/timeseriesmanager.h>
#include "shortestpath/GeoGraph.h"
#include "shortestpath/GeoGraphLoader.h"
#include <ipc.h>
#include <outputqueuemanager.h>
#include <outputmessage.h>
#include <messages/genericconsolestringoutputmessage.h>
#include <biomodule2.h>
#include <fisheriesmanagmt.h>
#include <iomanip>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <map>
#include <list>
#include <set>
#include <cstdlib>
#include <cstdio>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <ctime>
#include <cmath>
#include <cstring>
#include <errno.h>
#include <mkpath.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <values.h>
#include "Node.h"
#include "Benthos.h"
#include "Metier.h"
#include "Vessel.h"
#include "Firm.h"
#include "Ship.h"
#include "Population.h"
#include "Fishfarm.h"
#include "Windmill.h"
#include "Harbour.h"
#include "diffusion.h"
#include <outputexporter.h>
#include "readdata.h"
#include "myutils.h"
#include <memoryinfo.h>
#include <version.h>
#include <mutex>
#include "boost/bind.hpp"
#include "boost/program_options.hpp"

Macros

#define GetCurrentDir   getcwd
 
#define CALLGRIND_START_INSTRUMENTATION
 
#define CALLGRIND_STOP_INSTRUMENTATION
 
#define CALLGRIND_DUMP_STATS
 
#define MAXPATH   1024
 

Typedefs

typedef bg::model::point< double, 2, bg::cs::cartesian > point
 
typedef bg::model::box< pointbox
 
typedef std::pair< box, unsigned > value
 

Functions

bool load_relevant_nodes (string folder_name_parameterization, string inputfolder, string ftype, string a_quarter, set< types::NodeId > &nodes)
 
bool load_relevant_nodes (string folder_name_parameterization, string inputfolder, vector< types::NodeId > &ret)
 
bool test_not_belong_to_firm (const Vessel *v, int id)
 
void parseCommandLine (int argc, char const *argv[])
 
int app_main (int argc, char const *argv[])
 
int main (int argc, char const *argv[])
 

Variables

std::string cwd
 
char buf [MAXPATH]
 
MemoryInfo memInfo
 
std::mutex glob_mutex
 
vector< int > ve
 
vector< Vessel * > vessels
 
vector< Ship * > ships
 
vector< Benthos * > benthoss
 
vector< Population * > populations
 
vector< Fishfarm * > fishfarms
 
vector< Windmill * > windmills
 
int tstep
 
int nbpops
 
int nbbenthospops
 
int a_graph
 
types::NodeId a_port
 
int nrow_coord
 
int nrow_graph
 
vector< double > graph_res
 
bool is_individual_vessel_quotas
 
bool check_all_stocks_before_going_fishing
 
vector< int > tariff_pop
 
int freq_update_tariff_code
 
int update_tariffs_based_on_lpue_or_dpue_code
 
int freq_do_growth
 
int freq_redispatch_the_pop
 
vector< double > arbitary_breaks_for_tariff
 
int total_amount_credited
 
double tariff_annual_hcr_percent_change
 
bool is_tacs
 
bool is_fishing_credits
 
bool is_discard_ban
 
bool is_grouped_tacs
 
bool is_benthos_in_numbers
 
bool is_direct_killing_on_benthos
 
bool is_resuspension_effect_on_benthos
 
double tech_creeping_multiplier =1
 
bool enable_sqlite_out = true
 
std::string outSqlitePath
 
std::shared_ptr< SQLiteOutputStorageoutSqlite = nullptr
 
bool use_dtrees
 
vector< int > implicit_pops
 
vector< int > implicit_pops_level2
 
vector< int > grouped_tacs
 
vector< double > global_quotas_uptake
 
vector< int > explicit_pops
 
vector< double > calib_oth_landings
 
vector< double > calib_weight_at_szgroup
 
vector< double > calib_cpue_multiplier
 
vector< types::NodeIdint_harbours
 
displace::commons::Scenario scenario
 
DynAllocOptions dyn_alloc_sce
 
PopSceOptions dyn_pop_sce
 
ClosureOptions closure_opts
 
string biolsce
 
string fleetsce
 
adjacency_map_t adjacency_map
 
vector< string > vertex_names
 
vector< types::NodeIdrelevant_nodes
 
multimap< int, int > nodes_in_polygons
 
multimap< types::NodeId, int > possible_metiers
 
multimap< types::NodeId, double > freq_possible_metiers
 
multimap< types::NodeId, double > gshape_cpue_per_stk_on_nodes
 
multimap< types::NodeId, double > gscale_cpue_per_stk_on_nodes
 
vector< types::NodeIdspe_fgrounds
 
vector< types::NodeIdspe_fgrounds_init
 
vector< types::NodeIdspe_harbours
 
vector< double > spe_freq_fgrounds
 
vector< double > spe_freq_fgrounds_init
 
vector< double > spe_freq_harbours
 
vector< double > spe_vessel_betas_per_pop
 
vector< double > spe_percent_tac_per_pop
 
vector< double > spe_fishing_credits
 
vector< Node * > nodes
 
multimap< types::NodeId, string > harbour_names
 
vector< int > name_metiers
 
ofstream freq_cpue
 
ofstream freq_profit
 
ofstream freq_distance
 
ofstream vmslike2
 
ofstream vmslike3
 
vector< Metier * > metiers
 
ofstream export_individual_tacs
 
vector< PathShoppathshops
 
ofstream fishfarmslogs
 
ofstream windmillslogs
 
ofstream shipslogs
 
std::mutex listVesselMutex
 
vector< int > listVesselIdForVmsLikeToExport
 
vector< int > listVesselIdForVmsLikeFPingsOnlyToExport
 
vector< int > listVesselIdForLogLikeToExport
 
vector< int > listVesselIdForTripCatchPopPerSzgroupExport
 
string type_of_avai_field_to_read =""
 
bool crash_handler_enabled = true
 
string outdir
 
string namefolderinput ="fake"
 
string namefolderoutput ="baseline"
 
string inputfolder ="."
 
string namesimu ="sim1"
 
int nbsteps =10
 
double dparam =10.0
 
int use_static_paths =0
 
int selected_vessels_only =0
 
bool use_gui = false
 
bool gui_move_vessels = true
 
bool use_gnuplot = false
 
int num_threads = 4
 
int nb_displayed_moves_out_of_twenty =1
 
int export_vmslike = 1
 
int export_hugefiles = 1
 

Macro Definition Documentation

◆ CALLGRIND_DUMP_STATS

#define CALLGRIND_DUMP_STATS

◆ CALLGRIND_START_INSTRUMENTATION

#define CALLGRIND_START_INSTRUMENTATION

◆ CALLGRIND_STOP_INSTRUMENTATION

#define CALLGRIND_STOP_INSTRUMENTATION

◆ GetCurrentDir

#define GetCurrentDir   getcwd

◆ MAXPATH

#define MAXPATH   1024

Typedef Documentation

◆ box

typedef bg::model::box<point> box

◆ point

typedef bg::model::point<double, 2, bg::cs::cartesian> point

◆ value

typedef std::pair<box, unsigned> value

Function Documentation

◆ app_main()

int app_main ( int  argc,
char const *  argv[] 
)












---------------------------—/// ---------------------------—/// THE EFFORT CONTROL /// (ON GoFishing dtree) /// ---------------------------—/// ---------------------------—///

---------------------------—/// ---------------------------—/// THE FOR-LOOP OVER VESSELS /// ---------------------------—/// ---------------------------—///

---------------------------—/// ---------------------------—/// THE QUOTA UPTAKES & CHOKING /// ---------------------------—/// ---------------------------—///

---------------------------—/// ---------------------------—/// THE DIFFUSIVE ENVT /// ---------------------------—/// ---------------------------—///

---------------------------—/// ---------------------------—/// THE DIFFUSIVE BENTHOS /// ---------------------------—/// ---------------------------—///

---------------------------—/// ---------------------------—/// SHIPPING DISTURBING BENTHOS /// ---------------------------—/// ---------------------------—///

---------------------------—/// ---------------------------—/// REINIT SOME VALUES ON NODES /// ---------------------------—/// ---------------------------—///

---------------------------—/// ---------------------------—/// EXPORTING TO DB /// ---------------------------—/// ---------------------------—///

◆ load_relevant_nodes() [1/2]

bool load_relevant_nodes ( string  folder_name_parameterization,
string  inputfolder,
string  ftype,
string  a_quarter,
set< types::NodeId > &  nodes 
)

◆ load_relevant_nodes() [2/2]

bool load_relevant_nodes ( string  folder_name_parameterization,
string  inputfolder,
vector< types::NodeId > &  ret 
)

◆ main()

int main ( int  argc,
char const *  argv[] 
)

◆ parseCommandLine()

void parseCommandLine ( int  argc,
char const *  argv[] 
)

◆ test_not_belong_to_firm()

bool test_not_belong_to_firm ( const Vessel v,
int  id 
)

Variable Documentation

◆ a_graph

int a_graph

◆ a_port

types::NodeId a_port

◆ adjacency_map

adjacency_map_t adjacency_map

◆ arbitary_breaks_for_tariff

vector<double> arbitary_breaks_for_tariff

◆ benthoss

vector<Benthos* > benthoss

◆ biolsce

string biolsce

◆ buf

char buf[MAXPATH]

◆ calib_cpue_multiplier

vector<double> calib_cpue_multiplier

◆ calib_oth_landings

vector<double> calib_oth_landings

◆ calib_weight_at_szgroup

vector<double> calib_weight_at_szgroup

◆ check_all_stocks_before_going_fishing

bool check_all_stocks_before_going_fishing

◆ closure_opts

ClosureOptions closure_opts

◆ crash_handler_enabled

bool crash_handler_enabled = true

◆ cwd

std::string cwd

◆ dparam

double dparam =10.0

◆ dyn_alloc_sce

DynAllocOptions dyn_alloc_sce

◆ dyn_pop_sce

PopSceOptions dyn_pop_sce

◆ enable_sqlite_out

bool enable_sqlite_out = true

◆ explicit_pops

vector<int> explicit_pops

◆ export_hugefiles

int export_hugefiles = 1

◆ export_individual_tacs

ofstream export_individual_tacs

◆ export_vmslike

int export_vmslike = 1

◆ fishfarms

vector<Fishfarm* > fishfarms

◆ fishfarmslogs

ofstream fishfarmslogs

◆ fleetsce

string fleetsce

◆ freq_cpue

ofstream freq_cpue

◆ freq_distance

ofstream freq_distance

◆ freq_do_growth

int freq_do_growth

◆ freq_possible_metiers

multimap<types::NodeId, double> freq_possible_metiers

◆ freq_profit

ofstream freq_profit

◆ freq_redispatch_the_pop

int freq_redispatch_the_pop

◆ freq_update_tariff_code

int freq_update_tariff_code

◆ glob_mutex

std::mutex glob_mutex

◆ global_quotas_uptake

vector<double> global_quotas_uptake

◆ graph_res

vector<double> graph_res

◆ grouped_tacs

vector<int> grouped_tacs

◆ gscale_cpue_per_stk_on_nodes

multimap<types::NodeId, double> gscale_cpue_per_stk_on_nodes

◆ gshape_cpue_per_stk_on_nodes

multimap<types::NodeId, double> gshape_cpue_per_stk_on_nodes

◆ gui_move_vessels

bool gui_move_vessels = true

◆ harbour_names

multimap<types::NodeId, string> harbour_names

◆ implicit_pops

vector<int> implicit_pops

◆ implicit_pops_level2

vector<int> implicit_pops_level2

◆ inputfolder

string inputfolder ="."

◆ int_harbours

vector<types::NodeId> int_harbours

◆ is_benthos_in_numbers

bool is_benthos_in_numbers

◆ is_direct_killing_on_benthos

bool is_direct_killing_on_benthos

◆ is_discard_ban

bool is_discard_ban

◆ is_fishing_credits

bool is_fishing_credits

◆ is_grouped_tacs

bool is_grouped_tacs

◆ is_individual_vessel_quotas

bool is_individual_vessel_quotas

◆ is_resuspension_effect_on_benthos

bool is_resuspension_effect_on_benthos

◆ is_tacs

bool is_tacs

◆ listVesselIdForLogLikeToExport

vector<int> listVesselIdForLogLikeToExport

◆ listVesselIdForTripCatchPopPerSzgroupExport

vector<int> listVesselIdForTripCatchPopPerSzgroupExport

◆ listVesselIdForVmsLikeFPingsOnlyToExport

vector<int> listVesselIdForVmsLikeFPingsOnlyToExport

◆ listVesselIdForVmsLikeToExport

vector<int> listVesselIdForVmsLikeToExport

◆ listVesselMutex

std::mutex listVesselMutex

◆ memInfo

MemoryInfo memInfo

◆ metiers

vector<Metier*> metiers

◆ name_metiers

vector<int> name_metiers

◆ namefolderinput

string namefolderinput ="fake"

◆ namefolderoutput

string namefolderoutput ="baseline"

◆ namesimu

string namesimu ="sim1"

◆ nb_displayed_moves_out_of_twenty

int nb_displayed_moves_out_of_twenty =1

◆ nbbenthospops

int nbbenthospops

◆ nbpops

int nbpops

◆ nbsteps

int nbsteps =10

◆ nodes

vector<Node* > nodes

◆ nodes_in_polygons

multimap<int, int> nodes_in_polygons

◆ nrow_coord

int nrow_coord

◆ nrow_graph

int nrow_graph

◆ num_threads

int num_threads = 4

◆ outdir

string outdir

◆ outSqlite

std::shared_ptr<SQLiteOutputStorage> outSqlite = nullptr

◆ outSqlitePath

std::string outSqlitePath

◆ pathshops

vector<PathShop> pathshops

◆ populations

vector<Population* > populations

◆ possible_metiers

multimap<types::NodeId, int> possible_metiers

◆ relevant_nodes

vector<types::NodeId> relevant_nodes

◆ scenario

◆ selected_vessels_only

int selected_vessels_only =0

◆ ships

vector<Ship*> ships

◆ shipslogs

ofstream shipslogs

◆ spe_fgrounds

vector<types::NodeId> spe_fgrounds

◆ spe_fgrounds_init

vector<types::NodeId> spe_fgrounds_init

◆ spe_fishing_credits

vector<double> spe_fishing_credits

◆ spe_freq_fgrounds

vector<double> spe_freq_fgrounds

◆ spe_freq_fgrounds_init

vector<double> spe_freq_fgrounds_init

◆ spe_freq_harbours

vector<double> spe_freq_harbours

◆ spe_harbours

vector<types::NodeId> spe_harbours

◆ spe_percent_tac_per_pop

vector<double> spe_percent_tac_per_pop

◆ spe_vessel_betas_per_pop

vector<double> spe_vessel_betas_per_pop

◆ tariff_annual_hcr_percent_change

double tariff_annual_hcr_percent_change

◆ tariff_pop

vector<int> tariff_pop

◆ tech_creeping_multiplier

double tech_creeping_multiplier =1

◆ total_amount_credited

int total_amount_credited

◆ tstep

int tstep

◆ type_of_avai_field_to_read

string type_of_avai_field_to_read =""

◆ update_tariffs_based_on_lpue_or_dpue_code

int update_tariffs_based_on_lpue_or_dpue_code

◆ use_dtrees

bool use_dtrees

◆ use_gnuplot

bool use_gnuplot = false

◆ use_gui

bool use_gui = false

◆ use_static_paths

int use_static_paths =0

◆ ve

vector<int> ve

◆ vertex_names

vector<string> vertex_names

◆ vessels

vector<Vessel*> vessels

◆ vmslike2

ofstream vmslike2

◆ vmslike3

ofstream vmslike3

◆ windmills

vector<Windmill* > windmills

◆ windmillslogs

ofstream windmillslogs