{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Analyse isomorphisms of a set of orthogonal arrays with N=56" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In this example, we show how to identify isomorphic arrays from a list of two-level strength-2 orthogonal arrays with 56 runs and 28 factors." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "\n", "import oapackage\n", "import oapackage.graphtools\n", "from oapackage.graphtools import selectIsomorphismClasses" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Read the arrays from a file and determine their class." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "arrayclass: N 56, k 28, strength 2, s {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}, order 0\n", "loaded 9 arrays\n" ] } ], "source": [ "sols = oapackage.readarrayfile(\"OAN56K28.oa\")\n", "arrayclass = oapackage.arraylink2arraydata(sols[0])\n", "print(arrayclass)\n", "print(\"loaded %d arrays\" % len(sols))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Determine the unique isomorphism classes using Nauty." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "from 9 arrays selected 6 unique isomorphism classes\n", "indices: [0 4 5 3 1 5 3 2 4]\n" ] } ], "source": [ "b, mm = selectIsomorphismClasses(sols, verbose=0)\n", "\n", "print(\"from %d arrays selected %d unique isomorphism classes\" % (len(mm), np.unique(b).size))\n", "print(f\"indices: {str(b)}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Verify that the first two arrays are indeed non-isomorphic:" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[ 0 18018 2457]\n", "[ 0 18032 2436]\n" ] } ], "source": [ "jj = np.abs(sols[0].Jcharacteristics(4))\n", "n0, _ = np.histogram(jj, [0, 8, 16, 24])\n", "print(n0)\n", "jj = np.abs(sols[1].Jcharacteristics(4))\n", "n1, _ = np.histogram(jj, [0, 8, 16, 24])\n", "print(n1)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Since the first two arrays have different $J$-characteristics (see the section [Statistical properties of orthogonal arrays](https://oapackage.readthedocs.io/en/latest/properties.html#statistical-properties-of-orthogonal-arrays) for details), they are non-isomorphic. For the isomorphic arrays, it is possible to obtain the array transformation to make the arrays identical using the function `reduceConferenceTransformation`." ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.7.1" } }, "nbformat": 4, "nbformat_minor": 1 }