Exemple #1
0
        private Scheduler()
        {
            _from2set = new C5.HashDictionary <ISimEntity, C5.HashSet <ISimEventHandle> >();
            _to2set   = new C5.HashDictionary <ISimEntity, C5.HashSet <ISimEventHandle> >();

            _ud2ehandle = new C5.TreeDictionary <IUniqueDouble, ISimEventHandle>();
            _done       = false;
            _timeNow    = 0;
        }
Exemple #2
0
        private bool Compress()
        {
            TDigest         newTDigest = new TDigest(Accuracy, CompressionConstant);
            List <Centroid> temp       = _centroids.Values.ToList();

            temp.Shuffle();

            foreach (Centroid centroid in temp)
            {
                newTDigest.Add(centroid.Mean, centroid.Count);
            }

            _centroids = newTDigest._centroids;
            return(true);
        }
 static TunnelRuntime()
 {
     sTunnels = new TreeDictionary <short, TunnelSocket>();
     //when the application is about to shutdown we should free the open
     //connections
     AppDomain.CurrentDomain.DomainUnload += (object sender, EventArgs e) =>
     {
         foreach (short port in sTunnels.Keys)
         {
             TunnelSocket sock;
             short        refPort = port;
             sTunnels.Find(ref refPort, out sock);
             sock.Close();
         }
     };
 }
Exemple #4
0
        /// <summary>
        /// Construct a T-Digest,
        /// </summary>
        /// <param name="accuracy">Controls the trade-off between accuracy and memory consumption/performance.
        /// Default value is .05, higher values result in worse accuracy, but better performance and decreased memory usage, while
        /// lower values result in better accuracy and increased performance and memory usage</param>
        /// <param name="compression">K value</param>
        public TDigest(double accuracy = 0.02, double compression = 25)
        {
            if (accuracy <= 0)
            {
                throw new ArgumentOutOfRangeException("Accuracy must be greater than 0");
            }
            if (compression < 15)
            {
                throw new ArgumentOutOfRangeException("Compression constant must be 15 or greater");
            }

            _centroids          = new TreeDictionary <double, Centroid>();
            _rand               = new Random();
            _count              = 0;
            Accuracy            = accuracy;
            CompressionConstant = compression;
        }
Exemple #5
0
        public void Reset()
        {
            _from2set = new C5.HashDictionary <ISimEntity, C5.HashSet <ISimEventHandle> >();
            _to2set   = new C5.HashDictionary <ISimEntity, C5.HashSet <ISimEventHandle> >();

            _ud2ehandle = new C5.TreeDictionary <IUniqueDouble, ISimEventHandle>();
            _done       = false;
            _timeNow    = 0;

            /*
             * this._from2set.Clear();
             * this._to2set.Clear();
             * this._ud2ehandle.Clear();
             * this._timeNow = 0;
             * this._uid = 0;
             * this._done = false;
             */
        }