{"id":27278968,"url":"https://github.com/nafishr24/linear-programming","last_synced_at":"2026-04-15T23:31:10.205Z","repository":{"id":287338784,"uuid":"964390822","full_name":"nafishr24/linear-programming","owner":"nafishr24","description":"This Python project implements the isoline method to solve linear optimization problems for three constraint cases: dual ≤ constraints, dual ≥ constraints, and mixed ≤/≥ constraints, providing both computational solutions and visual representations of the optimization process.","archived":false,"fork":false,"pushed_at":"2025-09-10T08:41:46.000Z","size":639,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-10T12:05:45.382Z","etag":null,"topics":["linear-programming","math","optimization","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nafishr24.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-11T06:24:11.000Z","updated_at":"2025-09-10T08:41:50.000Z","dependencies_parsed_at":"2025-04-11T17:46:37.662Z","dependency_job_id":"48bd5681-dde7-49d1-ac6b-662f130d9f9a","html_url":"https://github.com/nafishr24/linear-programming","commit_stats":null,"previous_names":["nafishr24/linear-programming"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nafishr24/linear-programming","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nafishr24%2Flinear-programming","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nafishr24%2Flinear-programming/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nafishr24%2Flinear-programming/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nafishr24%2Flinear-programming/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nafishr24","download_url":"https://codeload.github.com/nafishr24/linear-programming/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nafishr24%2Flinear-programming/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31864911,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"ssl_error","status_checked_at":"2026-04-15T15:24:39.138Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["linear-programming","math","optimization","python"],"created_at":"2025-04-11T17:46:25.919Z","updated_at":"2026-04-15T23:31:10.198Z","avatar_url":"https://github.com/nafishr24.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# 🧮 Isoline Method in Linear Programming\n\n## 📌 Overview\n\nThe **Isoline Method** (also known as *isoprofit* or *isocost line*) is a **graphical technique** used in **linear programming with two variables** to find the **optimal solution** of an objective function, either for **maximization** or **minimization**.\n\n---\n\n## 📚 1. What is the Isoline Method?\n\nThe isoline is a line representing all combinations of `x` and `y` that yield the same value of the objective function:  \n\n```\nZ = gx + hy\n\n````\n\nBy shifting this line **parallelly**, we can determine which point in the feasible region gives the **maximum** or **minimum** value of `Z`.\n\n---\n\n## 🧠 2. Basic Concept\n\n- Each isoline represents a **constant value** of the objective function.\n- The lines have the **same slope** (gradient).\n- The **optimal solution** is found at the point where the **isoline is tangent to the feasible region**:\n  - **Maximization** → Farthest isoline from origin that still touches feasible region.\n  - **Minimization** → Nearest isoline to the origin that still touches feasible region.\n\n---\n\n## 🪜 3. Steps to Use the Isoline Method\n\n1. **Define the objective function and constraints**  \n   Example: `Z = 5x + 3y`\n\n2. **Plot the constraints** on the coordinate system and shade the feasible region.\n\n3. **Draw isolines** for different values of `Z`:  \n   Example: `Z = 10, 20, 30` → same slope\n\n4. **Shift the isoline** in the optimal direction:\n   - ➕ Maximization → Away from origin  \n   - ➖ Minimization → Toward origin\n\n5. **Determine the optimal point**:\n   - Where the isoline last/first touches the feasible region\n\n---\n\n## ⚖️ 4. Advantages \u0026 Limitations\n\n| ✅ Advantages                     | ⚠️ Limitations                             |\n|----------------------------------|--------------------------------------------|\n| Visual and intuitive             | Only works for 2-variable problems         |\n| Easy to teach and understand     | Not scalable for large problems            |\n| Ideal for educational purposes   | Needs plotting tools for precision         |\n\n---\n\n## 🧪 5. Analysis of Constraint Scenarios\n\n### A. Both Constraints with ≤ Signs\n```text\na₁x + b₁y ≤ c₁  \na₂x + b₂y ≤ c₂  \nx, y ≥ 0\n````\n\n* Represents **limited resources**\n* Often **bounded** region\n* Typically used in **maximization**\n\n---\n\n### B. Both Constraints with ≥ Signs\n\n```text\na₁x + b₁y ≥ c₁  \na₂x + b₂y ≥ c₂  \nx, y ≥ 0\n```\n\n* Represents **minimum requirements**\n* Region is usually **unbounded**\n* Suitable for **minimization**\n\n---\n\n### C. Mixed Signs (One ≤, One ≥)\n\n```text\na₁x + b₁y ≤ c₁  \na₂x + b₂y ≥ c₂  \nx, y ≥ 0\n```\n\n* Common in **real-world problems**\n* Region can be **bounded or unbounded**\n* Careful analysis needed\n\n---\n\n## 📊 6. Summary Table\n\n| Case               | Feasible Region   | Optimal Solution (Min) | Optimal Solution (Max)       |\n| ------------------ | ----------------- | ---------------------- | ---------------------------- |\n| Both ≤ Constraints | Bounded/Unbounded | Closest corner point   | Farthest corner or unbounded |\n| Both ≥ Constraints | Usually Unbounded | Closest corner point   | Unbounded or none            |\n| Mixed Constraints  | Bounded/Unbounded | Depends on geometry    | May be bounded/unbounded     |\n\n---\n\n## 💻 7. Python Implementation\n\nThis repository includes a Python implementation to **visualize the isoline method** and **solve LP problems** using matplotlib.\n\nIt supports:\n\n* Two constraints with ≤\n* Two constraints with ≥\n* One constraint ≤ and one ≥\n\n### ✅ How to Use\n\nFirst, import the library:\n\n```python\nfrom isoline import *\n```\n\nThen, choose the function based on the constraint signs:\n\n---\n\n### 🔹 Case 1: Both constraints use `≥`\n\nUse `minimize()` for **minimum requirement problems**:\n\n```python\nminimize(\n    a=5, b=3, c=30,        # Constraint 1: 5x + 3y ≥ 30\n    d=4, e=3, f=24,        # Constraint 2: 4x + 3y ≥ 24\n    g=20000, h=16000,      # Objective Function: Z = 20000x + 16000y\n    x_max=15, y_max=15     # Axis limits for graph\n)\n```\n\n---\n\n### 🔹 Case 2: Both constraints use `≤`\n\nUse `maximize()` for **resource limitation problems**:\n\n```python\nmaximize(\n    a1=2, b1=1, c1=300,     # Constraint 1: 2x + y ≤ 300\n    a2=1, b2=2, c2=300,     # Constraint 2: x + 2y ≤ 300\n    g=150, h=100,           # Objective Function: Z = 150x + 100y\n    x_max=300, y_max=300    # Axis limits for graph\n)\n```\n\n---\n\n### 🔹 Case 3: Mixed signs (`≤` and `≥`)\n\nUse `optimize()` when constraint signs are **mixed**:\n\n```python\noptimize(\n    a=4, b=3, c=24,         # Constraint 1: 4x + 3y ≤ 24\n    d=2, e=5, f=20,         # Constraint 2: 2x + 5y ≥ 20\n    g=7, h=5,               # Objective Function: Z = 7x + 5y\n    x_max=10, y_max=8       # Axis limits for graph\n)\n```\n\nEach function will:\n\n* Display the feasible region\n* Plot isolines for different Z values\n* Highlight the **optimal solution**\n\n---\n\n## 📎 8. Installation\n\nMake sure you have the following packages installed:\n\n```bash\npip install matplotlib numpy\n```\n\n---\n\n## 📖 9. References\n\n1. Hillier \u0026 Lieberman, *Introduction to Operations Research* (2015)\n2. Bazaraa, Jarvis, \u0026 Sherali, *Linear Programming and Network Flows* (2011)\n\n---\n\n## 🧑‍💻 Author\n\nDeveloped by **Nafis**, passionate about mathematics, automation, and programming education.\nFor educational purposes only.\n\n---","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnafishr24%2Flinear-programming","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnafishr24%2Flinear-programming","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnafishr24%2Flinear-programming/lists"}