Created using Colab

This commit is contained in:
udlbook
2025-04-20 10:42:09 -04:00
parent f65f0b1ddf
commit 44bbfbed91

View File

@@ -4,7 +4,7 @@
"metadata": { "metadata": {
"colab": { "colab": {
"provenance": [], "provenance": [],
"authorship_tag": "ABX9TyPDBtiVN1Oic8RyyLIJuzAu", "authorship_tag": "ABX9TyNm1191WQYfb72RCYRciluw",
"include_colab_link": true "include_colab_link": true
}, },
"kernelspec": { "kernelspec": {
@@ -178,7 +178,7 @@
" sat_result = s.check()\n", " sat_result = s.check()\n",
" print(sat_result)\n", " print(sat_result)\n",
"\n", "\n",
" # If it isn't then return\n", " # If it is then print out solution, otherwise return\n",
" if sat_result == z3.sat:\n", " if sat_result == z3.sat:\n",
" result = s.model()\n", " result = s.model()\n",
" x_vals = np.array([[[int(bool(result[z3.Bool(\"x_{%d,%d,%d}\" % (i, j, k))])) for k in range(9)] for j in range(9)] for i in range(9)] )\n", " x_vals = np.array([[[int(bool(result[z3.Bool(\"x_{%d,%d,%d}\" % (i, j, k))])) for k in range(9)] for j in range(9)] for i in range(9)] )\n",