Exact supplied-matrix route
Find an exact minimum-cost directed route visiting every supplied stop once, as a fixed-start cycle or open path with optional fixed end. Null arcs are forbidden; no maps, geocoding, traffic, vehicle capacity, time windows or dispatch.
workflow-assurance · Operation ID: route-matrix-optimize
Choose this operation when
- All leg costs and allowed arcs are supplied in one declared unit; at most 12 stops including the start
Outside this profile
- Shortest paths that may skip/revisit stops, real routing data, multiple vehicles, capacity or time windows
- General route search beyond the exact bounded Hamiltonian model
- Investment advice, high-impact decisions about people, or validating the truth of caller assumptions
Exact release references
Static JSON contract · Markdown reference · Fixed example response
Complete input schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"stopIds": {
"minItems": 1,
"maxItems": 12,
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 64
}
},
"costs": {
"minItems": 1,
"maxItems": 12,
"type": "array",
"items": {
"minItems": 1,
"maxItems": 12,
"type": "array",
"items": {
"anyOf": [
{
"type": "string",
"pattern": "^(?:0|[1-9][0-9]{0,11})(?:\\.[0-9]{1,6})?$"
},
{
"type": "null"
}
]
}
}
},
"route": {
"oneOf": [
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "cycle"
},
"startId": {
"type": "string",
"minLength": 1,
"maxLength": 64
}
},
"required": [
"kind",
"startId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "path"
},
"startId": {
"type": "string",
"minLength": 1,
"maxLength": 64
},
"endId": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 64
},
{
"type": "null"
}
]
}
},
"required": [
"kind",
"startId",
"endId"
],
"additionalProperties": false
}
]
},
"costUnit": {
"type": "string",
"minLength": 1,
"maxLength": 64
}
},
"required": [
"stopIds",
"costs",
"route",
"costUnit"
],
"additionalProperties": false
}
Complete output-envelope schema
{
"type": "object",
"required": [
"operation",
"version",
"result",
"provenance"
],
"properties": {
"operation": {
"const": "route-matrix-optimize",
"type": "string"
},
"version": {
"const": "0.29.0",
"type": "string"
},
"result": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"oneOf": [
{
"type": "object",
"properties": {
"profile": {
"type": "string",
"const": "exact-directed-hamiltonian-route-v1"
},
"externalRequests": {
"type": "number",
"const": 0
},
"execution": {
"type": "boolean",
"const": false
},
"assumptionsVerified": {
"type": "boolean",
"const": false
},
"costUnit": {
"type": "string",
"minLength": 1,
"maxLength": 64
},
"stopIds": {
"minItems": 1,
"maxItems": 12,
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 64
}
},
"route": {
"oneOf": [
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "cycle"
},
"startId": {
"type": "string",
"minLength": 1,
"maxLength": 64
}
},
"required": [
"kind",
"startId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "path"
},
"startId": {
"type": "string",
"minLength": 1,
"maxLength": 64
},
"endId": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 64
},
{
"type": "null"
}
]
}
},
"required": [
"kind",
"startId",
"endId"
],
"additionalProperties": false
}
]
},
"algorithm": {
"type": "string",
"const": "subset-dynamic-programming"
},
"work": {
"type": "object",
"properties": {
"statesEvaluated": {
"type": "integer",
"minimum": 1,
"maximum": 24576
},
"transitionsConsidered": {
"type": "integer",
"minimum": 0,
"maximum": 135168
}
},
"required": [
"statesEvaluated",
"transitionsConsidered"
],
"additionalProperties": false
},
"status": {
"type": "string",
"const": "optimal"
},
"visitOrder": {
"minItems": 1,
"maxItems": 13,
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 64
}
},
"legs": {
"maxItems": 12,
"type": "array",
"items": {
"type": "object",
"properties": {
"fromId": {
"type": "string",
"minLength": 1,
"maxLength": 64
},
"toId": {
"type": "string",
"minLength": 1,
"maxLength": 64
},
"cost": {
"type": "object",
"properties": {
"numerator": {
"type": "string",
"pattern": "^(?:0|[1-9][0-9]*)$"
},
"denominator": {
"type": "string",
"pattern": "^[1-9][0-9]*$"
}
},
"required": [
"numerator",
"denominator"
],
"additionalProperties": false
}
},
"required": [
"fromId",
"toId",
"cost"
],
"additionalProperties": false
}
},
"totalCost": {
"type": "object",
"properties": {
"numerator": {
"type": "string",
"pattern": "^(?:0|[1-9][0-9]*)$"
},
"denominator": {
"type": "string",
"pattern": "^[1-9][0-9]*$"
}
},
"required": [
"numerator",
"denominator"
],
"additionalProperties": false
},
"tieBreak": {
"type": "string",
"const": "lexicographically-smallest-visit-order-by-UTF-16"
}
},
"required": [
"profile",
"externalRequests",
"execution",
"assumptionsVerified",
"costUnit",
"stopIds",
"route",
"algorithm",
"work",
"status",
"visitOrder",
"legs",
"totalCost",
"tieBreak"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"profile": {
"type": "string",
"const": "exact-directed-hamiltonian-route-v1"
},
"externalRequests": {
"type": "number",
"const": 0
},
"execution": {
"type": "boolean",
"const": false
},
"assumptionsVerified": {
"type": "boolean",
"const": false
},
"costUnit": {
"type": "string",
"minLength": 1,
"maxLength": 64
},
"stopIds": {
"minItems": 1,
"maxItems": 12,
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 64
}
},
"route": {
"oneOf": [
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "cycle"
},
"startId": {
"type": "string",
"minLength": 1,
"maxLength": 64
}
},
"required": [
"kind",
"startId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "path"
},
"startId": {
"type": "string",
"minLength": 1,
"maxLength": 64
},
"endId": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 64
},
{
"type": "null"
}
]
}
},
"required": [
"kind",
"startId",
"endId"
],
"additionalProperties": false
}
]
},
"algorithm": {
"type": "string",
"const": "subset-dynamic-programming"
},
"work": {
"type": "object",
"properties": {
"statesEvaluated": {
"type": "integer",
"minimum": 1,
"maximum": 24576
},
"transitionsConsidered": {
"type": "integer",
"minimum": 0,
"maximum": 135168
}
},
"required": [
"statesEvaluated",
"transitionsConsidered"
],
"additionalProperties": false
},
"status": {
"type": "string",
"const": "infeasible"
},
"visitOrder": {
"type": "null"
},
"legs": {
"type": "null"
},
"totalCost": {
"type": "null"
},
"reason": {
"type": "string",
"const": "No route visits every supplied stop exactly once under the declared endpoints and allowed arcs"
}
},
"required": [
"profile",
"externalRequests",
"execution",
"assumptionsVerified",
"costUnit",
"stopIds",
"route",
"algorithm",
"work",
"status",
"visitOrder",
"legs",
"totalCost",
"reason"
],
"additionalProperties": false
}
]
},
"provenance": {
"type": "object",
"required": [
"inputSha256",
"outputSha256",
"deterministic",
"externalRequests"
],
"properties": {
"inputSha256": {
"type": "string",
"pattern": "^[a-f0-9]{64}$"
},
"outputSha256": {
"type": "string",
"pattern": "^[a-f0-9]{64}$"
},
"deterministic": {
"const": true
},
"externalRequests": {
"const": 0
}
}
}
},
"additionalProperties": false
}
Fixed example
One accepted fixed example, not a custom-input trial. No operation runs when this static page is requested.
Example input
{
"stopIds": [
"depot",
"alpha",
"beta",
"gamma"
],
"costs": [
[
"0",
"4",
"2",
"8"
],
[
"3",
"0",
"5",
"2"
],
[
"7",
"1",
"0",
"6"
],
[
"3",
"4",
"2",
"0"
]
],
"route": {
"kind": "cycle",
"startId": "depot"
},
"costUnit": "declared travel minutes"
}
Example response
{
"operation": "route-matrix-optimize",
"version": "0.29.0",
"result": {
"profile": "exact-directed-hamiltonian-route-v1",
"externalRequests": 0,
"execution": false,
"assumptionsVerified": false,
"costUnit": "declared travel minutes",
"stopIds": [
"alpha",
"beta",
"depot",
"gamma"
],
"route": {
"kind": "cycle",
"startId": "depot"
},
"algorithm": "subset-dynamic-programming",
"work": {
"statesEvaluated": 20,
"transitionsConsidered": 24
},
"status": "optimal",
"visitOrder": [
"depot",
"beta",
"alpha",
"gamma",
"depot"
],
"legs": [
{
"fromId": "depot",
"toId": "beta",
"cost": {
"numerator": "2",
"denominator": "1"
}
},
{
"fromId": "beta",
"toId": "alpha",
"cost": {
"numerator": "1",
"denominator": "1"
}
},
{
"fromId": "alpha",
"toId": "gamma",
"cost": {
"numerator": "2",
"denominator": "1"
}
},
{
"fromId": "gamma",
"toId": "depot",
"cost": {
"numerator": "3",
"denominator": "1"
}
}
],
"totalCost": {
"numerator": "8",
"denominator": "1"
},
"tieBreak": "lexicographically-smallest-visit-order-by-UTF-16"
},
"provenance": {
"inputSha256": "69efa70491b7b083786ef5f6071ee2963cb1eaaf0be6d0d27dec7bc05b2648d2",
"outputSha256": "49ae8abe2fd859ad0e439a60afe82b5b38520337afe6da77ca7d9d5e80942e9d",
"deterministic": true,
"externalRequests": 0
}
}
Bounds and precision
JavaScript IEEE-754 numbers; use strings for large integer IDs/exact decimals where the schema accepts strings. No lossless numeric parsing.
{
"global": {
"requestBytes": 131072,
"responseBytes": 524288,
"jsonDepth": 32,
"jsonNodes": 20000,
"requestsPerMinute": 60,
"paidAttemptsPerMinute": 20,
"idempotencyHours": 24
},
"operation": {
"inputBytes": 48000,
"outputBytes": 192000,
"jsonNodes": 8000,
"depth": 12,
"stops": 12,
"matrixCells": 144,
"allocatedDpCells": 24576,
"maximumTransitionChecks": 135168,
"decimalIntegerDigits": 12,
"decimalFractionDigits": 6
}
}
Complete schemas, descriptions and cross-field validation may impose additional limits.
Proposed price and protocol definitions
{
"unit": "one successful operation call",
"proposedNominalUsd": "0.010",
"sixDecimalTokenBaseUnits": "10000",
"subscription": false,
"includesPayerWalletOrNetworkFees": false,
"liveQuoteVerified": false,
"condition": "Actual SDK challenge is authoritative only within the caller's explicit authorization; configured six-decimal token peg is an operator assertion, not a conversion guarantee."
}
Protocol definitions: x402, mpp. MPP uses Tempo charge. Paid MCP execution is unsupported. All runtime readiness is not evaluated in this build.
API path templates, not endpoints on this documentation host
{
"x402": "/v1/x402/route-matrix-optimize",
"mpp": "/v1/mpp/route-matrix-optimize"
}
Required headers
{
"Content-Type": "application/json",
"Idempotency-Key": "random 16–128 character operation identifier"
}
Actual SDK challenge amount, asset, network, recipient and wallet costs must pass independent authorization. Preserve identical key, body, protocol and credential on retries; on PAYMENT_UNCERTAIN stop and reconcile.
Execution profile and provider conditions
{
"deterministic": true,
"externalRequests": 0,
"maxExternalRequests": 0,
"resultSnapshotPersisted": false,
"fixedExampleIsIllustrativeSnapshot": false,
"requiresPayment": true,
"supportsMcpExecution": false
}
Deterministic supplied-input operation with no external requests or stored request/result bodies. Payment infrastructure retains payment metadata and hashes.
Failure handling
- HTTP 400: Malformed JSON, missing/invalid idempotency key, or payment identifier mismatch Correct the request before payment
- HTTP 402: Payment challenge or rejected payment Use official protocol SDK; inspect payment outcome before another payment
- HTTP 409: Idempotency conflict, duplicate proof, or PAYMENT_UNCERTAIN Keep original key, body, and proof; reconcile uncertainty with operator; never blindly repay
- HTTP 413: Input or generated output too large Reduce input; no payment attempted for validation failure
- HTTP 415: Unsupported media type or compression Send uncompressed application/json
- HTTP 422: Schema or service-specific semantic validation failure Correct input using returned error code; no payment attempted
- HTTP 429: Request/payment-attempt rate exceeded Wait for rate limit window; preserve existing payment identity
- HTTP 503: Payment configuration/provider/state unavailable, or live DNS preparation failed before settlement Check readiness; DNS preparation failures may retry the identical key/body/credential only; uncertainty requires reconciliation
Declared requirements
Before any paid call, refresh the live operation contract and POST the complete bounded budgeted plan to the separate API's /preflight. Unknown requirements block selection; compatible preflight is not permission to spend.