Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            fighterRepository = new FighterRepository();
            stateExtractor    = new StateExtractor();
            betInfoExtractor  = new BetInformationExtractor();
            currentState      = new State();
            currentMatch      = new Match();
            InitializeDB();
            InitializeWebSocketListener();
            InitializeTwitchChatListener();

            Console.ReadLine();
            stateListener.Dispose();
            db.Close();
        }
Ejemplo n.º 2
0
    /// <summary>
    /// Constructor for XML
    /// </summary>
    /// <param name="stateExtractor"></param>
    /// <param name="mower"></param>
    /// <param name="paramSet"></param>

    public QLearner(StateExtractor stateExtractor, Mower mower, ParamSet paramSet)
        : this(stateExtractor,
               mower,
               paramSet.FloatParam(ParamSet.ParamGroupQLearner, ParamSet.ParamGreediness),
               paramSet.FloatParam(ParamSet.ParamGroupQLearner, ParamSet.ParamDiscountValue),
               paramSet.FloatParam(ParamSet.ParamGroupQLearner, ParamSet.ParamLearnRate),
               paramSet.FloatParam(ParamSet.ParamGroupQLearner, ParamSet.ParamInitialQValue),
               paramSet.StringParam(ParamSet.ParamGroupQLearner, ParamSet.ParamQTableDeserialiaztionFile),
               paramSet.StringParam(ParamSet.ParamGroupQLearner, ParamSet.ParamQTableSerialiaztionFile),
               paramSet.BoolParam(ParamSet.ParamGroupMower, ParamSet.ParamEligTraces),
               paramSet.FloatParam(ParamSet.ParamGroupMower, ParamSet.ParamGamma),
               paramSet.StringParam(ParamSet.ParamGroupMower, ParamSet.ParamEligibilityTableDeserialiaztionFile),
               paramSet.StringParam(ParamSet.ParamGroupMower, ParamSet.ParamEligibilityTableSerialiaztionFile),
               paramSet.BoolParam(ParamSet.ParamGroupMower, ParamSet.ParamModelPlanning),
               paramSet.BoolParam(ParamSet.ParamGroupMower, ParamSet.ParamModelPlanningRefined),
               paramSet.StringParam(ParamSet.ParamGroupMower, ParamSet.ParamModelTableDeserialiaztionFile),
               paramSet.StringParam(ParamSet.ParamGroupMower, ParamSet.ParamModelTableSerialiaztionFile),
               paramSet.IntParam(ParamSet.ParamGroupMower, ParamSet.ParamN),
               paramSet.BoolParam(ParamSet.ParamGroupSetupManager, ParamSet.ParamShow)
               )
    {
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Constructor of the QLearner
    /// </summary>
    /// <param name="stateExtractor"></param>
    /// The mower, that is learning
    /// <param name="mower"></param>
    ///
    /// The following are all classic QLearning parameters,
    /// with values in between 0 and 1:
    ///
    /// Greediness of the Q learning algorithm
    /// <param name="greediness"></param>
    /// Discountvalue: How much are old experiences weighted
    /// <param name="discountValue"></param>
    /// How fast or slow shall the mower learn?
    /// Fast: High value, slow: low value
    /// <param name="learnRate"></param>
    ///
    /// "Special" parameters:
    ///
    /// QLearning with optimitstic initial values
    /// <param name="initialQValue"></param>
    /// File to load the qTable from. Can be null.
    /// <param name="qTableDeserializationFile">
    /// File to write the qTable to after the episode limit is reached.
    /// <param name="qTableSerializationFile">
    /// Running with ETraces, yes or no?
    /// <param name="eligTraces"></param>
    /// If so, with what gamma?
    /// <param name="gamma"></param>
    /// File to load the EligibilityTable from. Can be null.
    /// <param name="eTableDeserializationFile">
    /// File to write the EligibilityTable to after the episode limit is reached.
    /// <param name="eTableSerializationFile">
    /// Running with Model?
    /// <param name="modelPlanning"></param>
    /// Using refined (true) or DynaQ (false) model
    /// <param name="refined"></param>
    /// File to load the Model from. Can be null.
    /// <param name="modelTableDeserializationFile">
    /// File to write the Model to after the episode limit is reached.
    /// <param name="modelTableSerializationFile">
    /// How many N virtual steps are executed in the model?
    /// <param name="n"></param>
    /// Shall the parameter label be shown?
    /// <param name="showParamLabel"></param>

    public QLearner(StateExtractor stateExtractor,
                    Mower mower,
                    float greediness,
                    float discountValue,
                    float learnRate,
                    float initialQValue,
                    string qTableDeserializationFile,
                    string qTableSerializationFile,
                    bool eligTraces,
                    float gamma,
                    string eTableDeserializationFile,
                    string eTableSerializationFile,
                    bool modelPlanning,
                    bool refined,
                    string modelTableDeserializationFile,
                    string modelTableSerializationFile,
                    int n,
                    bool showParamLabel)
        : base(stateExtractor)
    {
        Greediness               = greediness;
        DiscountValue            = discountValue;
        LearnRate                = learnRate;
        InitialQValue            = initialQValue;
        _qTableSerializationFile = qTableSerializationFile;
        _qTable                      = new QTable(InitialQValue, qTableDeserializationFile);
        Run_with_etraces             = eligTraces;
        Gamma                        = gamma;
        _eTableSerializationFile     = eTableSerializationFile;
        ModelPlanning                = modelPlanning;
        Refined                      = refined;
        _modelTableSerializationFile = modelTableSerializationFile;
        if (Run_with_etraces)
        {
            _eTable = new EligibilityTable(0f, eTableDeserializationFile);
        }
        if (ModelPlanning)
        {
            if (refined)
            {
                _mTable = new ModelTable(mower, modelTableDeserializationFile);
            }
            else
            {
                _simpleMTable = new ModelTableSimple(0f, modelTableDeserializationFile);
            }
        }

        N = n;
        _showParamLabel = showParamLabel;

        Debug.Log(string.Format(
                      "QLearner instantiated with greediness:{0}, discountValue:{1}, learnRate:{2}, initialQValue:{3}, N for Model:{4}",
                      Greediness,
                      DiscountValue,
                      LearnRate,
                      InitialQValue,
                      N));

        EpisodeManager.AddEpisodeChangesReceiver(this);
    }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RandomLearner"/> class.
 /// </summary>
 /// <param name="stateExtractor">The State extractor available to the <see cref="T:Learner/> subclass. Not really needed by the <see cref="T:RandomLearner"/>.</param>
 public RandomLearner(StateExtractor stateExtractor)
     : base(stateExtractor)
 {
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Learner"/> class.
 /// </summary>
 /// <param name="stateExtractor">The StateExtractor providing state information.</param>
 public Learner(StateExtractor stateExtractor)
 {
     this._stateExtractor = stateExtractor;
 }