Skip to content

CloudSim is primarily a simulation framework for modeling and simulating cloud computing infrastructures and services. While CloudSim itself does not include built-in machine learning capabilities, you can integrate machine learning techniques into CloudSim to optimize various aspects of cloud resource management.

License

Notifications You must be signed in to change notification settings

ArkS0001/CloudSim-QWhale-SARSAWhale-Hybrid-Optimization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

To simulate the workloads

org.cloudbus.cloudsim -> “Cloudlet.java”

To simulate the regions and datacenters

org.cloudbus.cloudsim -> “Datacenter.java”

To simulate the task offloading and policy-related services

org.cloudbus.cloudsim -> “VmAllocationPolicy.java”, “CloudletScheduler.java”, “DatacenterBroker.java”, etc

Research Topics in Cloud Computing

Optimization Approaches for Network End-to-End Delay
Resource and Multi-Task Offloading
Optimal VM Distribution and Deployment Policies
Cloud Workflow Observation and Execution
Cloud VM Deployment and Management
QoS Negotiation in Real-Time Applications
Migration-less Adaptive Task Scheduling
Cloud Service Utilization Billing, Accounting and Metering
SLA based Admission Control and Management
Energy-aware Dynamic VM Consolidations and Migrations

One of the interesting factors in Cloudsim is its supporting algorithms. Depending on the functionalities, it supports several approaches and algorithms and some of them are classified below for your references.

In CloudSim, cloudlets represent the tasks or workloads that are executed on virtual machines (VMs) within the simulated cloud environment. CloudSim provides several methods for generating cloudlet information, allowing users to create diverse workload scenarios for their simulations. Here's how cloudlet information can be generated in CloudSim:

Manual Specification: Users can manually specify the attributes of cloudlets, such as the length of the task (in MI, or million instructions), the required number of CPU cores, the amount of data to be transferred, and other relevant parameters. This approach is suitable for creating custom workload profiles tailored to specific research objectives.

Trace-Based Generation: CloudSim supports the use of workload traces obtained from real-world systems or generated by workload generators. These traces typically contain information about the arrival times, execution lengths, and resource requirements of individual tasks. By replaying or interpolating these traces within CloudSim, users can simulate realistic workload scenarios and evaluate the performance of cloud infrastructures under various conditions.

Random Generation: CloudSim includes utilities for generating synthetic workload data using random distributions. Users can specify parameters such as the mean task length, arrival rate, and distribution of resource requirements to create workload instances with varying characteristics. While synthetic workloads may not accurately reflect real-world usage patterns, they allow for controlled experimentation and scalability testing.

Task Workload Models: CloudSim also supports the use of workload models, such as Poisson processes or Markov chains, to generate cloudlet information dynamically during the simulation. These models capture statistical properties of workload arrival patterns and resource demands, enabling the creation of dynamic and evolving workload scenarios.

Supported CloudSim Algorithms

# VM Management Algorithms
    Maximum Correlation Coefficient Approach
    Random Choice / Sample Technique
    Average Mean / Median Absolute Deviations Method
    Time Policy based  Minimum Migration Strategy
    Soft Actor Critic (SAC) Reinforcement Learning Algorithm
# VM Load Balancing Algorithms
    Recurrent Neural Networks (RNN)
    Logistic and Linear Regression
    Convolutional Neural Networks (CNN)
    Naïve Bayes  and SVM Algorithm
    Fuzzy Wavelet Neural Network Theory
    Neural Networks and Deep Learning Algorithms
    Quality based Dynamic Service Broker Chaining
    Random Forest and Decision Tree Algorithm
    Waltz Filtering / Labeling Algorithm – Constraint Satisfaction
    Cluster Analysis (For instances: K-Means, EM, Gaussian distributions)
# Added Approaches and Algorithms
    Queen Bee Inspired Algorithm
    Morpho Graph Algorithm
    Fuzzy-Neuro Prediction Algorithm
    Cooperative Game Theory Approach
    Honey Bee Optimization Algorithm
    Artificial Ant Colony Optimization Algorithm

Next, we can see about the software requirements for simulating the cloud computing project in Cloudsim. Under these requirements, we can model and simulate any kind of cloudapplications.

Requirements for CloudSim Projects

Integrated Development Environment (IDE)
    Java Development Kit (JDK)
    Eclipse/NetBeans IDE
Operating System (OS)
    Windows Vista (32 or 64 bit)
    Windows 7 (32 or 64 bit)
    Windows 8 and 10 (32 or 64 bit)
    Windows XP (32 bit)
    Mac OS X 10.5.8 or later (32 bit only)
    Linux (Lucid Lynx and Ubuntu Linux)

How to run Cloudsim Simulation Scenario?

Set both CloudSim and CloudInformationService element with the present watch time
Construct required number of Datacenter(s) as resource suppliers and any one to begin simulation.
Construct Broker for scheduling the task, allocating the VM and deploying the VM.
Construct one or more VM and allocate to the broker. Next further submit to the corresponding DataCenters
Create one or more Cloudlet and add them to the cloudlet list and broker for next task scheduling process on VMs. Then, it starts processing in the time of simulation
Starts simulation to initiate all the deployed entities to perform their tasks
Stop simulation to terminate all the entities prior to end the simulation
Once the simulation is completed then pint the generated outcome. It clearly shows the cloudlet execution time in VM with start and finish time
For more detailed explanation follow the “Guide to CloudsimExample1.java simulation workflow“ article

The first and foremost version of Cloud computing simulator is Cloudsim 3.x.x which turn out to be the foundation for several other extensions. And some of them are given as follows, Other Simulators based on Cloudsim

CloudReports
CloudSimEx
iFogSim
EdgeCloudSim
CloudAnalyst
WorkflowSim
Cloudsim Plus

In the beginning, the CloudSim act as a stand-alone cloud simulator which is globally used in everywhere. Later, so many independent scholars have added some significant features into it. As a result, Cloudsim is now extended in many ways as follow,

CloudReports – Generates GUI based report of Simulation
ThermoSim – Empowers Learning assisted Cloud Nodes Temperature Prediction using Thermal characteristics
Cloud2Sim – Supports Open source Hazelcast Java framework for Multi-server distributed system
RECAP DES – Enables Synchronous Design of Hierarchical Model Architectures
    For instance: ElasticSearch
CloudSimEx – Includes Parallel and MapReduce Simulation

CloudSim Extension Tools

Cloud2Sim
Dynamic CloudSim
CloudAnalyst
CloudReports
CLoudAuction
CloudMIG Xpress
CloudSim Automation
CloudSimEx
iFogSim
RedCloudSim
WorkflowSim
And also FederatedCloudSim

Using CloudSim Plus you can generate results in CSV and other formats. The code is as below. CloudSim Plus even allows you to add any data you want to the generated table.

try {
CsvTable csv = new CsvTable();
csv.setPrintStream(new PrintStream(new java.io.File("/tmp/results.csv")));
new CloudletsTableBuilder(broker0.getCloudletFinishedList(), csv).build();
} 
catch (IOException e) {
System.err.println(e.getMessage());
}

Don't Try At Home

Suppose you have a Python script called machine_learning.py containing the machine learning code:

machine_learning.py

import numpy as np
from sklearn.linear_model import LinearRegression
X = np.array([[1], [2], [3], [4], [5]])
y = np.array([2, 4, 6, 8, 10])
model = LinearRegression()
model.fit(X, y)
x_test = np.array([[6]])
predicted_y = model.predict(x_test)
print("Predicted value for x =", x_test[0][0], "is", predicted_y[0])

Now, you can create a Java program that invokes this Python script using Jython:

import org.python.util.PythonInterpreter;
public class JythonMachineLearning {
public static void main(String[] args) {
PythonInterpreter interpreter = new PythonInterpreter();
interpreter.execfile("machine_learning.py");
    }
}

Make sure you have Jython installed and added to your Java project's classpath. You can then run the JythonMachineLearning class, which will execute the Python script machine_learning.py using Jython. The output of the Python script will be displayed in the Java program's console. This integration allows you to leverage Python's powerful machine learning libraries within your Java application seamlessly. You can pass data between Java and Python, call Python functions from Java, and vice versa, enabling flexible and efficient development workflows.

To optimize CloudSim's Cloudlet execution, you can implement various scheduling policies, resource allocation strategies, and load balancing techniques. Here's a simplified example of how you can optimize CloudSim's Cloudlet execution using a Round Robin scheduling policy:

import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.schedulers.cloudlet.CloudletScheduler;
import org.cloudbus.cloudsim.schedulers.cloudlet.CloudletSchedulerTimeShared;
import java.util.List;

public class CloudletOptimizer {

    public static void main(String[] args) {
        // Initialize CloudSim
        CloudSim.init(1, null, false);
        // Create a list of Cloudlets
        List<Cloudlet> cloudletList = createCloudlets();
        // Initialize CloudletScheduler
        CloudletScheduler scheduler = new CloudletSchedulerTimeShared();
        // Assign Cloudlets to VMs using Round Robin scheduling policy
        roundRobinScheduling(cloudletList, scheduler);
        // Execute CloudSim simulation
        CloudSim.startSimulation();
        // Print Cloudlet execution results
        printCloudletResults(cloudletList);

        // End CloudSim simulation
        CloudSim.stopSimulation();
    }

    private static List<Cloudlet> createCloudlets() {
        // Implement Cloudlet creation logic
        // Example: create and return a list of Cloudlets
    }

    private static void roundRobinScheduling(List<Cloudlet> cloudletList, CloudletScheduler scheduler) {
        int vmIndex = 0;
        for (Cloudlet cloudlet : cloudletList) {
            cloudlet.setCloudletScheduler(scheduler);
            cloudlet.setVmId(vmIndex);
            vmIndex = (vmIndex + 1) % CloudSim.getNumEntities();
        }
    }    

    private static void printCloudletResults(List<Cloudlet> cloudletList) {
        // Implement Cloudlet result printing logic
        // Example: iterate over cloudletList and print relevant results
    }
}

In this example:

We initialize CloudSim and create a list of Cloudlets.
We initialize a CloudletScheduler (in this case, CloudletSchedulerTimeShared).
We assign Cloudlets to Virtual Machines (VMs) using the Round Robin scheduling policy in the roundRobinScheduling method. Each Cloudlet is assigned to a VM sequentially, looping back to the first VM when reaching the end of the list of VMs.
We execute the CloudSim simulation, allowing Cloudlets to be scheduled and executed on VMs.
After the simulation finishes, we print the results of Cloudlet execution.

You can replace the createCloudlets and printCloudletResults methods with your implementation to create Cloudlets and process the results, respectively. Additionally, you can explore other scheduling policies and optimization techniques to further improve Cloudlet execution in CloudSim.

Q-Learning:
    Q-learning is a model-free RL algorithm that learns an optimal action-value function (Q-function) by iteratively updating Q-values based on the observed rewards and the agent's actions. It's suitable for discrete action spaces.

Deep Q-Networks (DQN):
    DQN extends Q-learning by using deep neural networks to approximate the Q-function. It's well-suited for problems with high-dimensional state spaces and can handle continuous action spaces by discretizing them.

Policy Gradient Methods:
    Policy Gradient methods directly parameterize the policy function and learn the policy by optimizing its parameters through gradient ascent. Examples include REINFORCE, Actor-Critic, and Proximal Policy Optimization (PPO).

Actor-Critic Methods:
    Actor-Critic methods combine aspects of both value-based (e.g., Q-learning) and policy-based methods. They maintain both a policy (actor) and a value function (critic), and use them to update each other iteratively.

Deep Deterministic Policy Gradient (DDPG):
    DDPG is an actor-critic algorithm specifically designed for continuous action spaces. It combines the deep Q-learning with deterministic policy gradients.

Twin Delayed DDPG (TD3):
    TD3 is an extension of DDPG that introduces several improvements to stabilize training and improve performance, including target policy smoothing and delayed policy updates.

Soft Actor-Critic (SAC):
    SAC is an off-policy actor-critic algorithm that maximizes the entropy of the policy, leading to more exploratory behavior. It's well-suited for continuous control tasks with high-dimensional action spaces.

Trust Region Policy Optimization (TRPO):
    TRPO is a policy optimization algorithm that constrains the policy updates to ensure that they are close to the previous policy, which can lead to more stable training.

Proximal Policy Optimization (PPO):
    PPO is an on-policy policy optimization algorithm that uses a clipped surrogate objective to prevent large policy updates and improve stability.

Asynchronous Advantage Actor-Critic (A3C):
    A3C is a distributed RL algorithm that parallelizes the training process across multiple workers, each with its own copy of the environment and agent, to accelerate learning.

About

CloudSim is primarily a simulation framework for modeling and simulating cloud computing infrastructures and services. While CloudSim itself does not include built-in machine learning capabilities, you can integrate machine learning techniques into CloudSim to optimize various aspects of cloud resource management.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published