Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@
"text": [
"\n",
"============================================================\n",
" N-Reines (syntaxe MiniZinc, ~5 lignes)\n",
" N-Reines (syntaxe MiniZinc)\n",
"============================================================\r\n"
]
},
Expand Down Expand Up @@ -514,7 +514,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Comparaison de concision : MiniZinc ~5 lignes vs CP-SAT ~12 lignes (ratio ~2.4x).\r\n"
"Comparaison de concision : MiniZinc plus concis que CP-SAT (ratio ~2.4x).\r\n"
]
}
],
Expand All @@ -531,8 +531,8 @@
"constraint alldifferent([q[i] + i | i in 1..n]); % pas meme diagonale montante\n",
"constraint alldifferent([q[i] - i | i in 1..n]); % pas meme diagonale descendante\n",
"solve satisfy;\";\n",
"DisplayModel(mznNQueens, \"N-Reines (syntaxe MiniZinc, ~5 lignes)\");\n",
"Console.WriteLine(\"Comparaison de concision : MiniZinc ~5 lignes vs CP-SAT ~12 lignes (ratio ~2.4x).\");\n"
"DisplayModel(mznNQueens, \"N-Reines (syntaxe MiniZinc)\");\n",
"Console.WriteLine(\"Comparaison de concision : MiniZinc plus concis que CP-SAT (ratio ~2.4x).\");\n"
]
},
{
Expand Down Expand Up @@ -1138,13 +1138,6 @@
"--------------------------------------------------------------------------------------\r\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Lignes de code (N-Reines) ~20 lignes ~12 lignes ~5 lignes \r\n"
]
},
{
"name": "stdout",
"output_type": "stream",
Expand Down Expand Up @@ -1200,7 +1193,6 @@
"// Repris du twin Python, avec la colonne MiniZinc (high-level, multi-solveur).\n",
"var rows = new[]\n",
"{\n",
" new { Crit = \"Lignes de code (N-Reines)\", Py = \"~20 lignes\", Cp = \"~12 lignes\", Mz = \"~5 lignes\" },\n",
" new { Crit = \"Lisibilite mathematique\", Py = \"Faible\", Cp = \"Moyenne\", Mz = \"Haute\" },\n",
" new { Crit = \"Flexibilite du solveur\", Py = \"Aucune (ad-hoc)\", Cp = \"CP-SAT uniquement\", Mz = \"Multi-solveur\" },\n",
" new { Crit = \"Integration Python/.NET\", Py = \"Totale\", Cp = \"Excellente (API native)\", Mz = \"Via package/CLI\" },\n",
Expand Down
65 changes: 20 additions & 45 deletions MyIA.AI.Notebooks/Search/Applications/CSP/App-8-MiniZinc.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -780,18 +780,14 @@
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": "Comparaison de concision : N-Reines\n==================================================\nCP-SAT (Python) : ~12 lignes utiles\nMiniZinc : concis\nRatio : MiniZinc est ~2.4x plus concis\n"
},
{
"output_type": "stream",
"text": [
"Comparaison de concision : N-Reines\n",
"==================================================\n",
"CP-SAT (Python) : ~12 lignes utiles\n",
"MiniZinc : ~5 lignes utiles\n",
"Ratio : MiniZinc est ~2.4x plus concis\n",
"\n",
"CP-SAT solution : [4, 7, 3, 0, 6, 1, 5, 2]\n",
"CP-SAT temps : 19.31 ms\n"
]
"name": "stdout",
"text": "\nCP-SAT solution : [4, 7, 3, 0, 6, 1, 5, 2]\nCP-SAT temps : 280.01 ms\n"
}
],
"source": [
Expand Down Expand Up @@ -855,7 +851,7 @@
"print(\"Comparaison de concision : N-Reines\")\n",
"print(\"=\" * 50)\n",
"print(f\"CP-SAT (Python) : ~12 lignes utiles\")\n",
"print(f\"MiniZinc : ~5 lignes utiles\")\n",
"print(f\"MiniZinc : concis\")\n",
"print(f\"Ratio : MiniZinc est ~2.4x plus concis\")\n",
"\n",
"# Execution CP-SAT\n",
Expand Down Expand Up @@ -1476,23 +1472,19 @@
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": "Comparaison du nombre de lignes"
},
{
"output_type": "stream",
"text": [
"Comparaison du nombre de lignes\n",
"==================================================\n",
"MiniZinc : ~25 lignes (modele complet avec output)\n",
"CP-SAT : ~45 lignes (sans compter imports/affichage)\n",
"Ratio : MiniZinc ~1.8x plus concis\n",
"\n",
"Solution CP-SAT :\n",
" Cours 1 -> creneau 1, salle 1 (prof=1, 30 eleves)\n",
" Cours 2 -> creneau 4, salle 3 (prof=1, 25 eleves)\n",
" Cours 3 -> creneau 3, salle 2 (prof=2, 40 eleves)\n",
" Cours 4 -> creneau 4, salle 2 (prof=2, 20 eleves)\n",
" Cours 5 -> creneau 2, salle 1 (prof=3, 35 eleves)\n",
" Cours 6 -> creneau 4, salle 1 (prof=3, 15 eleves)\n"
]
"name": "stdout",
"text": "\n==================================================\nMiniZinc : modele complet avec output\nCP-SAT : sans compter imports/affichage\nRatio : MiniZinc ~1.8x plus concis\n\nSolution CP-SAT :\n"
},
{
"output_type": "stream",
"name": "stdout",
"text": " Cours 1 -> creneau 1, salle 1 (prof=1, 30 eleves)\n Cours 2 -> creneau 4, salle 3 (prof=1, 25 eleves)\n Cours 3 -> creneau 3, salle 2 (prof=2, 40 eleves)\n Cours 4 -> creneau 4, salle 2 (prof=2, 20 eleves)\n Cours 5 -> creneau 2, salle 1 (prof=3, 35 eleves)\n Cours 6 -> creneau 4, salle 1 (prof=3, 15 eleves)\n"
}
],
"source": [
Expand Down Expand Up @@ -1556,8 +1548,8 @@
"\n",
"print(\"Comparaison du nombre de lignes\")\n",
"print(\"=\" * 50)\n",
"print(f\"MiniZinc : ~25 lignes (modele complet avec output)\")\n",
"print(f\"CP-SAT : ~45 lignes (sans compter imports/affichage)\")\n",
"print(f\"MiniZinc : modele complet avec output\")\n",
"print(f\"CP-SAT : sans compter imports/affichage\")\n",
"print(f\"Ratio : MiniZinc ~1.8x plus concis\")\n",
"print()\n",
"\n",
Expand Down Expand Up @@ -2107,7 +2099,6 @@
"=====================================================================================\n",
"Critere Python pur CP-SAT MiniZinc \n",
"-------------------------------------------------------------------------------------\n",
"Lignes de code (N-Reines) ~20 lignes ~12 lignes ~5 lignes \n",
"Lisibilite mathematique Faible Moyenne Haute \n",
"Flexibilite du solveur Aucune (ad-hoc) CP-SAT uniquement Multi-solveur \n",
"Integration Python Totale Excellente (API native) Via package python\n",
Expand All @@ -2124,7 +2115,6 @@
"# Tableau comparatif detaille\n",
"comparison_data = {\n",
" 'Critere': [\n",
" 'Lignes de code (N-Reines)',\n",
" 'Lisibilite mathematique',\n",
" 'Flexibilite du solveur',\n",
" 'Integration Python',\n",
Expand All @@ -2135,7 +2125,6 @@
" 'Cas d\\'usage ideal'\n",
" ],\n",
" 'Python pur': [\n",
" '~20 lignes',\n",
" 'Faible',\n",
" 'Aucune (ad-hoc)',\n",
" 'Totale',\n",
Expand All @@ -2146,7 +2135,6 @@
" 'Prototypage, pedagogie'\n",
" ],\n",
" 'CP-SAT': [\n",
" '~12 lignes',\n",
" 'Moyenne',\n",
" 'CP-SAT uniquement',\n",
" 'Excellente (API native)',\n",
Expand All @@ -2157,7 +2145,6 @@
" 'Production, performance'\n",
" ],\n",
" 'MiniZinc': [\n",
" '~5 lignes',\n",
" 'Haute',\n",
" 'Multi-solveur',\n",
" 'Via package python',\n",
Expand Down Expand Up @@ -2746,18 +2733,6 @@
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.3"
},
"papermill": {
"default_parameters": {},
"duration": 4.300975,
"end_time": "2026-04-25T15:21:13.096151",
"environment_variables": {},
"exception": null,
"input_path": "App-8-MiniZinc.ipynb",
"output_path": "App-8-MiniZinc.ipynb",
"parameters": {},
"start_time": "2026-04-25T15:21:08.795176",
"version": "2.6.0"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
date: '2026-09-30'
by: myia-po-2025:CoursIA
python_sha: c12a5c2cb801cb5b8a380ba0f084b92fb68f596c
csharp_sha: 8b7e97ba3c9e4767e3d8893c8f756cb07686de7e
content_python_sha: a9cdd64f96a9843b8e00e00812eecf378c6d7b060845a99338d9e62f4f8e23ac
content_csharp_sha: f687ab503b6bb8ba5e7a40209c53fb9453ec12d85c89d501fe868ad7633f9574
Loading