Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0e92a88

Browse files
Update README.md
1 parent 7c610e2 commit 0e92a88

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

‎README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Load Balancing Problem Approximation Algorithm
2-
Approximation Algorithm for balancing loads on machines. (Could be applied to processes management on a CPU). Does not guarantee an optimal solution, but instead, the algorithm guarantees that its solution is within a factor of 1.5 of the optimal solution.
2+
Approximation Algorithm for balancing job loads on machines. (Could be applied to processes management on a CPU). Does not guarantee an optimal solution, but instead, a solution is within a factor of 1.5 of the optimal solution.
33

44
## Problem Statement
55
- `M` identical machines
66
- `N` jobs
77
- Each jobs has processing time **T<sub>j</sub>**
8-
- Let `J(i)` be the subset of jobs assigned to machine `i`
9-
- The load of machine `i` is **L<sub>i</sub>** = sum of the processing times for the jobs
8+
- `J(i)` is the subset of jobs assigned to machine `i`
9+
- The load of machine `i` is **L<sub>i</sub>** = sum of the processing times for the jobs on that machine
1010

1111
**Makespan** = the maximum of the loads on the machines (the machine with the largest load)
12-
***Goal:* Minimize the Makespan**
12+
**Goal: Minimize the Makespan**
1313

1414
## Solution
1515
Assign each job to a machine to minimize makespan
@@ -56,20 +56,20 @@ Proof involves complicated sigma notation and can be found in the references
5656
## Usage
5757
**Machine ID's are meaningless since machines are identical, they're created for readability.
5858
But the algorithm still creates the job assignments on the machines according to the greedy strategy**
59-
- `int machineCount` parameter for `balanceMachines()`is how many machines exist in the problem
59+
- `int machineCount` parameter is how many machines there are
6060
- `int[][] jobs` is a 2D array containing the jobs
6161
- `jobs[i]` is an array represents a job
6262
- `jobs[i][0]` is the **Job Id or name**
6363
- `jobs[i][1]` is the **Processing time**
6464

6565
## Code Details
66-
- Unlike the pseudocode, this version keeps the jobs assigned to a machine inside the `Machine` object in the Priority Queue
66+
- Unlike the pseudocode, the jobs assigned to a machine are inside the `Machine` object in the Priority Queue
6767
- 1st Creates `M` machines with unique Id's
68-
- Then loop over the jobs and assign the job with the longest processing time to the smallest load machine
68+
- Then loop over the jobs and assigns the job with the longest processing time to the machine with the smallest current load
6969
- Java's Priority Queue doesn't really have an `IncreaseKey()` method so the same effect is achieved by removing the machine from the Queue, updating the Machine's `currentLoad` and then adding the Machine back to the Queue
7070
- `Machine` class represents a machine
7171
- **Some Important Parts of a Machine**
72-
- `id` is the **id or name of the machine**
72+
- `id` is the **ID or name of the machine**
7373
- `currentLoad` is the sum of the processing times of the jobs currently assigned to the machine
7474
- `jobs` is a 2D ArrayList containing the jobs currently assigned to the machine
7575
- `Machine` class **overrides** `compareTo()` from the `Comparable` interface so that the `PriotityQueue is always has the smallest load machine at the top

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /