Esempio n. 1
0
        private void DebugPlan(INode <T> node, INode <T> parent)
        {
            if (!debugPlan)
            {
                return;
            }
            if (debugger == null)
            {
                debugger = new PlanDebugger();
            }

            string nodeStr = string.Format(@"{0} [label=<
<table border='0' color='black' fontcolor='#F5F5F5'>
    <tr> <td colspan='2'><b>{4}</b></td> </tr>
    <hr/>
    <tr align='left'> <td border='1' sides='rt'><b>Costs</b></td>           <td border='1' sides='t'><b>g</b>: {1} ; <b>h</b>: {2} ; <b>c</b>: {3}</td> </tr>
    <tr align='left'> <td border='1' sides='rt'><b>Preconditions</b></td>   <td border='1' sides='t'>{5}</td> </tr>
    <tr align='left'> <td border='1' sides='rt'><b>Effects</b></td>         <td border='1' sides='t'>{6}</td> </tr>
    <tr align='left'> <td border='1' sides='rt'><b>Goal</b></td>            <td border='1' sides='t'>{7}</td> </tr>
</table>
>]",
                                           node.GetHashCode(),
                                           node.GetPathCost(), node.GetHeuristicCost(), node.GetCost(),
                                           node.Name, node.Preconditions != null ? node.Preconditions.ToString() : "",
                                           node.Effects != null ? node.Effects.ToString() : "",
                                           node.Goal != null ? node.Goal.ToString() : "");

            debugger.AddNode(nodeStr);

            if (parent != null)
            {
                string connStr = string.Format("{0} -> {1}", parent.GetHashCode(), node.GetHashCode());
                debugger.AddConn(connStr);
            }
        }
Esempio n. 2
0
        private void _DebugPlan(INode <T> node, INode <T> parent)
        {
            if (!_debugPlan)
            {
                return;
            }
            if (null == _debugger)
            {
                _debugger = new PlanDebugger();
            }

            string nodeStr = string.Format("{0} [label=\"GOAL({4}): {5}:\n{1}\nEFFECT:\n{2}\nPRECOND:\n{3}\n\"]", node.GetHashCode(), node.GoalString, node.EffectString, node.PrecondString, node.GetCost(), node.Name);

            _debugger.AddNode(nodeStr);

            if (parent != null)
            {
                string connStr = string.Format("{0} -> {1}", parent.GetHashCode(), node.GetHashCode());
                _debugger.AddConn(connStr);
            }
        }