Rev 1221 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
811 | werner | 1 | #ifndef AGENT_H |
2 | #define AGENT_H |
||
3 | |||
938 | werner | 4 | #include <QJSValue> |
939 | werner | 5 | #include "scheduler.h" |
938 | werner | 6 | |
905 | werner | 7 | namespace ABE { |
870 | werner | 8 | |
9 | |||
811 | werner | 10 | class AgentType; // forward |
939 | werner | 11 | class FMUnit; // forward |
811 | werner | 12 | |
1033 | werner | 13 | /******************************************************************************************** |
14 | ** iLand - an individual based forest landscape and disturbance model |
||
15 | ** http://iland.boku.ac.at |
||
16 | ** Copyright (C) 2009- Werner Rammer, Rupert Seidl |
||
17 | ** |
||
18 | ** This program is free software: you can redistribute it and/or modify |
||
19 | ** it under the terms of the GNU General Public License as published by |
||
20 | ** the Free Software Foundation, either version 3 of the License, or |
||
21 | ** (at your option) any later version. |
||
22 | ** |
||
23 | ** This program is distributed in the hope that it will be useful, |
||
24 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
25 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
26 | ** GNU General Public License for more details. |
||
27 | ** |
||
28 | ** You should have received a copy of the GNU General Public License |
||
29 | ** along with this program. If not, see <http://www.gnu.org/licenses/>. |
||
30 | ********************************************************************************************/ |
||
31 | |||
811 | werner | 32 | /** The Agent is the core element of the agent based forest management model and simulates |
33 | * a foresters decisions. */ |
||
34 | class Agent |
||
35 | { |
||
36 | public: |
||
938 | werner | 37 | Agent(AgentType *type, QJSValue js); |
873 | werner | 38 | AgentType *type() const {return mType; } |
938 | werner | 39 | QString name() const { return mName; } |
40 | void setName(const QString &name); |
||
41 | QJSValue jsAgent() const { return mJSAgent; } |
||
939 | werner | 42 | const SchedulerOptions &schedulerOptions() const { return mSchedulerOptions; } |
43 | |||
44 | /// add a unit to the list of managed units |
||
45 | void addUnit(FMUnit *unit) {mUnits.push_back(unit);} |
||
46 | |||
47 | |||
915 | werner | 48 | // agent properties |
921 | werner | 49 | double useSustainableHarvest() const; |
811 | werner | 50 | |
939 | werner | 51 | void setup(); |
811 | werner | 52 | private: |
938 | werner | 53 | static int mAgentsCreated; |
811 | werner | 54 | // link to the base agent type |
873 | werner | 55 | AgentType *mType; |
938 | werner | 56 | // the javascript object representing the agent: |
57 | QJSValue mJSAgent; |
||
939 | werner | 58 | SchedulerOptions mSchedulerOptions; ///< agent specific scheduler options |
59 | QVector<FMUnit*> mUnits; ///< list of units managed by the agent |
||
60 | |||
811 | werner | 61 | // agent properties |
938 | werner | 62 | QString mName; |
811 | werner | 63 | double mKnowledge; |
64 | double mEconomy; |
||
65 | double mExperimentation; |
||
66 | double mAltruism; |
||
67 | double mRisk; |
||
68 | |||
69 | }; |
||
70 | |||
870 | werner | 71 | } // namespace |
811 | werner | 72 | #endif // AGENT_H |