# Classification and Merging Techniques to Reduce Brokerage Using Multi-Objective Optimization
## 4 CMRBC: System Model
4: Output: _Set of K (_larger jobs_)
5: Step 1: Consider a job j\({}_{i}\) K _extra-large jobs_, if j\({}_{i}\) is equal to 200 (VM capacity) then add to _large job(K)_ set and increment K else consider some smaller jobs to best fit in _larger job_ bin packing method and increment K.
6: Step 2: Consider each job _large jobs(j\({}_{i}\))_ one by one, if size of _j\({}_{i}\)_ is less than 200 then consider some _smaller jobs_ and _medium jobs_ and _large jobs_ to best fit in larger jobs using bin packing method and add to larger job(K) and increment K.
7: Step 3: Consider medium jobs(j\({}_{i}\)) one by one, if size of _j\({}_{i}\)_ is less than 200 then consider some smaller jobs and medium jobs and large jobs to best fit in larger jobs using bin packing method and increment K and add to larger job(K). 8: Step 4: Consider smaller jobs(j\({}_{i}\)) one by one, if size of _j\({}_{i}\)_ is less than 200 then consider some smaller jobs and medium jobs and large jobs consider remaining jobs in this set to best fit in larger jobs using bin packing method and add to _larger job (K)_ and increment (_K_)
9: Step 5: _larger jobs [1]... larger jobs[K]_ contains subset of jobs such that their sum is less than or equal to 200. 10:endprocedure
```  
**Algorithm 1**Algorithm for **Classification**  
```
1:procedureT(o)  Reduce the brokerage and reducing the VM creation
2: Algorithm: _CMRBC (job, n)_
3: Input: job: Array of structure of jobs (Twitter Data Set) n: Total No. of Jobs
4: Output: Bc: Broker cost
5: Cl: Overall execution job
6: Begin
7: //ClassifyingJobs(small jobs, medium jobs, large jobs, extra large jobs). 8: Classifier (jobs, n)
9: //Finding set of larger jobs [1]... larger jobs[k] contains subset of jobs
10: //such that their sum is less than or equal to 200. 11:  Merging job ()
12:  cost=0, x [ ] [ ] is a binary matrix of size k x n and initialised to 0
13:  for (i=1 to K) do
14:  for (j=1; j = large jobs[i]. length) do
15:  if jobi large Jobs[i]
```  
**Algorithm 2**Algorithm Merging Jobs  
```
1:procedureT(o) (



_Example:_ Figure 3 shows the complete structure of the classification and merging process. It considers 10 jobs submitted by the user to a classifier as \(\{j_{1},j_{2},j_{3},j_{4},j_{5},j_{6},j_{7},j_{8},j_{9},j_{10}\}\), as shown in Figure 3a. _The classifier results in_ classifying the job as small, medium, large, or extra-large based on threshold value '\(p\)', where '\(p\)' is set to 50 MB job size, as shown in Figure 3b. Results of the classifier are given as input to the merger, and it first segregates the jobs based on job type, as shown in Figure 3c. Then, it starts merging one by one until it becomes one _larger_job_, as shown in Figure 3d. Each _larger_job_ is profiled and analyzed to obtain a set of requirements such as CPU Cycles usage, Memory, Bandwidth, Start-time, and End-time and is submitted to a mapper. The mapper interacts with the local scheduler and gives information such as CPU, free time slots, and the expected amount of resources to be utilized. Then, all _larger_job_s along with their information are given to the cloudlet, and the cloudlet converts jobs into tasks, as shown in Figure 3e; these tasks are submitted to the broker to be assigned to virtual machines with all the requirements for execution, as shown in Figure 3f.