144
X-Machines for Agent-Based Modeling: FLAME Perspectives
01
02
priceP
Firm_optimise
02
03
/* The Firm Agent Functions**/
#include "header.h"
#include "my_library_header.h"
#include "Firm_agent_header.h"
#include
int Firm_select_strategy()
{
int counter=0; //to count empty strategies
int counter_j=0;//to count inside strategy
strategy_array temp_good_strategies;
init_strategy_array(&temp_good_strategies);
strategy_array temp_cum_fitness;
init_strategy_array(&temp_cum_fitness);
strategy_array new_strategies;
init_strategy_array(&new_strategies);
int new=0;
double lowest=0.0;
int pos=0;
int temp_size=0;
double sum=0.0, sum_prob=0.0;
double start_ptr=0.0;
int i,j,l;
int strategy_chosen_flag=0;
strategy received_strategies[5];
int FirmStrategySize=10;
//choose one of the good strategies in my database
//using roulette wheel selection
for(i=0;i
{
if(FIRM_STRATEGY_MAP[i].score>0.0)
{
//only consider strategies which have more than 0 scores
add_strategy(&temp_good_strategies,&FIRM_STRATEGY_MAP[i].output[0],
X-Machines for Agent-Based Modeling: FLAME Perspectives
/* The Firm Agent Functions**/
#include "header.h"
#include "my_library_header.h"
#include "Firm_agent_header.h"
#include
int Firm_select_strategy()
{
int counter=0; //to count empty strategies
int counter_j=0;//to count inside strategy
strategy_array temp_good_strategies;
init_strategy_array(&temp_good_strategies);
strategy_array temp_cum_fitness;
init_strategy_array(&temp_cum_fitness);
strategy_array new_strategies;
init_strategy_array(&new_strategies);
int new=0;
double lowest=0.0;
int pos=0;
int temp_size=0;
double sum=0.0, sum_prob=0.0;
double start_ptr=0.0;
int i,j,l;
int strategy_chosen_flag=0;
strategy received_strategies[5];
int FirmStrategySize=10;
//choose one of the good strategies in my database
//using roulette wheel selection
for(i=0;i
if(FIRM_STRATEGY_MAP[i].score>0.0)
{
//only consider strategies which have more than 0 scores
add_strategy(&temp_good_strategies,&FIRM_STRATEGY_MAP[i].output[0],
