Пример #1
0
        public StochasticRewardGridWorld()
        {
            availableActions = new List <int[]>();
            availableActions.Add(new int[2] {
                -1, 0
            });
            availableActions.Add(new int[2] {
                0, -1
            });
            availableActions.Add(new int[2] {
                1, 0
            });
            availableActions.Add(new int[2] {
                0, 1
            });

            rewardSites = new HashSet <int[]>(comparer);

            // set the default agent
            startState = new int[2] {
                1, 1
            };

            Policy <int[], int[]>      policy = new EGreedyPolicy <int[], int[]>();
            ActionValue <int[], int[]> value  = new ModelFreeValue <int[], int[]>(new IntArrayComparer(), new IntArrayComparer(), availableActions, startState);

            agent = new Agent <int[], int[]>(startState, policy, value, availableActions);
        }
Пример #2
0
        public EgoAlloGridWorld()
        {
            availableActions = new List <int[]>();
            availableActions.Add(new int[2] {
                -1, 0
            });
            availableActions.Add(new int[2] {
                0, -1
            });
            availableActions.Add(new int[2] {
                1, 0
            });
            availableActions.Add(new int[2] {
                0, 1
            });
            //availableActions.Add(new int[2] { -1, -1 });
            //availableActions.Add(new int[2] { 1, -1 });
            //availableActions.Add(new int[2] { -1, 1 });
            //availableActions.Add(new int[2] { 1, 1 });

            // set the default agent
            startState = new int[14] {
                1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
            };

            Policy <int[], int[]>      policy = new EGreedyPolicy <int[], int[]>();
            ActionValue <int[], int[]> value  = new ModelFreeValue <int[], int[]>(new IntArrayComparer(), new IntArrayComparer(), availableActions, startState);

            agent = new Agent <int[], int[]>(startState, policy, value, availableActions);
        }
Пример #3
0
        public Taxi()
        {
            dropSites.Add(null);

            availableActions.Add(1); //left
            availableActions.Add(2); //up
            availableActions.Add(3); //right
            availableActions.Add(4); //down
            availableActions.Add(5); //pickup
            availableActions.Add(6); //drop

            // set the default agent
            Policy <int[], int>      policy = new EGreedyPolicy <int[], int>();
            ActionValue <int[], int> value  = new ModelFreeValue <int[], int>(new IntArrayComparer(), EqualityComparer <int> .Default, availableActions, new int[4] {
                1, 2, 1, 10
            });

            agent = new Agent <int[], int>(new int[4] {
                1, 2, 10, 1
            }, policy, value, availableActions);
        }
Пример #4
0
        public MountainCar()
        {
            availableActions.Add(-1);
            //availableActions.Add(0);
            availableActions.Add(1);
            rndStartState(out _position, out _velocity);

            // set the default agent
            Policy <int[], int>      policy = new EGreedyPolicy <int[], int>();
            ActionValue <int[], int> value  = new ModelFreeValue <int[], int>(new IntArrayComparer(), EqualityComparer <int> .Default, availableActions, discretizeState(_position, _velocity));

            agent = new Agent <int[], int>(discretizeState(_position, _velocity), policy, value, availableActions);

            // create the hill bitmap
            for (int i = 0; i < 17; i++)
            {
                double position  = (0.5 + 1.2) / (18 - 1) * i - 1.2;
                double amplitude = Math.Sin(3 * position);
                amplitude = amplitude * 50 + 50;
                hill.SetPixel(i, (int)(100 - amplitude), Color.ForestGreen);
            }
        }