A menu-driven C#/.NET 8 console application for solving and analysing Linear Programming (LP) and Integer Programming (IP) models.
The project was developed for **Linear Programming and supports multiple optimisation algorithms, sensitivity analysis, special-case detection, text-file input/output, and a nonlinear-programming bonus implementation.
- Primal Simplex Algorithm
- Revised Primal Simplex Algorithm
- Canonical-form generation
- Full tableau iteration output
- Product Form and Price Out calculations
- Maximisation models
- Branch and Bound Simplex
- Branch and Bound Knapsack
- Cutting Plane / Gomory Cut
- Backtracking
- Node generation and fathoming
- Candidate and best-solution tracking
- Range and change of a selected non-basic variable coefficient
- Range and change of a selected basic variable coefficient
- Range and change of a constraint RHS value
- Range and change of a coefficient in a non-basic variable column
- Add a new activity
- Add a new constraint
- Shadow prices
- Duality and duality-gap verification
- Infeasible model detection
- Unbounded model detection
- Two-Phase Simplex
- Artificial-variable handling
- Dual Simplex re-optimisation
- Golden Section Search
- One-variable polynomial optimisation
- Convexity / concavity checks using the second derivative
- Generic polynomial evaluation using Horner's Method
- Reads programming models from
.txtfiles - Supports a dynamic number of variables and constraints
- Supports
<=,>=, and=relations - Supports variable restrictions such as
+,-,urs,int, andbin - Exports results to a text file
- Numerical results displayed to three decimal places
- C#
- .NET 8
- Visual Studio 2022
- Object-Oriented Programming
- Linear Programming
- Integer Programming
- Numerical Optimisation
LPR381Solver/
├── Algorithms/
├── Models/
├── Nonlinear/
├── Output/
├── Parsing/
├── SensitivityAnalysis/
├── SpecialCases/
├── TestFiles/
└── Program.cs
The first line specifies the optimisation direction and objective-function coefficients.
Each following line represents a constraint.
The final line specifies the variable restrictions.
Example:
max +60 +30 +20
+8 +6 +1 <=48
+4 +2 +1.5 <=20
+2 +1.5 +0.5 <=8
+ + +
This represents:
Maximise:
z = 60x1 + 30x2 + 20x3
Subject to:
8x1 + 6x2 + x3 <= 48
4x1 + 2x2 + 1.5x3 <= 20
2x1 + 1.5x2 + 0.5x3 <= 8
x1, x2, x3 >= 0
- Clone the repository.
- Open the solution in Visual Studio 2022.
- Make sure the .NET 8 SDK is installed.
- Build the solution.
- Run the project.
git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY.git
cd YOUR-REPOSITORY
dotnet restore
dotnet build
dotnet run1. Load Programming Model from File
2. Display Loaded Model
3. Solve Model
4. Sensitivity Analysis
5. Export Results
6. Nonlinear Programming Bonus
7. Special Cases
0. Exit
For the sample furniture LP:
x1 = 2.000
x2 = 0.000
x3 = 8.000
z = 280.000
For the Branch and Bound integer example:
x1 = 5.000
x2 = 0.000
z = 40.000
The application reports unsupported or invalid model/algorithm combinations instead of terminating unexpectedly.
Examples include:
- Invalid input-file values
- Unsupported variable restrictions for a selected algorithm
- Infeasible programming models
- Unbounded programming models
- Incorrect algorithm selection for the loaded model
This project demonstrates:
- Implementation of optimisation algorithms from first principles
- Matrix operations used by Revised Simplex
- Recursive Branch and Bound
- Gomory Cutting Planes
- Dual Simplex
- Sensitivity Analysis
- Duality and Shadow Prices
- Two-Phase Simplex
- Numerical optimisation with Golden Section Search
- File parsing and result exporting
- Object-oriented C# application design
This repository contains an academic implementation developed as part of the LPR381 Linear Programming programming project.
Christopher Wawa