Agents in Economic Markets and Games
151
strategies_for_firm
a.id
EQ
m.firm_id
/* Message reading stay exactly the same*/
strategies_for_firm_message=get_first_strategies_for_firm_message();
while(strategies_for_firm_message)
{
if(strategies_for_firm_message->firm_id==ID)
{
for(i=0;i
{
for(j=0;j
{
received_strategies[i].output[j]=
strategies_for_firm_message->
firm_strategies[i].output[j];
}
received_strategies[i].score=strategies_for_firm_message->
firm_strategies[i].score;
}
}
}
strategies_for_firm_message=get_next_strategies_for_firm_message
(strategies_for_firm_message);
}
6.3.3 Comparing Two Data Structures
Two arrays or datatypes can be compared, to see if they carry the same
values or not. This is useful when performing crossover between two parents,
to check if both parents are not the same strategy strings. By using the ‘compare array’ function, if a zero if returned this is true; else 1 means a false.
if(compare_arrays(&received_strategies[i].output,
&FIRM_STRATEGY_MAP[j].output)==0)
{
//true they are the same
...//if 1 is returned, they are two different strings
}
151
/* Message reading stay exactly the same*/
strategies_for_firm_message=get_first_strategies_for_firm_message();
while(strategies_for_firm_message)
{
if(strategies_for_firm_message->firm_id==ID)
{
for(i=0;i
for(j=0;j
received_strategies[i].output[j]=
strategies_for_firm_message->
firm_strategies[i].output[j];
}
received_strategies[i].score=strategies_for_firm_message->
firm_strategies[i].score;
}
}
}
strategies_for_firm_message=get_next_strategies_for_firm_message
(strategies_for_firm_message);
}
6.3.3 Comparing Two Data Structures
Two arrays or datatypes can be compared, to see if they carry the same
values or not. This is useful when performing crossover between two parents,
to check if both parents are not the same strategy strings. By using the ‘compare array’ function, if a zero if returned this is true; else 1 means a false.
if(compare_arrays(&received_strategies[i].output,
&FIRM_STRATEGY_MAP[j].output)==0)
{
//true they are the same
...//if 1 is returned, they are two different strings
}
