You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.2 KiB
63 lines
2.2 KiB
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "23083bd9",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Maximum Weight Stable Set\n",
|
|
"\n",
|
|
"## Problem definition\n",
|
|
"\n",
|
|
"Given a simple undirected graph $G=(V,E)$ and weights $w \\in \\mathbb{R}^V$, the problem is to find a stable set $S \\subseteq V$ that maximizes $ \\sum_{v \\in V} w_v$. We recall that a subset $S \\subseteq V$ is a *stable set* if no two vertices of $S$ are adjacent. This is one of Karp's 21 NP-complete problems.\n",
|
|
"\n",
|
|
"## Random instance generator\n",
|
|
"\n",
|
|
"The class `MaxWeightStableSetGenerator` can be used to generate random instances of this problem, with user-specified probability distributions. When the constructor parameter `fix_graph=True` is provided, one random Erdős-Rényi graph $G_{n,p}$ is generated during the constructor, where $n$ and $p$ are sampled from user-provided probability distributions `n` and `p`. To generate each instance, the generator independently samples each $w_v$ from the user-provided probability distribution `w`. When `fix_graph=False`, a new random graph is generated for each instance, while the remaining parameters are sampled in the same way.\n",
|
|
"\n",
|
|
"## Challenge A\n",
|
|
"\n",
|
|
"* Fixed random Erdős-Rényi graph $G_{n,p}$ with $n=200$ and $p=5\\%$\n",
|
|
"* Random vertex weights $w_v \\sim U(100, 150)$\n",
|
|
"* 500 training instances, 50 test instances"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "207c7846",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"MaxWeightStableSetGenerator(\n",
|
|
" w=uniform(loc=100., scale=50.),\n",
|
|
" n=randint(low=200, high=201),\n",
|
|
" p=uniform(loc=0.05, scale=0.0),\n",
|
|
" fix_graph=True,\n",
|
|
")"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "miplearn",
|
|
"language": "python",
|
|
"name": "miplearn"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.8.10"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|