Esempio n. 1
0
 public InferenceMachine(InferenceContext context, IEnumerable<UniversalSet> universes,
     RuleSet ruleSet)
 {
     Universes = new List<UniversalSet>(universes);
     RuleSet = ruleSet;
     Context = context;
 }
Esempio n. 2
0
 public double Evaluate(InferenceContext context)
 {
     return context.Options.LogicOps.Not(_operand.Evaluate(context));
 }
Esempio n. 3
0
 public double Evaluate(InferenceContext context)
 {
     double value = context[_left];
     return double.IsNaN(value) ? double.NaN : _right[value];
 }
Esempio n. 4
0
 public double Evaluate(InferenceContext context)
 {
     var leftResult = _left.Evaluate(context);
     var rightResult = _right.Evaluate(context);
     return context.Options.LogicOps.Or(leftResult, rightResult);
 }
Esempio n. 5
0
 public Task<Set> EvaluateAsync(InferenceContext context)
 {
     return Task.Run(() =>
     {
         var resultSet = Set.Empty;
         Parallel.ForEach(Rules, rule =>
         {
             var result = rule.Evaluate(context);
             context.Options.SetOps.Union(resultSet, result);
         });
         return resultSet;
     });
 }
Esempio n. 6
0
 public Set Evaluate(InferenceContext context)
 {
     var resultSet = Set.Empty;
     Parallel.ForEach(Rules, rule =>
     {
         var result = rule.Evaluate(context);
         context.Options.SetOps.Union(resultSet, result);
     });
     return resultSet;
 }
Esempio n. 7
0
 public Task<Set> EvaluateAsync(InferenceContext context)
 {
     return Task.Run(() =>
     {
         var result = Condition.Evaluate(context);
         var newDic = Then.Values.Where(item => item.Value <= result).ToDictionary(item => item.Key, item => item.Value);
         return new Set(string.Concat(Name, " result set"), newDic);
     });
 }
Esempio n. 8
0
 public Set Evaluate(InferenceContext context)
 {
     var result = Condition.Evaluate(context);
     var newDic = Then.Values.Where(item => item.Value <= result).ToDictionary(item => item.Key, item => item.Value);
     return new Set(string.Concat(Name, " result set"), newDic);
 }