public XmlElement asXML(RlModel <StateId_t, Action_t> model, XmlElement parent) { var nodeElement = parent.OwnerDocument.CreateElement("child"); parent.AppendChild(nodeElement); if (m_stats.IsDefined) { nodeElement.SetAttribute("count", m_stats.m_count.ToString()); nodeElement.SetAttribute("mean", m_stats.m_mean.ToString("F3")); } // render the actions var actionsElement = nodeElement.OwnerDocument.CreateElement("actions"); nodeElement.AppendChild(actionsElement); foreach (var action in m_actions) { action.toXML(model, actionsElement); } // render the children foreach (var key in m_childs.Keys) { var childElement = m_childs[key].asXML(model, nodeElement); childElement.SetAttribute("id", key.ToString()); } return(nodeElement); }
public XmlDocument asXML(RlModel <StateId_t, Action_t> model) { var result = new XmlDocument(); var element = result.CreateElement("root"); result.AppendChild(element); m_root.asXML(model, element); return(result); }
public RlNode(RlModel <StateId_t, Action_t> model, int actorId) { Action_t[] actions; model.rlModelGetActions(actorId, out actions); m_actions = new RlAction <StateId_t, Action_t> [actions.Length]; for (int index = 0; index < actions.Length; ++index) { m_actions[index] = new RlAction <StateId_t, Action_t>(actions[index]); } }
public RlSearch(RlModel <StateId_t, Action_t> model) { m_model = model; m_running = false; m_estimateGames = 0; m_evaluateGames = 0; m_avgEstimateGameLength = 0.0f; m_avgEvaluateGameLength = 0.0f; m_avgTreeSize = 0; }
public RlEpisod(RlSearch <StateId_t, Action_t> search, RlModel <StateId_t, Action_t> model, RlTree <StateId_t, Action_t>[] searchTrees, RlSearchParams searchParams) { m_search = search; m_model = model; m_searchModel = m_model.rlModelClone(); m_searchTrees = searchTrees; m_records = new RlRecord[m_model.rlModelGetActorsCount(), searchParams.maxGameLength + 10]; m_recordsCount = new int[m_model.rlModelGetActorsCount()]; m_searchParams = searchParams; //m_searchParams.biasTermConstant = Math.Sqrt(Math.Log(maxGames)); }
public bool AddChild(RlModel <StateId_t, Action_t> model, int actorId, out RlNode <StateId_t, Action_t> result) { StateId_t stateId = model.rlModelStateGetId(); if (m_childs.TryGetValue(stateId, out result)) { return(false); } result = new RlNode <StateId_t, Action_t>(model, actorId); m_childs.Add(stateId, result); return(true); }
public RlNode <StateId_t, Action_t> AddState(RlModel <StateId_t, Action_t> model, int actorId, ref RlNode <StateId_t, Action_t> currentNode) { if (currentNode == null) { currentNode = m_root; } if (currentNode.AddChild(model, actorId, out currentNode)) { m_nodesCount++; } return(currentNode); }
public void toXML(RlModel <StateId_t, Action_t> model, XmlElement parent) { var element = parent.OwnerDocument.CreateElement("action"); parent.AppendChild(element); if (m_stats.IsDefined) { element.SetAttribute("count", m_stats.m_count.ToString()); element.SetAttribute("mean", m_stats.m_mean.ToString("F3")); } else { element.SetAttribute("count", "0"); element.SetAttribute("mean", "-NAN-"); } element.InnerText = model.rlModelActionToString(m_action); }