/** * Creates a fault injection mechanism for the Hosts of a given {@link Datacenter}. * The Hosts failures are randomly injected according to a {@link UniformDistr} * pseudo random number generator, which indicates the mean of failures to be generated per <b>hour</b>, * (which is also called <b>event rate</b> or <b>rate parameter</b>). * * @param datacenter the Datacenter to which failures will be randomly injected for its Hosts * @see #HostFaultInjection(Datacenter, ContinuousDistribution) */ public HostFaultInjection(final Datacenter datacenter) { this(datacenter, new UniformDistr()); }
CloudletSchedulerExperiment(int index, ExperimentRunner runner) { super(index, runner); this.cloudletPesPrng = new UniformDistr(0, 1); }
public PowerVmSelectionPolicyRandomSelection(){ super(); rand = new UniformDistr(); }
/** * Instantiates the simulation experiment. * * @param index a number the identifies the current experiment being run * @param runner the runner that will be in charge to setup and run the * experiment */ DatacenterBrokerHeuristicExperiment(int index, DatacenterBrokerHeuristicRunner runner) { super(index, runner); this.randomGen = new UniformDistr(0, 1); createSimulatedAnnealingHeuristic(); }
/** * Creates a new Poisson random number generator to check * the probability of 1 event ({@link #getK() k}) to happen at each time * interval. * * @param lambda the average number of events that happen at each 1 time unit. * If one considers the unit as minute, this value means the average number of arrivals * at each minute. * @param seed the seed to initialize the uniform random number generator * @see #setK(int) * @see #setLambda(double) */ public PoissonDistr(final double lambda, final long seed){ this.rand = new UniformDistr(seed); this.k = 1; this.setLambda(lambda); }
private CloudletTaskCompletionTimeMinimizationExperiment(final int index, final ExperimentRunner runner, final long seed) { super(index, runner, seed); setHostsNumber(HOSTS); setVmsNumber(VMS); 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<>(); }
/** * Instantiates a new utilization model stochastic. * * @param seed the seed to generate the pseudo random utilization values */ public UtilizationModelStochastic(long seed) { super(); setHistory(new HashMap<>()); setRandomGenerator(new UniformDistr(seed)); }
/** * 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++) { final int vmIndex = (int)rand.sample() % vmList.size(); NetworkVm vm = vmList.get(vmIndex); list.add(vm); } return list; }
/** * Instantiates a new utilization model stochastic * that defines the resource utilization in percentage. */ public UtilizationModelStochastic() { super(); setHistory(new HashMap<>()); setRandomGenerator(new UniformDistr()); }
private CloudletTaskCompletionTimeWorkLoadMinimizationExperiment(final int index, final ExperimentRunner runner, final long seed) { super(index, runner, seed); setHostsNumber(HOSTS); setVmsNumber(VMS); randVm = new UniformDistr(getSeed()+1); randMip = new UniformDistr(getSeed()+2); contractsMap = new HashMap<>(); }
@Override protected void setup() { cloudletsCompletionTimeMeans = new ArrayList<>(getSimulationRuns()); cloudletsNumber = new ArrayList<>(getSimulationRuns()); cloudletsNumberPrng = new UniformDistr(VM_PES / 2, VM_PES + 1, getBaseSeed()); }
private void createSimulatedAnnealingHeuristic() { heuristic = new CloudletToVmMappingSimulatedAnnealing(SA_INITIAL_TEMPERATURE, new UniformDistr(0, 1)); heuristic.setColdTemperature(SA_COLD_TEMPERATURE); heuristic.setCoolingRate(SA_COOLING_RATE); heuristic.setNeighborhoodSearchesByIteration(SA_NUMBER_OF_NEIGHBORHOOD_SEARCHES); }
@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(); }
/** * 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; }
private MinTimeBetweenEventsExample() { Log.setLevel(Level.WARN); System.out.println("Starting " + getClass().getSimpleName()); simulation = new CloudSim(MIN_TIME_BETWEEN_EVENTS); this.hostList = new ArrayList<>(); this.vmList = new ArrayList<>(); this.cloudletList = new ArrayList<>(); this.datacenter = createDatacenter(); this.broker = new DatacenterBrokerSimple(simulation); Vm vm = createAndSubmitVm(); final long seed = 1547040598054L; random = new UniformDistr(seed); createAndSubmitCloudlets(vm); runSimulationAndPrintResults(); }
private CloudletTaskCompletionTimeWorkLoadWithoutMinimizationExperiment(final int index, final ExperimentRunner runner, final long seed) { super(index, runner, seed); this.randVm = new UniformDistr(1475098589732L + 1); this.contract = SlaContract.getInstance(METRICS_FILE); setHostsNumber(HOSTS); setVmsNumber(VMS); }
private HostFaultInjectionExperiment(final int index, final ExperimentRunner runner, final long seed) { super(index, runner, seed); setNumBrokersToCreate(readContractList().size()); setAfterScenarioBuild(exp -> createFaultInjectionForHosts(getDatacenter0())); this.randCloudlet = new UniformDistr(this.getSeed()); contractsMap = new HashMap<>(); templatesMap = new HashMap<>(); }
private CloudletTaskCompletionTimeWithoutMinimizationExperiment(final int index, final ExperimentRunner runner, final long seed) { super(index, runner, seed); setHostsNumber(HOSTS); setVmsNumber(VMS); randCloudlet = new UniformDistr(getSeed()); randVm = new UniformDistr(getSeed()+1); this.contract = SlaContract.getInstance(METRICS_FILE); getCloudSim().addOnClockTickListener(this::printVmsCpuUsage); }
private RandomCloudletsArrivalExample() { /*Enables just some level of log messages. Make sure to import org.cloudsimplus.util.Log;*/ //Log.setLevel(ch.qos.logback.classic.Level.WARN); simulation = new CloudSim(); random = new UniformDistr(); simulation.terminateAt(TIME_TO_TERMINATE_SIMULATION); datacenter0 = createDatacenter(); broker0 = new DatacenterBrokerSimple(simulation); vmList = createVms(); cloudletList = createCloudlets(INITIAL_CLOUDLETS_NUMBER); broker0.submitVmList(vmList); broker0.submitCloudletList(cloudletList); simulation.addOnClockTickListener(this::createRandomCloudlets); simulation.start(); final List<Cloudlet> finishedCloudlets = broker0.getCloudletFinishedList(); new CloudletsTableBuilder(finishedCloudlets).build(); final int randomCloudlets = cloudletList.size()-INITIAL_CLOUDLETS_NUMBER; System.out.println( "Number of Arrived Cloudlets: " + cloudletList.size() + " ("+INITIAL_CLOUDLETS_NUMBER+" statically created and "+ randomCloudlets+" randomly created during simulation runtime)"); }
public RandomVmAllocationPolicyExample() { /*Enables just some level of log messages. Make sure to import org.cloudsimplus.util.Log;*/ //Log.setLevel(ch.qos.logback.classic.Level.WARN); simulation = new CloudSim(); random = new UniformDistr(-1, 2); datacenter0 = createDatacenter(); //Creates a broker that is a software acting on behalf a cloud customer to manage his/her VMs and Cloudlets broker0 = new DatacenterBrokerSimple(simulation); vmList = createVms(); cloudletList = createCloudlets(); broker0.submitVmList(vmList); broker0.submitCloudletList(cloudletList); simulation.start(); final List<Cloudlet> finishedCloudlets = broker0.getCloudletFinishedList(); new CloudletsTableBuilder(finishedCloudlets).build(); }