<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -32,6 +32,36 @@ void Agent::initQ()
     }
 }
 
+void Agent::changeAlpha(int i)
+{
+    setAlpha(i/10);
+}
+
+void Agent::changeGamma(int i)
+{
+    setGamma(i/10);
+}
+
+void Agent::changeEps(int i)
+{
+    switch(i){
+        case 0:
+        setEps(0);
+        case 1:
+        setEps(0.0001);
+        case 2:
+        setEps(0.001);
+        case 3:
+        setEps(0.01);
+        case 4:
+        setEps(0.1);
+        case 5:
+        setEps(1.0);
+        default:
+        setEps(0);
+    }
+}
+
 Action Agent::selectAction(Status s)
 {
     Reward max = -100000000;
@@ -47,60 +77,60 @@ Action Agent::selectAction(Status s)
     }
     p = m_Q.find(MyQ(s,Action(0,-1)));
     if(p != m_Q.end()){
-        if (p.value() &gt; max) {max = p.value(); a = Action(0,-1);}
+        if (p.value() &gt; max) {max = p.value(); a.first = 0; a.second = -1;}
     }
     p = m_Q.find(MyQ(s,Action(0,1)));
     if(p != m_Q.end()){
-        if (p.value() &gt; max) {max = p.value(); a = Action(0,1);}
+        if (p.value() &gt; max) {max = p.value(); a.first = 0; a.second = 1;}
     }
     p = m_Q.find(MyQ(s,Action(1,1)));
     if(p != m_Q.end()){
-        if (p.value() &gt; max) {max = p.value(); a = Action(1,1);}
+        if (p.value() &gt; max) {max = p.value(); a.first = 1; a.second = 1;}
     }
     p = m_Q.find(MyQ(s,Action(-1,1)));
     if(p != m_Q.end()){
-        if (p.value() &gt; max) {max = p.value(); a = Action(-1,1);}
+        if (p.value() &gt; max) {max = p.value(); a.first = -1; a.second = 1;}
     }
     p = m_Q.find(MyQ(s,Action(1,-1)));
     if(p != m_Q.end()){
-        if (p.value() &gt; max) {max = p.value(); a = Action(1,-1);}
+        if (p.value() &gt; max) {max = p.value(); a.first = 1; a.second = -1;}
     }
     p = m_Q.find(MyQ(s,Action(-1,-1)));
     if(p != m_Q.end()){
-        if (p.value() &gt; max) {max = p.value(); a = Action(-1,-1);}
-    }
-    p = m_Q.find(MyQ(s,Action(2,0)));
-    if(p != m_Q.end()){
-        if (p.value() &gt; max) {max = p.value(); a = Action(2,0);}
-    }
-    p = m_Q.find(MyQ(s,Action(-2,0)));
-    if(p != m_Q.end()){
-        if (p.value() &gt; max) {max = p.value(); a = Action(-2,0);}
-    }
-    p = m_Q.find(MyQ(s,Action(0,-2)));
-    if(p != m_Q.end()){
-        if (p.value() &gt; max) {max = p.value(); a = Action(0,-2);}
-    }
-    p = m_Q.find(MyQ(s,Action(0,2)));
-    if(p != m_Q.end()){
-        if (p.value() &gt; max) {max = p.value(); a = Action(0,2);}
-    }
-    p = m_Q.find(MyQ(s,Action(2,2)));
-    if(p != m_Q.end()){
-        if (p.value() &gt; max) {max = p.value(); a = Action(2,2);}
-    }
-    p = m_Q.find(MyQ(s,Action(-2,2)));
-    if(p != m_Q.end()){
-        if (p.value() &gt; max) {max = p.value(); a = Action(-2,2);}
-    }
-    p = m_Q.find(MyQ(s,Action(2,-2)));
-    if(p != m_Q.end()){
-        if (p.value() &gt; max) {max = p.value(); a = Action(2,-2);}
-    }
-    p = m_Q.find(MyQ(s,Action(-2,-2)));
-    if(p != m_Q.end()){
-        if (p.value() &gt; max) {max = p.value(); a = Action(-2,-2);}
-    }
+        if (p.value() &gt; max) {max = p.value(); a.first = -1; a.second = -1;}
+    }
+//    p = m_Q.find(MyQ(s,Action(2,0)));
+//    if(p != m_Q.end()){
+//        if (p.value() &gt; max) {max = p.value(); a = Action(2,0);}
+//    }
+//    p = m_Q.find(MyQ(s,Action(-2,0)));
+//    if(p != m_Q.end()){
+//        if (p.value() &gt; max) {max = p.value(); a = Action(-2,0);}
+//    }
+//    p = m_Q.find(MyQ(s,Action(0,-2)));
+//    if(p != m_Q.end()){
+//        if (p.value() &gt; max) {max = p.value(); a = Action(0,-2);}
+//    }
+//    p = m_Q.find(MyQ(s,Action(0,2)));
+//    if(p != m_Q.end()){
+//        if (p.value() &gt; max) {max = p.value(); a = Action(0,2);}
+//    }
+//    p = m_Q.find(MyQ(s,Action(2,2)));
+//    if(p != m_Q.end()){
+//        if (p.value() &gt; max) {max = p.value(); a = Action(2,2);}
+//    }
+//    p = m_Q.find(MyQ(s,Action(-2,2)));
+//    if(p != m_Q.end()){
+//        if (p.value() &gt; max) {max = p.value(); a = Action(-2,2);}
+//    }
+//    p = m_Q.find(MyQ(s,Action(2,-2)));
+//    if(p != m_Q.end()){
+//        if (p.value() &gt; max) {max = p.value(); a = Action(2,-2);}
+//    }
+//    p = m_Q.find(MyQ(s,Action(-2,-2)));
+//    if(p != m_Q.end()){
+//        if (p.value() &gt; max) {max = p.value(); a = Action(-2,-2);}
+//    }
 
     return a;
 }</diff>
      <filename>reinforce/agent.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -9,6 +9,9 @@ class Agent : public QObject
     Q_OBJECT
 public:
     Agent(Environment *env, double alpha, double gamma, double eps);
+    double alpha() { return m_alpha; }
+    double gamma() { return m_gamma; }
+    double epsilon() { return m_eps; }
     void setAlpha(double alpha){ m_alpha = alpha; }
     void setGamma(double gamma){ m_gamma = gamma; }
     void setEps(double eps){ m_eps = eps; }
@@ -16,6 +19,10 @@ public:
     void initQ();
     bool isFin(Status st);
     Action selectAction(Status s);
+public slots:
+    void changeAlpha(int i);
+    void changeGamma(int i);
+    void changeEps(int i);
 private:
     Environment *m_env;
     double m_alpha;</diff>
      <filename>reinforce/agent.h</filename>
    </modified>
    <modified>
      <diff>@@ -14,6 +14,7 @@ public:
     Status getStatus() { return m_cur_status; }
 signals:
     void statusChanged(Status s);
+
 private:
     Status m_cur_status;
 };</diff>
      <filename>reinforce/environment.h</filename>
    </modified>
    <modified>
      <diff>@@ -2,6 +2,8 @@
 #include &quot;ui_mainwindow.h&quot;
 #include &quot;environment.h&quot;
 
+#include &lt;QMessageBox&gt;
+
 MainWindow::MainWindow(QWidget *parent)
     : QMainWindow(parent), ui(new Ui::MainWindow)
 {
@@ -9,8 +11,17 @@ MainWindow::MainWindow(QWidget *parent)
 
     env = new Environment();
     agent = new Agent(env, 0.5, 0.5, 0.1); // double alpha, double gamma, double eps
+    ui-&gt;alphaCombo-&gt;setCurrentIndex(5);
+    ui-&gt;gammaCombo-&gt;setCurrentIndex(5);
+    ui-&gt;epsilonCombo-&gt;setCurrentIndex(4);
     connect(env, SIGNAL(statusChanged(Status)),
             this, SLOT(recvStatusChanged(Status)));
+    connect(ui-&gt;alphaCombo, SIGNAL(currentIndexChanged(int)),
+            agent, SLOT(changeAlpha(int)));
+    connect(ui-&gt;gammaCombo, SIGNAL(currentIndexChanged(int)),
+            agent, SLOT(changeGamma(int)));
+    connect(ui-&gt;epsilonCombo, SIGNAL(currentIndexChanged(int)),
+            agent, SLOT(changeEps(int)));
 }
 
 MainWindow::~MainWindow()
@@ -26,12 +37,16 @@ void MainWindow::recvStatusChanged(Status s)
 void MainWindow::on_initButton_clicked()
 {
 
+    if(Status(10,10) == Status(10,10)){
+        QMessageBox::information(NULL, &quot;&quot;, &quot;true&quot;);
+    }
+
 }
 
 void MainWindow::on_startButton_clicked()
 {
     agent-&gt;initQ();
-    for(int i=0;i&lt;100;i++){
+    for(int i=0;i&lt;3;i++){
         agent-&gt;doEpisode();
     }
 }</diff>
      <filename>reinforce/mainwindow.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -227,6 +227,11 @@
            &lt;string&gt;0.1&lt;/string&gt;
           &lt;/property&gt;
          &lt;/item&gt;
+         &lt;item&gt;
+          &lt;property name=&quot;text&quot;&gt;
+           &lt;string&gt;1.0&lt;/string&gt;
+          &lt;/property&gt;
+         &lt;/item&gt;
         &lt;/widget&gt;
        &lt;/item&gt;
       &lt;/layout&gt;</diff>
      <filename>reinforce/mainwindow.ui</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>84bd05d69c64f92cd7a2f5c44fc8d02ae3ceca0a</id>
    </parent>
  </parents>
  <author>
    <name>NOSE Takafumi</name>
    <email>ahya365@gmail.com</email>
  </author>
  <url>http://github.com/plus7/plus7pub/commit/93fdbc5fb07b79ee5672f81cadb79e80e59b3532</url>
  <id>93fdbc5fb07b79ee5672f81cadb79e80e59b3532</id>
  <committed-date>2009-04-29T20:43:24-07:00</committed-date>
  <authored-date>2009-04-29T20:43:24-07:00</authored-date>
  <message>nf</message>
  <tree>54c91070b1582bc26d2d7af9ba0954ccc264d048</tree>
  <committer>
    <name>NOSE Takafumi</name>
    <email>ahya365@gmail.com</email>
  </committer>
</commit>
