This file provides guidance to AI coding agents when working with code in this repository.
CloudSim Plus Testbeds: more complex simulation scenarios that run an experiment many times with Pseudo Random Number Generators (PRNGs) to produce scientifically valid results (means, standard deviations, confidence intervals). It can apply the antithetic variates technique and the Batch Means Method to reduce variance and correlation. Unlike the cloudsimplus-examples module, the goal is valid research results, not showing framework features.
Requires JDK 25 (maven-compiler-plugin uses <release>25</release>). The .sdkmanrc file sets Amazon Corretto 25 for SDKMAN! users (sdk env).
./mvnw clean install # build (CI runs: mvn -B package)There are no tests and no Maven profiles or exec plugin. Each testbed is run through the main method of its *Runner class (or of an *Experiment class for a single isolated run), usually from the IDE. From the terminal, after a build:
./mvnw -q dependency:build-classpath -Dmdep.outputFile=cp.txt
java -cp "target/classes:$(cat cp.txt)" org.cloudsimplus.testbeds.hostfaultinjection.HostFaultInjectionRunnerThe jar manifest adds dependencies to the classpath using ~/.m2/repository/ paths, so java -cp target/*.jar ... also works on the machine that built it.
license-maven-plugin (mvn license:check / license:format) uses the header file ../COPYRIGHT, which only resolves when run from a directory where that file exists (it is in ../cloudsimplus/COPYRIGHT, not in the parent directory).
- The module version is the CloudSim Plus version used (currently
<version>9.0.0-SNAPSHOT</version>, and the dependency uses${project.version}). Change both together by changing only the project version. - The base abstractions (
Experiment,ExperimentRunner,AbstractRunnable,ConfidenceInterval,ResultTablein packageorg.cloudsimplus.testbeds) are not in this repo: they live in the framework (../cloudsimplus/src/main/java/org/cloudsimplus/testbeds/). Onlypackage-info.javaof that package is here. - SNAPSHOT versions are resolved from the local Maven repository or from the Maven Central snapshots repository (declared in
pom.xml). To use changes made in the sibling../cloudsimplusproject, runmvn installthere first. - Only use libraries this project declares in
pom.xml, not the ones that come indirectly from CloudSim Plus: they may be removed from the framework (e.g. Apache Commons Math 3 was replaced by Commons Statistics in 9.0.0). - Logging is through Logback (
logback-classic).
Each testbed is a package under org.cloudsimplus.testbeds with a pair of classes:
XxxExperiment extends Experiment<XxxExperiment>: one simulation run. Template-method style: it implementscreateBroker,createHost,createVm,createCloudlet(s)andprintResults;Experiment.build()/run()(final) wire the scenario. It is created with an index and its runner, and gets its PRNG seed from the runner.XxxRunner extends ExperimentRunner<XxxExperiment>: runs the experimentsimulationRunstimes. The constructor setsbaseSeed, number of runs, number of batches (Batch Means) and whether to apply antithetic variates (e.g.super(baseSeed, 400, 5, true)). It implementscreateExperimentInternal(index)andprintSimulationParameters().
How a runner works (see ExperimentRunner.run() in the framework):
- All experiments are created up front (needed because seeds are a shared list and runs may be parallel).
- Seeds come from
getSeed(index)/createRandomGen(index, ...). With antithetic variates, the second half of the runs reuses the seeds of the first half (isToReuseSeedFromFirstHalfOfExperiments) to produce antithetic samples. - Each experiment registers a callback with
setAfterExperimentFinish(...); the runner collects per-run values withaddMetricValue(metricName, value)into a metrics map keyed by metric name. - At the end, for each metric,
computeFinalStatisticsapplies antithetic means and/or batch means (only if runs > batches), then builds aConfidenceInterval;ResultTableprints the results as LaTeX and CSV tables.
Per-broker metrics are keyed by broker name (not instance), since each run creates new broker instances that must be matched across runs.
Current testbeds:
hostfaultinjection: host failure injection and VM availability vs. SLA (based on Raysa Oliveira's MSc thesis).sla/taskcompletiontime: Cloudlet task completion time with and without a minimization policy, also with real workloads. Variants shareAbstractCloudletTaskCompletionTimeExperiment.
Resources (src/main/resources, loaded via ResourceLoader/SwfWorkloadFileReader): SLA contracts in JSON (SlaCustomerN.json, SlaMetrics.json), sla-files.txt listing which SLA files are used (one broker per enabled file; lines starting with # are ignored), and SWF workload traces (METACENTRUM-2009-2.swf, UniLu-Gaia-2014-2.swf).