예제 #1
0
 def run_explor(self):
     """環境の状態をセット"""
     self.env.set_state()
     """MatchSet[M]を生成"""
     self.match_set = XCSMatchSet(self.pop, self.env, self.actual_time)
     """MatchSet[M]に基いて,prediction array[PA]を生成"""
     self.generate_prediction_array()
     """prediction array[PA]に基づいて行動選択"""
     self.select_action()
     """選択した行動に基いて,ActionSet[A]を生成する."""
     self.action_set = XCSActionSet(self.match_set, self.action, self.env,
                                    self.actual_time)
     """行動を取る. 強化学習が働く"""
     self.action_set.do_action()
     """ActionSet[A]内に対してパラメータ更新"""
     self.action_set.update_action_set()
     """ActionSet[A]内でルールの包摂をする"""
     self.action_set.do_action_set_subsumption(self.pop)
     """ActionSet[A]に対してGAを回す."""
     self.run_GA()
     if len(self.pop.cls) > conf.N:
         self.pop.delete_from_population()
     self.actual_time += 1.0
예제 #2
0
            ['40%', '50%', '60%', '70%', '80%', '90%', '100%', ''])
        ax.grid()
        filenamepng = "performance.png"
        plt.savefig(filenamepng, dpi=150)
        filenameeps = "performance.eps"
        plt.savefig(filenameeps)
        plt.show()


if __name__ == '__main__':
    """
    print("main start")
    xcs = XCSProgram()
    print("initialized XCSProgram")
    xcs.run_experiments()
    """

    xcs = XCSProgram()
    xcs.pop = XCSClassifierSet(xcs.env, 0.0)
    xcs.init()
    xcs.env.set_state()
    xcs.match_set = XCSMatchSet(pop, xcs.env, 0.0)
    xcs.generate_prediction_array()
    xcs.match_set = XCSMatchSet(xcs.pop, xcs.env, 0.0)
    xcs.generate_prediction_array()
    xcs.select_action()
    xcs.action_set = XCSActionSet(xcs.match_set, xcs.action, xcs.env, 0.0)
    actset = xcs.action_set.get_cls()
    actset = xcs.action_set.get_cls()
    actset[0].get_cond()