{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Covering Designs\n", "\n", "This notebook provides permanent access to data on covering designs from the __[La Jolla Combinatorics Repository](https://dmgordon.org)__. A $(v,k,t)$ covering design is a collection of $k$-subsets of a $v$-set (\"blocks\"), such that all $t$-sets are contained in at least one $k$-set. This database gives upper and lower bounds for coverings designs with $v < 100$, $k \\leq 25$ and $t \\leq 8$.\n", "\n", "The database is contained in two json files. `coverdata.json` contains data about the covering designs: upper and lower bounds, and a history of improvements since the database was first created in 1996. `covers.json` contains the blocks of the best known covering designs. The file `covering_code.py` contains basic code for accessing information from the database." ] }, { "cell_type": "code", "execution_count": 36, "metadata": {}, "outputs": [], "source": [ "%run covering_code.py" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "read history of 8771 covering designs\n" ] } ], "source": [ "f = open('coverdata.json','r')\n", "coverdata = json.load(f)\n", "f.close()\n", "print(f'read history of {len(coverdata.keys())} covering designs')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Note that `covers.json` is 2.7 GB, so reading it in may take a few minutes." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "read 8771 covering designs\n" ] } ], "source": [ "f = open('covers.json','r')\n", "covers = json.load(f)\n", "f.close()\n", "print(f'read {len(covers.keys())} covering designs')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The website allows searches for particular values or ranges of the parameters. If you just want to replicate that here, you can ignore everything below, and just substitute numbers of interest in the ranges of $v$, $k$, and $t$." ] }, { "cell_type": "code", "execution_count": 37, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
vktsizelower bdcreatormethodtimestamp
108588JCD article1996-11-14 17:08:00
11851616JCD article1996-11-14 17:08:00
12852626JCD article1996-11-14 17:08:00
13854233Chaoying Dai, Ben Li and Michel Toulouse2005-06-28 00:00:00
14855549Covering provided by Rade Belic1997-05-09 00:00:00
15858975Covering provided by Dietmar Pree1997-05-16 00:00:00
1685115104Alessandro Jurcovich2006-05-08 00:00:00
1785177147Anastasios TampakisWheel Generator, based on Chaoying Dai, Ben Li and Michel Toulouse work2019-06-24 10:08:22
1885250192Anastasios TampakisWheel Generator2019-02-14 14:33:29
1985335264Marco MeoliMethod of constrution private tools 2015-10-31 04:41:03
2085418328Jan de Heer and Steve MuirPrivate tools2015-12-11 00:23:48
2185558431Marco Meoli2015-12-02 08:08:05
2285688528Anastasios TampakisWheel Generator2019-06-24 10:09:40
2385755670Jan de Heer and Steve Muir2008-09-26 00:00:00
2485759759JCD article1996-11-14 17:08:00
\n" ], "text/plain": [ "" ] }, "execution_count": 37, "metadata": {}, "output_type": "execute_result" } ], "source": [ "T = init_tab()\n", "for C in coverdata:\n", " v = get_v(C)\n", " k = get_k(C)\n", " t = get_t(C)\n", " if v in range(10,25):\n", " if k in range(8,9):\n", " if t in range(5,6):\n", " add_tab_entry(coverdata,T,C)\n", "show_tab(T)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The cells below show the code available to examine the dataset. `get_cover_data(v,k,t)` shows the size of the current best $(v,k,t)$ covering design, together with its source and a lower bound for the size of such a covering." ] }, { "cell_type": "code", "execution_count": 38, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2975 <= C(35,9,5) <= 4773\n", "last update 4773: 2023-04-06 10:47:19 by Dietmar Pree using Local search\n" ] } ], "source": [ "get_cover_data(coverdata,35,9,5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`show_history(v,k,t)` shows previous $(v,k,t)$ covering designs submitted." ] }, { "cell_type": "code", "execution_count": 39, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2975 <= C(35,9,5) <= 4773\n", "update history:\n" ] }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
sizecreatormethodtimestamp
4773Dietmar PreeLocal search2023-04-06 10:47:19
4774Alessandro Jurcovich2022-10-26 07:15:14
4775Alessandro Jurcovich2022-10-25 11:36:06
4791M. WangWang construction2022-10-15 23:08:06
4793Dietmar PreeLocal search2021-02-09 20:50:16
4797Marco Meoli2021-01-27 23:03:09
4812LJCRDynamic programming construction2021-01-27 17:38:08
4888Alessandro Jurcovich2021-01-02 00:41:37
4889Terenzio Lazzarotto2020-07-26 10:41:11
4936kleszekWheel Generator2020-06-18 02:26:18
4938kleszekWheel Generator2020-06-18 01:59:24
4943Jan de Heer and Steve MuirPrivate tools2020-05-22 12:12:20
4975kleszekWheel Generator2019-05-08 04:40:09
4976Jan de Heer and Steve MuirPrivate tools2013-05-22 12:43:30
4997Gerald Unger2013-05-12 22:59:58
4999Rade Belic & Dragan Stojiljkovic2009-10-16 10:54:41
5017Gerald Unger2009-09-12 09:10:11
5035Flavio Perona2009-09-05 00:52:31
5039LJCRSidorenko construction2009-04-18 21:28:33
5120Flavio.Perona2009-01-02 11:56:02
\n" ], "text/plain": [ "" ] }, "execution_count": 39, "metadata": {}, "output_type": "execute_result" } ], "source": [ "show_history(coverdata,35,9,5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`show_cover(v,k,t)` prints out the blocks of a $(v,k,t)$ covering design. Be careful about using it for large coverings." ] }, { "cell_type": "code", "execution_count": 40, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "C(7,3,2) has 7 blocks\n", "[1, 2, 3]\n", "[1, 4, 5]\n", "[1, 6, 7]\n", "[2, 4, 6]\n", "[2, 5, 7]\n", "[3, 4, 7]\n", "[3, 5, 6]\n" ] } ], "source": [ "show_cover(covers,7,3,2)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Handling covering designs\n", "\n", "The above functions are to get information about results in the database. If you want to get the actual objects to manipulate, get_cover$(v,k,t)$ returns the covering design in the database, as a list $[v,k,t,L]$, where $L$ is a list of the blocks of the covering design." ] }, { "cell_type": "code", "execution_count": 41, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "C(7,3,2) has 7 blocks\n" ] }, { "data": { "text/plain": [ "[7,\n", " 3,\n", " 2,\n", " [[1, 2, 3], [1, 4, 5], [1, 6, 7], [2, 4, 6], [2, 5, 7], [3, 4, 7], [3, 5, 6]]]" ] }, "execution_count": 41, "metadata": {}, "output_type": "execute_result" } ], "source": [ "C=get_cover(covers,7,3,2)\n", "C" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To keep this dataset as easy to access as possible, I have only included python code here. However, Sage has functions to handle covering designs, for example checking if one really does cover all t-sets." ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "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.10.12" } }, "nbformat": 4, "nbformat_minor": 4 }