diff options
author | Fabian Oehlmann <oehlmann@in.tum.de> | 2014-01-03 13:12:47 +0000 |
---|---|---|
committer | Fabian Oehlmann <oehlmann@in.tum.de> | 2014-01-03 13:12:47 +0000 |
commit | e3a638a83534cf52c353a67e750d024545096184 (patch) | |
tree | fbeb509e2ad40e6a5a982fe3a9a5a6665007ebf6 /src | |
parent | 6af4c1d1b29d08490b936946ab01e377d3b62240 (diff) | |
download | gnunet-e3a638a83534cf52c353a67e750d024545096184.tar.gz gnunet-e3a638a83534cf52c353a67e750d024545096184.zip |
minor softmax eligibility traces fix
Diffstat (limited to 'src')
-rwxr-xr-x | src/ats/plugin_ats_ril.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ats/plugin_ats_ril.c b/src/ats/plugin_ats_ril.c index a57c2068b..eba687d75 100755 --- a/src/ats/plugin_ats_ril.c +++ b/src/ats/plugin_ats_ril.c | |||
@@ -1238,11 +1238,14 @@ static int | |||
1238 | agent_select_softmax (struct RIL_Peer_Agent *agent, double *state) | 1238 | agent_select_softmax (struct RIL_Peer_Agent *agent, double *state) |
1239 | { | 1239 | { |
1240 | int i; | 1240 | int i; |
1241 | int a_max; | ||
1241 | double eqt[agent->n]; | 1242 | double eqt[agent->n]; |
1242 | double p[agent->n]; | 1243 | double p[agent->n]; |
1243 | double sum = 0; | 1244 | double sum = 0; |
1244 | double r; | 1245 | double r; |
1245 | 1246 | ||
1247 | a_max = agent_get_action_best(agent, state); | ||
1248 | |||
1246 | for (i=0; i<agent->n; i++) | 1249 | for (i=0; i<agent->n; i++) |
1247 | { | 1250 | { |
1248 | eqt[i] = exp(agent_estimate_q(agent,state,i) / agent->envi->parameters.temperature); | 1251 | eqt[i] = exp(agent_estimate_q(agent,state,i) / agent->envi->parameters.temperature); |
@@ -1261,7 +1264,10 @@ agent_select_softmax (struct RIL_Peer_Agent *agent, double *state) | |||
1261 | { | 1264 | { |
1262 | if (RIL_ALGO_Q == agent->envi->parameters.algorithm) | 1265 | if (RIL_ALGO_Q == agent->envi->parameters.algorithm) |
1263 | { | 1266 | { |
1264 | agent_modify_eligibility(agent, RIL_E_UPDATE, NULL, i); | 1267 | if (i == a_max) |
1268 | agent_modify_eligibility(agent, RIL_E_UPDATE, NULL, i); | ||
1269 | else | ||
1270 | agent_modify_eligibility(agent, RIL_E_ZERO, NULL, -1); | ||
1265 | } | 1271 | } |
1266 | return i; | 1272 | return i; |
1267 | } | 1273 | } |