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

Java UniformDistr类代码示例

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

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



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

示例1: LoadBalancerByHorizontalVmScalingExample

import org.cloudbus.cloudsim.distributions.UniformDistr; //导入依赖的package包/类
/**
 * Default constructor that builds the simulation scenario and starts the simulation.
 */
public LoadBalancerByHorizontalVmScalingExample() {
    /*You can remove the seed to get a dynamic one, based on current computer time.
    * With a dynamic seed you will get different results at each simulation run.*/
    final long seed = 1;
    rand = new UniformDistr(0, CLOUDLET_LENGTHS.length, seed);
    hostList = new ArrayList<>(HOSTS);
    vmList = new ArrayList<>(VMS);
    cloudletList = new ArrayList<>(CLOUDLETS);

    simulation = new CloudSim();
    simulation.addOnClockTickListener(this::createNewCloudlets);

    createDatacenter();
    broker0 = new DatacenterBrokerSimple(simulation);

    vmList.addAll(createListOfScalableVms(VMS));

    createCloudletList();
    broker0.submitVmList(vmList);
    broker0.submitCloudletList(cloudletList);

    simulation.start();

    printSimulationResults();
}
 
开发者ID:manoelcampos,项目名称:cloudsim-plus,代码行数:29,代码来源:LoadBalancerByHorizontalVmScalingExample.java


示例2: doSetup

import org.cloudbus.cloudsim.distributions.UniformDistr; //导入依赖的package包/类
@Setup
public void doSetup() {
    CloudletToVmMappingSimulatedAnnealing heuristic =
        new CloudletToVmMappingSimulatedAnnealing(0, new UniformDistr(0, 1));
    instance1 = createInstance();
    instance2 = createInstance();
    /*Call the getCost the first time without measure it
    in order to measure the time for the second call,
    when the cost is already computed*/
    instance2.getCost();
}
 
开发者ID:manoelcampos,项目名称:cloudsim-plus,代码行数:12,代码来源:CloudletToVmMappingSolutionBenchmark.java


示例3: createSimulatedAnnealingHeuristic

import org.cloudbus.cloudsim.distributions.UniformDistr; //导入依赖的package包/类
private void createSimulatedAnnealingHeuristic() {
	heuristic =
	        new CloudletToVmMappingSimulatedAnnealing(SA_INITIAL_TEMPERATURE, new UniformDistr(0, 1));
	heuristic.setColdTemperature(SA_COLD_TEMPERATURE);
	heuristic.setCoolingRate(SA_COOLING_RATE);
	heuristic.setNumberOfNeighborhoodSearchesByIteration(SA_NUMBER_OF_NEIGHBORHOOD_SEARCHES);
}
 
开发者ID:manoelcampos,项目名称:cloudsim-plus,代码行数:8,代码来源:DatacenterBrokerHeuristicExample.java


示例4: randomlySelectVmsForApp

import org.cloudbus.cloudsim.distributions.UniformDistr; //导入依赖的package包/类
/**
 * Randomly select a given number of VMs from the list of created VMs,
 * to be used by the NetworkCloudlets of the given application.
 *
 * @param broker the broker where to get the existing VM list
 * @param numberOfVmsToSelect number of VMs to selected from the existing list of VMs.
 * @return The list of randomly selected VMs
 */
protected List<NetworkVm> randomlySelectVmsForApp(
    DatacenterBroker broker, int numberOfVmsToSelect) {
    List<NetworkVm> list = new ArrayList<>();
    int numOfExistingVms = this.vmList.size();
    UniformDistr rand = new UniformDistr(0, numOfExistingVms, 5);
    for (int i = 0; i < numberOfVmsToSelect; i++) {
        int vmId = (int) rand.sample();
        NetworkVm vm = VmList.getById(this.vmList, vmId);
        if(vm != Vm.NULL){
            list.add(vm);
        }
    }
    return list;
}
 
开发者ID:manoelcampos,项目名称:cloudsim-plus,代码行数:23,代码来源:NetworkVmExampleAbstract.java


示例5: createVmPesArray

import org.cloudbus.cloudsim.distributions.UniformDistr; //导入依赖的package包/类
/**
 * Creates an array with the configuration of PEs for each VM to be created
 * in each experiment run. Every experiment will use the same VMs
 * configurations.
 *
 * @return the created VMs PEs array
 */
private int[] createVmPesArray() {
    final UniformDistr random = new UniformDistr(0, VM_PES_NUMBERS.length, getBaseSeed());
    int[] pesArray = new int[VMS_TO_CREATE];
    int totalNumberOfPes = 0;
    for (int i = 0; i < VMS_TO_CREATE; i++) {
        pesArray[i] = VM_PES_NUMBERS[(int) random.sample()];
        totalNumberOfPes += pesArray[i];
    }

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


示例6: HostFaultInjectionExperiment

import org.cloudbus.cloudsim.distributions.UniformDistr; //导入依赖的package包/类
private HostFaultInjectionExperiment(int index, ExperimentRunner runner, long seed) {
    super(index, runner, seed);
    setNumBrokersToCreate((int)numberSlaContracts());
    setAfterScenarioBuild(exp -> createFaultInjectionForHosts(getDatacenter0()));
    this.randCloudlet = new UniformDistr(this.getSeed());
    contractsMap = new HashMap<>();
    templatesMap = new HashMap<>();
}
 
开发者ID:manoelcampos,项目名称:cloudsim-plus,代码行数:9,代码来源:HostFaultInjectionExperiment.java


示例7: TestWithoutAlgorithmExample

import org.cloudbus.cloudsim.distributions.UniformDistr; //导入依赖的package包/类
public TestWithoutAlgorithmExample() throws FileNotFoundException, IOException {

        final long seed = 1;
        randCloudlet = new UniformDistr(0, CLOUDLET_LENGTHS.length, seed);
        randVm = new UniformDistr(0, VM_PES.length, seed);
        hostList = new ArrayList<>(HOSTS);
        vmList = new ArrayList<>(VMS);
        cloudletList = new ArrayList<>(CLOUDLETS);

        simulation = new CloudSim();

        // Reading the sla contract and taking the metric values
        this.contract = SlaContract.getInstanceFromResourcesDir(getClass(), METRICS_FILE);

        //       simulation.addOnClockTickListener(this::createNewCloudlets);
        simulation.addOnClockTickListener(this::printVmsCpuUsage);

        createDatacenter();
        broker0 = new DatacenterBrokerSimple(simulation);

        vmList.addAll(createListOfScalableVms(VMS));

        createCloudletList();

        broker0.submitVmList(vmList);
        broker0.submitCloudletList(cloudletList);

        simulation.start();

        taskTimeCompletionCloudletSimulation(broker0);
        double percentage = (totalOfcloudletSlaSatisfied * 100) / cloudletList.size();
        System.out.println("\n ** Percentage of cloudlets that complied"
                + " with the SLA Agreement: " + percentage + " %");
        double totalCost = totalCostPrice(vmList);
        System.out.println("\t** Total cost (memory, bw, processing, storage) - " + totalCost);
        printSimulationResults();
    }
 
开发者ID:manoelcampos,项目名称:cloudsim-plus,代码行数:38,代码来源:TestWithoutAlgorithmExample.java


示例8: CloudletTaskTimeCompletionWorkLoadMinimizationExperiment

import org.cloudbus.cloudsim.distributions.UniformDistr; //导入依赖的package包/类
private CloudletTaskTimeCompletionWorkLoadMinimizationExperiment(final int index, final ExperimentRunner runner, final long seed) {
    super(index, runner, seed);
    randCloudlet = new UniformDistr(getSeed());
    randVm = new UniformDistr(getSeed()+1);
    randMip = new UniformDistr(getSeed()+2);
    contractsMap = new HashMap<>();
}
 
开发者ID:manoelcampos,项目名称:cloudsim-plus,代码行数:8,代码来源:CloudletTaskTimeCompletionWorkLoadMinimizationExperiment.java


示例9: CloudletTaskTimeCompletionWorkLoadWithoutMinimizationExperiment

import org.cloudbus.cloudsim.distributions.UniformDistr; //导入依赖的package包/类
private CloudletTaskTimeCompletionWorkLoadWithoutMinimizationExperiment(final int index, final ExperimentRunner runner, final long seed) {
    super(index, runner, seed);
    this.randCloudlet = new UniformDistr(1475098589732L);
    this.randVm = new UniformDistr(1475098589732L+1);
    try {
        this.contract = SlaContract.getInstanceFromResourcesDir(getClass(), METRICS_FILE);
    } catch (IOException ex) {
        Logger.getLogger(CloudletTaskTimeCompletionWorkLoadWithoutMinimizationExperiment.class.getName()).log(Level.SEVERE, null, ex);
        throw new RuntimeException(ex);
    }
}
 
开发者ID:manoelcampos,项目名称:cloudsim-plus,代码行数:12,代码来源:CloudletTaskTimeCompletionWorkLoadWithoutMinimizationExperiment.java


示例10: CloudletTaskTimeCompletionMinimizationExperiment

import org.cloudbus.cloudsim.distributions.UniformDistr; //导入依赖的package包/类
private CloudletTaskTimeCompletionMinimizationExperiment(int index, ExperimentRunner runner, long seed) {
    super(index, runner, seed);
    this.randCloudlet = new UniformDistr(getSeed());
    this.randVm = new UniformDistr(getSeed()+2);
    this.randCloudletPes = new UniformDistr(getSeed()+3);
    this.randMipsVm = new UniformDistr(getSeed()+4);
    contractsMap = new HashMap<>();
//    getCloudSim().addOnClockTickListener(this::printVmsCpuUsage);

}
 
开发者ID:manoelcampos,项目名称:cloudsim-plus,代码行数:11,代码来源:CloudletTaskTimeCompletionMinimizationExperiment.java


示例11: CloudletTaskTimeCompletionWithoutMinimizationExperiment

import org.cloudbus.cloudsim.distributions.UniformDistr; //导入依赖的package包/类
private CloudletTaskTimeCompletionWithoutMinimizationExperiment(final int index, final ExperimentRunner runner, final long seed) {
    super(index, runner, seed);
    randCloudlet = new UniformDistr(getSeed());
    randVm = new UniformDistr(getSeed()+1);
    try {
        this.contract = SlaContract.getInstanceFromResourcesDir(getClass(), METRICS_FILE);
        getCloudSim().addOnClockTickListener(this::printVmsCpuUsage);
    } catch (IOException ex) {
        Logger.getLogger(CloudletTaskTimeCompletionWithoutMinimizationExperiment.class.getName()).log(Level.SEVERE, null, ex);
        throw new RuntimeException(ex);
    }
}
 
开发者ID:manoelcampos,项目名称:cloudsim-plus,代码行数:13,代码来源:CloudletTaskTimeCompletionWithoutMinimizationExperiment.java


示例12: UsageSequenceGenerator

import org.cloudbus.cloudsim.distributions.UniformDistr; //导入依赖的package包/类
/**
 * Creates a usageSequenceGenerator with the following distributions:
 * file size uniformly distributed from 1KB to 1GB
 * intervals between 10ms and 5min
 * download probability distribution between 0 and 0.6
 */
public UsageSequenceGenerator() {
	fileSizeDistribution = new UniformDistr(FileSizeHelper.toBytes(1, KILO_BYTE), FileSizeHelper.toBytes(1, GIGA_BYTE));
	intervalDistribution = new UniformDistr(0, 1000.0 * 30.0); //10 ms - 30sec
	downloadProbability = new UniformDistr(0, 0.6);
	usedFilenames = new ArrayList<>();
}
 
开发者ID:toebbel,项目名称:StorageCloudSim,代码行数:13,代码来源:UsageSequenceGenerator.java


示例13: createVmsInDatacenterBase

import org.cloudbus.cloudsim.distributions.UniformDistr; //导入依赖的package包/类
/**
 * Create the virtual machines in a datacenter and submit/schedule cloudlets to them.
 * 
 * @param datacenterId Id of the chosen PowerDatacenter
 * 
 * @pre $none
 * @post $none
 */
protected void createVmsInDatacenterBase(int datacenterId) {
	// send as much vms as possible for this datacenter before trying the
	// next one
	int requestedVms = 0;

	// All host will have two VMs (assumption) VM is the minimum unit
	if (createvmflag) {
		CreateVMs(datacenterId);
		createvmflag = false;
	}

	// generate Application execution Requests
	for (int i = 0; i < 100; i++) {
		this.getAppCloudletList().add(
				new WorkflowApp(AppCloudlet.APP_Workflow, NetworkConstants.currentAppId, 0, 0, getId()));
		NetworkConstants.currentAppId++;

	}
	int k = 0;

	// schedule the application on VMs
	for (AppCloudlet app : this.getAppCloudletList()) {

		List<Integer> vmids = new ArrayList<Integer>();
		int numVms = linkDC.getVmList().size();
		UniformDistr ufrnd = new UniformDistr(0, numVms, 5);
		for (int i = 0; i < app.numbervm; i++) {

			int vmid = (int) ufrnd.sample();
			vmids.add(vmid);

		}

		if (vmids != null) {
			if (!vmids.isEmpty()) {

				app.createCloudletList(vmids);
				for (int i = 0; i < app.numbervm; i++) {
					app.clist.get(i).setUserId(getId());
					appCloudletRecieved.put(app.appID, app.numbervm);
					this.getCloudletSubmittedList().add(app.clist.get(i));
					cloudletsSubmitted++;

					// Sending cloudlet
					sendNow(
							getVmsToDatacentersMap().get(this.getVmList().get(0).getId()),
							CloudSimTags.CLOUDLET_SUBMIT,
							app.clist.get(i));
				}
				System.out.println("app" + (k++));
			}
		}

	}
	setAppCloudletList(new ArrayList<AppCloudlet>());
	if (NetworkConstants.iteration < 10) {

		NetworkConstants.iteration++;
		this.schedule(getId(), NetworkConstants.nexttime, CloudSimTags.NextCycle);
	}

	setVmsRequested(requestedVms);
	setVmsAcks(0);
}
 
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:73,代码来源:NetDatacenterBroker.java


示例14: setup

import org.cloudbus.cloudsim.distributions.UniformDistr; //导入依赖的package包/类
@Override
protected void setup() {
    cloudletsCompletionTimeMeans = new ArrayList<>(getSimulationRuns());
    cloudletsNumber = new ArrayList<>(getSimulationRuns());
    cloudletsNumberPrng = new UniformDistr(VM_PES / 2, VM_PES + 1, getBaseSeed());
}
 
开发者ID:manoelcampos,项目名称:cloudsim-plus,代码行数:7,代码来源:CloudletSchedulerRunner.java


示例15: CloudletSchedulerExperiment

import org.cloudbus.cloudsim.distributions.UniformDistr; //导入依赖的package包/类
CloudletSchedulerExperiment(int index, ExperimentRunner runner) {
    super(index, runner);
    this.cloudletPesPrng = new UniformDistr(0, 1);
}
 
开发者ID:manoelcampos,项目名称:cloudsim-plus,代码行数:5,代码来源:CloudletSchedulerExperiment.java


示例16: PowerVmSelectionPolicyRandomSelection

import org.cloudbus.cloudsim.distributions.UniformDistr; //导入依赖的package包/类
public PowerVmSelectionPolicyRandomSelection(){
    rand = new UniformDistr();
}
 
开发者ID:manoelcampos,项目名称:cloudsim-plus,代码行数:4,代码来源:PowerVmSelectionPolicyRandomSelection.java


示例17: UtilizationModelStochastic

import org.cloudbus.cloudsim.distributions.UniformDistr; //导入依赖的package包/类
/**
 * Instantiates a new utilization model stochastic
 * that defines the resource utilization in percentage.
 */
public UtilizationModelStochastic() {
    super();
    setHistory(new HashMap<>());
    setRandomGenerator(new UniformDistr());
}
 
开发者ID:manoelcampos,项目名称:cloudsim-plus,代码行数:10,代码来源:UtilizationModelStochastic.java


示例18: MySeekTimeDistr

import org.cloudbus.cloudsim.distributions.UniformDistr; //导入依赖的package包/类
/**
 * Creates a new exponential number generator.
 * 
 * @param min
 *            the min for the distribution.
 * @param max
 *            the max for the distribution.
 * @param mean
 *            the mean for the distribution.
 */
public MySeekTimeDistr(double min, double max, double mean) {
	if (mean <= min || mean >= max || min >= max) {
		throw new IllegalArgumentException("Incorect parameters");
	}
	this.numGen1 = new UniformDistr(min, mean);
	this.numGen2 = new UniformDistr(mean, max);
	this.mean = mean;
	this.x = new ArrayList<Double>();
}
 
开发者ID:Udacity2048,项目名称:CloudSimDisk,代码行数:20,代码来源:MySeekTimeDistr.java


示例19: createRandomGen

import org.cloudbus.cloudsim.distributions.UniformDistr; //导入依赖的package包/类
/**
 * Creates a pseudo random number generator (PRNG) for a experiment run that
 * generates uniform values between [min and max[. If it is to apply the
 * {@link #isApplyAntitheticVariatesTechnique() "Antithetic Variates Technique"}
 * to reduce results variance, the second half of experiments will use the
 * seeds from the first half.
 *
 * @param experimentIndex
 * @param minValue the minimum value the generator will return (inclusive)
 * @param maxValue the maximum value the generator will return (exclusive)
 * @return the created PRNG
 *
 * @see UniformDistr#isApplyAntitheticVariatesTechnique()
 */
public ContinuousDistribution createRandomGen(int experimentIndex, double minValue, double maxValue) {
    if (isToReuseSeedFromFirstHalfOfExperiments(experimentIndex)) {
        final int expIndexFromFirstHalf = experimentIndex - halfSimulationRuns();
        return new UniformDistr(minValue, maxValue, seeds.get(expIndexFromFirstHalf))
                .setApplyAntitheticVariatesTechnique(true);
    }

    return new UniformDistr(minValue, maxValue, seeds.get(experimentIndex));
}
 
开发者ID:manoelcampos,项目名称:cloudsim-plus,代码行数:24,代码来源:ExperimentRunner.java


示例20: DynamicVmCreationByCpuUtilizationAndFreePesOfVm

import org.cloudbus.cloudsim.distributions.UniformDistr; //导入依赖的package包/类
public DynamicVmCreationByCpuUtilizationAndFreePesOfVm() throws FileNotFoundException, IOException {

        final long seed = 1;
        randCloudlet = new UniformDistr(0, CLOUDLET_LENGTHS.length, seed);
        hostList = new ArrayList<>(HOSTS);
        vmList = new ArrayList<>(VMS);
        cloudletList = new ArrayList<>(CLOUDLET_LENGTHS.length);

        simulation = new CloudSim();

        // Reading the sla contract and taking the metric values
        this.contract = SlaContract.getInstanceFromResourcesDir(getClass(), METRICS_FILE);

        simulation.addOnClockTickListener(this::createNewCloudlets);
        simulation.addOnClockTickListener(this::printVmsCpuUsage);
        simulation.addOnClockTickListener(this::cpuUtilization);

        createDatacenter();
        broker0 = new DatacenterBrokerSimple(simulation);

        vmList.addAll(createListOfScalableVms(VMS));

        createCloudletList();

        broker0.submitVmList(vmList);
        broker0.submitCloudletList(cloudletList);

        simulation.start();

        printSimulationResults();
    }
 
开发者ID:manoelcampos,项目名称:cloudsim-plus,代码行数:32,代码来源:DynamicVmCreationByCpuUtilizationAndFreePesOfVm.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java DCStartElement类代码示例发布时间:2022-05-22
下一篇:
Java EV3MediumRegulatedMotor类代码示例发布时间: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