MultiAgentDecisionProcess
Release 0.2.1
Main Page
Namespaces
Classes
Files
File List
File Members
PolicyDiscrete.cpp
Go to the documentation of this file.
1
28
#include "
PolicyDiscrete.h
"
29
#include <stdlib.h>
30
31
32
Index
PolicyDiscrete::SampleAction
(
Index
i )
const
33
{
34
size_t
nrA =
GetInterfacePTPDiscrete
()->
GetNrActions
(
_m_agentI
);
35
double
randNr= ((double)rand()) / (RAND_MAX + 1.0);
36
double
sum=0;
37
Index
selected_a=0;
38
39
for
(
Index
a=0; a<nrA; a++)
40
{
41
sum+=
GetActionProb
(i, a);
42
if
(randNr<=sum)
43
{
44
selected_a=a;
45
break
;
46
}
47
}
48
return
(selected_a);
49
}
src
support
PolicyDiscrete.cpp
Generated on Mon Sep 23 2013 14:50:06 for MultiAgentDecisionProcess by
1.8.1.2