iLand
agent.h
Go to the documentation of this file.
1#ifndef AGENT_H
2#define AGENT_H
3
4#include <QJSValue>
5#include "scheduler.h"
6
7namespace ABE {
8
9
10class AgentType; // forward
11class FMUnit; // forward
12
13/********************************************************************************************
14** iLand - an individual based forest landscape and disturbance model
15** http://iland-model.org
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
34class Agent
35{
36public:
37 Agent(AgentType *type, QJSValue js);
38 AgentType *type() const {return mType; }
39 QString name() const { return mName; }
40 void setName(const QString &name);
41 QJSValue jsAgent() const { return mJSAgent; }
42 const SchedulerOptions &schedulerOptions() const { return mSchedulerOptions; }
43
45 void addUnit(FMUnit *unit) {mUnits.push_back(unit);}
46
47
48 // agent properties
49 double useSustainableHarvest() const;
50
51 void setup();
52private:
53 static int mAgentsCreated;
54 // link to the base agent type
55 AgentType *mType;
56 // the javascript object representing the agent:
57 QJSValue mJSAgent;
58 SchedulerOptions mSchedulerOptions;
59 QVector<FMUnit*> mUnits;
60
61 // agent properties
62 QString mName;
63 double mKnowledge;
64 double mEconomy;
65 double mExperimentation;
66 double mAltruism;
67 double mRisk;
68
69};
70
71} // namespace
72#endif // AGENT_H
The Agent is the core element of the agent based forest management model and simulates a foresters de...
Definition: agent.h:35
void setName(const QString &name)
Definition: agent.cpp:46
void addUnit(FMUnit *unit)
add a unit to the list of managed units
Definition: agent.h:45
void setup()
Definition: agent.cpp:57
QString name() const
Definition: agent.h:39
AgentType * type() const
Definition: agent.h:38
double useSustainableHarvest() const
Definition: agent.cpp:52
const SchedulerOptions & schedulerOptions() const
Definition: agent.h:42
QJSValue jsAgent() const
Definition: agent.h:41
Agent(AgentType *type, QJSValue js)
Definition: agent.cpp:38
AgentType is the archtype agent including the agents decision logic.
Definition: agenttype.h:72
The FMUnit represents a management unit, i.e.
Definition: fmunit.h:32
Definition: abegrid.h:22
SchedulerOptions store agent-specific options.
Definition: scheduler.h:34