# Capacity allocation check

`capacity-allocation-check` · version 1.0.0 · Numbers & math · free, no key needed

Check an exact claimed allocation for eligibility and per-bin decimal capacity compliance.

**Use when you need to: check capacity allocation · validate claimed capacitated assignment · audit bin capacity compliance.**

## Decide before calling

Read the [versioned contract](/v1/tools/capacity-allocation-check/versions/1.0.0) and the supported scope below. Reuse `capacity-allocation-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 `capacity-allocation-check@1.0.0` for check capacity allocation. 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

- check capacity allocation
- validate claimed capacitated assignment
- audit bin capacity compliance
- check exact decimal allocation loads
- detect overloaded bins
- validate item demand assignment

## Not supported

- choose an allocation
- split item demand

## Behavior

- Items and bins use exact, case-sensitive string identifiers; duplicate declarations and duplicate eligibility entries are malformed.
- A false claim is reported at the first source item, then source bin, then claim index relevant to the discrepancy; no assignment is repaired or synthesized.
- Null is never an identifier, decimal, array, object, or quota; unknown fields are rejected.
- Decimal strings are canonical non-negative base-10 values and are summed as scaled integers without binary floating-point.
- Reference version: Ahuja-Magnanti-Orlin-Network-Flows-1993-chapter-12.

## Input

- `items` (array of object, required): min items 1; max items 2000
- `bins` (array of object, required): min items 1; max items 500
- `claim` (object, required)

## Output

- `valid` (boolean, required)
- `reason` (string, required): min length 1
- `discrepancy` (object or null, required)
- `reference_version` (constant "Ahuja-Magnanti-Orlin-Network-Flows-1993-chapter-12", required)

## Limits

- max input bytes: 262144
- max items: 2000
- max bins: 500
- max assignments: 4000
- max eligible bins per item: 500
- max decimal digits: 40

## Example

Request input:

```json
{
  "items": [
    {
      "id": "i1",
      "eligible_bins": [
        "b1"
      ],
      "demand": "1.25"
    }
  ],
  "bins": [
    {
      "id": "b1",
      "capacity": "1.25"
    }
  ],
  "claim": {
    "assignments": [
      {
        "item_id": "i1",
        "bin_id": "b1"
      }
    ]
  }
}
```

Response:

```json
{
  "result": {
    "valid": true,
    "reason": "claim_exact",
    "discrepancy": null,
    "reference_version": "Ahuja-Magnanti-Orlin-Network-Flows-1993-chapter-12"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "capacity-allocation-check",
  "version": "1.0.0",
  "input": {
    "items": [
      {
        "id": "i1",
        "eligible_bins": [
          "b1"
        ],
        "demand": "1.25"
      }
    ],
    "bins": [
      {
        "id": "b1",
        "capacity": "1.25"
      }
    ],
    "claim": {
      "assignments": [
        {
          "item_id": "i1",
          "bin_id": "b1"
        }
      ]
    }
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/capacity-allocation-check/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"items":[{"id":"i1","eligible_bins":["b1"],"demand":"1.25"}],"bins":[{"id":"b1","capacity":"1.25"}],"claim":{"assignments":[{"item_id":"i1","bin_id":"b1"}]}}'
```

The machine-readable contract is at [/v1/tools/capacity-allocation-check/versions/1.0.0](/v1/tools/capacity-allocation-check/versions/1.0.0).

### CLI

```sh
node cli.mjs run capacity-allocation-check 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Assignment feasibility check](/tools/assignment-feasibility-check): Check whether a claimed item-to-bin assignment is complete, unique, declared, and eligible.
- [Quota allocation check](/tools/quota-allocation-check): Check an exact claimed allocation for eligibility and per-bin lower and upper quotas.
- [Network flow feasibility check](/tools/network-flow-feasibility-check): Check a claimed s-t flow for capacity bounds and conservation with exact integers; returns the first bad edge or node.
- [Permutation ranked check](/tools/permutation-ranked-check): Check exact stable ordinal ranks for decimal-string values and nulls, reporting the first source-index discrepancy.
- [Sample histogram check](/tools/sample-histogram-check): Check claimed histogram counts, outside count and densities for exact edges and an edge rule; returns the first bad bin.
- [Coloring count check](/tools/coloring-count-check): Check a proper indexed coloring and an exact canonical-decimal claim for its number of distinct colors.
