Lp optimality certificate check

lp-optimality-certificate-check · version 1.0.0 · Numbers & math · free, no key needed

Check an LP optimum claim from a primal x and dual y: feasibility, complementary slackness and zero duality gap.

Use when you need to: verify an lp optimal solution with a dual certificate · check complementary slackness for x and y · prove a linear program optimum by strong duality.

Decide before calling

Read the versioned contract and the supported scope below. Reuse lp-optimality-certificate-check@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.

Explain the choice

"I can use lp-optimality-certificate-check@1.0.0 for verify an lp optimal solution with a dual certificate. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

Supported

Not supported

Behavior

Input

Output

Limits

Example

Request input:

{
  "objective": [
    "3",
    "5"
  ],
  "matrix": [
    [
      "1",
      "0"
    ],
    [
      "0",
      "2"
    ],
    [
      "3",
      "2"
    ]
  ],
  "rhs": [
    "4",
    "12",
    "18"
  ],
  "x": [
    "2",
    "6"
  ],
  "y": [
    "0",
    "3/2",
    "1"
  ],
  "claimed_optimum": "36"
}

Response:

{
  "result": {
    "valid": true,
    "reason": null,
    "first_discrepancy": null,
    "primal_objective": "36",
    "dual_objective": "36",
    "duality_gap": "0",
    "form": "max c.x subject to A.x <= b, x >= 0",
    "reference_version": "schrijver-1986-tlip-s7.4-s7.9"
  }
}

How to call it

MCP

Connect https://computefirst.net/mcp (setup), then call execute with:

{
  "id": "lp-optimality-certificate-check",
  "version": "1.0.0",
  "input": {
    "objective": [
      "3",
      "5"
    ],
    "matrix": [
      [
        "1",
        "0"
      ],
      [
        "0",
        "2"
      ],
      [
        "3",
        "2"
      ]
    ],
    "rhs": [
      "4",
      "12",
      "18"
    ],
    "x": [
      "2",
      "6"
    ],
    "y": [
      "0",
      "3/2",
      "1"
    ],
    "claimed_optimum": "36"
  }
}

HTTP (no key)

curl -X POST https://computefirst.net/v1/tools/lp-optimality-certificate-check/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"objective":["3","5"],"matrix":[["1","0"],["0","2"],["3","2"]],"rhs":["4","12","18"],"x":["2","6"],"y":["0","3/2","1"],"claimed_optimum":"36"}'

The machine-readable contract is at /v1/tools/lp-optimality-certificate-check/versions/1.0.0.

CLI

node cli.mjs run lp-optimality-certificate-check 1.0.0 --input input.json --base-url https://computefirst.net

Get the client at /clients/cli/.