Calculator Inputs
This version solves a two-variable linear program with up to four inequalities using a logarithmic barrier interior-point routine.
Example Data Table
Sample linear program for testing the solver.
| Direction | Objective | Constraint 1 | Constraint 2 | Constraint 3 | Initial Point | Approx. Result |
|---|---|---|---|---|---|---|
| Maximize | 3x1 + 5x2 | x1 + x2 ≤ 4 | 2x1 + x2 ≤ 5 | x1 + 3x2 ≤ 9 | (0.5, 0.5) | x1 ≈ 1.20, x2 ≈ 2.60, objective ≈ 16.60 |
Formula Used
Linear program: Optimize z = c1x1 + c2x2
Subject to: ai1x1 + ai2x2 ≤ bi, with x1 > 0 and x2 > 0
Barrier objective for minimization: φ(x, μ) = cᵀx − μ[ln(x1) + ln(x2) + Σln(bi − aiᵀx)]
Barrier objective for maximization: φ(x, μ) = −cᵀx − μ[ln(x1) + ln(x2) + Σln(bi − aiᵀx)]
Newton step: p = −H−1∇φ(x, μ)
Barrier update: μnew = μ × reduction factor
The calculator builds a logarithmic barrier around each inequality slack and the positivity conditions. It then applies a damped Newton step with backtracking line search, keeping every trial point strictly inside the feasible region. The reported feasibility margin is the smallest current slack, including x1 and x2 positivity.
How to Use This Calculator
- Select whether the model should maximize or minimize the objective.
- Enter objective coefficients for x1 and x2.
- Choose how many inequalities your model uses.
- Fill a1, a2, and b for each inequality in the form a1x1 + a2x2 ≤ b.
- Enter a positive initial point. If it is not feasible, the solver tries an automatic interior start.
- Set the barrier parameter, reduction factor, tolerance, and iteration limits.
- Submit the form to view the solution summary and iteration history above the form.
- Use the export buttons to save the summary and iteration log as CSV or PDF.
Frequently Asked Questions
1. What does this solver calculate?
It estimates the optimal interior solution for a two-variable linear program with up to four inequalities. It also shows barrier progress, slacks, and convergence information.
2. Why must x1 and x2 stay positive?
The logarithmic barrier includes ln(x1) and ln(x2). Those terms are only defined for positive values, so the method stays strictly inside the feasible region.
3. What is the feasibility margin?
It is the smallest distance from the current point to any active boundary, including positivity limits. Larger margins indicate a deeper interior location.
4. What if my initial point is infeasible?
The page attempts an automatic interior search. If no strictly feasible point is found, you should adjust the constraints or provide a better starting guess.
5. How should I choose the barrier value μ?
Start with a moderate positive value such as 0.5 to 1.0. Larger values emphasize interior safety, while smaller values move faster toward the boundary.
6. What does the reduction factor do?
It shrinks the barrier after each outer loop. Smaller factors reduce the barrier faster, while larger factors usually give steadier but slower progress.
7. Why are some constraints marked active?
An inequality is marked active when its slack becomes very small near the final point. Active constraints usually shape the optimal boundary.
8. Is this a full general-purpose linear optimizer?
No. This page is designed for educational and practical two-variable models. It demonstrates interior-point logic, barrier control, and convergence behavior clearly.