B

Bounded Decision Solver · BIN Pack

by Bounded Decision Solver

POSTBaseArbitrumPolygon

$0.005

per call · USD Coin on Base

Bin-packing heuristic — deterministic best-fit-decreasing capacity planning for placing items into bins, with feasibility evidence and an honest volume bound.

Endpoint

POST https://decision-solver.use.x402atlas.com/bin-pack

2

Calls / 30d

1

Unique payers / 30d

Sep 1

Last called

exact

Payment scheme

Call this service

TypeScript · @x402/fetch
import { wrapFetchWithPayment } from "@x402/fetch";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.PRIVATE_KEY);
const fetchWithPay = wrapFetchWithPayment(fetch, account);

const res = await fetchWithPay("https://decision-solver.use.x402atlas.com/bin-pack", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "capacity": 10,
    "items": [
      {
        "id": "a",
        "size": 8
      },
      {
        "id": "b",
        "size": 7
      },
      {
        "id": "c",
        "size": 6
      },
      {
        "id": "d",
        "size": 5
      },
      {
        "id": "e",
        "size": 4
      }
    ]
  }),
});
const data = await res.json();
cURL
curl -X POST \
  "https://decision-solver.use.x402atlas.com/bin-pack" \
  -H "Content-Type: application/json" \
  -d '{"capacity":10,"items":[{"id":"a","size":8},{"id":"b","size":7},{"id":"c","size":6},{"id":"d","size":5},{"id":"e","size":4}]}' \
  -H "X-PAYMENT: <signed x402 payment>"

Example response

{
  "algorithm_version": "best-fit-decreasing-v1",
  "certificate": {
    "algorithm": "best-fit-decreasing-v1",
    "capacity": 10,
    "capacity_feasible": true,
    "item_conservation": true,
    "item_count": 5,
    "total_size": 30,
    "volume_lower_bound": 3
  },
  "objective": "minimum_bin_count",
  "objective_value": 4,
  "operation": "bin-pack",
  "optimal": false,
  "optimality_gap_upper_bound": 1,
  "solution": {
    "bin_count": 4,
    "bins": [
      {
        "index": 0,
        "items": [
          {
            "id": "a",
            "original_index": 0,
            "size": 8
          }
        ],
        "load": 8,
        "remaining": 2
      },
      {
        "index": 1,
        "items": [
          {
            "id": "b",
            "original_index": 1,
            "size": 7
          }
        ],
        "load": 7,
        "remaining": 3
      },
      {
        "index": 2,
        "items": [
          {
            "id": "c",
            "original_index": 2,
            "size": 6
          },
          {
            "id": "e",
            "original_index": 4,
            "size": 4
          }
        ],
        "load": 10,
        "remaining": 0
      },
      {
        "index": 3,
        "items": [
          {
            "id": "d",
            "original_index": 3,
            "size": 5
          }
        ],
        "load": 5,
        "remaining": 5
      }
    ]
  },
  "warnings": [
    "Best-fit decreasing is a heuristic; a nonzero reported bound is only an upper bound on the unknown optimality gap."
  ],
  "work_units": 10
}

Payment details

Pay to0x8c128f1ee62bb5e47867cfbae2ad89be325df1b2
AssetUSD Coin · 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913
NetworksBase, Arbitrum, Polygon
Schemesexact

Is this your API?

Pin it to the top of Search & Web and the homepage with a featured placement.

Get featured →

More from Bounded Decision Solver & similar services