public ModelledWalkerAI(WalkerAgent agent, float nearDistance, float farDistance) { sarsa = new ExpectedSarsa(new WalkerDiscreteEnvironment(nearDistance, farDistance), new EpsGreedyPolicy(0.7), 0.7, 0.8); ai = new PrioritizeSweeping(sarsa, 30); this.agent = agent; }
public static WalkerState GetState(WalkerAgent agent, float nearDistance, float farDistance) { WalkerState.FieldDirections fieldDirections = new WalkerState.FieldDirections(); fieldDirections.ForwardDistance = GetDistanceStateInDirection(agent.Position, WalkerField.Direction.FORWARD, nearDistance, farDistance); fieldDirections.BackwardDistance = GetDistanceStateInDirection(agent.Position, WalkerField.Direction.BACKWARD, nearDistance, farDistance); fieldDirections.LeftDistance = GetDistanceStateInDirection(agent.Position, WalkerField.Direction.LEFT, nearDistance, farDistance); fieldDirections.RightDistance = GetDistanceStateInDirection(agent.Position, WalkerField.Direction.RIGHT, nearDistance, farDistance); fieldDirections.ForwardLeftDistance = GetDistanceStateInDirection(agent.Position, WalkerField.Direction.FORWARDLEFT, nearDistance, farDistance); fieldDirections.ForwardRightDistance = GetDistanceStateInDirection(agent.Position, WalkerField.Direction.FORWARDRIGHT, nearDistance, farDistance); fieldDirections.BackwardLeftDistance = GetDistanceStateInDirection(agent.Position, WalkerField.Direction.BACKWARDLEFT, nearDistance, farDistance); fieldDirections.BackwardRightDistance = GetDistanceStateInDirection(agent.Position, WalkerField.Direction.BACKWARDRIGHT, nearDistance, farDistance); return(new WalkerState(fieldDirections, Game.IsExitVisible(agent.Position))); }
public SarsaWalkerAI(WalkerAgent agent, float nearDistance, float farDistance) { ai = new ExpectedSarsa(new WalkerDiscreteEnvironment(nearDistance, farDistance), new EpsGreedyPolicy(0.8), 0.5, 0.8); this.agent = agent; }