Class Experiment<T extends Experiment<T>>

java.lang.Object
org.cloudsimplus.testbeds.AbstractRunnable
org.cloudsimplus.testbeds.Experiment<T>
Type Parameters:
T - the type of the subclass extending this class
All Implemented Interfaces:
Runnable

public abstract class Experiment<T extends Experiment<T>> extends AbstractRunnable
An abstract class to implement simulation experiments that can be executed repeatably by a ExperimentRunner.
Since:
CloudSim Plus 1.0
Author:
Manoel Campos da Silva Filho
  • Field Details

    • hostsNumber

      protected int hostsNumber
  • Constructor Details

    • Experiment

      public Experiment(long seed)
      Creates a simulation experiment which is not linked to a runner, to enable it to execute just once.
    • Experiment

      public Experiment(int index, ExperimentRunner<?> runner)
      Instantiates a simulation experiment with 1 Datacenter by default.
      Parameters:
      index - the index that identifies the current experiment run.
      runner - the ExperimentRunner that is in charge of executing this experiment a defined number of times and to collect data for statistical analysis.
      See Also:
      • invalid reference
        #setDatacentersNumber(int)
    • Experiment

      protected Experiment(int index, ExperimentRunner<?> runner, long seed)
      Instantiates a simulation experiment that will create 1 broker and 1 Datacenter by default.
      Parameters:
      index - the index that identifies the current experiment run.
      runner - the ExperimentRunner to execute the experiment. If omitted, it means the experiment is independent and may be run just once. If you don't provide a runner, you must provide a seed
      seed - the seed to be set. If a runner is given, this value is ignored and the seed is generated from the runner base seed. If you don't provide a seed, you must provide a runner.
      See Also:
  • Method Details

    • run

      public final void run()
      Builds the simulation scenario and starts execution.
      Throws:
      RuntimeException
    • isFirstExperimentCreated

      public boolean isFirstExperimentCreated()
    • printResults

      public abstract void printResults()
      Prints the results for the experiment. The method has to be implemented by subclasses to output the experiment results.
      See Also:
      • printResultsInternal()
    • build

      protected final void build()
      Creates the simulation scenario to run the experiment.
    • createBrokers

      protected void createBrokers()
      Creates a list of brokers. This is the entry-point for broker creation.
    • createBroker

      protected abstract DatacenterBroker createBroker()
      Creates a DatacenterBroker.
      Returns:
      the created DatacenterBroker
    • createDatacenter

      protected Datacenter createDatacenter(int index)
      Creates a datacenter using a VmAllocationPolicy supplied by the vmAllocationPolicySupplier.
      Parameters:
      index - index of the datacenter being created, from the datacentersNumber.
      Returns:
      the created Datacenter
      See Also:
      • invalid reference
        #setVmAllocationPolicySupplier(Supplier)
    • createCloudlets

      protected abstract List<Cloudlet> createCloudlets(DatacenterBroker broker)
      Creates a list of Cloudlets to be used by the experiment.
      Parameters:
      broker - the broker to create the Cloudlets to
      Returns:
      the list of created cloudlets
    • createCloudlet

      protected abstract Cloudlet createCloudlet(DatacenterBroker broker)
    • createVms

      protected List<Vm> createVms(DatacenterBroker broker)
      Creates the Vms to be used by the experiment.
      Parameters:
      broker - the DatacenterBroker to attach VMs to
      Returns:
      the List of created VMs
    • createVm

      protected abstract Vm createVm(DatacenterBroker broker, int id)
    • nextVmId

      protected final int nextVmId()
    • nextCloudletId

      protected final int nextCloudletId()
    • createAndSubmitCloudletsInternal

      protected void createAndSubmitCloudletsInternal(DatacenterBroker broker)
      Creates all the Cloudlets required by the experiment and submits them to a Broker. This the entry-point for Cloudlets creation.
      Parameters:
      broker - broker to submit Cloudlets to
    • createHosts

      protected final List<Host> createHosts()
    • createHost

      protected abstract Host createHost(int id)
    • setBrokersNumber

      public Experiment setBrokersNumber(int brokersNumber)
      Sets the number of brokers to create.
      Parameters:
      brokersNumber - the value to set
      Returns:
      this experiment instance
    • setHostsNumber

      protected final void setHostsNumber(int hostsNumber)
    • newVmAllocationPolicy

      protected final VmAllocationPolicy newVmAllocationPolicy()
    • toString

      public String toString()
      Overrides:
      toString in class Object