Beispiel #1
0
        public void Evaluate(ChainLink chainLink)
        {
            foreach (var longitudinalEvaluators in _evaluators)
            {
                if (!_evaluations.Evaluations.ContainsKey(longitudinalEvaluators.Key))
                {
                    var newEvaluation = new LongitudinalEvaluation();

                    newEvaluation.State = longitudinalEvaluators.Value.StateInitializer();

                    _evaluations.Evaluations.Add(longitudinalEvaluators.Key, newEvaluation);
                }

                var evaluation = _evaluations.Evaluations[longitudinalEvaluators.Key];

                var state = evaluation.State;

                // I think this isn't right because state may not be malleable ... should it be passed back as a complex type?
                var result = longitudinalEvaluators.Value.Evaluator(chainLink.MarkovEvent, state);

                if (!result.HasNoValue)
                {
                    evaluation.Values.Add(result.Value);
                }

                if (result.State != null)
                {
                    evaluation.State = result.State;
                }
            }
        }
Beispiel #2
0
        public void Accept(MarkovEvent markovEvent)
        {
            // build a link

            var chainLink = ChainLink.Build(markovEvent);

            _braidBuilderSubject.OnNext(chainLink);
        }
        public int Discriminate(ChainLink chainLink)
        {
            _results.Clear();

            foreach (var braidLinkDiscriminator in _discriminators)
            {
                _results.Add(braidLinkDiscriminator.Discriminate(chainLink));
            }

            int result = _results.Sum(x => (int)x);

            return(result);
        }
        public void Accept(ChainLink chainLink)
        {
            var chainIdentity = _buildChainIdentity(chainLink.MarkovEvent);

            if (!_chainWithIdentityExists(chainIdentity))
            {
                var newChain = Chain.Build(chainIdentity, _braid, _evaluators);

                _addChain(chainIdentity, newChain);
            }

            var chain = _getChainByIdentity(chainIdentity);

            chain.AddChainLink(chainLink);
        }
Beispiel #5
0
        public void AddChainLink(ChainLink chainLink)
        {
            var longitudinalDistance = LongitudinalDistance.Initial;

            if (_chainLinks.Any())
            {
                var previousLink = _chainLinks[_chainLinks.Count - 1];

                var distance = chainLink.MarkovEvent.OccurredOn - previousLink.MarkovEvent.OccurredOn;

                longitudinalDistance = LongitudinalDistance.Build(distance);
            }

            var position = new ChainPosition(this, _chainLinks.Count, longitudinalDistance);

            chainLink.AddToChain(position);

            _chainLinks.Add(chainLink);

            _longitudinalEvaluators.Evaluate(chainLink);
        }
 public virtual BraidLinkDiscriminationResult Discriminate(ChainLink chainLink)
 {
     return(_discrimate(chainLink));
 }
Beispiel #7
0
 internal void Accept(ChainLink chainLink)
 {
     // go async
     _chainBuilderSubject.OnNext(chainLink);
 }