{ "cells": [ { "cell_type": "markdown", "id": "6c1a6ba1-4ea4-4400-a4f2-5bf083577896", "metadata": {}, "source": [ "# Online Stochastic Matchings: Stability on Hypergraphs" ] }, { "cell_type": "markdown", "id": "cell-0", "metadata": {}, "source": [ "This is the companion notebook of the paper *Online Stochastic Matchings: Stability on Hypergraphs*.\n", "\n", "It covers the numerical claims of the paper, focusing on the candy hypergraph:\n", "\n", "1. **The characterization of stability.** `model.stabilizable` decides any $(G,\\lambda)$; `model.maximin`\n", " gives the witness flow $\\mu$; `model.incidence` gives the matrix.\n", "2. **The candy's closed-form stability region**, checked against `model.stabilizable`.\n", "3. **Regular greedy ML vs. VQML** on the candy $\\alpha$-family (the paper's figure).\n", "4. **The provable greedy-instability threshold** $\\alpha<2/21$: the domination and\n", " throughput-conservation ingredients.\n", "5. **Accessibility and tie-breaking of the virtual chain**: proof-level combinatorics." ] }, { "cell_type": "code", "execution_count": 1, "id": "cell-1", "metadata": { "execution": { "iopub.execute_input": "2026-07-18T22:02:30.298352Z", "iopub.status.busy": "2026-07-18T22:02:30.297878Z", "iopub.status.idle": "2026-07-18T22:02:32.024621Z", "shell.execute_reply": "2026-07-18T22:02:32.023566Z", "shell.execute_reply.started": "2026-07-18T22:02:30.298327Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "stochastic_matching: 0.4.0\n" ] } ], "source": [ "import numpy as np\n", "import matplotlib.pyplot as plt\n", "import multiprocess as mp\n", "import stochastic_matching as sm\n", "from stochastic_matching import XP, Iterator, evaluate\n", "\n", "print(\"stochastic_matching:\", sm.__version__)\n", "np.set_printoptions(precision=4, suppress=True)" ] }, { "cell_type": "markdown", "id": "60101877-3f1a-47a1-85ee-34cfb99a39c1", "metadata": {}, "source": [ "First, recall the candy structure: two triangles bridged by a hyperedge that includes a seventh node:" ] }, { "cell_type": "code", "execution_count": 6, "id": "ed3104d6-c2e0-4c29-bf58-3c574a38faa6", "metadata": { "execution": { "iopub.execute_input": "2026-07-18T22:02:39.840531Z", "iopub.status.busy": "2026-07-18T22:02:39.840248Z", "iopub.status.idle": "2026-07-18T22:02:39.848673Z", "shell.execute_reply": "2026-07-18T22:02:39.847447Z", "shell.execute_reply.started": "2026-07-18T22:02:39.840512Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "candy incidence A (from model.incidence):\n", "[[1 1 0 0 0 0 0]\n", " [1 0 1 0 0 0 0]\n", " [0 1 1 0 0 0 1]\n", " [0 0 0 0 0 0 1]\n", " [0 0 0 1 1 0 1]\n", " [0 0 0 1 0 1 0]\n", " [0 0 0 0 1 1 0]] \n", "\n" ] }, { "data": { "text/html": [ "\n", "