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 @@ -357,7 +357,7 @@
{
"output_type": "stream",
"name": "stdout",
"text": " Temps : 3,54 ms\r\n"
"text": " Temps : 2,53 ms\r\n"
},
{
"output_type": "stream",
Expand Down Expand Up @@ -578,7 +578,7 @@
{
"output_type": "stream",
"name": "stdout",
"text": " Temps : 1,89 ms\r\n"
"text": " Temps : 1,69 ms\r\n"
},
{
"output_type": "stream",
Expand Down Expand Up @@ -719,36 +719,11 @@
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": "\r\n(3,21): warning CS8632: L'annotation pour les types référence Nullable doit être utilisée uniquement dans le code au sein d'un contexte d'annotations '#nullable'.\r\n\r\n"
"name": "stdout",
"text": "Exercice 1 defini (stub) : DfsLimited -- a completer selon les Etapes 1-6, puis decommentez le test attendu ci-dessous.\r\n"
}
],
"source": [
"// Exercice 1 : DFS avec limite de profondeur.\n",
"// TODO etudiant : implementer la fonction DfsLimited (signature proposee).\n",
"static (SearchResult? result, bool cutoff) DfsLimited(Problem problem, int maxDepth, bool verbose = false) {\n",
" // Etape 1 : initialiser start, frontier (Stack<Node>), explored (HashSet<string>).\n",
" // Etape 2 : boucle while frontier.Count > 0.\n",
" // Etape 3 : Pop, si GoalTest -> retourner (SearchResult, false).\n",
" // Etape 4 : si node.Depth >= maxDepth -> marquer cutoff = true, continue.\n",
" // Etape 5 : ajouter a explored, expanser les enfants non explores.\n",
" // Etape 6 : retourner (null, cutoff) si frontiere vide.\n",
" Console.WriteLine($\"(Exercice a completer) -- maxDepth = {maxDepth}\");\n",
" return (null, false); // TODO etudiant : remplacer par la vraie logique\n",
"}\n",
"\n",
"// Test attendu (decommentez apres implementation) :\n",
"// for (int depth = 1; depth <= 5; depth++) {\n",
"// var (res, cutoff) = DfsLimited(problemBS, depth);\n",
"// if (res != null && res.Found) {\n",
"// Console.WriteLine($\"Profondeur {depth}: TROUVE - {string.Join(\" -> \", res.Path)} (cout={res.Cost:F0})\");\n",
"// } else if (cutoff) {\n",
"// Console.WriteLine($\"Profondeur {depth}: coupure (limite atteinte)\");\n",
"// } else {\n",
"// Console.WriteLine($\"Profondeur {depth}: pas de solution\");\n",
"// }\n",
"// }\n"
]
"source": "#nullable enable\n\n// Exercice 1 : DFS avec limite de profondeur.\n// TODO etudiant : implementer la fonction DfsLimited (signature proposee).\nstatic (SearchResult? result, bool cutoff) DfsLimited(Problem problem, int maxDepth, bool verbose = false) {\n // Etape 1 : initialiser start, frontier (Stack<Node>), explored (HashSet<string>).\n // Etape 2 : boucle while frontier.Count > 0.\n // Etape 3 : Pop, si GoalTest -> retourner (SearchResult, false).\n // Etape 4 : si node.Depth >= maxDepth -> marquer cutoff = true, continue.\n // Etape 5 : ajouter a explored, expanser les enfants non explores.\n // Etape 6 : retourner (null, cutoff) si frontiere vide.\n Console.WriteLine($\"(Exercice a completer) -- maxDepth = {maxDepth}\");\n return (null, false); // TODO etudiant : remplacer par la vraie logique\n}\n\n// Test attendu (decommentez apres implementation) :\n// for (int depth = 1; depth <= 5; depth++) {\n// var (res, cutoff) = DfsLimited(problemBS, depth);\n// if (res != null && res.Found) {\n// Console.WriteLine($\"Profondeur {depth}: TROUVE - {string.Join(\" -> \", res.Path)} (cout={res.Cost:F0})\");\n// } else if (cutoff) {\n// Console.WriteLine($\"Profondeur {depth}: coupure (limite atteinte)\");\n// } else {\n// Console.WriteLine($\"Profondeur {depth}: pas de solution\");\n// }\n// }\n\nConsole.WriteLine(\"Exercice 1 defini (stub) : DfsLimited -- a completer selon les Etapes 1-6, puis decommentez le test attendu ci-dessous.\");\n"
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -900,7 +875,7 @@
{
"output_type": "stream",
"name": "stdout",
"text": " Temps : 2,87 ms\r\n"
"text": " Temps : 2,48 ms\r\n"
},
{
"output_type": "stream",
Expand Down Expand Up @@ -1153,20 +1128,16 @@
{
"output_type": "stream",
"name": "stdout",
"text": " Temps : 0,55 ms\r\n"
"text": " Temps : 0,51 ms\r\n"
},
{
"output_type": "stream",
"name": "stdout",
"text": "\nOrdre d'exploration cumule : Bordeaux -> Paris -> Strasbourg...\r\n"
},
{
"output_type": "stream",
"name": "stderr",
"text": "\r\n(2,21): warning CS8632: L'annotation pour les types référence Nullable doit être utilisée uniquement dans le code au sein d'un contexte d'annotations '#nullable'.\r\n\r\n(6,10): warning CS8632: L'annotation pour les types référence Nullable doit être utilisée uniquement dans le code au sein d'un contexte d'annotations '#nullable'.\r\n\r\n(34,17): warning CS8632: L'annotation pour les types référence Nullable doit être utilisée uniquement dans le code au sein d'un contexte d'annotations '#nullable'.\r\n\r\n"
}
],
"source": [
"#nullable enable\n\n",
"// IDDFS : iterative deepening DFS = boucle de DLS avec profondeur croissante.\n",
"static (SearchResult? result, bool cutoff) DepthLimitedSearch(Problem problem, int limit, bool verbose = false) {\n",
" var exploredOrder = new List<string>();\n",
Expand Down Expand Up @@ -1874,7 +1845,7 @@
{
"output_type": "stream",
"name": "stdout",
"text": " Temps : 0,73 ms\r\n"
"text": " Temps : 0,17 ms\r\n"
}
],
"source": [
Expand Down Expand Up @@ -2769,18 +2740,6 @@
"name": "C#",
"pygments_lexer": "csharp",
"version": "13.0"
},
"papermill": {
"default_parameters": {},
"duration": 7.33741,
"end_time": "2026-08-15T19:15:30.839249",
"environment_variables": {},
"exception": null,
"input_path": "MyIA.AI.Notebooks/Search/Part1-Foundations/Search-02-Uninformed-Csharp.ipynb",
"output_path": "MyIA.AI.Notebooks/Search/Part1-Foundations/Search-02-Uninformed-Csharp.ipynb",
"parameters": {},
"start_time": "2026-08-15T19:15:23.501839",
"version": "2.7.0"
}
},
"nbformat": 4,
Expand Down
Loading
Loading