2 #include "../firm_agent_header.h"
3 #include "../library_header.h"
38 printf(
"Warning @firm_production_produce_goods(): Firm Id = %d, has lost her only employee through employee turnover! \n",
ID);
51 int goods_to_sale = 0;
52 double unit_cost_old, unit_cost_new;
64 if (goods_to_sale != 0) {
65 UNIT_COST = ((
INVENTORY * unit_cost_old) + (PRODUCTION_CURRENT * unit_cost_new) ) / goods_to_sale;
101 printf(
"Firm Id = %d, I = %d, PC = %d, GtoS = %d, S = %d, ES = %d, PP = %d\n",
ID,
INVENTORY, PRODUCTION_CURRENT, goods_to_sale,
SALES,
EXPECTED_SALES,
PRODUCTION_PLAN);
108 filename = malloc(100*
sizeof(
char));
111 if (needed < 1) {needed = 1;}
112 strcpy(filename,
"./outputs/data/Firm_Monthly.txt");
113 file1 = fopen(filename,
"a");
114 fprintf(file1,
"%d %d %f %d %d %d %d %d %d %f\n",
IT_NO,
ID,
WAGE_OFFER,
NO_EMPLOYEES,
EMPLOYEES_NEEDED,
SALES,
INVENTORY, PRODUCTION_CURRENT,
PRODUCTION_PLAN,
UNIT_GOODS_PRICE);
127 printf(
"Warning @firm_production_plan(): A negative production planning occurred Firm ID = %d, previous sales is targeted instead, Sales = %d\n",
ID,
SALES);
164 int capital, labour, units_to_produce;
171 units_to_produce =
min_int(labour, capital);
178 while (units_to_produce > 0) {
179 for(
int i = 0; i<=10; i++) {
180 if (units_to_produce <= 0) {
break;}
184 units_to_produce -=1;
186 if (units_to_produce > 0) {
188 units_to_produce -= 1;
225 int work_in_progress;
238 work_in_progress = 0;
240 for (
int i = 1; i<=11; i++) {
251 if (work_in_progress < maxsize) {
258 if (work_in_progress < 2) {
268 filename = malloc(100*
sizeof(
char));
272 if (needed < 1) {needed = 1;}
273 strcpy(filename,
"./outputs/data/Constructor_Firm_Monthly.txt");
274 file1 = fopen(filename,
"a");
275 fprintf(file1,
"%d %d %f %d %d %d %d %d %d %f\n",
IT_NO,
ID,
WAGE_OFFER,
NO_EMPLOYEES, needed,
SALES,
INVENTORY, last_production,
PRODUCTION_PLAN,
UNIT_HOUSE_PRICE);