コード例 #1
0
        public void Put(Vector env, Vector gesture, double evaluation)
        {
            SceneItem item = Get(env);

            if (item == null)
            {
                item = new SceneItem(env, gesture, evaluation);
                items.Add(item);
            }
            else
            {
                item.evaluation = evaluation;
            }
        }
コード例 #2
0
        /// <summary>
        /// 对环境做出评估
        /// Agent对环境有个好恶,该好恶与目标任务无关,只与它在环境中接收的奖励或惩罚有关
        ///
        /// </summary>
        /// <returns></returns>
        private double doEvaluateEnviornment(int time, PolicyState policyState)
        {
            var    obs = net.GetReceoptorSplit();
            Vector env = obs.env;


            //在记忆库中查找当前环境
            SceneItem sceneItem = this.scene.GetMatched(env);

            if (sceneItem != null)
            {
                policyState.AddEnviormentEvaluation(0, env, sceneItem.evaluation);
                return(sceneItem.evaluation);
            }

            double forcastReward = net.DoForcastReward(time, obs.gesture, env, 3, 0);

            policyState.AddEnviormentEvaluation(1, env, forcastReward);
            return(forcastReward);
        }