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
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 Summary
FieldsFields inherited from class org.cloudsimplus.testbeds.AbstractRunnable
verbose -
Constructor Summary
ConstructorsModifierConstructorDescriptionExperiment(int index, ExperimentRunner<?> runner) Instantiates a simulation experiment with 1 Datacenter by default.protectedExperiment(int index, ExperimentRunner<?> runner, long seed) Instantiates a simulation experiment that will create 1 broker and 1 Datacenter by default.Experiment(long seed) Creates a simulation experiment which is not linked to a runner, to enable it to execute just once. -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidbuild()Creates the simulation scenario to run the experiment.protected voidCreates all the Cloudlets required by the experiment and submits them to a Broker.protected abstract DatacenterBrokerCreates a DatacenterBroker.protected voidCreates a list of brokers.protected abstract CloudletcreateCloudlet(DatacenterBroker broker) createCloudlets(DatacenterBroker broker) Creates a list of Cloudlets to be used by the experiment.protected DatacentercreateDatacenter(int index) Creates a datacenter using aVmAllocationPolicysupplied by thevmAllocationPolicySupplier.protected abstract HostcreateHost(int id) protected abstract VmcreateVm(DatacenterBroker broker, int id) createVms(DatacenterBroker broker) Creates the Vms to be used by the experiment.booleanprotected final VmAllocationPolicyprotected final intprotected final intnextVmId()abstract voidPrints the results for the experiment.final voidrun()Builds the simulation scenario and starts execution.setBrokersNumber(int brokersNumber) Sets the number of brokers to create.protected final voidsetHostsNumber(int hostsNumber) toString()Methods inherited from class org.cloudsimplus.testbeds.AbstractRunnable
isNotVerbose, print, print, println, println, println
-
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
Instantiates a simulation experiment with 1 Datacenter by default.- Parameters:
index- the index that identifies the current experiment run.runner- theExperimentRunnerthat is in charge of executing this experiment a defined number of times and to collect data for statistical analysis.- See Also:
-
Experiment
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- theExperimentRunnerto 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 seedseed- 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:
-
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
Creates a DatacenterBroker.- Returns:
- the created DatacenterBroker
-
createDatacenter
Creates a datacenter using aVmAllocationPolicysupplied by thevmAllocationPolicySupplier.- Parameters:
index- index of the datacenter being created, from thedatacentersNumber.- Returns:
- the created Datacenter
- See Also:
-
createCloudlets
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
-
createVms
Creates the Vms to be used by the experiment.- Parameters:
broker- the DatacenterBroker to attach VMs to- Returns:
- the List of created VMs
-
createVm
-
nextVmId
protected final int nextVmId() -
nextCloudletId
protected final int nextCloudletId() -
createAndSubmitCloudletsInternal
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
-
createHost
-
setBrokersNumber
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
-
toString
-