Java mean meanAbortedExecutionTime( double totalExecutionTime, int totalOps, double granuleAbortProb)

Here you can find the source of meanAbortedExecutionTime( double totalExecutionTime, int totalOps, double granuleAbortProb)

Description

mean Aborted Execution Time

License

Open Source License

Declaration


public static double meanAbortedExecutionTime(
        double totalExecutionTime, int totalOps, double granuleAbortProb) 

Method Source Code

//package com.java2s;
/*//from   w w  w  .  j a va2  s . c  om
 *
 *  * INESC-ID, Instituto de Engenharia de Sistemas e Computadores Investiga??o e Desevolvimento em Lisboa
 *  * Copyright 2013 INESC-ID and/or its affiliates and other
 *  * contributors as indicated by the @author tags. All rights reserved.
 *  * See the copyright.txt in the distribution for a full listing of
 *  * individual contributors.
 *  *
 *  * This is free software; you can redistribute it and/or modify it
 *  * under the terms of the GNU Lesser General Public License as
 *  * published by the Free Software Foundation; either version 3.0 of
 *  * the License, or (at your option) any later version.
 *  *
 *  * This software is distributed in the hope that it will be useful,
 *  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 *  * Lesser General Public License for more details.
 *  *
 *  * You should have received a copy of the GNU Lesser General Public
 *  * License along with this software; if not, write to the Free
 *  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 *  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 *
 */

public class Main {
    /**
     *
     */

    public static double meanAbortedExecutionTime(
            double totalExecutionTime, int totalOps, double granuleAbortProb) {
        double meanExec = 0D;
        for (int i = 1; i <= totalOps; i++) {
            meanExec += binomialProbIthTrial(granuleAbortProb, i)
                    * executionTillIthOperation(totalExecutionTime,
                            totalOps, i);
        }
        return meanExec;
    }

    public static double binomialProbIthTrial(double p, int currentTrial) {
        return Math.pow(1.0D - p, currentTrial - 1) * p;
    }

    public static double executionTillIthOperation(
            double totalExecutionTime, int totalOps, int ithOp) {
        double quantum = totalExecutionTime / totalOps;
        return ithOp * quantum;
    }
}

Related

  1. mean(List values)
  2. mean(long[] values)
  3. mean(Number[] array)
  4. Mean(Object in)
  5. mean_Integer(List values)
  6. meanAndStandardDeviation(final double[] inp, final int startIndex, final int pastEnd)
  7. meanAndVariance(double[] a, boolean useUnbiasedEstimate)
  8. meanArithmetic(LinkedList a)
  9. meanArray(double[] arr)