Skip to content
HALOWERK

Ortwerk

stop order check

Computes the planned tour length (great-circle distance × detour factor, or your distance matrix) from the depot through the stops in order (and back), then searches a shorter order: exhaustively for up to 8 stops, otherwise nearest neighbour followed by 2-opt and Or-opt moves (segments of 1-3 stops, both directions) until no improvement — a heuristic that is not guaranteed optimal. Reports the saving, the improved order, pairs of planned legs that properly cross (each crossing means a 2-opt.

POST https://ort.halowerk.com/v1/stop-order-check

Inputs

Fields of the published input schema
FieldTypeRequiredDescription
depotobjectYesStart (and end) of the tour.
stopsarrayYesStops in planned order.
return_to_depotbooleanNoTour ends at the depot.
detour_factornumberNoFactor on great-circle distances (your assumption; does not change the order).
matrix_kmarrayNoOptional road distance matrix in km; index 0 = depot, then stops in the given order.
tolerance_pctnumberNoSaving up to which the order is called plausible.
Show full input schema
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "depot",
    "stops"
  ],
  "properties": {
    "depot": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "lat",
        "lon"
      ],
      "properties": {
        "lat": {
          "type": "number",
          "minimum": -90,
          "maximum": 90,
          "description": "Latitude in WGS84 degrees."
        },
        "lon": {
          "type": "number",
          "minimum": -180,
          "maximum": 180,
          "description": "Longitude in WGS84 degrees."
        }
      },
      "description": "Start (and end) of the tour."
    },
    "stops": {
      "type": "array",
      "minItems": 2,
      "maxItems": 200,
      "description": "Stops in planned order.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "lat",
          "lon"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "Stop reference."
          },
          "lat": {
            "type": "number",
            "minimum": -90,
            "maximum": 90,
            "description": "Latitude."
          },
          "lon": {
            "type": "number",
            "minimum": -180,
            "maximum": 180,
            "description": "Longitude."
          }
        }
      }
    },
    "return_to_depot": {
      "type": "boolean",
      "default": true,
      "description": "Tour ends at the depot."
    },
    "detour_factor": {
      "type": "number",
      "minimum": 1,
      "maximum": 3,
      "default": 1,
      "description": "Factor on great-circle distances (your assumption; does not change the order)."
    },
    "matrix_km": {
      "type": "array",
      "maxItems": 201,
      "items": {
        "type": "array",
        "maxItems": 201,
        "items": {
          "type": "number",
          "minimum": 0,
          "maximum": 100000
        }
      },
      "description": "Optional road distance matrix in km; index 0 = depot, then stops in the given order."
    },
    "tolerance_pct": {
      "type": "number",
      "minimum": 0,
      "maximum": 100,
      "default": 5,
      "description": "Saving up to which the order is called plausible."
    }
  }
}

Open original schema

Published input example

{
  "depot": {
    "lat": 52,
    "lon": 7
  },
  "stops": [
    {
      "id": "N",
      "lat": 52.009,
      "lon": 7
    },
    {
      "id": "S",
      "lat": 51.991,
      "lon": 7
    },
    {
      "id": "E",
      "lat": 52,
      "lon": 7.0146
    },
    {
      "id": "W",
      "lat": 52,
      "lon": 6.9854
    }
  ]
}

Result & documentation

Machine-readable documentation of this hub

Source of this page: the published HALOWERK catalog. Updated: 2026-11-17 UTC.

More endpoints in this hub

All endpoints in this hub →