本文整理汇总了Java中org.cloudbus.cloudsim.distributions.UniformDistr类的典型用法代码示例。如果您正苦于以下问题:Java UniformDistr类的具体用法?Java UniformDistr怎么用?Java UniformDistr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UniformDistr类属于org.cloudbus.cloudsim.distributions包,在下文中一共展示了UniformDistr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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();
}
示例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);
}
示例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;
}
示例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;
}
示例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<>();
}
示例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();
}
示例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<>();
}
示例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);
}
示例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());
}
示例15: CloudletSchedulerExperiment
import org.cloudbus.cloudsim.distributions.UniformDistr; //导入依赖的package包/类
CloudletSchedulerExperiment(int index, ExperimentRunner runner) {
super(index, runner);
this.cloudletPesPrng = new UniformDistr(0, 1);
}