For a moment, compare the structure info in my previous example:
1 2 3 4 5 6 7 8 9
|
struct info
{
double capital ;
double output ;
explicit info ( double capital_value )
: capital(capital_value), output(capital_value*1.5)
{}
};
|
to yours in the current code:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
struct info
{
std::vector<double> capital;
std::vector<double> output;
std::vector<double> net_income;
static int time; // mark time in simulation
explicit info(double initial_capital, double income.begin()) // constructor
:capital[0](initial_capital), output[0](initial_capital*1.5), net_income[0](income.begin())
{}
void PushPush(); // function of firms' capital, output evolution
};
|
Where, in both cases, the class member looks like:
std::vector<info> history;
The reason, in my example, for using 1 double for each of capital and output (as opposed to a vector of doubles) is that info was intended to be a sort of snapshot in time. The plurality of those moments is expressed by the definition of
history. Your snapshot includes vectors for
capital and company, which implies that there should be more than one of each value for each snapshot in time. Now, perhaps that's what you want. I tend to think it isn't.
That said, you've got quite a few logical and syntax errors in the code.
On lines 24 to 25 of main.cpp norm_dist only exists for the duration of one iteration of the for loop. Each iteration you create a new variable, assign it the value from distribution(generator) and discard it.
As a result, norm_dist isn't defined on line 28 (and was never defined as an array or vector type, so the indexing makes no sense.)
I don't know what you think you're doing on line 31.
The time variable defined on line 18 of main.cpp is not the same as the time variable declared on line 19 of agent.h (which is never actually defined.)
In the info constructor, it would appear you meant for the income parameter to be a vector, not a double. Keep in mind, the example I showed you was a minimal one. You need methods to modify your agent class, and the agent is responsible for constructing the info objects.
It doesn't appear you've actually implemented the agent's constructor anywhere.
Do one thing and get that thing working before you try to put everything together.