NetworkSimulation::NetworkSimulation ( const Network& net, Number n_chart, Number n_fund, const AgentProperty& prop ): _par_sim(0,0), _vec_trader(0) { if (n_chart + n_fund != net.Dimension() ) throw std::runtime_error("number of chartists and fundamentalists must match size of the network"); for (Index i = 0; i < n_chart; i++) _vec_trader.push_back( boost::shared_ptr<Trader>(new Chartist(net,i,prop,_vec_trader))); for (Index j = 0; j < n_chart; j++) _vec_trader.push_back( boost::shared_ptr<Trader>(new Fundamentalist(net,n_chart + j, prop,_vec_trader))); }
Trader::Trader ( const Network& net, Index i, const AgentProperty& prop, const VectorTrader& vec_trader ): _net(net), _i_pos_in_net(i), _prop(prop), _var ( 0.0, prop._initial_price, prop._initial_price, 0.0 ), _demandsP(net.Dimension(),0.0), _vec_trader(vec_trader) { }