Worked examples — Linear programming — simplex method (intro)
4.10.21 · D3· Maths › Advanced Topics (Elite Level) › Linear programming — simplex method (intro)
Shuru karne se pehle, parent note ki vocabulary ka ek reminder, kyunki hum ise har example ki pehli line mein use karenge:
Recall Woh paanch words jo hum har jagah reuse karte hain
- Decision variables — woh numbers jo tum choose kar sakte ho.
- Slack variable — woh "unused room" jo ko mein turn karta hai.
- Basic variable — jise hum actually solve karte hain; non-basic — jise hum par force karte hain.
- Tableau — equation coefficients ki woh grid jis par hum pivot karte hain.
- Optimal (maximizing ke liye) — tab reach hota hai jab -row mein har number ho.
The scenario matrix
Simplex method ko teen moving parts wali machine samjho: entering rule, ratio test, stopping rule. Har part ka ek "normal" behaviour hai aur kai "surprising" behaviours hain. Neeche ka grid har combination list karta hai jisse hum survive karna jaante hain. Yahan ten cells (A–J) hain, aur neeche ke naau worked examples sab dus ko cover karte hain — Example 7 deliberately do cells ek saath handle karta hai ( constraint ko minimization ke roop mein solve kiya), toh 9 examples 10 cells. Har example apne cell(s) apni heading mein announce karta hai.
| Cell | Is case mein kya unusual hai | Covered by |
|---|---|---|
| A. Clean run | Kuch nahi — ek seedha raasta seedha top tak | Example 1 |
| B. Tie in entering column | Do -row entries equally negative | Example 2 |
| C. Tie in ratio test (degeneracy) | Do rows smallest ratio share karti hain; ek basic variable ho jaata hai | Example 3 |
| D. Unbounded objective | Entering column mein koi positive entry nahi; | Example 4 |
| E. Multiple optima | End mein ek non-basic -row coefficient ke barabar; poori edge optimal hai | Example 5 |
| F. Degenerate start / zero RHS | Ek constraint ka hai; corner shuruaat se hi ek wall par baitha hai | Example 6 |
| G. constraint | Ulti inequality; surplus + artificial variables chahiye | Example 7 |
| H. Minimization | Hum sabse chhota chahte hain; maximize karo | Example 7 |
| I. Word problem | Numbers ek story + units mein chhupe hain; model banao, phir solve karo | Example 8 |
| J. Exam twist | "Ek coefficient kitna change ho sakta hai answer move hone se pehle?"; sensitivity | Example 9 |
Cell count reconciled: 10 cells, 9 examples, kyunki Example 7 = Cells G + H saath mein.
Example 1 — Cell A: the clean run (baseline, with geometry)
Forecast: Aage padhne se pehle, optimal corner guess karo. "Profit per unit" par zyada steep hai ( vs ), toh bet karo winner large ki taraf lean karega. Apna guess likh lo.
Pehle figure padho. Do constraint lines draw ki gayi hain — solid line labelled "" aur dashed line labelled "" (har line figure mein words mein bhi likhi hai, toh tumhe unhe distinguish karne ke liye colour ki zarurat nahi). Hatched region feasible set hai; iske chaar corners (jahan lines cross hoti hain) dots se mark hain aur unke -values ke saath labelled hain. Bada arrow " increases" top corner ki taraf point karta hai — yahi woh corner hai jis ki taraf machine crawl karegi.
-
Slacks add karo. Yeh step kyun? Machine sirf equations khaati hai, toh har mein bachi hui jagah ko naam do:
-
par shuru karo. Kyun? set karne se milta hai — ek legal corner (origin, jahan do axes cross hoti hain, feasible hai), .
Basis RHS 2 1 1 0 10 1 3 0 1 15 0 0 0 -
Entering variable. Kyun? sabse zyada negative hai, toh ko push karna sabse fast gain deta hai. enters.
-
Ratio test. Kyun? RHS ko positive column entries se divide karo: , . Sabse chhota hai (row 1) — aage jaao toh negative ho jaayega. leaves.
-
par Pivot karo. Pivot kyun? Pivoting entering column ko unit vector banata hai, toh basic (solved for) ho jaata hai jabki out ho jaata hai — yeh exactly next corner par hop karne ka algebra hai. Row1 ; Row2 Row1(new); -row Row1(new):
Basis RHS 1 0 5 0 1 10 0 2 0 20 -
ke neeche abhi bhi hai → optimal nahi. enters. Ratios: , . Sabse chhota → leaves. par pivot kyun? Same reason: column ko unit vector banana ko basic banata hai aur hum edge ke saath next, higher corner ki taraf move karte hain.
Basis RHS 1 0 3 0 1 4 0 0 24 -
Saare -row entries → optimal. Corner , .
Verify: Constraints check karo: ✓ (tight), ✓ (tight). Dono tight hain, toh ek genuine corner hai (do lines cross ho rahi hain). ✓. Corners compare karo , , , — max confirmed, aur yahi woh corner hai jis par figure mein arrow point kar raha tha.
Example 2 — Cell B: enters ke liye ek tie
Forecast: Dono variables ka identical profit hai ( each) aur region symmetric hai. Guess: answer symmetry line par baitha hai.
-
Initial -row: . Tie: dono "most negative" hain. Tie kyu matter nahi karta? Koi bhi choice phir bhi increase karegi; simplex dono taraf se converge karta hai. Bland's rule apply karo (top par stated): tie ko lowest index se break karo, toh enters.
-
enters. Ratios , → row 2 leaves (). par pivot kyun? column ko unit vector banana, ko basic banana — corner-hop step:
Basis RHS 0 1 4 1 0 4 0 0 20 -
ke neeche → enters. Ratios , → row 1 leaves. par pivot kyun? Same rule: column ko unit-vector karo, next corner par hop karo:
Basis RHS 0 1 1 0 0 0 -
Sab → optimal at , .
Verify: ✓ symmetry forecast se match karta hai. ✓ tight; ✓ tight. ✓. Agar hum tie doosri taraf break karte, hum same corner par land karte — Cell B ka lesson yahi hai.
Example 3 — Cell C: ek ratio-test tie (degeneracy)
Forecast: Teen lines , , sab se guzarti hain. Teen walls, ek corner: woh corner "over-determined" hai. Guess: optimum hai lekin machine ek "stalled" step le sakti hai jahan answer improve nahi hota.
-
Slacks: , , . Initial tableau ( par shuru karo):
Basis RHS 1 0 1 0 0 2 0 1 0 1 0 2 1 1 0 0 1 4 0 0 0 0 -
enters (-row tie → Bland's rule lowest index choose karta hai). Ratios: (row 1), -row mein column mein hai (skip), (row 3). Sabse chhota → leaves. Row-1 -entry () par pivot kyun? ko basic banana aur corner par hop karne ke liye:
Basis RHS 1 0 1 0 0 2 0 1 0 1 0 2 0 1 0 1 2 0 1 0 0 2 Ab at corner (jahan meets ).
-
ke neeche → enters. Ratios: (row 2, ), aur row 3 ab bhi deta hai () — ek tie. Kyun matter karta hai: hum jo bhi chunu, doosra basic variable exactly par land karega — ek degenerate basic feasible solution. Bland's rule ise break karta hai: lowest index wala leaving variable chuno, ( se neeche index).
Figure padho: wall labelled "", wall labelled "" aur line labelled "" sab ek single marked point mein pierce karte hain (har line ek alag dash pattern ke saath draw ki gayi hai aur words mein captioned hai). Teen walls, ek corner — yahi visual over-crowding exactly "degenerate" ka matlab hai, aur yahi wajah hai ki do rows ratio test mein tie karti hain.
-
leaves ( ko basic banana ke liye row-2 -entry par pivot karo). Hum par ke saath pahunchte hain, lekin basis mein value 0 par baitha hai. Kyun yeh Cell C ka poora point hai: corner ko do alag bases se describe kiya ja sakta hai; simplex un ke beech zero improvement ke saath swap kar sakta hai (ek stall). Bland's lowest-index rule exactly woh hai jo us swap ko forever loop karne se rokta hai.
-
Us pivot ke baad -row check karo: sab → optimal, .
Verify: : ✓ tight, ✓ tight, ✓ tight — ek corner par teen tight constraints exactly "degenerate" ka matlab hai. ✓.
Example 4 — Cell D: unbounded objective (koi maximum nahi)
Forecast: Constraints dekho — dono ko enormously grow karne dete hain jab tak peeche rehta hai. Guess: yeh region ek open wedge hai aur infinity tak push ho sakta hai.
Pehle figure padho. Do constraint lines (ek solid, ek dashed, dono words mein captioned) ek hatched region bound karti hain jo close nahi hoti — yeh forever upper-right mein flare hoti hai. Bada arrow " increases" us open channel par ride karta hai: jaise tum us par slide karte ho, dono aur bina limit ke badhte hain, toh ki koi ceiling nahi. Ek closed polygon arrow ko ek corner par trap karta; yeh open wedge kabhi nahi karta.
-
Slacks: , . Initial -row .
-
enters (-row tie → Bland's rule pick karta hai). Ratio test ko positive column entries chahiye: column hai . Sirf row 2 ka positive hai → ratio . leaves. Us par pivot kyun? column ko unit-vector karne aur ko basic banane ke liye — usual corner-hop:
Basis RHS 0 1 1 3 1 0 1 2 0 0 1 2 -
ke neeche → enters. Column hai — dono negative! Kyun yeh signal hai: ratio test sirf positive entries accept karta hai, aur yahan koi nahi hain. Matlab hum ko forever raise kar sakte hain bina kisi constraint ke hume rokne ke, aur bina bound ke rise karta hai.
-
Conclusion: LP UNBOUNDED hai. Koi finite maximum nahi hai.
Verify: set karo aur basis follow karo: , (sab har ke liye rehte hain). Phir as ✓. Forecast (open wedge) sahi nikla.
Example 5 — Cell E: multiple optima (ek poori optimal edge)
Forecast: Objective ko jitna bada ho sake banana se maximize hoti hai — lekin ise par cap karta hai. Guess: region ke andar segment par har point deta hai. Ek corner nahi — ek poori edge.
Pehle figure padho. Solid line captioned "" dashed "objective level lines" (constant ki lines) ke parallel hai. Kyunki woh parallel hain, objective region ko ek single corner par nahi touch karti — yeh poori bold edge ke saath flat lie karti hai se tak. Us bold edge par har point same score karta hai; yahi "multiple optima" kaisi dikhti hai.
-
Slacks: , . -row .
-
enters (-row tie → Bland's rule pick karta hai). Ratios , → leaves. Row 2 mein -entry par pivot kyun? Column ko unit-vector karo, ko basic banao, corner par hop karo:
Basis RHS 0 1 1 1 1 0 0 1 3 0 0 2 6 -
ke neeche → enters. Ratio → leaves. Row 1 mein -entry par pivot kyun? Same rule; corner par hop karo:
Basis RHS 0 1 1 1 1 0 0 1 3 0 0 2 0 8 -
Sab -row → optimal, at . Lekin dekho: iska -row coefficient hai aur non-basic hai. Kyun yeh multiple optima signal karta hai: ek non-basic variable ke neeche ka matlab hai hum ise basis mein la sakte hain aur nahi badle ga. Aisa karne se hum doosre corner par slide karte hain — same , exactly woh bold edge jo figure mein thi.
Verify: Corner : ✓. Corner : ✓. Edge par midpoint : ✓ — poora segment optimal hai, exactly forecast ke jaisa.
Example 6 — Cell F: degenerate start ( constraint)
Forecast: Pehli constraint with origin se guzarti hai. Toh starting corner already us wall par baitha hai — pehla tableau hi degenerate hai. Guess: pehla pivot "stuck" lag sakta hai (koi visible improvement nahi) cheezein move hone se pehle.
-
Slacks: , . Shuru karo : , . Note karo already — degenerate start (origin already wall par lie karta hai).
-
enters ( most negative). Ratios: row 1 , row 2 . Sabse chhota → leaves. Kyun zero ratio theek hai: iska matlab is step mein se increase kar sakta hai — ek degenerate pivot jo corner ko physically move kiye bina basis swap karta hai.
-
Row-1 -entry () par pivot kyun? ko basic banana bhale hi hum physically nahi move karenge — basis-swap exactly woh hai jo agle step ko wall se escape karne deta hai:
Basis RHS 1 1 0 0 0 2 1 4 0 3 0 0 Abhi bhi , — forecast ka predicted stall.
-
ke neeche → enters. Ratios: row 1 mein hai (skip, negative), row 2 → leaves. par pivot kyun? column ko unit-vector karo, ko basic banao, finally wall se ek new corner tak hop karo:
Basis RHS 1 0 2 0 1 2 0 0 10 -
Sab → optimal, , .
Verify: ✓ tight; ✓ tight; ✓. Degenerate first pivot ne humein ek "empty" step cost kiya lekin sahi answer tak pahuncha — forecast se match karta hai.
Example 7 — Cells G + H: ek constraint two-phase simplex ke zariye
Forecast: Positive-cost objective ko minimize karna dono variables ko neeche ki taraf push karta hai; constraint unhe rokti hai. Guess hai ki sabse sasta corner woh hai jahan kisi axis se milti hai.
-
Minimization ko maximization mein turn karo (Cell H). Kyun? Machine maximize karti hai. Min = , toh maximize karo.
-
ko properly convert karo (Cell G) — surplus + artificial. Sirf se multiply kyun nahi? Usse ek negative RHS milega, toh origin infeasible hai aur plain simplex shuru nahi kar sakta. Instead, ke liye ek surplus variable (jitni amount se hum exceed karte hain) subtract karo aur ek artificial variable (ek temporary crutch jo hume ek legal starting basis deta hai) add karo: Basis ke saath shuru karo: — legal.
-
Phase 1 — artificial ko zero tak drive karo. Kyun? ka matlab hai hum cheating kar rahe hain (real constraint abhi tak satisfied nahi hai). minimize karo, yaani maximize karo. use karke non-basic terms mein express karo, toh ; -row ke neeche hai.
Basis RHS 1 1 1 0 2 1 2 0 0 1 6 1 0 0 enters (-row tie → Bland's rule pick karta hai). Ratios , → leaves. -row -entry () par pivot kyun? ko basic banana aur artificial ko kick out karne ke liye:
Basis RHS 1 1 1 0 2 0 1 1 1 4 0 0 0 1 0 0 with non-basic → Phase 1 done, artificial gone, aur ek legal starting corner hai.
-
Phase 2 — ab real objective optimize karo. column drop karo. ko non-basic terms mein express karo: ke saath, , toh -row ke neeche aur ke neeche hai:
Basis RHS 1 1 0 2 0 1 1 1 4 0 0 enters (, most negative). Ratio test column mein positive entries use karta hai: sirf row 2 ka qualify karta hai → ratio → leaves. Us par pivot kyun? column ko unit-vector karo, ko basic banao, ek new corner par hop karo:
Basis RHS 1 2 0 1 6 0 1 1 1 4 0 1 0 2 4 Yeh naya corner hai, yaani , -row RHS ke saath, matlab — pichle tableau jaisa hi . Toh pivot ne improve nahi kiya: dono tableaux record karte hain. Stored optimum at corner hai (pre-pivot tableau already optimal tha). Isliye true optimum hai, yaani , at .
Verify: ki feasibility: ✓ tight, ✓. ke har corner ko cross-check karo: , , , ; do lines par milti hain (discard). Minimum at ✓ — two-phase result aur forecast se match karta hai (ek axis par corner).
Example 8 — Cell I: ek real-world word problem (with units)
Forecast: Tables per unit zyada earn karte hain lekin carpentry zyaada use karte hain. Guess hai ek mix, "all tables" nahi.
-
Model banao (word problems ka mushkil part). Pehle units define kyun? Taaki constraints balance karein. chairs/day, tables/day (dono dimensionless counts).
\underbrace{2x_1+1x_2\le 8}_{\text{polishing hr}},\quad x_1,x_2\ge0.$$ Objective (dollars/day): $z=20x_1+30x_2$. -
Slacks (spare carpentry hr), (spare polishing hr). -row .
-
enters ( most negative). Ratios , → leaves. par pivot kyun? column ko unit-vector karo, ko basic banao, next corner par hop karo:
Basis RHS 1 0 4 0 1 4 0 10 0 120 -
ke neeche → enters. Ratios , → leaves. par pivot kyun? Same rule: ko basic banao, final corner par hop karo:
Basis RHS 0 1 1 0 0 0 8 6 144 -
Sab → optimal: chairs, tables, profit z=\144$/day.
Verify (with units!): Carpentry used hr ✓ (sab use, tight). Polishing hr ✓ (sab use, tight). Dono constraints tight ⇒ genuine corner. Profit ✓. (Sanity: do tight equations , directly solve karne se same milta hai.)
Example 9 — Cell J: the exam twist (sensitivity)
Forecast: Agar chairs