{
  "openapi": "3.0.1",
  "info": {
    "title": "Optimization Solver: Linear & Integer Programming (LP/MIP)",
    "description": "Solve linear and integer programming models with HiGHS, written as plain algebra, LP or MPS files or JSON: optimal values, shadow prices, sensitivity ranges and the conflicting constraints of infeasible models. Ready-made assignment, knapsack, bin packing and transportation problems. For AI agents.",
    "version": "0.1",
    "x-build-id": "CpaJHME8GlIRRPsAJ"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/jumblemog~optimization-solver/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-jumblemog-optimization-solver",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/jumblemog~optimization-solver/runs": {
      "post": {
        "operationId": "runs-sync-jumblemog-optimization-solver",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/jumblemog~optimization-solver/run-sync": {
      "post": {
        "operationId": "run-sync-jumblemog-optimization-solver",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "model": {
            "title": "Model",
            "type": "string",
            "description": "The problem to solve, in plain algebra: an objective line (maximize or minimize, optionally named, like 'maximize profit: 3x + 5y'), then 'subject to' and the constraints, one per line or separated by commas, optionally named ('labor: 2x + y <= 100'). Variables are 0 or more unless bounded otherwise ('x >= -5', '0 <= y <= 10', 'free z'). Whole-number variables go on a line like 'int x, y' or 'x, y integer', yes/no ones like 'bin z'. Indexed names work (x[1], ship[A,B]), and so do CPLEX LP and MPS files and JSON (see Format)."
          },
          "format": {
            "title": "Format",
            "enum": [
              "auto",
              "algebra",
              "lp",
              "mps",
              "json"
            ],
            "type": "string",
            "description": "How the model is written. Detect recognizes MPS files, JSON and plain algebra (CPLEX LP files included) from the text, and LP files the plain reader can't take (semi-continuous variables, SOS) go to HiGHS's own LP reader.",
            "default": "auto"
          },
          "jsonModel": {
            "title": "Model as JSON",
            "type": "object",
            "description": "The model as a JSON object, for programs and AI agents. With strings: {\"maximize\": \"3x + 5y\", \"constraints\": [\"x <= 4\", \"labor: 3x + 2y <= 18\"], \"integer\": [\"x\"]}. With coefficients: {\"objective\": {\"sense\": \"max\", \"coefficients\": {\"x\": 3, \"y\": 5}}, \"constraints\": [{\"name\": \"labor\", \"terms\": {\"x\": 3, \"y\": 2}, \"<=\": 18}], \"variables\": [{\"name\": \"x\", \"upper\": 4, \"type\": \"integer\"}]}. As SciPy linprog arrays (minimized, like SciPy; add \"maximize\": true to maximize): {\"c\": [-3, -5], \"A_ub\": [[1, 0], [0, 2], [3, 2]], \"b_ub\": [4, 12, 18], \"bounds\": [0, null], \"integrality\": [0, 1]}."
          },
          "modelUrl": {
            "title": "Model file link",
            "type": "string",
            "description": "A link to a model file: MPS (.mps, or gzipped .mps.gz like MIPLIB instances), CPLEX LP (.lp), JSON or plain algebra text. GitHub and Gist file links work. Up to 64 MB; the site's robots.txt is respected."
          },
          "assignment": {
            "title": "Assignment problem",
            "type": "object",
            "description": "Who does which task at the lowest total cost (or highest total value): {\"workers\": [\"Ann\", \"Bob\", \"Cy\"], \"tasks\": [\"Paint\", \"Wire\", \"Plumb\"], \"costs\": [[9, 2, 7], [6, 4, 3], [5, 8, 1]]}, one row per worker and one column per task. null or \"x\" marks a pair that isn't allowed. Give \"values\" instead of costs to maximize. Optional: workers as objects with a capacity (tasks each can take, default 1), {\"name\": \"Ann\", \"capacity\": 2}, and tasks with workersNeeded (default 1). costs can also be {\"Ann\": {\"Paint\": 9}} or a list of {\"worker\", \"task\", \"cost\"} records."
          },
          "knapsack": {
            "title": "Knapsack problem",
            "type": "object",
            "description": "Which items to pick for the most value within a capacity, such as weight, space or budget: {\"capacity\": 15, \"items\": [{\"name\": \"Tent\", \"value\": 10, \"weight\": 5}, {\"name\": \"Stove\", \"value\": 7, \"weight\": 3}]}. Several limits at once: \"capacity\": {\"weight\": 15, \"volume\": 20} with each item's weight and volume. Per item, optional: quantity (copies available), min and \"required\": true. Several knapsacks: \"knapsacks\": [{\"name\": \"Bag 1\", \"capacity\": 10}, {\"name\": \"Bag 2\", \"capacity\": 8}]. Project or budget selection works the same way (value = return, weight = cost)."
          },
          "binPacking": {
            "title": "Bin packing problem",
            "type": "object",
            "description": "The fewest bins, boxes, pallets or trucks that hold every item: {\"binCapacity\": 10, \"items\": [{\"name\": \"A\", \"size\": 6, \"quantity\": 2}, {\"name\": \"B\", \"size\": 4, \"quantity\": 3}]}. Several dimensions: \"binCapacity\": {\"weight\": 20, \"volume\": 1.5} with each item's weight and volume. Bins of several types for the cheapest mix: \"bins\": [{\"name\": \"Small box\", \"capacity\": 20, \"cost\": 3, \"count\": 10}, {\"name\": \"Large box\", \"capacity\": 50, \"cost\": 6}]. Also cuts stock in one dimension: the stock length as the capacity and the pieces as items. Solved with OR-Tools CP-SAT."
          },
          "transportation": {
            "title": "Transportation problem",
            "type": "object",
            "description": "What to ship from each source to each destination at the lowest cost while meeting demand: {\"supply\": {\"Plant A\": 120, \"Plant B\": 80}, \"demand\": {\"Store 1\": 60, \"Store 2\": 70, \"Store 3\": 50}, \"costs\": [[4, 6, 9], [5, 3, 7]]}, costs per unit with one row per source. null or \"x\" blocks a route. Optional: routeCapacities (shaped like costs) and \"integer\": true for whole units. When supply falls short, as much demand as possible is met. The answer includes each destination's marginal cost and what one more unit of each source's supply would save."
          },
          "problems": {
            "title": "Several problems",
            "type": "array",
            "description": "Several problems in one run: each one a model string or an object with one of model, jsonModel, modelUrl, assignment, knapsack, binPacking or transportation, plus an optional title, timeLimitSeconds, mipGap and format. For example [\"max 3x + 2y st x + y <= 4, x + 3y <= 6\", {\"title\": \"Packing\", \"binPacking\": {\"binCapacity\": 10, \"items\": [{\"size\": 6}, {\"size\": 4}]}}]. Up to 100 per run; each is answered and charged on its own."
          },
          "timeLimitSeconds": {
            "title": "Time limit per problem (seconds)",
            "minimum": 1,
            "maximum": 300,
            "type": "integer",
            "description": "How long the solver may search on each problem. Linear models usually solve in well under a second. Hard integer models use the whole limit and return the best solution found, with how far from the best possible it can be. Solving past the first 10 seconds of a problem is charged per started 10 seconds.",
            "default": 10
          },
          "mipGap": {
            "title": "Integer optimality gap",
            "minimum": 0,
            "maximum": 1,
            "type": "number",
            "description": "For integer models: stop once the solution is proven to be within this fraction of the best possible. 0.0001 (0.01%, the default), 0.01 for 1% (faster on hard models), 0 to prove the exact optimum.",
            "default": 0.0001
          },
          "sensitivity": {
            "title": "Shadow prices and ranges",
            "type": "boolean",
            "description": "For linear models: each constraint's shadow price (what one more unit of its limit is worth), each variable's reduced cost, and the ranges over which they hold.",
            "default": true
          },
          "includeZeros": {
            "title": "List variables at 0",
            "type": "boolean",
            "description": "List every variable, including those at 0. Turn off to list only the nonzero ones, handy for big models. Models with over 5,000 variables list the nonzero ones and put every value in a CSV file.",
            "default": true
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}