Manager_farmers Class Reference

Derived class to explicitelly model the manager of farmer agents. More...

#include <Manager_farmers.h>

Inheritance diagram for Manager_farmers:

Inheritance graph
[legend]
Collaboration diagram for Manager_farmers:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Manager_farmers (ThreadManager *MTHREAD_h, string name_h)
 ~Manager_farmers ()
virtual void setAgentMoulds ()
 "prepare" the farmer moulds
virtual void riseMyAgents ()
 get the real agents out of the mould
virtual void locateMyAgents ()
 locate farmers in the space and allocate them plots.
virtual void createBehaviours ()
 create the decision matrix on each agent
virtual void prepare ()
 update liquidity, renting and investment decisions
virtual void landAllocation ()
 renting decisions
void calibrateLandValues ()
 calculate the renting sh price of owned plots
double quotePlot (Pixel *plot)
 return the renting value of an individual plot. This Function should be move to a more agent-type neutral class, allowing competition from different agent types.
virtual void act ()
 production
virtual void update ()
 update agents' status variables
virtual void planNext ()
 decision if continue or leave
virtual void removeFromModel (Agent_farmer *agent_h)
 remove agent from list and do some clean-up
virtual void endInit ()
 here we do some nice stuff before the simulation finally start...
virtual void assignPlot (Pixel *plot_h, Agent_space *agent_h, double rentalCost=0, int assignmentType=PLOTS_RENTED)
 Assign a plot to a specific agent.
double getAverageRightsByAct (int mouldCounter=-1)

Protected Attributes

vector< vector< double > > sumOfRightsOfDeadAgents
vector< vector< double > > sumOfHaOfDeadAgents

Detailed Description

Derived class to explicitelly model the manager of farmer agents.

This is the interface agent_side and it derive from class agentManager. \ It implement all the APIs with the specific target of the farmer agents. \

Author:
Antonello Lobianco

Definition at line 45 of file Manager_farmers.h.


Constructor & Destructor Documentation

Manager_farmers ( ThreadManager MTHREAD_h,
string  name_h 
)

Definition at line 35 of file Manager_farmers.cpp.

~Manager_farmers (  ) 

Definition at line 41 of file Manager_farmers.cpp.


Member Function Documentation

void setAgentMoulds (  )  [virtual]

"prepare" the farmer moulds

This function load the agent mould from a file and place them in the vector agentsMoulds.

See also:
Manager_base::setAgentMoulds()

Implements Manager_space.

Definition at line 52 of file Manager_farmers.cpp.

void riseMyAgents (  )  [virtual]

get the real agents out of the mould

This reimplemented function create the agents from their mould, applying to each of the mould their coefficient and place the (actual) agents to the vector managedAgents.

See also:
Manager_base::riseMyAgents()

Implements Manager_base.

Definition at line 146 of file Manager_farmers.cpp.

void locateMyAgents (  )  [virtual]

locate farmers in the space and allocate them plots.

Implements Manager_base.

Definition at line 179 of file Manager_farmers.cpp.

void createBehaviours (  )  [virtual]

create the decision matrix on each agent

Implements Manager_base.

Definition at line 390 of file Manager_farmers.cpp.

void prepare (  )  [virtual]

update liquidity, renting and investment decisions

Implements Manager_base.

Definition at line 429 of file Manager_farmers.cpp.

void landAllocation (  )  [virtual]

renting decisions

landAllocation is one of the most important functions.
Here we allocate the free plots to the individual farmers.
We collect the X closest farms to the free plot and we gonna ask each to bid for it. Then we collect the results and assign the plot to the highest bidder at the second-best bid.

Implements Manager_space.

Definition at line 460 of file Manager_farmers.cpp.

Referenced by prepare().

Here is the caller graph for this function:

void calibrateLandValues (  ) 

calculate the renting sh price of owned plots

On the first simulation year we calibrate the rental value of each owned plots as a coefficient in comparision of the average rental price. We need rental value shadow price to value the shadow price of owned land for farmers that may wish to get rid of farming activities but it is too computationally expensive to calculate it each year so we do it only the firt year and then we base on the avg rental costs*this coefficient.

Definition at line 742 of file Manager_farmers.cpp.

Referenced by prepare().

Here is the caller graph for this function:

double quotePlot ( Pixel plot  ) 

return the renting value of an individual plot. This Function should be move to a more agent-type neutral class, allowing competition from different agent types.

Definition at line 782 of file Manager_farmers.cpp.

Referenced by calibrateLandValues().

Here is the caller graph for this function:

void act (  )  [virtual]

production

Implements Manager_base.

Definition at line 831 of file Manager_farmers.cpp.

void update (  )  [virtual]

update agents' status variables

Implements Manager_base.

Definition at line 848 of file Manager_farmers.cpp.

void planNext (  )  [virtual]

decision if continue or leave

Implements Manager_base.

Definition at line 867 of file Manager_farmers.cpp.

void removeFromModel ( Agent_farmer agent_h  )  [virtual]

remove agent from list and do some clean-up

Definition at line 913 of file Manager_farmers.cpp.

Referenced by planNext().

Here is the caller graph for this function:

void endInit (  )  [virtual]

here we do some nice stuff before the simulation finally start...

This function is used to perform any various task to be done before the simulation start

Reimplemented from Manager_base.

Definition at line 412 of file Manager_farmers.cpp.

void assignPlot ( Pixel plot_h,
Agent_space agent_h,
double  rentalCost = 0,
int  assignmentType = PLOTS_RENTED 
) [virtual]

Assign a plot to a specific agent.

Parameters:
assignmentType,: plot type: PLOTS_OWNED, PLOTS_RENTED(d)

Implements Manager_space.

Definition at line 882 of file Manager_farmers.cpp.

Referenced by landAllocation(), and locateMyAgents().

Here is the caller graph for this function:

double getAverageRightsByAct ( int  actMouldCounter = -1  ) 

Return the regional rights for decoupling by (optional) activity Changed 2008.02.07: do not return the plenty rights, but those already filtered by the share of rights that are returned by each activity (e.g. 0.93)

Parameters:
actMouldCounter counter of the activity mould in the regional vector. Default to -1, means to all the moulds

Definition at line 971 of file Manager_farmers.cpp.


Member Data Documentation

vector< vector<double> > sumOfRightsOfDeadAgents [protected]

Definition at line 69 of file Manager_farmers.h.

Referenced by endInit(), getAverageRightsByAct(), and removeFromModel().

vector< vector<double> > sumOfHaOfDeadAgents [protected]

Definition at line 70 of file Manager_farmers.h.

Referenced by endInit(), getAverageRightsByAct(), and removeFromModel().


The documentation for this class was generated from the following files: