• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java MathUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.cloudbus.cloudsim.util.MathUtil的典型用法代码示例。如果您正苦于以下问题:Java MathUtil类的具体用法?Java MathUtil怎么用?Java MathUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MathUtil类属于org.cloudbus.cloudsim.util包,在下文中一共展示了MathUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getUtilizationMad

import org.cloudbus.cloudsim.util.MathUtil; //导入依赖的package包/类
/**
 * Gets the utilization MAD in MIPS.
 * 
 * @return the utilization mean in MIPS
 */
public double getUtilizationMad() {
	double mad = 0;
	if (!getUtilizationHistory().isEmpty()) {
		int n = HISTORY_LENGTH;
		if (HISTORY_LENGTH > getUtilizationHistory().size()) {
			n = getUtilizationHistory().size();
		}
		double median = MathUtil.median(getUtilizationHistory());
		double[] deviationSum = new double[n];
		for (int i = 0; i < n; i++) {
			deviationSum[i] = Math.abs(median - getUtilizationHistory().get(i));
		}
		mad = MathUtil.median(deviationSum);
	}
	return mad;
}
 
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:22,代码来源:PowerVm.java


示例2: getCorrelationCoefficients

import org.cloudbus.cloudsim.util.MathUtil; //导入依赖的package包/类
/**
 * Gets the correlation coefficients.
 * 
 * @param data the data
 * @return the correlation coefficients
 */
protected List<Double> getCorrelationCoefficients(final double[][] data) {
	int n = data.length;
	int m = data[0].length;
	List<Double> correlationCoefficients = new LinkedList<Double>();
	for (int i = 0; i < n; i++) {
		double[][] x = new double[n - 1][m];
		int k = 0;
		for (int j = 0; j < n; j++) {
			if (j != i) {
				x[k++] = data[j];
			}
		}

		// Transpose the matrix so that it fits the linear model
		double[][] xT = new Array2DRowRealMatrix(x).transpose().getData();

		// RSquare is the "coefficient of determination"
		correlationCoefficients.add(MathUtil.createLinearRegression(xT,
				data[i]).calculateRSquared());
	}
	return correlationCoefficients;
}
 
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:29,代码来源:PowerVmSelectionPolicyMaximumCorrelation.java


示例3: getCorrelationCoefficients

import org.cloudbus.cloudsim.util.MathUtil; //导入依赖的package包/类
/**
 * 计算相关系数 Gets the correlation coefficients.
 * 
 * @param data the data
 * @return the correlation coefficients
 */
protected List<Double> getCorrelationCoefficients(final double[][] data) {
	int n = data.length;
	int m = data[0].length;
	List<Double> correlationCoefficients = new LinkedList<Double>();
	for (int i = 0; i < n; i++) {
		double[][] x = new double[n - 1][m];
		int k = 0;
		for (int j = 0; j < n; j++) {
			if (j != i) {
				x[k++] = data[j];
			}
		}

		// Transpose the matrix so that it fits the linear model
		double[][] xT = new Array2DRowRealMatrix(x).transpose().getData();

		// RSquare is the "coefficient of determination"
		correlationCoefficients.add(MathUtil.createLinearRegression(xT,
				data[i]).calculateRSquared());
	}
	return correlationCoefficients;
}
 
开发者ID:demiaowu,项目名称:annotation-of-cloudsim3.0.3,代码行数:29,代码来源:PowerVmSelectionPolicyMaximumCorrelation.java


示例4: getUtilizationMad

import org.cloudbus.cloudsim.util.MathUtil; //导入依赖的package包/类
/**
 * Gets the utilization MAD in MIPS.
 * 
 * @return the utilization mean in MIPS
 */
public double getUtilizationMad() {
	double mad = 0;
	if (!getUtilizationHistory().isEmpty()) {
		int n = HISTORY_LENGTH;
		if (HISTORY_LENGTH > getUtilizationHistory().size()) {
			n = getUtilizationHistory().size();
		}
		double median = MathUtil.median(getUtilizationHistory());
		double[] deviationSum = new double[n];
		for (int i = 0; i < n; i++) {
			deviationSum[i] = Math.abs(median - getUtilizationHistory().get(i));
		}
		mad = Stat.median(deviationSum);
	}
	return mad;
}
 
开发者ID:marcbux,项目名称:dynamiccloudsim,代码行数:22,代码来源:PowerVm.java


示例5: getSlaMetrics

import org.cloudbus.cloudsim.util.MathUtil; //导入依赖的package包/类
/**
 * Gets a map of SLA metric names and the corresponding values from a list of VMs,.
 *
 * @param vms the vms
 * @return the sla metrics map, compounded of metric names and their values.
 */
protected Map<String, Double> getSlaMetrics(List<Vm> vms) {
    final Map<String, Double> metrics = new HashMap<>(3);
    final List<Double> slaViolation = new LinkedList<>();
    double totalAllocatedMips = 0;
    double totalRequestedMips = 0;
    double totalUnderAllocatedMipsDueToMigration = 0;

    for (Vm vm : vms) {
        VmSlaMetrics sla = new VmSlaMetrics(vm);
        slaViolation.addAll(sla.slaViolation);
        totalAllocatedMips += sla.totalAllocatedMips;
        totalRequestedMips += sla.totalRequestedMips;
        totalUnderAllocatedMipsDueToMigration += sla.underAllocatedMipsDueToMigration;
    }

    metrics.put(SLA_METRIC_OVERALL_PERCENT, (totalRequestedMips - totalAllocatedMips) / totalRequestedMips);
    metrics.put(SLA_METRIC_AVERAGE_PERCENT, slaViolation.isEmpty() ? 0.0 : MathUtil.mean(slaViolation));
    metrics.put(SLA_METRIC_UNDERALLOCATED_MIGRATION, totalUnderAllocatedMipsDueToMigration / totalRequestedMips);

    return metrics;
}
 
开发者ID:manoelcampos,项目名称:cloudsim-plus,代码行数:28,代码来源:Helper.java


示例6: getResourceAmountToScale

import org.cloudbus.cloudsim.util.MathUtil; //导入依赖的package包/类
@Override
public double getResourceAmountToScale(final VerticalVmScaling vmScaling) {
    final Function<Vm, Double> thresholdFunction = vmScaling.getResourceUsageThresholdFunction();
    /* Computes the size to which the resource has to be scaled to move it from the
    * under or overload state.*/
    final double newResourceSize =
        Math.ceil(vmScaling.getResource().getAllocatedResource() *
            MathUtil.HUNDRED_PERCENT / thresholdFunction.apply(vmScaling.getVm()));

    /*Includes and additional resource amount for safety, according to the scaling factor.
    * This way, if the resource usage increases again up to this extra amount,
    * there is no need to re-scale the resource.
    * If the scale factor is zero, no extra safety amount is included.*/
    final double extraSafetyCapacity = gradual.getResourceAmountToScale(vmScaling);
    return newResourceSize + extraSafetyCapacity;
}
 
开发者ID:manoelcampos,项目名称:cloudsim-plus,代码行数:17,代码来源:ResourceScalingInstantaneous.java


示例7: getCorrelationCoefficients

import org.cloudbus.cloudsim.util.MathUtil; //导入依赖的package包/类
/**
 * Gets the correlation coefficients.
 *
 * @param data the data
 * @return the correlation coefficients
 */
protected List<Double> getCorrelationCoefficients(final double[][] data) {
    final int n = data.length;
    final int m = data[0].length;
    final List<Double> correlationCoefficients = new LinkedList<>();
    for (int i = 0; i < n; i++) {
        final double[][] x = new double[n - 1][m];
        int k = 0;
        for (int j = 0; j < n; j++) {
            if (j != i) {
                x[k++] = data[j];
            }
        }

        // Transpose the matrix so that it fits the linear model
        final double[][] xT = new Array2DRowRealMatrix(x).transpose().getData();

        // RSquare is the "coefficient of determination"
        correlationCoefficients.add(
            MathUtil.createLinearRegression(xT, data[i]).calculateRSquared());
    }
    return correlationCoefficients;
}
 
开发者ID:manoelcampos,项目名称:cloudsim-plus,代码行数:29,代码来源:PowerVmSelectionPolicyMaximumCorrelation.java


示例8: getHostUtilizationIqr

import org.cloudbus.cloudsim.util.MathUtil; //导入依赖的package包/类
/**
 * Gets the host utilization iqr.
 * 
 * @param host the host
 * @return the host utilization iqr
 */
protected double getHostUtilizationIqr(PowerHostUtilizationHistory host) throws IllegalArgumentException {
	double[] data = host.getUtilizationHistory();
	if (MathUtil.countNonZeroBeginning(data) >= 12) { // 12 has been suggested as a safe value
		return MathUtil.iqr(data);
	}
	throw new IllegalArgumentException();
}
 
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:14,代码来源:PowerVmAllocationPolicyMigrationInterQuartileRange.java


示例9: getUtilizationHistory

import org.cloudbus.cloudsim.util.MathUtil; //导入依赖的package包/类
/**
 * Gets the host utilization history.
 * 
 * @return the host utilization history
 */
protected double[] getUtilizationHistory() {
	double[] utilizationHistory = new double[PowerVm.HISTORY_LENGTH];
	double hostMips = getTotalMips();
	for (PowerVm vm : this.<PowerVm> getVmList()) {
		for (int i = 0; i < vm.getUtilizationHistory().size(); i++) {
			utilizationHistory[i] += vm.getUtilizationHistory().get(i) * vm.getMips() / hostMips;
		}
	}
	return MathUtil.trimZeroTail(utilizationHistory);
}
 
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:16,代码来源:PowerHostUtilizationHistory.java


示例10: getHostUtilizationMad

import org.cloudbus.cloudsim.util.MathUtil; //导入依赖的package包/类
/**
 * Gets the host utilization mad.
 * 
 * @param host the host
 * @return the host utilization mad
 */
protected double getHostUtilizationMad(PowerHostUtilizationHistory host) throws IllegalArgumentException {
	double[] data = host.getUtilizationHistory();
	if (MathUtil.countNonZeroBeginning(data) >= 12) { // 12 has been suggested as a safe value
		return MathUtil.mad(data);
	}
	throw new IllegalArgumentException();
}
 
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:14,代码来源:PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation.java


示例11: getHostUtilizationMad

import org.cloudbus.cloudsim.util.MathUtil; //导入依赖的package包/类
/**
 * 计算出使用率的中位数绝对离差 Gets the host utilization mad.
 * 
 * @param host the host
 * @return the host utilization mad
 */
protected double getHostUtilizationMad(PowerHostUtilizationHistory host) throws IllegalArgumentException {
	double[] data = host.getUtilizationHistory();
	if (MathUtil.countNonZeroBeginning(data) >= 12) { // 12 has been suggested as a safe value
		return MathUtil.mad(data);
	}
	throw new IllegalArgumentException();
}
 
开发者ID:demiaowu,项目名称:annotation-of-cloudsim3.0.3,代码行数:14,代码来源:PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation.java


示例12: computeHostUtilizationMeasure

import org.cloudbus.cloudsim.util.MathUtil; //导入依赖的package包/类
/**
 * Computes the host utilization IRQ used for generating the host over utilization threshold.
 *
 * @param host the host
 * @return the host CPU utilization percentage IQR
 */
@Override
public double computeHostUtilizationMeasure(PowerHostUtilizationHistory host) throws IllegalArgumentException {
    final double[] data = host.getUtilizationHistory();
    if (MathUtil.countNonZeroBeginning(data) >= MIN_NUM_OF_HISTORY_ENTRIES_TO_COMPUTE_IRQ) {
        return MathUtil.iqr(data);
    }

    throw new IllegalArgumentException("There is not enough Host history to compute Host utilization IRQ");
}
 
开发者ID:manoelcampos,项目名称:cloudsim-plus,代码行数:16,代码来源:PowerVmAllocationPolicyMigrationInterQuartileRange.java


示例13: computeHostUtilizationMeasure

import org.cloudbus.cloudsim.util.MathUtil; //导入依赖的package包/类
/**
 * Computes the host utilization MAD used for generating the host over utilization threshold.
 *
 * @param host the host
 * @return the host utilization MAD
 * @throws {@inheritDoc}
 */
@Override
public double computeHostUtilizationMeasure(PowerHostUtilizationHistory host) throws IllegalArgumentException {
    final double[] data = host.getUtilizationHistory();
    if (MathUtil.countNonZeroBeginning(data) >= MIN_NUM_OF_HISTORY_ENTRIES_TO_COMPUTE_MAD) {
        return MathUtil.mad(data);
    }

    throw new IllegalArgumentException("There is not enough Host history to compute Host utilization MAD");
}
 
开发者ID:manoelcampos,项目名称:cloudsim-plus,代码行数:17,代码来源:PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation.java


示例14: getUtilizationHistory

import org.cloudbus.cloudsim.util.MathUtil; //导入依赖的package包/类
/**
* Gets the host CPU utilization percentage history (between [0 and 1], where 1 is 100%).
   * Each value into the returned array is the CPU utilization percentage for
   * a time interval equal to the {@link Datacenter#getSchedulingInterval()}.
   * @return
*/
  public double[] getUtilizationHistory() {
      final double[] utilizationHistory = new double[PowerVm.MAX_HISTORY_ENTRIES];
      final double totalMipsCapacity = getTotalMipsCapacity();
      for (final PowerVm vm : this.<PowerVm>getVmCreatedList()) {
          for (int i = 0; i < vm.getUtilizationHistory().size(); i++) {
              utilizationHistory[i] += vm.getUtilizationHistory().get(i) * vm.getTotalMipsCapacity() / totalMipsCapacity;
          }
      }
      return MathUtil.trimZeroTail(utilizationHistory);
  }
 
开发者ID:manoelcampos,项目名称:cloudsim-plus,代码行数:17,代码来源:PowerHostUtilizationHistory.java


示例15: getUtilizationMad

import org.cloudbus.cloudsim.util.MathUtil; //导入依赖的package包/类
/**
 * Gets the utilization Median Absolute Deviation (MAD) in MIPS.
 * @return
 */
public double getUtilizationMad() {
    if (!getUtilizationHistory().isEmpty()) {
        int n = Math.min(MAX_HISTORY_ENTRIES, getUtilizationHistory().size());
        double median = MathUtil.median(getUtilizationHistory());
        double[] deviationSum = new double[n];
        for (int i = 0; i < n; i++) {
            deviationSum[i] = Math.abs(median - getUtilizationHistory().get(i));
        }
        return MathUtil.median(deviationSum);
    }

    return 0;
}
 
开发者ID:manoelcampos,项目名称:cloudsim-plus,代码行数:18,代码来源:PowerVm.java



注:本文中的org.cloudbus.cloudsim.util.MathUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Builder类代码示例发布时间:2022-05-22
下一篇:
Java ModelElementInstance类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap