-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathagents.cpp
41 lines (36 loc) · 1.37 KB
/
agents.cpp
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
#include "agents.h"
Firms::Firms(int nFirms) : numberOfFirms(nFirms)
{
this->price = std::vector<float>(numberOfFirms, 0);
for(int i=0; i < numberOfFirms; i++){
this->price[i] = this->price_dist(this->gen);
}
this->debt = std::vector<float>(numberOfFirms, 0);
this->networth = std::vector<float>(numberOfFirms, 10);
this->profit = std::vector<float>(numberOfFirms, 0);
this->interestRate = std::vector<float>(numberOfFirms, 0);
this->leverage = std::vector<float>(numberOfFirms, 1);
this->capital = std::vector<float>(numberOfFirms, 0);
this->output = std::vector<float>(numberOfFirms, 0);
this->lgdf = std::vector<float>(numberOfFirms, 0);
this->defaulted = std::vector<float>(numberOfFirms, 0);
}
bool Firms::isDefaulted(int firm)
{
return defaulted[firm] == 1 ? true : false;
}
Banks::Banks(int nBanks) : numberOfBanks(nBanks)
{
this->badDebt = std::vector<float>(numberOfBanks, 0);
this->networth = std::vector<float>(numberOfBanks, 10);
this->profit = std::vector<float>(numberOfBanks, 0);
this->interestRate = std::vector<float>(numberOfBanks, 0);
this->deposit = std::vector<float>(numberOfBanks, 0);
this->creditLinkDegree = std::vector<float>(numberOfBanks, 0);
this->nonPerformingLoans = std::vector<float>(numberOfBanks, 0);
this->defaulted = std::vector<float>(numberOfBanks, 0);
}
bool Banks::isDefaulted(int bank)
{
return defaulted[bank] == 1 ? true : false;
}