public override void PostSimulationStep() { // prepare for new inference of motivaiton from the hierarchy base.PostSimulationStep(); base.m_motivatonSource.MakeStep(); m_prev_st = Ds.GetCurrentState(); this.m_newVariables.Clear(); }
public void Learn() { int[] s_tt = Ds.GetCurrentState(); float r_t = Ds.GetReward(); int a_t = Ds.GetLastExecutedAction(); if (a_t == this.m_prevSelectedAction) { base.SetJustExecuted(true); } if (a_t < 0) { // aciton ignored and nothing happened if (r_t == 0) { return; } // action adding, reward received as a result of unknown action List <int> toBeAdded = Ds.GetLastExecutedActions(); this.PerformActionAdding(toBeAdded); return; } if (m_setup.OnlineSubspaceVariables) { m_mlvh.monitorVariableChanges(this); } LearningAlgorithm.Learn(r_t, s_tt, a_t); if (r_t > 0) { // SRP is also an action, if the reward is received means that it just has been executed base.SetJustExecuted(true); this.ResetMotivationSource(); m_mlvh.performOnlineVariableRemoving(this); } }
public float[] SelectAction() { int[] s_tt = Ds.GetCurrentState(); float[] utils; // use own asm to select one action? if (m_setup.UseHierarchicalASM) { utils = this.Rescale(m_asm.SelectAction(Mem.ReadData(s_tt))); } else { utils = this.Rescale(Mem.ReadData(s_tt)); } if (m_setup.PropagateUtilitiesInHierarchy) { float myMot = this.GetMyTotalMotivation(); Ds.PromoteUtilitiesToChilds(utils, myMot); } this.MarkSelection(utils); return(utils); }