示例#1
0
    public SolverManager()
    {
        FG         = 0;
        _timestamp = DateTime.Now.ToFileTime();
        _logger    = new Logger();
#if !DEBUG
        _logger.Init(".\\app_" + _timestamp + ".log");
#endif
        _logger.Log(JsonConvert.SerializeObject(SolverConfig.GetInstance()));

        int asyncLearners = SolverConfig.GetInstance().async_learners;
        _actorMonitor = new Dictionary <int, int>();

        _inputInterface = new InputInterface();
        _encoder        = new StateEncoder(_inputInterface);
        _agent          = new AsyncQN(asyncLearners);
        _learners       = new AsyncSolver[asyncLearners];

        for (int i = 0; i < asyncLearners; i++)
        {
            IExploration exp = null;
            exp = new BoltzmannExploration(SolverConfig.GetInstance().epsilon, 0.13f);
            exp.Init(0.13f);
            //exp = new EGreedyExploration(SolverConfig.GetInstance().epsilon, 0f);
            //exp.Init(0.05f, 0f);

            _learners[i] = new AsyncSolver(_inputInterface, _encoder, _agent, exp, _logger);
        }
    }
示例#2
0
文件: Solver.cs 项目: Iskandor/Sofia
 public Solver(InputInterface p_inputInterface, StateEncoder p_encoder, BaseAgent p_agent, IExploration p_exp, Logger p_logger)
 {
     _inputInterface = p_inputInterface;
     _encoder        = p_encoder;
     _agent          = p_agent;
     _exploration    = p_exp;
     _logger         = p_logger;
     _gameState      = new StateVar();
     _histogram      = new Dictionary <int, int>();
 }
示例#3
0
    public void Start(IExploration p_exp)
    {
        _logger    = new Logger();
        _timestamp = DateTime.Now.ToFileTime();
#if !DEBUG
        _logger.Init(".\\app_" + _timestamp + ".log");
#endif

        _wins        = _loses = 0;
        _exp         = p_exp;
        _agent       = new ACN();
        _firstRun    = true;
        _environment = new FrozenLake();
        Reset();
    }
示例#4
0
        override public int ChooseAction(IExploration p_exp, Vector p_estimate)
        {
            _action = p_exp.ChooseAction(p_estimate);

            /*
             * BoltzmannExploration exp = (BoltzmannExploration)p_exp;
             *
             * for(int i = 0; i < 5; i++)
             * {
             *  exp.Temperature = 0.5f * i + 0.15f;
             *  exp.ChooseAction(p_estimate);
             * }
             */

            return(_action);
        }
示例#5
0
 override public int ChooseAction(IExploration p_exp, Vector p_estimate)
 {
     _action = p_exp.ChooseAction(p_estimate);
     return(_action);
 }
示例#6
0
 public AsyncSolver(InputInterface p_inputInterface, StateEncoder p_encoder, BaseAgent p_agent, IExploration p_exp, Logger p_logger) : base(p_inputInterface, p_encoder, p_agent, p_exp, p_logger)
 {
 }
示例#7
0
 virtual public int ChooseAction(IExploration p_exp, Vector p_state0)
 {
     return(0);
 }