Agent_space Class Reference

Base class for spaciallly-located agents. More...

#include <Agent_space.h>

Inheritance diagram for Agent_space:

Inheritance graph
[legend]
Collaboration diagram for Agent_space:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Agent_space (ThreadManager *MTHREAD_h, Manager_base *manager_h)
 Constructor.
 Agent_space (ThreadManager *MTHREAD_h, int uniqueID_h, Manager_base *manager_h)
 ~Agent_space ()
int uncompletePlotDotation (int landCode_h, int ptype=PLOTS_ALL)
 Return the number of plots to complete the initial dotation.
vector< Pixel * > getPlots (int ptype=PLOTS_ALL, int landCode_h=0)
 Return pointer to the plots owned or rented by the agent (eventually by type).
int getNPlots (int ptype=PLOTS_ALL, int landCode_h=0)
 Return number of owned/rented plots by type.
virtual int countMyObjects ()
double getDistance (const Pixel *px1)
 distance in meters from the homePlot
double getLandCapital ()
virtual void update ()=0
virtual void payInitialYearCosts ()
 Pay the initial costs for the year coming (suckCosts: rental costs and maintainance costs).
void freeLand ()
virtual map< int, double > getInitialOwnedPlots ()
virtual map< int, double > getInitialRentedPlots ()
int getHomeLandUseCode ()
PixelgetHomePlot ()
virtual double getLandShPrice ()
void setHomeLandUseCode (int homeLandUseCode_h)
virtual void setInitialOwnedPlots (map< int, double > initialOwnedPlots_h)
virtual void setInitialRentedPlots (map< int, double > initialRentedPlots_h)
virtual void setHomePlot (Pixel *plot_h)
void addPlotToOwnedList (Pixel *px_h)
void addPlotToRentedList (Pixel *px_h)
void addPlotToMIP (Pixel *px_h)
void setLandCapital (double landCapital_h)

Protected Attributes

PixelhomePlot
map< int, double > initialOwnedPlots
map< int, double > initialRentedPlots
vector< Pixel * > ownedPlots
vector< Pixel * > rentedPlots
int homeLandUseCode
 Land use code where the "home" has to be place (urban or a specific agricultural land type).
double landCapital
 Value of owned land.
double landShPrice
 Shadow price of the owned land (sum of rental prices).

Detailed Description

Base class for spaciallly-located agents.

This is the base class for each derived agent WITH spaccially explicit carachteristics:
Agent_base --> Agent_nospace --> ...
Agent_base --> Agent_space --> ...

Author:
Antonello Lobianco

Definition at line 43 of file Agent_space.h.


Constructor & Destructor Documentation

Agent_space ( ThreadManager MTHREAD_h,
Manager_base manager_h 
)

Constructor.

Definition at line 26 of file Agent_space.cpp.

Agent_space ( ThreadManager MTHREAD_h,
int  uniqueID_h,
Manager_base manager_h 
)

Definition at line 30 of file Agent_space.cpp.

~Agent_space (  ) 

Definition at line 38 of file Agent_space.cpp.


Member Function Documentation

int uncompletePlotDotation ( int  landCode_h,
int  ptype = PLOTS_ALL 
)

Return the number of plots to complete the initial dotation.

Parameters:
ptype type: PLOTS_ALL(d), PLOTS_OWNED, PLOTS_RENTED

Definition at line 43 of file Agent_space.cpp.

Referenced by Manager_farmers::locateMyAgents().

Here is the caller graph for this function:

vector< Pixel * > getPlots ( int  ptype = PLOTS_ALL,
int  landCode_h = 0 
)

Return pointer to the plots owned or rented by the agent (eventually by type).

Parameters:
ptype Type of returned plots: PLOTS_ALL(d), PLOTS_OWNED, PLOTS_RENTED
landCode_h Land use code of returned plots. If 0 all landTypes are returned

Definition at line 79 of file Agent_space.cpp.

Referenced by Agent_base::answerStats(), Agent_base::getAvailableObjects(), getNPlots(), Agent_base::getOwnedObjects(), Manager_farmers::removeFromModel(), Opt::updateActivities(), and Opt::updateResourceNames().

Here is the caller graph for this function:

int getNPlots ( int  ptype = PLOTS_ALL,
int  landCode_h = 0 
) [virtual]

Return number of owned/rented plots by type.

Parameters:
ptype Type of returned plots: PLOTS_ALL(d), PLOTS_OWNED, PLOTS_RENTED
landCode_h Land use code of returned plots. If 0 all landTypes are returned

Reimplemented from Agent_base.

Definition at line 113 of file Agent_space.cpp.

Referenced by Opt::addPixel().

Here is the caller graph for this function:

int countMyObjects (  )  [virtual]

Reimplemented from Agent_base.

Definition at line 135 of file Agent_space.cpp.

double getDistance ( const Pixel px1  ) 

distance in meters from the homePlot

Definition at line 144 of file Agent_space.cpp.

Referenced by Agent_farmer::getAgrDistCost().

Here is the caller graph for this function:

double getLandCapital (  )  [inline, virtual]

Reimplemented from Agent_base.

Definition at line 58 of file Agent_space.h.

Referenced by Agent_base::answerStats().

Here is the caller graph for this function:

virtual void update (  )  [pure virtual]

Implements Agent_base.

Implemented in Agent_farmer.

void payInitialYearCosts (  )  [virtual]

Pay the initial costs for the year coming (suckCosts: rental costs and maintainance costs).

Implements Agent_base.

Definition at line 149 of file Agent_space.cpp.

void freeLand (  ) 

This function free the land rented and owned by the leaving agents. Plots are marked again as "available". While the rentedPlots array is cleared, the ownedPlots one is kept untouched, so we can eventually still refear to the original plots owned by the agent.

Definition at line 165 of file Agent_space.cpp.

Referenced by Manager_farmers::removeFromModel().

Here is the caller graph for this function:

virtual map<int,double> getInitialOwnedPlots (  )  [inline, virtual]

Definition at line 65 of file Agent_space.h.

virtual map<int,double> getInitialRentedPlots (  )  [inline, virtual]

Definition at line 66 of file Agent_space.h.

int getHomeLandUseCode (  )  [inline]

Definition at line 67 of file Agent_space.h.

Pixel* getHomePlot (  )  [inline]

Definition at line 68 of file Agent_space.h.

Referenced by Agent_base::answerStats(), and Manager_farmers::removeFromModel().

Here is the caller graph for this function:

virtual double getLandShPrice (  )  [inline, virtual]

Reimplemented from Agent_base.

Definition at line 69 of file Agent_space.h.

void setHomeLandUseCode ( int  homeLandUseCode_h  )  [inline]

Definition at line 71 of file Agent_space.h.

virtual void setInitialOwnedPlots ( map< int, double >  initialOwnedPlots_h  )  [inline, virtual]

Definition at line 72 of file Agent_space.h.

virtual void setInitialRentedPlots ( map< int, double >  initialRentedPlots_h  )  [inline, virtual]

Definition at line 74 of file Agent_space.h.

virtual void setHomePlot ( Pixel plot_h  )  [inline, virtual]

Definition at line 76 of file Agent_space.h.

void addPlotToOwnedList ( Pixel px_h  )  [inline]

Definition at line 77 of file Agent_space.h.

Referenced by Manager_farmers::assignPlot().

Here is the caller graph for this function:

void addPlotToRentedList ( Pixel px_h  )  [inline]

Definition at line 78 of file Agent_space.h.

Referenced by Manager_farmers::assignPlot().

Here is the caller graph for this function:

void addPlotToMIP ( Pixel px_h  )  [inline]

Definition at line 79 of file Agent_space.h.

Referenced by Manager_farmers::assignPlot().

Here is the caller graph for this function:

void setLandCapital ( double  landCapital_h  )  [inline]

Definition at line 80 of file Agent_space.h.


Member Data Documentation

Pixel* homePlot [protected]

Definition at line 80 of file Agent_space.h.

Referenced by Agent_space(), getDistance(), getHomePlot(), and setHomePlot().

map<int,double> initialOwnedPlots [protected]

Definition at line 84 of file Agent_space.h.

Referenced by getInitialOwnedPlots(), setInitialOwnedPlots(), and uncompletePlotDotation().

map<int,double> initialRentedPlots [protected]

Definition at line 85 of file Agent_space.h.

Referenced by getInitialRentedPlots(), setInitialRentedPlots(), and uncompletePlotDotation().

vector<Pixel *> ownedPlots [protected]

Definition at line 86 of file Agent_space.h.

Referenced by addPlotToOwnedList(), countMyObjects(), freeLand(), getNPlots(), getPlots(), Agent_farmer::getUAA(), Agent_farmer::leaveActivity(), and uncompletePlotDotation().

vector<Pixel *> rentedPlots [protected]

Definition at line 87 of file Agent_space.h.

Referenced by addPlotToRentedList(), freeLand(), getNPlots(), getPlots(), Agent_farmer::getUAA(), payInitialYearCosts(), uncompletePlotDotation(), and Agent_farmer::update().

int homeLandUseCode [protected]

Land use code where the "home" has to be place (urban or a specific agricultural land type).

Definition at line 89 of file Agent_space.h.

Referenced by getHomeLandUseCode(), and setHomeLandUseCode().

double landCapital [protected]

Value of owned land.

Definition at line 90 of file Agent_space.h.

Referenced by getLandCapital(), and setLandCapital().

double landShPrice [protected]

Shadow price of the owned land (sum of rental prices).

Definition at line 91 of file Agent_space.h.

Referenced by getLandShPrice(), and Agent_farmer::leaveActivity().


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