# Linear programming solver

- Human page: https://happytails.ai/en/calculators/linear-programming-solver/
- Markdown: https://happytails.ai/en/calculators/linear-programming-solver.md
- Structured JSON: https://happytails.ai/agents/en/calculators/linear-programming-solver/index.json
- Visibility: public

## Tool capabilities

| Property | Value |
| --- | --- |
| Tool ID | `linear-programming-solver` |
| Category | calculators |
| Implementation | Registered implementation. Registration alone is not a production-quality guarantee. |
| Browser execution | Use the visible action or interactive controls. |
| Browser processing | Browser; see tool notes for network behavior. |
| HTTP API | Not callable through HTTP. |
| Browser-agent interface | run_current_tool |

### Implementation notes

Solves exactly on your device with the simplex method, for up to 12 variables, 24 constraints and 4,000 characters, and proves the result with a certificate.

### Inputs and settings

Text input: Linear program.

Example or placeholder shown in the interface (not a validated fixture):

```text
maximize 40x + 30y
x + y <= 12
2x + y <= 16
```

Objective first, then one constraint per line with <=, >= or =. Up to 4,000 characters. Review the settings before running.

| Setting | Meaning | Control type | Default | Constraints |
| --- | --- | --- | --- | --- |
| `nonnegative` | All variables are nonnegative | checkbox | true |  |

### Browser-agent workflow

1. Open the human page in a browser that supports WebMCP.
2. Discover the interface exposed by that page; use its actual schema.
3. Select files on the page first when the tool requires files.
4. Call `run_current_tool` with valid input and settings.
5. Inspect the returned result or error and the displayed output. Retrieve files from the displayed download links.

Calls do not automatically copy or download results. Browser permissions still apply. Interface availability alone is not proof of successful execution.

### Planning specification

Programs are limited to 4,000 characters, 40 lines, 12 variables, 24 constraints, 2,000 pivots and exact values of 1,024 digits. Everything is computed on your device in a background worker with a 15 second limit. Downloads are a JSON report and CSV tables of variables and constraints.

This describes intended requirements. Use the implementation notes, interface schema and observed output to determine current support.

### Complete machine-readable capability record

```json
{
  "id": "linear-programming-solver",
  "category": "calculators",
  "built": true,
  "requirements": "Programs are limited to 4,000 characters, 40 lines, 12 variables, 24 constraints, 2,000 pivots and exact values of 1,024 digits. Everything is computed on your device in a background worker with a 15 second limit. Downloads are a JSON report and CSV tables of variables and constraints.",
  "implementation": {
    "fields": [
      {
        "key": "nonnegative",
        "label": "All variables are nonnegative",
        "value": true,
        "type": "checkbox"
      }
    ],
    "registrationFamily": "exact-math-reference",
    "inputMaxLength": 4000,
    "inputErrorCode": "EXACT_MATH_REFERENCE_PROGRAM_TOO_LONG",
    "note": "Solves exactly on your device with the simplex method, for up to 12 variables, 24 constraints and 4,000 characters, and proves the result with a certificate.",
    "experience": {
      "automatic": false,
      "single": false,
      "inputMaxLength": 4000,
      "inputMode": "text",
      "label": "Linear program",
      "placeholder": "maximize 40x + 30y\nx + y <= 12\n2x + y <= 16",
      "help": "Objective first, then one constraint per line with <=, >= or =. Up to 4,000 characters. Review the settings before running.",
      "action": null
    },
    "mode": "explicit",
    "interactive": false
  },
  "execution": "Browser interface",
  "api": null,
  "browser_agent": {
    "supported": true,
    "name": "run_current_tool",
    "discovery": "WebMCP on the human page in a supporting browser",
    "verification": "See audit/API-AUDIT.md; availability is not verification"
  }
}
```

## Page guide

Maximize or minimize a linear objective under linear constraints with exact fractions. The result is an optimal solution, or a proof that the problem is infeasible or unbounded.

How can we improve this tool?

Report a problem or share an idea.

Please leave out private information. Your message and the tool name go to our team via PostHog.

### How to use Linear programming solver

1. Write the objective on the first line, such as maximize 40x + 30y.
2. Add one constraint per line, such as x + y <= 12.
3. Choose whether all variables must be nonnegative, then run the solver.
4. Review the solution, shadow prices and certificate, then download JSON or CSV.

## Useful next steps

- [Linear system solver](https://happytails.ai/en/calculators/linear-system-solver/) ([Markdown](https://happytails.ai/en/calculators/linear-system-solver.md))

- [Matrix workspace](https://happytails.ai/en/calculators/matrix-workspace/) ([Markdown](https://happytails.ai/en/calculators/matrix-workspace.md))

- [Graphing calculator](https://happytails.ai/en/calculators/graphing-calculator/) ([Markdown](https://happytails.ai/en/calculators/graphing-calculator.md))

## Method

The solver uses the two-phase simplex method with Bland's smallest-index rule, which cannot cycle on degenerate problems. All arithmetic uses exact fractions. Source: R. G. Bland, New finite pivoting rules for the simplex method, Mathematics of Operations Research 2(2), 1977.

### Certificates

An optimal answer comes with dual multipliers that prove no better value exists. An infeasible problem comes with Farkas multipliers that combine the constraints into an impossible inequality. An unbounded problem comes with a feasible point and a direction that improves the objective forever. Each certificate is checked exactly against your constraints.

### Writing the program

Use <=, >= or = in each constraint, and variable names such as x, y or x1. A line such as x, y >= 0 adds one bound per variable. Strict inequalities and products of variables are not supported.
