MultiAgentDecisionProcess
Release 0.2.1
Main Page
Namespaces
Classes
Files
File List
File Members
MultiAgentDecisionProcess.cpp
Go to the documentation of this file.
1
28
#include "
MultiAgentDecisionProcess.h
"
29
30
using namespace
std;
31
32
#define DEBUG_MADP 0
33
34
MultiAgentDecisionProcess::MultiAgentDecisionProcess
(
size_t
nrAgents,
35
string
name,
string
description,
string
pf) :
36
NamedDescribedEntity
(name, description),
37
_m_nrAgents(nrAgents),
38
_m_problemFile(pf)
39
{
40
InitializeUnixName
();
41
}
42
43
MultiAgentDecisionProcess::MultiAgentDecisionProcess
(
44
string
name,
string
description,
string
pf) :
45
NamedDescribedEntity
(name, description),
46
_m_nrAgents(0),
47
_m_problemFile(pf)
48
{
49
InitializeUnixName
();
50
}
51
52
void
MultiAgentDecisionProcess::InitializeUnixName
()
53
{
54
// strip everything before and including the last /
55
string
unixName=
_m_problemFile
.substr(
_m_problemFile
.find_last_of(
'/'
) + 1);
56
57
// and after the last .
58
_m_unixName
=unixName.substr(0,unixName.find_last_of(
'.'
));
59
}
60
61
MultiAgentDecisionProcess::~MultiAgentDecisionProcess
()
62
{
63
_m_problemFile
.clear();
64
}
65
66
size_t
MultiAgentDecisionProcess::GetNrAgents
()
const
67
{
68
return
(
_m_nrAgents
);
69
}
70
71
void
MultiAgentDecisionProcess::SetNrAgents
(
size_t
nrAgents)
72
{
73
_m_nrAgents
= nrAgents;
74
_m_agents
.clear();
75
for
(
Index
i = 0; i < nrAgents; i++)
76
_m_agents
.push_back(
Agent
(i));
77
}
78
79
void
MultiAgentDecisionProcess::AddAgent
(
string
name)
80
{
81
_m_agents
.push_back(
Agent
(
_m_nrAgents
++, name) );
82
}
83
84
85
string
MultiAgentDecisionProcess::GetProblemFile
()
const
86
{
87
return
(
_m_problemFile
);
88
}
89
90
string
MultiAgentDecisionProcess::SoftPrint
()
const
91
{
92
stringstream ss;
93
ss <<
"Problem:"
<<
GetName
()<< endl;
94
ss <<
"descr.:"
<<
GetDescription
() << endl;
95
ss <<
"nrAgents="
<<
_m_nrAgents
<< endl;
96
ss <<
"problem file="
<<
_m_problemFile
<< endl;
97
return
(ss.str());
98
}
src
base
MultiAgentDecisionProcess.cpp
Generated on Mon Sep 23 2013 14:50:05 for MultiAgentDecisionProcess by
1.8.1.2