Exemplo n.º 1
0
        public QAgent(QAlgo algo, QState initialState)
        {
            trialNum          = 0;
            this.initialState = initialState;
            initialState.setQAgent(this);

            currentAlgo = algo;
            currentAlgo.setQAgent(this);
            currentAlgo.Initialize();
        }
Exemplo n.º 2
0
        private void LoadQAlgoPlugin(string f)
        {
            try
            {
                bool loaded = false;
                foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies())
                {
                    foreach (Type qalgo in a.GetTypes().
                             Where(t => String.Equals(t.Namespace, "QLearner.QAlgos", StringComparison.Ordinal)).
                             Where(t => t.IsSubclassOf(typeof(QAlgo))).
                             Where(t => t.IsVisible).
                             Where(t => !t.IsAbstract).
                             Where(t => t.Name == f))
                    {
                        algo = (QAlgo)Activator.CreateInstance(qalgo);
                        WriteOutput("Loaded QAlgo: " + qalgo.Name, true);
                        algo.setQLearner(this);

                        if (algo != null && state != null)
                        {
                            agent = new QAgent(this, algo, state);
                            Reset();
                            Awaken.Enabled = Learn.Enabled = true;
                        }

                        Properties.Settings.Default.QAlgoPlugin = qalgo.Name;
                        Properties.Settings.Default.Save();

                        loaded = true;
                        break;
                    }
                }
                if (!loaded)
                {
                    WriteOutput("QAlgo Not Found: " + f, true);
                    ResetPlugins(false);
                }
            }
            catch (Exception e)
            {
                WriteOutput("Unable to load QAlgo: " + f + "\n" + e, true);
                ResetPlugins(false);
            }
        }
Exemplo n.º 3
0
 public QAgent(QLearner master, QAlgo algo, QState initialState)
     : this(algo, initialState)
 {
     this.master = master;
 }