コード例 #1
0
ファイル: RLForm.cs プロジェクト: paweenwich/sc2
        private void picMain_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            //g.DrawLine(SC2ExtendImageData.penBlack, 0, 0, 500, 500);
            //world.Draw(g, new Rectangle(0, 0, 500, 500));
            if (learningAgent != null)
            {
                if (chkMenuETable.Checked && (learningAgent is SARSALearningAgent))
                {
                    SARSALearningAgent l = (SARSALearningAgent)learningAgent;
                    Bound bound          = learningAgent.GetBound(l.eTable);
                    foreach (float[] state in l.eTable.Keys)
                    {
                        Point       p         = world.StateToXY(state);
                        Rectangle   rect      = world.GetRect(p.X, p.Y, new Rectangle(0, 0, 500, 500));
                        float[]     eData     = l.eTable[state];
                        float       eMax      = eData.Max();
                        int         eMaxIndex = eData.ToList().IndexOf(eMax);
                        WorldAction act       = Me.IndexToAction(eMaxIndex);
                        int         c         = (int)bound.map(eMax, 0, 255);
                        g.FillRectangle(new SolidBrush(Color.FromArgb(c, c, c)), rect);
                        g.DrawString(String.Format("{0:0.00}", eMax), drawFont, rect.Left, rect.Top);
                        g.DrawString(String.Format("{0}", act.ToString()), drawFont, rect.Left, rect.Top + 12);
                    }
                }
                else
                {
                    Bound bound = learningAgent.GetBound(learningAgent.qTable);
                    foreach (float[] state in learningAgent.qTable.Keys)
                    {
                        Point       p         = world.StateToXY(state);
                        Rectangle   rect      = world.GetRect(p.X, p.Y, new Rectangle(0, 0, 500, 500));
                        float[]     qData     = learningAgent.qTable[state];
                        float       qMax      = qData.Max();
                        int         qMaxIndex = qData.ToList().IndexOf(qMax);
                        WorldAction act       = Me.IndexToAction(qMaxIndex);
                        int         c         = (int)bound.map(qMax, 0, 255);
                        g.FillRectangle(new SolidBrush(Color.FromArgb(c, c, c)), rect);
                        g.DrawString(String.Format("{0:0.00}", qMax), drawFont, rect.Left, rect.Top);
                        g.DrawString(String.Format("{0}", act.ToString()), drawFont, rect.Left, rect.Top + 12);
                    }
                }
            }
            world.Draw(g, new Rectangle(0, 0, 500, 500));

            //g.DrawGrid(SC2ExtendImageData.penBlack, ,10,10);
        }
コード例 #2
0
 public override string ToString()
 {
     return(logicExpression + " triggers " + worldAction.ToString());
 }
コード例 #3
0
 public override string ToString()
 {
     return(worldAction.ToString() + " releases " + fluent.ToString() + ((ifExpression == "") ? "" : (" if " + ifExpression)));
 }
コード例 #4
0
 public override string ToString()
 {
     return("Impossible " + worldAction.ToString() + " at " + time);
 }
コード例 #5
0
 public override string ToString()
 {
     return("impossible " + worldAction.ToString() + " if " + ifExpression);
 }
コード例 #6
0
 public override string ToString()
 {
     return(this.worldAction.ToString() + " invokes " + result.ToString() + " after " + after + ((ifExpression == "") ? "" : (" if " + ifExpression)));
 }