Esempio n. 1
0
void firms::set_info()
{	
	vector<double> x;
	x.push_back(1);
	x.push_back(production());
	_rls.update(average_price(), x);
	x.clear();
	x = _rls.get_action();
	int _f = firm_number();
	for (map<int, firm>::iterator i = _firms.begin(); i != _firms.end(); ++i)
	{
		(i->second).set_info(x[0], -x[1], _f);
	}
}
Esempio n. 2
0
void subformula_2()
{
     int choicesubformula2;

     //subformula2();

     while(choicesubformula2<5 || choicesubformula2>6)
     {
     clearScreen();
     printf("\n[1]M=(P*T)/V\n");
     printf("\n[2]V=(P*T)/M\n");
     printf("\n[3]P=(M*V)/T\n");
     printf("\n[4]T=(M*V)/P\n");
     printf("\n[5]Back to main menu\n");
     printf("\n[6]Quit\n");
     printf("\nWhat variable do you want to solve? ");
     fflush(stdin);
     scanf("%d",&choicesubformula2);

     switch (choicesubformula2)
     {
     case 1 : money_supply();
     break;
     case 2 : velocity_money();
     break;
     case 3 : average_price();
     break;
     case 4 : index_expenditure();
     break;
     case 5:
     break;
     case 6:  doExit=1;
     break;
     default:
     printf("Invalid choice.\n");
     system("pause");
     break;
     }

     }
}
Esempio n. 3
0
void firms::write_log(string model_name)
{
	for (map<int, firm>::iterator i = _firms.begin(); i != _firms.end(); ++i)
	{
		(i->second).write_log(model_name, i->first);
		//_log.setfirmaction(i->first, (i->second).getaction());
	}	
	ofstream fout;
	ostringstream fn;
	fn<<model_name<<"_average_price.txt";
	fout.open(fn.str(), ios_base::app);
	fout<<average_price()<<" ";;
	fout.close();
	fn.str("");
	fn<<model_name<<"_average_salary.txt";
	fout.open(fn.str(), ios_base::app);
	fout<<average_salary()<<" ";
	fout.close();
	fn.str("");
	fn<<model_name<<"_gdp.txt";
	fout.open(fn.str(), ios_base::app);
	fout<<gdp()<<" ";
	fout.close();
	fn.str("");
	fn<<model_name<<"_consumption.txt";
	fout.open(fn.str(), ios_base::app);
	fout<<consumption()<<" ";
	fout.close();
	fn.str("");
	fn<<model_name<<"_production.txt";
	fout.open(fn.str(), ios_base::app);
	fout<<production()<<" ";
	fout.close();
	fn.str("");
	fn<<model_name<<"_firm_number.txt";
	fout.open(fn.str(), ios_base::app);
	fout<<firm_number()<<" ";
	fout.close();
	fn.str("");
}