public static TyStateWeights GetDefault() { TyStateWeights p = new TyStateWeights(1.0f); p.SetWeight(WeightType.HealthFactor, 8.7f); return(p); }
public TyStateWeights(TyStateWeights other) : this() { for (int i = 0; i < _weights.Length; i++) { _weights[i] = other._weights[i]; } }
public static TyStateWeights operator -(TyStateWeights lhs, TyStateWeights rhs) { TyStateWeights p = new TyStateWeights(); for (int i = 0; i < p._weights.Length; i++) { p._weights[i] = lhs._weights[i] - rhs._weights[i]; } return(p); }
public static TyStateWeights operator /(TyStateWeights lhs, float rhs) { TyStateWeights p = new TyStateWeights(); for (int i = 0; i < p._weights.Length; i++) { p._weights[i] = lhs._weights[i] / rhs; } return(p); }
public static TyStateWeights UniformLerp(TyStateWeights lhs, TyStateWeights rhs, float t) { TyStateWeights p = new TyStateWeights(); for (int i = 0; i < p._weights.Length; i++) { p._weights[i] = TyUtility.Lerp(lhs._weights[i], rhs._weights[i], t); } return(p); }
private TycheAgent(TyStateWeights weights, bool heroBasedWeights, int episodeMultiplier, bool adjustEpisodeMultiplier) { _defaultEpisodeMultiplier = episodeMultiplier; _curEpisodeMultiplier = episodeMultiplier; _heroBasedWeights = heroBasedWeights; _analyzer = new TyStateAnalyzer(weights); _simTree = new TySimTree(); _random = new Random(); AdjustEpisodeMultiplier = adjustEpisodeMultiplier; }
/// <summary> Called the first round (might be second round game wise) this agents is able to see the game and his opponent. </summary> private void CustomInit(POGame.POGame initialState) { _hasInitialized = true; _playerId = initialState.CurrentPlayer.PlayerId; _analyzer.OwnPlayerId = _playerId; if (_heroBasedWeights) { _analyzer.Weights = TyStateWeights.GetHeroBased(initialState.CurrentPlayer.HeroClass, initialState.CurrentOpponent.HeroClass); } }
public static TyStateWeights UniformRandLerp(TyStateWeights lhs, TyStateWeights rhs, System.Random random, float tMin, float tMax) { TyStateWeights p = new TyStateWeights(); for (int i = 0; i < p._weights.Length; i++) { float t = random.RandFloat(tMin, tMax); p._weights[i] = TyUtility.Lerp(lhs._weights[i], rhs._weights[i], t); } return(p); }
public static TyStateWeights NonUniformLerp(TyStateWeights lhs, TyStateWeights rhs, float[] tValues) { System.Diagnostics.Debug.Assert(tValues.Length >= (int)WeightType.Count); TyStateWeights p = new TyStateWeights(); for (int i = 0; i < p._weights.Length; i++) { p._weights[i] = TyUtility.Lerp(lhs._weights[i], rhs._weights[i], tValues[i]); } return(p); }
public static TycheAgent GetTrainingAgent(float biasFactor = -1.0f, bool useSecrets = false) { const bool ADJUST_EPISODES = false; const bool HERO_BASED_WEIGHTS = false; var weights = TyStateWeights.GetDefault(); if (biasFactor >= 0.0f) { weights.SetWeight(TyStateWeights.WeightType.BiasFactor, biasFactor); } var agent = new TycheAgent(weights, HERO_BASED_WEIGHTS, 0, ADJUST_EPISODES); agent.UsedAlgorithm = Algorithm.Greedy; agent._analyzer.EstimateSecretsAndSpells = useSecrets; return(agent); }
public TycheAgent() : this(TyStateWeights.GetDefault(), true, DEFAULT_NUM_EPISODES_MULTIPLIER, true) { }
public static TycheAgent GetSearchTreeAgent(int episodeMultiplier) { return(new TycheAgent(TyStateWeights.GetDefault(), true, episodeMultiplier, true)); }
public static TycheAgent GetLearningAgent(TyStateWeights weights) { return(new TycheAgent(weights, false, LEARNING_NUM_EPISODES_MULTIPLIER, false)); }
public TyStateAnalyzer(TyStateWeights weights) { Weights = weights; }