MCPcopy Create free account
hub / github.com/bytedance/Fastbot_Android / selectNewAction

Method selectNewAction

native/agent/ModelReusableAgent.cpp:248–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246
247
248 ActionPtr ModelReusableAgent::selectNewAction() {
249 ActionPtr action = nullptr;
250 action = this->selectUnperformedActionNotInReuseModel();
251 if (nullptr != action) {
252 BLOG("%s", "select action not in reuse model");
253 return action;
254 }
255
256 action = this->selectUnperformedActionInReuseModel();
257 if (nullptr != action) {
258 BLOG("%s", "select action in reuse model");
259 return action;
260 }
261
262 action = this->_newState->randomPickUnvisitedAction();
263 if (nullptr != action) {
264 BLOG("%s", "select action in unvisited action");
265 return action;
266 }
267
268 // if all the actions are explored, use those two methods to generate new action based on q value.
269 // there are two methods to choose from.
270 // based on q value and a uniform distribution, select an action with the highest value.
271 action = this->selectActionByQValue();
272 if (nullptr != action) {
273 BLOG("%s", "select action by qvalue");
274 return action;
275 }
276
277 // use the traditional epsilon greedy strategy to choose the next action.
278 action = this->selectNewActionEpsilonGreedyRandomly();
279 if (nullptr != action) {
280 BLOG("%s", "select action by EpsilonGreedyRandom");
281 return action;
282 }
283 BLOGE("null action happened , handle null action");
284 return handleNullAction();
285 }
286
287 /// Randomly choose an action that is not been visited before, which belongs to the following type:
288 /// BACK,

Callers 1

resolveNewActionMethod · 0.80

Tested by

no test coverage detected