← Back to all projects

🛠️ Simplex Solver - Desktop App (Linux)

Comprehensive tool for Linear Programming with multiple definition and solution interfaces. Exclusive for Linux.

Core Solver and Functionality

The heart of the project uses the powerful scipy.optimize.linprog module to provide accurate linear programming solutions. It robustly handles:

  • Maximization and Minimization objectives.
  • Inequality constraints (\(\le, \ge\)).
  • Equality constraints (\(=\)).
  • Automatic conversion of Free Variables (without non-negativity constraint).

Advanced User Interfaces

1. Domain Specific Languages (DSLs)

Define optimization problems programmatically or in a human-readable way:

  • String-based DSL: To load problems from .lp files or directly from a text string in a standard format.
  • Pythonic DSL: An elegant syntax, inspired by mathematical libraries, that uses Python objects and operators to build the model natively.

2. Graphical User Interface (GUI) - PySide6

A complete desktop application built with PySide6 (Qt) that offers an interactive experience. It includes an editor, results table, and a logging console.

  • Graphical Visualization: Displays the feasible region and the optimal point for 2-variable problems.
  • Responsive UI: The solver runs in a separate thread to prevent the application from freezing.
Screenshot 1 of the GUI: input and results Screenshot 2 of the GUI: plotting section

Practical Example: Profit Maximization

The following optimization example (products A and B) is defined concisely using the String-based DSL, which reads a format similar to a traditional .lp file:

from dsl import DSL
problem_lp = DSL("""
MAXIMIZE
Z = 3*A + 4*B
SUBJECT TO
2*A + 3*B <= 100
1*A + 2*B <= 80
BOUNDS
A >= 0
B >= 0
""")
# 2*A + 3*B <= 100 # Work hours
# 1*A + 2*B <= 80 # Raw material
solver = problem_lp.to_simplex()
solver.solve_problem()
solver.show_results()
# Optimal solution: A=20, B=30, Z_max = $180
python

Quick Installation and Usage

Dependency Installation

After cloning the repository, use pip to install everything needed:

git clone https://github.com/xeland314/simplex.git
cd simplex
pip install -r requirements.txt
bash

Launching Interfaces

Run your preferred interface with a single command:

  • GUI (Desktop Application):
  • python app.py
    bash
  • Interactive Command Line (CLI):
  • python simplex.py
    bash