예제 #1
0
        internal void Update(ColonyBestTrailMessage message)
        {
            lock ( this )
            {
                ConvertPath(message.Trail);

                UpdateNodes();
                UpdateConverter();
            }

            m_Bus.Publish(new ShortestPathModelChangedMessage());
        }
예제 #2
0
        private ColonyBestTrailMessage CreateBestTrailMessage([NotNull] IEnumerable <int> trail)
        {
            var message = new ColonyBestTrailMessage
                          {
                              Iteration = 1,
                              Trail = trail,
                              Length = 123,
                              Type = "Type",
                              Alpha = 0.1,
                              Beta = 0.2,
                              Gamma = 0.3
                          };

            return message;
        }
        private ColonyBestTrailMessage CreateBestTrailMessage()
        {
            var message = new ColonyBestTrailMessage
                          {
                              Iteration = 1, // todo fix spelling iteration
                              Trail = new[]
                                      {
                                          0,
                                          1
                                      },
                              Length = 123.0,
                              Type = "Type",
                              Alpha = 0.1,
                              Beta = 0.2,
                              Gamma = 0.3
                          };

            return message;
        }
        private ColonyBestTrailMessage CreateOtherBestTrailMessage()
        {
            var message = new ColonyBestTrailMessage
                          {
                              Alpha = 0.1,
                              Beta = 0.2,
                              Gamma = 0.3,
                              Iteration = 2,
                              Length = 750.0,
                              Trail = new[]
                                      {
                                          2,
                                          0
                                      },
                              Type = "Type"
                          };

            return message;
        }
예제 #5
0
 internal void ColonyBestTrailHandler(ColonyBestTrailMessage message)
 {
     Update(message.Trail);
 }
예제 #6
0
        internal void ColonyBestTrailHandler(ColonyBestTrailMessage message)
        {
            m_Logger.Debug("Handling '{0}'...".Inject(message.GetType()));

            Update(message);
        }
예제 #7
0
        internal ITrailDetails CreateTrailDetails(ColonyBestTrailMessage message)
        {
            ITrailDetails details = m_Factory.Create(message.Iteration,
                                                     message.Trail,
                                                     message.Length,
                                                     0.0,
                                                     0.0,
                                                     message.Type,
                                                     message.Alpha,
                                                     message.Beta,
                                                     message.Gamma);

            m_FirstTrailDetails = details;
            return details;
        }
예제 #8
0
        internal void Update(ColonyBestTrailMessage message)
        {
            lock ( this )
            {
                ITrailDetails details = CreateTrailDetails(message);

                if ( m_Dictionary.ContainsKey(details.Interation) )
                {
                    m_Dictionary.Remove(details.Interation);
                }

                m_Dictionary.Add(details.Interation,
                                 details);

                m_TrailDetails = CreateTrailDetailsList(m_Dictionary.Values.ToArray());

                m_Logger.Info("Update called! (Count: {0})".Inject(m_Dictionary.Count));

                m_MemoryBus.PublishAsync(new TrailHistoryModelChangedMessage());
            }
        }
 internal void Update(ColonyBestTrailMessage message)
 {
     UpdateNodes(message.Trail);
 }