Agent_space.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2006-2008 by Antonello Lobianco                         *
00003  *   http://regmas.org                                                     *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 3 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef AGENTSPACE_H
00021 #define AGENTSPACE_H
00022 
00023 // standard headers
00024 #include <string>
00025 #include <vector>
00026 #include <stdexcept>
00027 #include <iostream>
00028 #include <sstream>
00029 #include <algorithm>
00030 
00031 // regmas headers
00032 #include "Agent_base.h"
00033 
00035 
00043 class Agent_space : public Agent_base{
00044 
00045 public:
00046                                 Agent_space(ThreadManager* MTHREAD_h, Manager_base* manager_h); 
00047                                 Agent_space(ThreadManager* MTHREAD_h, int uniqueID_h, Manager_base* manager_h);
00048                                ~Agent_space();
00049 
00051     int                         uncompletePlotDotation (int landCode_h, int ptype=PLOTS_ALL);
00053     vector <Pixel *>            getPlots(int ptype=PLOTS_ALL, int landCode_h = 0);
00055     int                         getNPlots(int ptype=PLOTS_ALL, int landCode_h = 0);
00056     virtual int                 countMyObjects();
00057     double                      getDistance(const Pixel* px1); 
00058     double                      getLandCapital(){return landCapital;};
00059     virtual void                update()=0;
00060     virtual void                payInitialYearCosts();
00061     void                        freeLand();
00062 
00063 
00064     // member data interface...
00065     virtual map<int,double>     getInitialOwnedPlots(){return initialOwnedPlots;};
00066     virtual map<int,double>     getInitialRentedPlots(){return initialRentedPlots;};
00067     int                         getHomeLandUseCode(){return homeLandUseCode;};
00068     Pixel*                      getHomePlot(){return homePlot;};
00069     virtual double              getLandShPrice(){return landShPrice;};
00070 
00071     void                        setHomeLandUseCode(int homeLandUseCode_h){homeLandUseCode = homeLandUseCode_h;};
00072     virtual void                setInitialOwnedPlots(
00073                                     map<int,double> initialOwnedPlots_h){initialOwnedPlots=initialOwnedPlots_h;};
00074     virtual void                setInitialRentedPlots(
00075                                     map<int,double> initialRentedPlots_h){initialRentedPlots=initialRentedPlots_h;};
00076     virtual void                setHomePlot(Pixel* plot_h){homePlot = plot_h;};
00077     void                        addPlotToOwnedList(Pixel* px_h){ownedPlots.push_back(px_h);};
00078     void                        addPlotToRentedList(Pixel* px_h){rentedPlots.push_back(px_h);};
00079     void                        addPlotToMIP(Pixel* px_h){OPT.addPixel(px_h);};
00080     void                        setLandCapital(double landCapital_h){landCapital = landCapital_h;};
00081 
00082 protected:
00083     Pixel *                             homePlot;
00084     map<int,double>            initialOwnedPlots;
00085     map<int,double>           initialRentedPlots;
00086     vector <Pixel *>                  ownedPlots;
00087     vector <Pixel *>                 rentedPlots;
00089     int                          homeLandUseCode;
00090     double                           landCapital; 
00091     double                           landShPrice; 
00092 
00093 };
00094 
00095 #endif