Semidefinite Programming Solver Calculator

Build symmetric matrices and test feasible regions. Track objective changes, export findings, and validate constraints. Understand small optimization problems through practical visual matrix analysis.

Calculator Inputs

This solver searches over a symmetric 2×2 matrix X = [[x11, x12], [x12, x22]].

Objective Matrix C
Constraint 1

A₁ • X = d₁, where A₁ is symmetric.

Constraint 2

A₂ • X = d₂, where A₂ is symmetric.

Search Bounds for x11
Search Bounds for x12
Search Bounds for x22
Numerical Controls

Example Data Table

The default values below create a simple feasible semidefinite optimization example.

Item Value Meaning
Objective C [ [1, 0], [0, 1] ] Minimizes x11 + x22, which is the trace of X.
Constraint 1 [ [1, 1], [1, 1] ] • X = 4 Enforces x11 + 2x12 + x22 = 4.
Constraint 2 [ [1, 0], [0, -1] ] • X = 0 Forces x11 = x22.
Bounds x11 ∈ [0,4], x12 ∈ [-2,2], x22 ∈ [0,4] Search interval for the grid-based solver.
Expected pattern x11 ≈ 1, x12 ≈ 1, x22 ≈ 1 Produces a boundary PSD solution with determinant near zero.

Formula Used

This page solves a small semidefinite model for a symmetric decision matrix:

X = [ [x11, x12], [x12, x22] ]

The objective uses the symmetric matrix inner product:

minimize or maximize   C • X = C11·x11 + 2·C12·x12 + C22·x22

Each equality constraint uses the same structure:

Ai • X = Ai11·x11 + 2·Ai12·x12 + Ai22·x22 = di

The positive semidefinite condition for a 2×2 symmetric matrix is checked through:

x11 ≥ 0,   x22 ≥ 0,   det(X) = x11·x22 - x12² ≥ 0

The eigenvalues are reported with:

λmin,max = (trace(X) ± √((x11 - x22)² + 4x12²)) / 2

Because this page is self-contained, it uses an approximate grid search. It is excellent for learning, checking examples, and exploring small 2×2 semidefinite programs.

How to Use This Calculator

  1. Enter the objective matrix C using C11, C12, and C22.
  2. Turn on one or both equality constraints if needed.
  3. Provide each constraint matrix coefficient and its right-hand side.
  4. Set realistic search bounds for x11, x12, and x22.
  5. Choose the number of grid steps. Higher values improve detail but increase runtime.
  6. Set tolerance for equality matching and PSD acceptance.
  7. Press the solve button to generate the best sampled feasible point.
  8. Review the matrix, eigenvalues, determinant, residuals, top feasible samples, and the Plotly chart.

Frequently Asked Questions

1. What does this calculator solve?

It solves a small semidefinite optimization model for a 2×2 symmetric matrix. You can minimize or maximize a linear matrix objective while enforcing equality constraints and the positive semidefinite condition.

2. What does positive semidefinite mean here?

For a 2×2 symmetric matrix, positive semidefinite means both diagonal entries are nonnegative and the determinant is nonnegative. These conditions ensure the matrix has no negative eigenvalues.

3. Is the solver exact?

No. This page uses a grid-based numerical search. It is approximate, but very useful for demonstrations, quick feasibility checks, classroom examples, and small exploratory optimization tasks.

4. Why does tolerance matter?

A grid search rarely lands on an equality exactly. Tolerance lets the page accept points that are numerically close to the required constraints and semidefinite boundary.

5. Why does the formula use 2·A12·x12?

The matrix inner product counts both off-diagonal terms of a symmetric matrix. Since x12 appears in positions (1,2) and (2,1), the contribution becomes twice the off-diagonal coefficient.

6. How should I choose bounds?

Start with mathematically reasonable limits from your model. Narrow bounds speed the search and improve detail. Wide bounds are helpful when you do not yet know where the feasible region lies.

7. What does the Plotly graph show?

The chart shows feasible sampled matrices using x11, x12, and x22 as coordinates. Marker coloring follows the objective value, helping you see where stronger solutions tend to appear.

8. When should I use a specialized optimizer instead?

Use a dedicated optimizer for larger matrices, many constraints, exact certificates, or production research. This page is best for compact educational problems and fast visual experimentation.

Related Calculators

utility maximization calculatordeep learning optimizersimplex method solvergradient descent calculatorlasso regression solverinterior point solverconvex set projectionfeasible region findertrajectory optimization toolconvex combination calculator

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.