Пример #1
0
        protected override MolecularPattern GetSpamp(NSEventBlock eventBlock)
        {
            double alpha = 0.5;

            var dtp         = MetricEngine.Compute(Metric.DataThroughput, eventBlock);
            var rls         = MetricEngine.Compute(Metric.RoutingListSize, eventBlock);
            var dtpExpected = MetricEngine.Compute(Metric.ExpectedDataThroughput, eventBlock);

            if (dtp >= 0)
            {
                dtpMean = alpha * dtpMean + (1 - alpha) * dtp;
            }
            if (rls >= 0)
            {
                rlsMean = alpha * rlsMean + (1 - alpha) * rls;
            }
            if (dtpExpected >= 0)
            {
                dtpExpectedMean = alpha * dtpExpectedMean + (1 - alpha) * dtpExpected;
            }

            if (dtpMean == 0 || rlsMean == 0 || dtpExpectedMean == 0)
            {
                return(null);
            }

            return(new MolecularPattern(new double[]
            {
                rlsMean,
                dtpMean,
                dtpExpectedMean
            }));
        }
Пример #2
0
        protected override MolecularPattern GetSdamp(NSEventBlock eventBlock)
        {
            // compute SDAMP
            var ITH = MetricEngine.Compute(Metric.InterestThroughput, eventBlock);
            var LBP = MetricEngine.Compute(Metric.LongBufferProbability, eventBlock);
            var OHD = MetricEngine.Compute(Metric.OneHopDelay, eventBlock);

            if (ITH < 0 || LBP < 0 || OHD < 0)
            {
                return(null);
            }
            return(new MolecularPattern(new double[3] {
                ITH, LBP, OHD
            }));
        }
Пример #3
0
        protected override MolecularPattern GetAntigenPeptide(NSEventBlock eventBlock)
        {
            // NOTE: set PEPTIDE_LENGTH constant accordingly
            var myIR = MetricEngine.Compute(Metric.MyInterestSendRate, eventBlock);

            if (myIR < 0)
            {
                return(null);
            }
            // TODO: NORMALIZE THE VECTOR
            if (myIR < 20)
            {
                myIR /= 20;
            }
            else
            {
                myIR = 1;
            }
            return(new MolecularPattern(new double[] { myIR }));
        }