Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,
I am a beginner in Cloud and Cloudsim.
In a paper steps for implementing ABC-SA (implementing a hybrid optimization algorithm by integrating the functionality of simulated annealing (SA) into artificial bee colony (ABC) algorithm) algorithm are as below:
(1) Initializing the population
In the starting stage, there are N number of SB is placed in VMs, randomly one cloud environment.
(2) Fitness evaluation 
The fitness function is calculated using the following equation as:

fitij=(sum of all task_lengthij)/(capacity of VMij)
where fitij denotes the fitness value of the population i in VMj .VMj can also be representing the capacity VM with ith bee. Task length denotes the length of the task which is submitted toVMj and the capacity is calculated according to:

capacityj = penumj × pemipsj + vmbwj ,
where capacityj denotes the capacity ofVMj, penumj denotes the number of processors in VMj, pemipsj denotes the millions of instructions per second over the processor in VMj, vmbwj denotes the network bandwidth.

(3) Choose m sites for neighbor search
"Selected Bees" are chosen SBs where each SB consists of highest fitness value from neighborhood on m VMs.
(4) Recruit bees for selected sites
More number of bees is send to neighborhood(based on SA) of the best e VM and calculate the fitness according to:

fitij=(sum of all (task_lengthij+InputFile_length))/(capacity of VMij)
where InputFile_length denotes the length calculated before execution of a task.
(5)Choose the best fitness bees from each patch and assign task to each VMj.
In each round of operation best fitness based bees is elected from each patch and allocated task to VMj .


In Cloudsim, In MyDataCenterBroker class, and in submitCloudlets method, ABC algorithm is called.
ABC algorithm:
<pre>for (int i = 0; i < vmList.size(); i++) {<br />
<br />
			Vm vm = vmList.get(i);<br />
<br />
			double capacity = vm.getNumberOfPes() * vm.getMips() + vm.getBw();<br />
<br />
			Log.printLine("====fitness of VM " + i);<br />
<br />
			waiting_time[i] = calculatewatingtimeofvm(i);<br />
			//double[] ft = new double[cloudletList.size()];<br />
			double ft=0;<br />
			for (int j = 0; j < cloudletList.size(); j++) {<br />
				Cloudlet Cloudlet = cloudletList.get(j);<br />
				ft += (double) Cloudlet.getCloudletLength();<br />
				<br />
			}<br />
<br />
			ft/=capacity;<br />
			fitness.add(ft);<br />
			Log.printLine("====fitness==== " + ft);<br />
<br />
		}<br />
<br />
		double t = 0;<br />
		for (int i = 0; i < fitness.size(); i++) {<br />
			if(fitness.get(i) > t)<br />
			{<br />
				t=fitness.get(i);<br />
				vm_index=i;<br />
			}<br />
		}<br />
		Log.printLine("====highest fitness===== " + t);<br />
for (int i = 0; i < cloudletList.size(); i++) {<br />
			if (getCloudletList().get(i).select_task == 0) {<br />
				cloudletList.get(i).setVmId(vm_index);<br />
				MyVM vm = getVmsCreatedList().get(vm_index); <br />
				double Update = cloudletList.get(i).getCloudletLength() / (vm.getHost().getTotalAllocatedMipsForVm(vm));<br />
				<br />
				getCloudletList().get(i).select_task = 1;<br />
				vm.setwaitingtime(Update);<br />
			}<br />
		}</pre>

And in the output:
0.0: Broker: Trying to Create VM #0 in Datecenter_0
0.0: Broker: Trying to Create VM #1 in Datecenter_0
[VmScheduler.vmCreate] Allocation of VM #1 to Host #0 failed by RAM
0.1: Broker: VM #0 has been created in Datacenter #2, Host #0
0.1: Broker: VM #1 has been created in Datacenter #2, Host #1
====fitness of VM 0
====fitness==== 3.066666666666667
====fitness of VM 1
====fitness==== 2.3
====highest fitness===== 3.066666666666667
=====================================
0.1: Broker: Sending cloudlet 0 to VM #0
0.1: Broker: Sending cloudlet 1 to VM #0
0.1: Broker: Sending cloudlet 2 to VM #0
0.1: Broker: Sending cloudlet 3 to VM #0
0.1: Broker: Sending cloudlet 4 to VM #0
0.1: Broker: Sending cloudlet 5 to VM #0
1.292: Broker: Cloudlet 4 received
5.289999999999999: Broker: Cloudlet 0 received
5.289999999999999: Broker: Cloudlet 3 received
8.29: Broker: Cloudlet 1 received
8.29: Broker: Cloudlet 2 received
9.29: Broker: Cloudlet 5 received
9.29: Broker: All Cloudlets executed. Finishing...
9.29: Broker: Destroying VM #0
9.29: Broker: Destroying VM #1
Broker is shutting down...
Simulation: No more future events
CloudInformationService: Notify all CloudSim entities for shutting down.
Datecenter_0 is shutting down...
Broker is shutting down...
Simulation completed.
Simulation completed.

======= OUTPUT======
Cloudlet ID    STATUS   datacnterid   vmid   time   starttime   Finish Time
   4      SUCCESS      2         0         1.19      0.1         1.29
   0      SUCCESS      2         0         5.19      0.1         5.29
   3      SUCCESS      2         0         5.19      0.1         5.29
   1      SUCCESS      2         0         8.19      0.1         8.29
   2      SUCCESS      2         0         8.19      0.1         8.29
   5      SUCCESS      2         0         9.19      0.1         9.29
stopping test finished


In my codes I just considered the first fitness function, where should I use the second fitness function in my codes?

What I have tried:

Implementing a hybrid optimization algorithm by integrating the functionality of simulated annealing (SA) into artificial bee colony (ABC) algorithm
using Cloudsim
Posted
Updated 19-Jan-18 21:44pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900