Beispiel #1
0
        //private Dictionary<Experience, List<IRandomVariable>> _cache = new Dictionary<Experience, List<IRandomVariable>>();
        public SampleContext GetOverrides(Dictionary<ExperienceFactor, int> levels)
        {
            var ctx = new SampleContext();

            ctx.Variables = new List<IRandomVariable>();

            foreach (var o in this.All().SelectMany(g => g.ExperienceOverrides.Where(e => e.Matches(levels))
                .OrderByDescending(f => f.Factors.Count)))
            {
                ctx.Variables.AddRange(o.Variables);
                //ctx.GoalBoosts.Merge(o.GoalBoosts);
            }

            return ctx;
        }
Beispiel #2
0
 public override IRandomValue Sample(SampleContext context = null)
 {
     return new RandomValue<Guid>(this, _id, (visit) => { }, _set.Sample());
 }
Beispiel #3
0
        public virtual void UpdateState(IEnumerable<IRandomVariable> variables)
        {
            var ctx = new SampleContext
            {
                Visit = this,
                Variables = variables.ToList()
            };

            var newValues = ctx.Sample();
            _variables.Merge(newValues, overwrite: true);
            UpdateState(ctx);
        }
Beispiel #4
0
 public virtual void UpdateState(SampleContext context = null)
 {
     context = context ?? new SampleContext {Visit = this};
     foreach (var var in Group.All().SelectMany(g => g.Variables)
         .Sample(_variables, context).Values)
     {
         var.Update(this);
     }
 }
Beispiel #5
0
 public override IRandomValue Sample(SampleContext context = null)
 {
     return null;
 }