Skip to content

Commit e17aed8

Browse files
Merge pull request #650 from Quantum-Software-Development/FabianaCampanari-patch-1
Update README.md
2 parents dcbabe6 + f3b9137 commit e17aed8

File tree

1 file changed

+96
-56
lines changed

1 file changed

+96
-56
lines changed

README.md

Lines changed: 96 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,44 +1527,26 @@ The **Assignment Problem** aims to allocate *n* tasks to *n* agents (machines, w
15271527

15281528
### [**Step 2](): Subtract Column Minimums**
15291529

1530-
#### Subtract the minimum value in each column from all elements in that column]().
1530+
### Problem Recap
15311531

1532-
- Col 1 min: 0 → [0, 0, 3]
1533-
- Col 2 min: 0 → [2, 2, 0]
1534-
- Col 3 min: 1 → [0, 0, 1]
1535-
1536-
<br>
1537-
1538-
#### [**Matrix after column subtraction:**]()
1539-
1540-
| | M1 | M2 | M3 |
1541-
|---------|----|----|----|
1542-
| Task 1 | 0 | 2 | 0 |
1543-
| Task 2 | 0 | 2 | 0 |
1544-
| Task 3 | 3 | 0 | 1 |
1545-
1546-
<br>
1547-
1548-
### [**Step 3](): Assignment (Cover Zeros)**
1549-
1550-
- Cover all zeros using the minimum number of lines (rows or columns).
1551-
- Assign tasks to machines where possible (one zero per row/column).
1552-
1553-
**Optimal Assignment:**
1554-
- Task 1 → Machine 1 (cost 2)
1555-
- Task 2 → Machine 3 (cost 2)
1556-
- Task 3 → Machine 2 (cost 2)
1532+
- **3 tasks** must be assigned to **3 machines**.
1533+
- Each task can be done by any machine, but with different costs.
1534+
- Each task must be assigned to exactly one machine, and each machine to exactly one task.
1535+
- **Goal:** Minimize total assignment cost.
15571536

1537+
### Cost Table
15581538

1559-
### ***Total Minimum Cost = [2 + 2 + 2 = 6]()***
1560-
1561-
<br>
1539+
| | Machine 1 | Machine 2 | Machine 3 |
1540+
|---------|-----------|-----------|-----------|
1541+
| Task 1 | 2 | 4 | 3 |
1542+
| Task 2 | 1 | 3 | 2 |
1543+
| Task 3 | 5 | 2 | 4 |
15621544

1563-
## 2. Excel Solver Step-by-Step
1545+
---
15641546

1565-
### **A. Excel Table Setup**
1547+
## Step 1: Set Up the Excel Spreadsheet
15661548

1567-
#### 1. **Cost Table (A1:D4)**
1549+
### 1. Enter the Cost Matrix
15681550

15691551
| | B | C | D |
15701552
|-----|------|------|------|
@@ -1573,7 +1555,9 @@ The **Assignment Problem** aims to allocate *n* tasks to *n* agents (machines, w
15731555
| T2 | 1 | 3 | 2 |
15741556
| T3 | 5 | 2 | 4 |
15751557

1576-
#### 2. **Decision Variables Table (F1:I4)**
1558+
- Place this table in cells **B2:D4**.
1559+
1560+
### 2. Create the Decision Variable Table
15771561

15781562
| | G | H | I |
15791563
|-----|------|------|------|
@@ -1582,42 +1566,98 @@ The **Assignment Problem** aims to allocate *n* tasks to *n* agents (machines, w
15821566
| T2 | x21 | x22 | x23 |
15831567
| T3 | x31 | x32 | x33 |
15841568

1585-
Each cell is 0 or 1 (to be filled by Solver).
1569+
- Place this table in **G2:I4**.
1570+
- These cells will be filled with 0 or 1 by the Solver (1 = assigned, 0 = not assigned).
15861571

1587-
<br>
1572+
### 3. Calculate the Total Cost
15881573

1589-
#### 3. **Objective Function (K2)**
1574+
In cell **K2**, enter:
15901575

1591-
1592-
```
1576+
```bash
15931577
=SUMPRODUCT(B2:D4, G2:I4)
15941578
```
15951579

1596-
#### 4. **Row Constraints (One task per machine)**
1580+
This formula multiplies each assignment by its cost and sums the total.
15971581

1598-
- J2: `=SUM(G2:I2)` (should be 1)
1599-
- J3: `=SUM(G3:I3)` (should be 1)
1600-
- J4: `=SUM(G4:I4)` (should be 1)
1582+
### 4. Add Row and Column Sums for Constraints
16011583

1602-
<br>
1584+
#### Row Sums (Each Task Assigned Once)
16031585

1604-
#### 5. **Column Constraints (One machine per task)**
1586+
- In **J2**: `=SUM(G2:I2)`
1587+
- In **J3**: `=SUM(G3:I3)`
1588+
- In **J4**: `=SUM(G4:I4)`
1589+
1590+
#### Column Sums (Each Machine Assigned Once)
1591+
1592+
- In **G5**: `=SUM(G2:G4)`
1593+
- In **H5**: `=SUM(H2:H4)`
1594+
- In **I5**: `=SUM(I2:I4)`
1595+
1596+
---
1597+
1598+
## Step 2: Configure Excel Solver
1599+
1600+
1. **Go to**: Data > Solver
1601+
2. **Set Objective**:
1602+
- Set **K2** (total cost) to **Minimize**.
1603+
3. **By Changing Variable Cells**:
1604+
- Select **G2:I4**.
1605+
4. **Add Constraints**:
1606+
- **J2:J4 = 1** (each task assigned once)
1607+
- **G5:I5 = 1** (each machine assigned once)
1608+
- **G2:I4 = binary** (only 0 or 1 allowed)
1609+
5. **Choose Solving Method**:
1610+
- Use "Simplex LP" or "GRG Nonlinear" (either works for this size).
1611+
6. **Click Solve**.
1612+
1613+
---
1614+
1615+
## Step 3: Solution Example
1616+
1617+
After running Solver, you should get a solution like:
1618+
1619+
| | M1 | M2 | M3 | Row Sum |
1620+
|-----|----|----|----|---------|
1621+
| T1 | 1 | 0 | 0 | 1 |
1622+
| T2 | 0 | 0 | 1 | 1 |
1623+
| T3 | 0 | 1 | 0 | 1 |
1624+
|Col Sum| 1| 1 | 1 | |
1625+
1626+
- **Task 1 → Machine 1** (cost 2)
1627+
- **Task 2 → Machine 3** (cost 2)
1628+
- **Task 3 → Machine 2** (cost 2)
1629+
1630+
**Total minimum cost:** 6
1631+
1632+
---
1633+
1634+
## Excel Table and Formula Summary
1635+
1636+
| | M1 | M2 | M3 | Row Sum |
1637+
|-----|------|------|------|---------|
1638+
| T1 | G2 | H2 | I2 | J2 |
1639+
| T2 | G3 | H3 | I3 | J3 |
1640+
| T3 | G4 | H4 | I4 | J4 |
1641+
|Col Sum|G5 | H5 | I5 | |
1642+
1643+
- **Total Cost:** `=SUMPRODUCT(B2:D4, G2:I4)`
1644+
- **Row Sums:** `=SUM(G2:I2)`, etc.
1645+
- **Column Sums:** `=SUM(G2:G4)`, etc.
1646+
1647+
---
1648+
1649+
## Result (in English)
1650+
1651+
**The optimal assignment is:**
1652+
- Task 1 to Machine 1 (cost 2)
1653+
- Task 2 to Machine 3 (cost 2)
1654+
- Task 3 to Machine 2 (cost 2)
1655+
1656+
**Total minimum cost:** 6
16051657

1606-
- G5: `=SUM(G2:G4)` (should be 1)
1607-
- H5: `=SUM(H2:H4)` (should be 1)
1608-
- I5: `=SUM(I2:I4)` (should be 1)
16091658

1610-
<br>
16111659

1612-
### **B. Solver Configuration**
16131660

1614-
- **Set Objective:** K2 (Minimize)
1615-
- **By Changing Variables:** G2:I4
1616-
- **Add Constraints:**
1617-
- J2:J4 = 1
1618-
- G5:I5 = 1
1619-
- G2:I4 = binary
1620-
16211661
<br>
16221662

16231663

0 commit comments

Comments
 (0)