diff --git a/MyIA.AI.Notebooks/SymbolicAI/Tweety/Tweety-07b-Ranking-Probabilistic-CSharp.ipynb b/MyIA.AI.Notebooks/SymbolicAI/Tweety/Tweety-07b-Ranking-Probabilistic-CSharp.ipynb
index 4084dcbec1..6ceb2fb65e 100644
--- a/MyIA.AI.Notebooks/SymbolicAI/Tweety/Tweety-07b-Ranking-Probabilistic-CSharp.ipynb
+++ b/MyIA.AI.Notebooks/SymbolicAI/Tweety/Tweety-07b-Ranking-Probabilistic-CSharp.ipynb
@@ -3,7 +3,16 @@
{
"cell_type": "markdown",
"id": "9597775b",
- "metadata": {},
+ "metadata": {
+ "papermill": {
+ "duration": 0.003267,
+ "end_time": "2026-09-27T22:57:35.012415+00:00",
+ "exception": false,
+ "start_time": "2026-09-27T22:57:35.009148+00:00",
+ "status": "completed"
+ },
+ "tags": []
+ },
"source": [
"# Tweety-7b - Ranking Probabilistic Conditional Logic en C#/.NET (port natif IKVM)\n",
"\n",
@@ -50,7 +59,16 @@
{
"cell_type": "markdown",
"id": "8efedcce",
- "metadata": {},
+ "metadata": {
+ "papermill": {
+ "duration": 0.002107,
+ "end_time": "2026-09-27T22:57:35.021234+00:00",
+ "exception": false,
+ "start_time": "2026-09-27T22:57:35.019127+00:00",
+ "status": "completed"
+ },
+ "tags": []
+ },
"source": [
"## 1 - Runtime IKVM : charger le module `logics-rpcl`\n",
"\n",
@@ -66,26 +84,141 @@
"id": "5d429938",
"metadata": {
"execution": {
- "iopub.execute_input": "2026-07-03T14:21:58.573286Z",
- "iopub.status.busy": "2026-07-03T14:21:58.565254Z",
- "iopub.status.idle": "2026-07-03T14:22:00.502758Z",
- "shell.execute_reply": "2026-07-03T14:22:00.495998Z"
- }
+ "iopub.execute_input": "2026-09-27T22:57:35.035682Z",
+ "iopub.status.busy": "2026-09-27T22:57:35.028811Z",
+ "iopub.status.idle": "2026-09-27T22:57:41.043685Z",
+ "shell.execute_reply": "2026-09-27T22:57:41.038990Z"
+ },
+ "papermill": {
+ "duration": 6.020618,
+ "end_time": "2026-09-27T22:57:41.044188+00:00",
+ "exception": false,
+ "start_time": "2026-09-27T22:57:35.023570+00:00",
+ "status": "completed"
+ },
+ "tags": []
},
"outputs": [
{
- "output_type": "display_data",
"data": {
- "text/html": "
Installing Packages- IKVM
- IKVM.Image
- IKVM.Image.runtime.win-x64
"
+ "text/html": [
+ "\r\n",
+ "\r\n",
+ "
\r\n",
+ " The below script needs to be able to find the current output cell; this is an easy method to get it.\r\n",
+ "
\r\n",
+ " \r\n",
+ "
"
+ ]
},
- "metadata": {}
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/html": [
+ "Installed Packages- IKVM, 8.14.0
- IKVM.Image, 8.14.0
"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
}
],
"source": [
"#r \"nuget: IKVM, 8.14.0\"\n",
"#r \"nuget: IKVM.Image, 8.14.0\"\n",
- "#r \"nuget: IKVM.Image.runtime.win-x64, 8.14.0\"\n",
- ""
+ "#r \"nuget: IKVM.Image.runtime.win-x64, 8.14.0\"\n"
]
},
{
@@ -94,17 +227,27 @@
"id": "d274fe58",
"metadata": {
"execution": {
- "iopub.execute_input": "2026-07-03T14:22:00.505913Z",
- "iopub.status.busy": "2026-07-03T14:22:00.505675Z",
- "iopub.status.idle": "2026-07-03T14:22:01.915499Z",
- "shell.execute_reply": "2026-07-03T14:22:01.915301Z"
- }
+ "iopub.execute_input": "2026-09-27T22:57:41.054917Z",
+ "iopub.status.busy": "2026-09-27T22:57:41.054458Z",
+ "iopub.status.idle": "2026-09-27T22:57:42.155119Z",
+ "shell.execute_reply": "2026-09-27T22:57:42.154963Z"
+ },
+ "papermill": {
+ "duration": 1.106804,
+ "end_time": "2026-09-27T22:57:42.155195+00:00",
+ "exception": false,
+ "start_time": "2026-09-27T22:57:41.048391+00:00",
+ "status": "completed"
+ },
+ "tags": []
},
"outputs": [
{
- "output_type": "stream",
"name": "stdout",
- "text": "IKVM home=OK\r\n"
+ "output_type": "stream",
+ "text": [
+ "IKVM home=OK\r\n"
+ ]
}
],
"source": [
@@ -133,8 +276,7 @@
" IkvmCopyMerge(ikvmArchDir, ikvmHome);\n",
"}\n",
"AppContext.SetData(\"IKVM.Home\", ikvmHome);\n",
- "Console.WriteLine(\"IKVM home=\" + (File.Exists(Path.Combine(ikvmHome, \"lib\", \"tzdb.dat\")) ? \"OK\" : \"MISSING\"));\n",
- ""
+ "Console.WriteLine(\"IKVM home=\" + (File.Exists(Path.Combine(ikvmHome, \"lib\", \"tzdb.dat\")) ? \"OK\" : \"MISSING\"));\n"
]
},
{
@@ -143,11 +285,19 @@
"id": "b06f5525",
"metadata": {
"execution": {
- "iopub.execute_input": "2026-07-03T14:22:01.917202Z",
- "iopub.status.busy": "2026-07-03T14:22:01.916867Z",
- "iopub.status.idle": "2026-07-03T14:22:01.955629Z",
- "shell.execute_reply": "2026-07-03T14:22:01.955403Z"
- }
+ "iopub.execute_input": "2026-09-27T22:57:42.165033Z",
+ "iopub.status.busy": "2026-09-27T22:57:42.164819Z",
+ "iopub.status.idle": "2026-09-27T22:57:42.747106Z",
+ "shell.execute_reply": "2026-09-27T22:57:42.746849Z"
+ },
+ "papermill": {
+ "duration": 0.587773,
+ "end_time": "2026-09-27T22:57:42.747238+00:00",
+ "exception": false,
+ "start_time": "2026-09-27T22:57:42.159465+00:00",
+ "status": "completed"
+ },
+ "tags": []
},
"outputs": [],
"source": [
@@ -160,17 +310,27 @@
"id": "1ed4203b",
"metadata": {
"execution": {
- "iopub.execute_input": "2026-07-03T14:22:01.957191Z",
- "iopub.status.busy": "2026-07-03T14:22:01.956973Z",
- "iopub.status.idle": "2026-07-03T14:22:02.114920Z",
- "shell.execute_reply": "2026-07-03T14:22:02.114401Z"
- }
+ "iopub.execute_input": "2026-09-27T22:57:42.754197Z",
+ "iopub.status.busy": "2026-09-27T22:57:42.754002Z",
+ "iopub.status.idle": "2026-09-27T22:57:42.877356Z",
+ "shell.execute_reply": "2026-09-27T22:57:42.877111Z"
+ },
+ "papermill": {
+ "duration": 0.127048,
+ "end_time": "2026-09-27T22:57:42.877484+00:00",
+ "exception": false,
+ "start_time": "2026-09-27T22:57:42.750436+00:00",
+ "status": "completed"
+ },
+ "tags": []
},
"outputs": [
{
- "output_type": "stream",
"name": "stdout",
- "text": "Tweety RPCL (IKVM) reference chargee : org.tweetyproject.tweety-rpcl v1.30.0.0 (13,0 Mo).\r\n"
+ "output_type": "stream",
+ "text": [
+ "Tweety RPCL (IKVM) reference chargee : org.tweetyproject.tweety-rpcl v1.30.0.0 (13,0 Mo).\r\n"
+ ]
}
],
"source": [
@@ -184,23 +344,39 @@
{
"cell_type": "markdown",
"id": "abcc94b8",
- "metadata": {},
+ "metadata": {
+ "papermill": {
+ "duration": 0.003833,
+ "end_time": "2026-09-27T22:57:42.885571+00:00",
+ "exception": false,
+ "start_time": "2026-09-27T22:57:42.881738+00:00",
+ "status": "completed"
+ },
+ "tags": []
+ },
"source": [
- "## Diagnostic IKVM - Verdict exact\n",
- "\n",
- "`#r \"org.tweetyproject.tweety-rpcl.dll\"` charge bien la DLL (13.0 Mo, v1.30.0.0, cf. cell[5]).\n",
+ "## Diagnostic IKVM - Verdict exact (rectifie le 2026-09-28, mesure sur le blob tracke c7f71e08)\n",
"\n",
- "Le JAR shade contient bien toutes les classes (`RelationalProbabilisticConditional`, `RpclBeliefSet`, `RpclMeReasoner`, etc.) ; cf. `unzip -l tweety-rpcl-full-1.30.jar | grep rpcl`. **Mais** `Assembly.GetTypes()` retourne **0 types exposes** sous `org.tweetyproject.logics.*`.\n",
+ "`#r \"org.tweetyproject.tweety-rpcl.dll\"` charge bien la DLL (v1.30.0.0) - et depuis le correctif C190 (commit `6300d915`, 2026-07-04 : IKVM 8.14 + shade downgrades en bytecode Java 8, meme fix que `Tweety-3-ModalLogic-Csharp` section 1.4), **l'ancien diagnostic « `GetTypes()` retourne 0 type / bug IKVM 8.15 » est perime** : re-mesure le 2026-09-28 sous le runtime epingle par ce notebook (IKVM 8.14.0), la DLL expose **7 697 types, dont 31 `org.tweetyproject.logics.rpcl.*`**, avec les 6 types cles presents (`RelationalProbabilisticConditional`, `RpclBeliefSet`, `RpclMeReasoner`, `RpclProbabilityDistribution`, `ReferenceWorld`, `AggregatingSemantics`). La section 2 execute ci-dessous une construction RP-CL reelle sur cette DLL.\n",
"\n",
- "**Verdict exact** : `RECOVERABLE-LOCAL` partiel - même bug IKVM 8.15 que pour Tw-3-ML (PR #5207) : la compilation IKVM n'expose pas les types des JAR shades avec deps transitives. Sibling `tweety-pl.dll` (Tweety-2c-FOL, sans deps lourdes transitive) expose 33 types et marche.\n",
+ "**Verrou restant, mesure** : la **requete ME** (`RpclMeReasoner.query()`) construit un probleme d'optimisation **sous contraintes** qu'aucun solveur general embarque ne couvre (NLCG : problemes sans contraintes ; CMAES : contraintes de bord seulement ; Gurobi : licence + bibliotheque native absente). Sans solveur par defaut configure, l'appel termine meme le process (« No default solver for general optimization problems configured ») ; la section 4 le demontre en configurant un solveur puis en interceptant son refus reel.\n",
"\n",
- "Pour permettre l'exécution end-to-end et respecter C.2 (notebooks committes AVEC outputs), les trois cellules de code des sections 2, 3 et 4 voient leur code ORIGINAL preserve en commentaire + un diagnostic explicite est imprime en stdout. Les exercices restent des stubs et ne dependent pas des types Tweety."
+ "**Portee du verdict** : la partie syntaxe/construction est verifiee par execution (section 2) ; la boucle ME reste bloquee - **verrou mesure, chemin de sortie non verifie** : pistes non testees ici (un solveur sous contraintes tel que Gurobi, si sa licence et sa bibliotheque native sont disponibles ; ou une recompilation du shade - recette `dotnet-build/build-TweetyRpclShade.csproj`). Aucune de ces pistes n'a ete demontree. En attendant, l'ancien code des sections 3-4 reste conserve en commentaire sous les cellules reecrites ; sa reactivation exigera une reecriture partielle (l'API citee y est inexacte : `FolPredicate` n'existe pas en 1.30 - le vrai type est `commons.syntax.Predicate` ; les variables doivent commencer par une majuscule ; `Probability` exige un `java.lang.Double`). Les exercices utilisent la vraie API RP-CL, dont les types sont bien exposes ; seule leur boucle ME complete depend de la levee du verrou solveur."
]
},
{
"cell_type": "markdown",
"id": "f3177ea0",
- "metadata": {},
+ "metadata": {
+ "papermill": {
+ "duration": 0.004137,
+ "end_time": "2026-09-27T22:57:42.893996+00:00",
+ "exception": false,
+ "start_time": "2026-09-27T22:57:42.889859+00:00",
+ "status": "completed"
+ },
+ "tags": []
+ },
"source": [
"## 2 - Syntaxe RP-CL : conditionnels probabilistes relationnels\n",
"\n",
@@ -217,8 +393,8 @@
"- `RelationalProbabilisticConditional(premise, conclusion)` : probabilite par defaut = 1.0 ;\n",
"- `RelationalProbabilisticConditional(relationalConditional, probability)` : a partir d'un conditionnel déjà construit.\n",
"\n",
- "Le **complement** d'un conditionnel `(B|A)[p]` est `(A|!B)[1-p]` : *si la conclusion est fausse, la probabilite\n",
- "que la premisse soit vraie est `1-p`*. C'est la **reciproque probabiliste**.\n",
+ "Le **complement** Tweety d'un conditionnel `(B|A)[p]` est le *meme* conditionnel avec la probabilite `1-p`\n",
+ "(mesure en section 2 : `(flu(a)|fever(a))[0.3]` pour `p = 0.7`).\n",
"\n",
"**Cas pedagogique canonique** : le diagnostic medical.\n",
"- `fever => flu` avec probabilite 0.7 : *si le patient a de la fievre, il a la grippe avec 70% de chance*.\n",
@@ -231,34 +407,99 @@
"id": "dcf476ed",
"metadata": {
"execution": {
- "iopub.execute_input": "2026-07-03T14:22:02.116657Z",
- "iopub.status.busy": "2026-07-03T14:22:02.116395Z",
- "iopub.status.idle": "2026-07-03T14:22:02.177405Z",
- "shell.execute_reply": "2026-07-03T14:22:02.177171Z"
- }
+ "iopub.execute_input": "2026-09-27T22:57:42.902373Z",
+ "iopub.status.busy": "2026-09-27T22:57:42.902191Z",
+ "iopub.status.idle": "2026-09-27T22:57:43.451050Z",
+ "shell.execute_reply": "2026-09-27T22:57:43.450922Z"
+ },
+ "papermill": {
+ "duration": 0.552581,
+ "end_time": "2026-09-27T22:57:43.451122+00:00",
+ "exception": false,
+ "start_time": "2026-09-27T22:57:42.898541+00:00",
+ "status": "completed"
+ },
+ "tags": []
},
"outputs": [
{
+ "name": "stdout",
"output_type": "stream",
+ "text": [
+ "Base RP-CL construite : 3 conditionnels probabilistes.\r\n"
+ ]
+ },
+ {
"name": "stdout",
- "text": "[DIAGNOSTIC IKVM] Cell[8] : types non exposes, code preserve en commentaire.\r\n"
+ "output_type": "stream",
+ "text": [
+ "Conditionnel canonique : (flu(a)|fever(a))[0.7]\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Probabilite : 0.7\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Complement (meme conditionnel, p -> 1-p) : (flu(a)|fever(a))[0.30000000000000004]\r\n"
+ ]
}
],
"source": [
- "// --- Cell[8] : contenu preserve ci-dessous en commentaire (DIAGNOSTIC IKVM) ---\n",
+ "// Construction REELLE d'une base RP-CL sur la DLL chargee (API Tweety 1.30, verifiee) :\n",
+ "// Predicate(nom, arite) et Constant(nom). L'API citee par l'ancien bloc conserve ci-dessous\n",
+ "// etait inexacte : FolPredicate inexistant, variable minuscule rejetee, Probability(double) introuvable.\n",
+ "using Pred = org.tweetyproject.logics.commons.syntax.Predicate;\n",
+ "using FolAtom = org.tweetyproject.logics.fol.syntax.FolAtom;\n",
+ "using RpcCond = org.tweetyproject.logics.rpcl.syntax.RelationalProbabilisticConditional;\n",
+ "\n",
+ "var fever = new Pred(\"fever\", 1);\n",
+ "var flu = new Pred(\"flu\", 1);\n",
+ "var cold = new Pred(\"cold\", 1);\n",
+ "var a = new org.tweetyproject.logics.commons.syntax.Constant(\"a\");\n",
+ "var A_fever = new FolAtom(fever, a);\n",
+ "var A_flu = new FolAtom(flu, a);\n",
+ "var A_cold = new FolAtom(cold, a);\n",
+ "\n",
+ "// Base medicale a un patient (constante \"a\") : R1 fever=>flu [0.7], R2 fever=>cold [0.5], R3 flu=>!cold [0.8].\n",
+ "var bs = new org.tweetyproject.logics.rpcl.syntax.RpclBeliefSet();\n",
+ "bs.add(new RpcCond(A_fever, A_flu, new org.tweetyproject.math.probability.Probability(java.lang.Double.valueOf(0.7))));\n",
+ "bs.add(new RpcCond(A_fever, A_cold, new org.tweetyproject.math.probability.Probability(java.lang.Double.valueOf(0.5))));\n",
+ "bs.add(new RpcCond(A_flu, new org.tweetyproject.logics.fol.syntax.Negation(A_cold), new org.tweetyproject.math.probability.Probability(java.lang.Double.valueOf(0.8))));\n",
+ "Console.WriteLine($\"Base RP-CL construite : {bs.size()} conditionnels probabilistes.\");\n",
+ "\n",
+ "var r1 = new RpcCond(A_fever, A_flu, new org.tweetyproject.math.probability.Probability(java.lang.Double.valueOf(0.7)));\n",
+ "Console.WriteLine($\"Conditionnel canonique : {r1}\");\n",
+ "Console.WriteLine($\"Probabilite : {r1.getProbability()}\");\n",
+ "Console.WriteLine($\"Complement (meme conditionnel, p -> 1-p) : {r1.complement()}\");\n",
+ "\n",
+ "// --- Ancien code original, conserve pour reference historique (API inexacte, non reactivable tel quel) ---\n",
"// La DLL tweety-rpcl.dll expose 0 types `org.tweetyproject.logics.*`\n",
"// alors que le JAR shade contient toutes les classes. Bug IKVM 8.15 sur JAR shades\n",
"// avec deps transitives. Sibling PL (Tweety-2c-FOL) OK.\n",
- "// Code ORIGINAL preserve en commentaire pour re-execution quand le bug sera resolu.\n",
"//\n",
- "// // Construire un conditionnel probabiliste canonique : fever => flu [0.7].// // Syntaxe : (forall x. P(x) => Q(x)) [p] = RelationalProbabilisticConditional(premise, conclusion, Probability).// using org.tweetyproject.logics.fol.syntax;// using org.tweetyproject.logics.rpcl.syntax;// using org.tweetyproject.math.probability;//// // Predicats : fever(x), flu(x).// var fever = new FolPredicate(\"fever\");// var flu = new FolPredicate(\"flu\");// var x = new org.tweetyproject.logics.commons.syntax.Variable(\"x\");// // Premisse : fever(x). Conclusion : flu(x).// var premise = new FolAtom(fever, x);// var conclusion = new FolAtom(flu, x);// // Probabilite : 0.7.// var prob = new Probability(0.7);// // Conditionnel probabiliste.// var cond = new RelationalProbabilisticConditional(premise, conclusion, prob);// Console.WriteLine($\"Conditionnel RP-CL : {cond}\");// Console.WriteLine($\"Probabilite : {cond.getProbability()}\");// Console.WriteLine($\"Complement : {cond.complement()}\");//\n",
- "Console.WriteLine(\"[DIAGNOSTIC IKVM] Cell[8] : types non exposes, code preserve en commentaire.\");\n"
+ "// // Construire un conditionnel probabiliste canonique : fever => flu [0.7].// // Syntaxe : (forall x. P(x) => Q(x)) [p] = RelationalProbabilisticConditional(premise, conclusion, Probability).// using org.tweetyproject.logics.fol.syntax;// using org.tweetyproject.logics.rpcl.syntax;// using org.tweetyproject.math.probability;//// // Predicats : fever(x), flu(x).// var fever = new FolPredicate(\"fever\");// var flu = new FolPredicate(\"flu\");// var x = new org.tweetyproject.logics.commons.syntax.Variable(\"x\");// // Premisse : fever(x). Conclusion : flu(x).// var premise = new FolAtom(fever, x);// var conclusion = new FolAtom(flu, x);// // Probabilite : 0.7.// var prob = new Probability(0.7);// // Conditionnel probabiliste.// var cond = new RelationalProbabilisticConditional(premise, conclusion, prob);// Console.WriteLine($\"Conditionnel RP-CL : {cond}\");// Console.WriteLine($\"Probabilite : {cond.getProbability()}\");// Console.WriteLine($\"Complement : {cond.complement()}\");//"
]
},
{
"cell_type": "markdown",
"id": "d381e518",
- "metadata": {},
+ "metadata": {
+ "papermill": {
+ "duration": 0.003182,
+ "end_time": "2026-09-27T22:57:43.457598+00:00",
+ "exception": false,
+ "start_time": "2026-09-27T22:57:43.454416+00:00",
+ "status": "completed"
+ },
+ "tags": []
+ },
"source": [
"## 3 - RpclBeliefSet et raisonnement par Maximum Entropie\n",
"\n",
@@ -287,34 +528,120 @@
"id": "3ab3804d",
"metadata": {
"execution": {
- "iopub.execute_input": "2026-07-03T14:22:02.178754Z",
- "iopub.status.busy": "2026-07-03T14:22:02.178540Z",
- "iopub.status.idle": "2026-07-03T14:22:02.216827Z",
- "shell.execute_reply": "2026-07-03T14:22:02.216679Z"
- }
+ "iopub.execute_input": "2026-09-27T22:57:43.464757Z",
+ "iopub.status.busy": "2026-09-27T22:57:43.464550Z",
+ "iopub.status.idle": "2026-09-27T22:57:43.785146Z",
+ "shell.execute_reply": "2026-09-27T22:57:43.784993Z"
+ },
+ "papermill": {
+ "duration": 0.324784,
+ "end_time": "2026-09-27T22:57:43.785223+00:00",
+ "exception": false,
+ "start_time": "2026-09-27T22:57:43.460439+00:00",
+ "status": "completed"
+ },
+ "tags": []
},
"outputs": [
{
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Types org.tweetyproject.logics.rpcl.* charges : 31\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " RelationalProbabilisticConditional PRESENT\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " RpclBeliefSet PRESENT\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
"output_type": "stream",
+ "text": [
+ " RpclMeReasoner PRESENT\r\n"
+ ]
+ },
+ {
"name": "stdout",
- "text": "[DIAGNOSTIC IKVM] Cell[10] : types non exposes, code preserve en commentaire.\r\n"
+ "output_type": "stream",
+ "text": [
+ " RpclProbabilityDistribution PRESENT\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " ReferenceWorld PRESENT\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " AggregatingSemantics PRESENT\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Solveurs embarques (org.tweetyproject.math.opt.solver.*) : AntColonyOptimization, ApacheCommonsCMAESOptimizer, ApacheCommonsNonLinearConjugateGradientOptimizer, ApacheCommonsSimplex, BfgsSolver, CombinatoricsSolver, GlpkSolver, GradientDescent, GurobiOptimizer, HessianGradientDescent, IteratedLocalSearch, IteratedLocalSearchOnConstrProb, LagrangeSolver, LpSolve, OctaveSqpSolver, SimpleGeneticOptimizationSolver, SimpleGeneticOptimizationSolverCombinatorics, SimulatedAnnealing, SimulatedAnnealingOnConstrProb, Solver, StochasticLocalSearch, StochasticLocalSearchOnConstrProb, TabuSearch, TabuSearchOnConstrProb\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Solveur general par defaut configure : NON - sans lui, RpclMeReasoner.query()/getModel() termine le process\r\n"
+ ]
}
],
"source": [
- "// --- Cell[10] : contenu preserve ci-dessous en commentaire (DIAGNOSTIC IKVM) ---\n",
+ "// Diagnostic exact, EXECUTE : les types ME sont bien charges - c'est le solveur d'optimisation\n",
+ "// sous contraintes qui manque dans le shade, pas l'exposition des types (verdict section 1).\n",
+ "using System.Linq;\n",
+ "var rpclAsm = AppDomain.CurrentDomain.GetAssemblies().First(x => x.GetName().Name == \"org.tweetyproject.tweety-rpcl\");\n",
+ "var tweetyTypes = rpclAsm.GetTypes();\n",
+ "Console.WriteLine($\"Types org.tweetyproject.logics.rpcl.* charges : {tweetyTypes.Count(t => t.FullName!.StartsWith(\"org.tweetyproject.logics.rpcl.\"))}\");\n",
+ "foreach (var k in new[] { \"RelationalProbabilisticConditional\", \"RpclBeliefSet\", \"RpclMeReasoner\", \"RpclProbabilityDistribution\", \"ReferenceWorld\", \"AggregatingSemantics\" })\n",
+ " Console.WriteLine($\" {k,-40} {(tweetyTypes.Any(t => t.Name == k) ? \"PRESENT\" : \"ABSENT\")}\");\n",
+ "\n",
+ "var solvers = tweetyTypes.Where(t => t.FullName!.StartsWith(\"org.tweetyproject.math.opt.solver.\") && !t.FullName.Contains(\"+\")).Select(t => t.Name).OrderBy(n => n).ToList();\n",
+ "Console.WriteLine($\"Solveurs embarques (org.tweetyproject.math.opt.solver.*) : {string.Join(\", \", solvers)}\");\n",
+ "Console.WriteLine(\"Solveur general par defaut configure : \" + (org.tweetyproject.math.opt.solver.Solver.hasDefaultGeneralSolver() ? \"OUI\" : \"NON - sans lui, RpclMeReasoner.query()/getModel() termine le process\"));\n",
+ "\n",
+ "// --- Ancien code original, conserve pour reference historique (API inexacte, non reactivable tel quel) ---\n",
"// La DLL tweety-rpcl.dll expose 0 types `org.tweetyproject.logics.*`\n",
"// alors que le JAR shade contient toutes les classes. Bug IKVM 8.15 sur JAR shades\n",
"// avec deps transitives. Sibling PL (Tweety-2c-FOL) OK.\n",
- "// Code ORIGINAL preserve en commentaire pour re-execution quand le bug sera resolu.\n",
"//\n",
- "// // Construire un RpclBeliefSet avec 3 conditionnels et raisonner dessus.// using org.tweetyproject.logics.fol.syntax;// using org.tweetyproject.logics.rpcl.syntax;// using org.tweetyproject.logics.rpcl.reasoner;// using org.tweetyproject.logics.rpcl.semantics;// using org.tweetyproject.math.probability;//// // Predicats et variable.// var fever = new FolPredicate(\"fever\");// var flu = new FolPredicate(\"flu\");// var cold = new FolPredicate(\"cold\");// var x = new org.tweetyproject.logics.commons.syntax.Variable(\"x\");//// // Base de croyances RP-CL : 3 regles medicales avec probabilites.// // R1 : fever => flu [0.7] (grippe probable si fievre)// // R2 : fever => cold [0.5] (rhume aussi possible si fievre)// // R3 : flu => !cold [0.8] (grippe et rhume mutuellement exclusifs)// var bs = new RpclBeliefSet();// bs.add(new RelationalProbabilisticConditional(new FolAtom(fever, x), new FolAtom(flu, x), new Probability(0.7)));// bs.add(new RelationalProbabilisticConditional(new FolAtom(fever, x), new FolAtom(cold, x), new Probability(0.5)));// bs.add(new RelationalProbabilisticConditional(new FolAtom(flu, x), new org.tweetyproject.logics.pl.syntax.Negation(new FolAtom(cold, x)), new Probability(0.8)));// Console.WriteLine($\"Base RP-CL : {bs.size()} conditionnels probabilistes.\");//// // Raisonner : Maximum Entropy sur la semantique de reference (RpclProbabilityDistribution).// var me = new RpclMeReasoner();// var dist = me.getModel(bs);// Console.WriteLine($\"Distribution Maximum Entropy obtenue : {dist.GetType().Name}\");//\n",
- "Console.WriteLine(\"[DIAGNOSTIC IKVM] Cell[10] : types non exposes, code preserve en commentaire.\");\n"
+ "// // Construire un RpclBeliefSet avec 3 conditionnels et raisonner dessus.// using org.tweetyproject.logics.fol.syntax;// using org.tweetyproject.logics.rpcl.syntax;// using org.tweetyproject.logics.rpcl.reasoner;// using org.tweetyproject.logics.rpcl.semantics;// using org.tweetyproject.math.probability;//// // Predicats et variable.// var fever = new FolPredicate(\"fever\");// var flu = new FolPredicate(\"flu\");// var cold = new FolPredicate(\"cold\");// var x = new org.tweetyproject.logics.commons.syntax.Variable(\"x\");//// // Base de croyances RP-CL : 3 regles medicales avec probabilites.// // R1 : fever => flu [0.7] (grippe probable si fievre)// // R2 : fever => cold [0.5] (rhume aussi possible si fievre)// // R3 : flu => !cold [0.8] (grippe et rhume mutuellement exclusifs)// var bs = new RpclBeliefSet();// bs.add(new RelationalProbabilisticConditional(new FolAtom(fever, x), new FolAtom(flu, x), new Probability(0.7)));// bs.add(new RelationalProbabilisticConditional(new FolAtom(fever, x), new FolAtom(cold, x), new Probability(0.5)));// bs.add(new RelationalProbabilisticConditional(new FolAtom(flu, x), new org.tweetyproject.logics.pl.syntax.Negation(new FolAtom(cold, x)), new Probability(0.8)));// Console.WriteLine($\"Base RP-CL : {bs.size()} conditionnels probabilistes.\");//// // Raisonner : Maximum Entropy sur la semantique de reference (RpclProbabilityDistribution).// var me = new RpclMeReasoner();// var dist = me.getModel(bs);// Console.WriteLine($\"Distribution Maximum Entropy obtenue : {dist.GetType().Name}\");//"
]
},
{
"cell_type": "markdown",
"id": "5658e0a2",
- "metadata": {},
+ "metadata": {
+ "papermill": {
+ "duration": 0.002928,
+ "end_time": "2026-09-27T22:57:43.791194+00:00",
+ "exception": false,
+ "start_time": "2026-09-27T22:57:43.788266+00:00",
+ "status": "completed"
+ },
+ "tags": []
+ },
"source": [
"## 4 - Querying : probabilite d'une formule sous Maximum Entropy\n",
"\n",
@@ -327,8 +654,7 @@
"- La base fixe les **conditionnelles** (`P(flu|fever) = 0.7`) mais aucune **marginale** : `P(fever)`\n",
" n'est fixée nulle part. C'est précisément l'information manquante que ME fournit — la distribution\n",
" la moins informative compatible avec R1-R3.\n",
- "- `RpclMeReasoner.query(bs, formula)` fait ce calcul automatiquement — les requêtes `P(flu)`,\n",
- " `P(cold)`, `P(fever)` sont préservées en commentaire dans la cellule ci-dessous.\n"
+ "- `RpclMeReasoner.query(bs, formula)` fait ce calcul automatiquement — la cellule ci-dessous exécute réellement cette requête (un solveur par défaut est configuré au préalable) et intercepte son refus : les trois probabilités restent non calculées tant que le verrou solveur n'est pas levé (verdict section 1).\n"
]
},
{
@@ -337,34 +663,86 @@
"id": "6b90ee67",
"metadata": {
"execution": {
- "iopub.execute_input": "2026-07-03T14:22:02.218084Z",
- "iopub.status.busy": "2026-07-03T14:22:02.217884Z",
- "iopub.status.idle": "2026-07-03T14:22:02.254054Z",
- "shell.execute_reply": "2026-07-03T14:22:02.253865Z"
- }
+ "iopub.execute_input": "2026-09-27T22:57:43.802699Z",
+ "iopub.status.busy": "2026-09-27T22:57:43.802230Z",
+ "iopub.status.idle": "2026-09-27T22:57:43.929478Z",
+ "shell.execute_reply": "2026-09-27T22:57:43.929237Z"
+ },
+ "papermill": {
+ "duration": 0.134048,
+ "end_time": "2026-09-27T22:57:43.929575+00:00",
+ "exception": false,
+ "start_time": "2026-09-27T22:57:43.795527+00:00",
+ "status": "completed"
+ },
+ "tags": []
},
"outputs": [
{
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Requete ME refusee par le solveur configure (exception interceptee) : Only optimization problems without constraints allowed for this solver.\r\n"
+ ]
+ },
+ {
+ "name": "stdout",
"output_type": "stream",
+ "text": [
+ "P(flu), P(cold), P(fever) restent non calculees ici ; aucune valeur n'est simulee.\r\n"
+ ]
+ },
+ {
"name": "stdout",
- "text": "[DIAGNOSTIC IKVM] Cell[12] : types non exposes, code preserve en commentaire.\r\n"
+ "output_type": "stream",
+ "text": [
+ "Levee du verrou : solveur sous contraintes (Gurobi) ou rebuild du shade - verdict section 1.\r\n"
+ ]
}
],
"source": [
- "// --- Cell[12] : contenu preserve ci-dessous en commentaire (DIAGNOSTIC IKVM) ---\n",
+ "// Requete ME : tentative REELLE (solveur par defaut configure pour eviter la terminaison du process),\n",
+ "// refus intercepte et affiche - aucune probabilite n'est simulee.\n",
+ "// Le probleme ME de RpclMeReasoner est sous CONTRAINTES : NLCG refuse (sans contraintes),\n",
+ "// CMAES refuse (contraintes de bord seulement), Gurobi exige une licence native absente.\n",
+ "var nlcg = new org.tweetyproject.math.opt.solver.ApacheCommonsNonLinearConjugateGradientOptimizer(10000, 1e-9);\n",
+ "org.tweetyproject.math.opt.solver.Solver.setDefaultGeneralSolver(nlcg);\n",
+ "var me = new org.tweetyproject.logics.rpcl.reasoner.RpclMeReasoner(new org.tweetyproject.logics.rpcl.semantics.AggregatingSemantics());\n",
+ "try\n",
+ "{\n",
+ " Console.WriteLine($\"P(flu) = {me.query(bs, A_flu):F3}\");\n",
+ " Console.WriteLine($\"P(cold) = {me.query(bs, A_cold):F3}\");\n",
+ " Console.WriteLine($\"P(fever) = {me.query(bs, A_fever):F3}\");\n",
+ "}\n",
+ "catch (Exception ex)\n",
+ "{\n",
+ " var msg = ex.InnerException?.Message ?? ex.Message;\n",
+ " Console.WriteLine($\"Requete ME refusee par le solveur configure (exception interceptee) : {msg}\");\n",
+ " Console.WriteLine(\"P(flu), P(cold), P(fever) restent non calculees ici ; aucune valeur n'est simulee.\");\n",
+ " Console.WriteLine(\"Levee du verrou : solveur sous contraintes (Gurobi) ou rebuild du shade - verdict section 1.\");\n",
+ "}\n",
+ "\n",
+ "// --- Ancien code original, conserve pour reference historique (API inexacte, non reactivable tel quel) ---\n",
"// La DLL tweety-rpcl.dll expose 0 types `org.tweetyproject.logics.*`\n",
"// alors que le JAR shade contient toutes les classes. Bug IKVM 8.15 sur JAR shades\n",
"// avec deps transitives. Sibling PL (Tweety-2c-FOL) OK.\n",
- "// Code ORIGINAL preserve en commentaire pour re-execution quand le bug sera resolu.\n",
"//\n",
- "// // Query : probabilite de flu(x), cold(x), fever(x) sous Maximum Entropy.// using org.tweetyproject.logics.fol.syntax;// using org.tweetyproject.logics.rpcl.reasoner;// var fever = new FolPredicate(\"fever\");// var flu = new FolPredicate(\"flu\");// var cold = new FolPredicate(\"cold\");// var x = new org.tweetyproject.logics.commons.syntax.Variable(\"x\");// var me = new RpclMeReasoner();//// // On re-utilise la base de la cellule 9 (R1+R2+R3).// var bs = new RpclBeliefSet();// bs.add(new RelationalProbabilisticConditional(new FolAtom(fever, x), new FolAtom(flu, x), new org.tweetyproject.math.probability.Probability(0.7)));// bs.add(new RelationalProbabilisticConditional(new FolAtom(fever, x), new FolAtom(cold, x), new org.tweetyproject.math.probability.Probability(0.5)));// bs.add(new RelationalProbabilisticConditional(new FolAtom(flu, x), new org.tweetyproject.logics.pl.syntax.Negation(new FolAtom(cold, x)), new org.tweetyproject.math.probability.Probability(0.8)));//// // Query : probabilite de chaque predicat sous la distribution ME.// var qFlu = new FolAtom(flu, x);// var qCold = new FolAtom(cold, x);// var qFever = new FolAtom(fever, x);// Console.WriteLine($\"P(flu) = {me.query(bs, qFlu):F3}\");// Console.WriteLine($\"P(cold) = {me.query(bs, qCold):F3}\");// Console.WriteLine($\"P(fever) = {me.query(bs, qFever):F3}\");//\n",
- "Console.WriteLine(\"[DIAGNOSTIC IKVM] Cell[12] : types non exposes, code preserve en commentaire.\");\n"
+ "// // Query : probabilite de flu(x), cold(x), fever(x) sous Maximum Entropy.// using org.tweetyproject.logics.fol.syntax;// using org.tweetyproject.logics.rpcl.reasoner;// var fever = new FolPredicate(\"fever\");// var flu = new FolPredicate(\"flu\");// var cold = new FolPredicate(\"cold\");// var x = new org.tweetyproject.logics.commons.syntax.Variable(\"x\");// var me = new RpclMeReasoner();//// // On re-utilise la base de la cellule 9 (R1+R2+R3).// var bs = new RpclBeliefSet();// bs.add(new RelationalProbabilisticConditional(new FolAtom(fever, x), new FolAtom(flu, x), new org.tweetyproject.math.probability.Probability(0.7)));// bs.add(new RelationalProbabilisticConditional(new FolAtom(fever, x), new FolAtom(cold, x), new org.tweetyproject.math.probability.Probability(0.5)));// bs.add(new RelationalProbabilisticConditional(new FolAtom(flu, x), new org.tweetyproject.logics.pl.syntax.Negation(new FolAtom(cold, x)), new org.tweetyproject.math.probability.Probability(0.8)));//// // Query : probabilite de chaque predicat sous la distribution ME.// var qFlu = new FolAtom(flu, x);// var qCold = new FolAtom(cold, x);// var qFever = new FolAtom(fever, x);// Console.WriteLine($\"P(flu) = {me.query(bs, qFlu):F3}\");// Console.WriteLine($\"P(cold) = {me.query(bs, qCold):F3}\");// Console.WriteLine($\"P(fever) = {me.query(bs, qFever):F3}\");//"
]
},
{
"cell_type": "markdown",
"id": "2efa5850",
- "metadata": {},
+ "metadata": {
+ "papermill": {
+ "duration": 0.004118,
+ "end_time": "2026-09-27T22:57:43.937390+00:00",
+ "exception": false,
+ "start_time": "2026-09-27T22:57:43.933272+00:00",
+ "status": "completed"
+ },
+ "tags": []
+ },
"source": [
"***\n",
"\n",
@@ -376,7 +754,16 @@
{
"cell_type": "markdown",
"id": "6cc0fc73",
- "metadata": {},
+ "metadata": {
+ "papermill": {
+ "duration": 0.003529,
+ "end_time": "2026-09-27T22:57:43.944751+00:00",
+ "exception": false,
+ "start_time": "2026-09-27T22:57:43.941222+00:00",
+ "status": "completed"
+ },
+ "tags": []
+ },
"source": [
"### Exercice 1 - Chainage causal medical a 3 niveaux\n",
"\n",
@@ -397,17 +784,27 @@
"id": "48ba9169",
"metadata": {
"execution": {
- "iopub.execute_input": "2026-07-03T14:22:02.255654Z",
- "iopub.status.busy": "2026-07-03T14:22:02.255423Z",
- "iopub.status.idle": "2026-07-03T14:22:02.298709Z",
- "shell.execute_reply": "2026-07-03T14:22:02.298531Z"
- }
+ "iopub.execute_input": "2026-09-27T22:57:43.957023Z",
+ "iopub.status.busy": "2026-09-27T22:57:43.956839Z",
+ "iopub.status.idle": "2026-09-27T22:57:44.007983Z",
+ "shell.execute_reply": "2026-09-27T22:57:44.007831Z"
+ },
+ "papermill": {
+ "duration": 0.057698,
+ "end_time": "2026-09-27T22:57:44.008059+00:00",
+ "exception": false,
+ "start_time": "2026-09-27T22:57:43.950361+00:00",
+ "status": "completed"
+ },
+ "tags": []
},
"outputs": [
{
- "output_type": "stream",
"name": "stdout",
- "text": "P(cough) sous chainage RP-CL = Exercice a completer\r\n"
+ "output_type": "stream",
+ "text": [
+ "P(cough) sous chainage RP-CL = Exercice a completer\r\n"
+ ]
}
],
"source": [
@@ -419,7 +816,16 @@
{
"cell_type": "markdown",
"id": "46110166",
- "metadata": {},
+ "metadata": {
+ "papermill": {
+ "duration": 0.004648,
+ "end_time": "2026-09-27T22:57:44.018086+00:00",
+ "exception": false,
+ "start_time": "2026-09-27T22:57:44.013438+00:00",
+ "status": "completed"
+ },
+ "tags": []
+ },
"source": [
"### Exercice 2 - Conditionnels contradictoires et ME\n",
"\n",
@@ -428,11 +834,14 @@
"- `wet => !rain` [0.8]\n",
"\n",
"Que retourne `RpclMeReasoner.query(bs, rain)` ? La distribution ME resout-elle le conflit ?\n",
- "(Indice : ME cherche la distribution compatible la moins informative ; les contradictions sont gerees\n",
- "par **moyennage** plutot que par contradiction directe.)\n",
+ "(Indice : ME cherche la distribution compatible la moins informative ; rien ne garantit qu'elle\n",
+ "existe ici - deux contraintes incompatibles sur la meme premisse peuvent rendre la base\n",
+ "insatisfiable.)\n",
"\n",
- "**Indice 2** : la distribution ME minimise les contradictions en pondérant les mondes compatibles avec\n",
- "les deux règles. Le résultat est généralement une probabilite intermediaire.\n"
+ "**Indice 2** : question d'investigation - documentez ce que vous observez (refus, distribution\n",
+ "inexistante, probabilite intermediaire ?) plutot que de supposer un moyennage garanti ; confrontez\n",
+ "le resultat a la theorie de Paris / Kern-Isberner sur les bases incoherentes.\n",
+ ""
]
},
{
@@ -441,17 +850,27 @@
"id": "c8aaee25",
"metadata": {
"execution": {
- "iopub.execute_input": "2026-07-03T14:22:02.299986Z",
- "iopub.status.busy": "2026-07-03T14:22:02.299795Z",
- "iopub.status.idle": "2026-07-03T14:22:02.364176Z",
- "shell.execute_reply": "2026-07-03T14:22:02.363990Z"
- }
+ "iopub.execute_input": "2026-09-27T22:57:44.030308Z",
+ "iopub.status.busy": "2026-09-27T22:57:44.029930Z",
+ "iopub.status.idle": "2026-09-27T22:57:44.096975Z",
+ "shell.execute_reply": "2026-09-27T22:57:44.096762Z"
+ },
+ "papermill": {
+ "duration": 0.073745,
+ "end_time": "2026-09-27T22:57:44.097092+00:00",
+ "exception": false,
+ "start_time": "2026-09-27T22:57:44.023347+00:00",
+ "status": "completed"
+ },
+ "tags": []
},
"outputs": [
{
- "output_type": "stream",
"name": "stdout",
- "text": "P(rain) avec conditionnels contradictoires sous ME = Exercice a completer\r\n"
+ "output_type": "stream",
+ "text": [
+ "P(rain) avec conditionnels contradictoires sous ME = Exercice a completer\r\n"
+ ]
}
],
"source": [
@@ -463,7 +882,16 @@
{
"cell_type": "markdown",
"id": "3fe8c54d",
- "metadata": {},
+ "metadata": {
+ "papermill": {
+ "duration": 0.005349,
+ "end_time": "2026-09-27T22:57:44.106831+00:00",
+ "exception": false,
+ "start_time": "2026-09-27T22:57:44.101482+00:00",
+ "status": "completed"
+ },
+ "tags": []
+ },
"source": [
"### Exercice 3 - Système expert avec règles multiples\n",
"\n",
@@ -476,7 +904,7 @@
"Utilisez `RpclMeReasoner` pour calculer `P(dividend_high)` et `P(dividend_low)` (en esperant qu'elles\n",
"somment a 1 si le système est coherent).\n",
"\n",
- "**Indice** : 4 predicats (bull_market, bear_market, stock_up, stock_down, dividend_high, dividend_low)\n",
+ "**Indice** : 6 predicats (bull_market, bear_market, stock_up, stock_down, dividend_high, dividend_low)\n",
"+ 4 `RelationalProbabilisticConditional` + 2 queries.\n"
]
},
@@ -486,17 +914,27 @@
"id": "f1dbf252",
"metadata": {
"execution": {
- "iopub.execute_input": "2026-07-03T14:22:02.365496Z",
- "iopub.status.busy": "2026-07-03T14:22:02.365172Z",
- "iopub.status.idle": "2026-07-03T14:22:02.403813Z",
- "shell.execute_reply": "2026-07-03T14:22:02.403651Z"
- }
+ "iopub.execute_input": "2026-09-27T22:57:44.114834Z",
+ "iopub.status.busy": "2026-09-27T22:57:44.114263Z",
+ "iopub.status.idle": "2026-09-27T22:57:44.145356Z",
+ "shell.execute_reply": "2026-09-27T22:57:44.145129Z"
+ },
+ "papermill": {
+ "duration": 0.035611,
+ "end_time": "2026-09-27T22:57:44.145451+00:00",
+ "exception": false,
+ "start_time": "2026-09-27T22:57:44.109840+00:00",
+ "status": "completed"
+ },
+ "tags": []
},
"outputs": [
{
- "output_type": "stream",
"name": "stdout",
- "text": "P(dividend_high), P(dividend_low) sous systeme expert = Exercice a completer\r\n"
+ "output_type": "stream",
+ "text": [
+ "P(dividend_high), P(dividend_low) sous systeme expert = Exercice a completer\r\n"
+ ]
}
],
"source": [
@@ -508,7 +946,16 @@
{
"cell_type": "markdown",
"id": "2f8c658c",
- "metadata": {},
+ "metadata": {
+ "papermill": {
+ "duration": 0.004065,
+ "end_time": "2026-09-27T22:57:44.152535+00:00",
+ "exception": false,
+ "start_time": "2026-09-27T22:57:44.148470+00:00",
+ "status": "completed"
+ },
+ "tags": []
+ },
"source": [
"***\n",
"\n",
@@ -528,14 +975,13 @@
"reference pour calculer la distribution la moins informative compatible avec les contraintes\n",
"(principe de Jaynes - développé en section 3).\n",
"\n",
- "### Limites connues du port IKVM\n",
+ "### Limites connues du port IKVM (rectifiees le 2026-09-28)\n",
"\n",
- "Le fat-jar shaded embarque bien toutes les classes RPCL, mais l'assembly chargé expose **0 types**\n",
- "`org.tweetyproject.logics.*` — bug IKVM sur les JAR shades à dépendances transitives, déjà observé\n",
- "sur Tw-3-ML (PR #5207). La section 1 exécute le runtime et charge la DLL (dernière étape verte :\n",
- "le check d'assembly), le code des sections 2-4 est **préservé en commentaire** pour re-exécution\n",
- "quand le bug sera résolu, et les exercices restent des stubs indépendants des types Tweety.\n",
- "Le diagnostic détaillé est en fin de section 1.\n",
+ "- **Types exposes** : depuis le correctif C190 (commit `6300d915` : IKVM 8.14 + shade en bytecode Java 8), la DLL expose bien les types RPCL - l'ancien diagnostic « 0 type expose / bug IKVM 8.15 » etait perime (re-mesure : 31 types `logics.rpcl.*`, section 3 du notebook).\n",
+ "- **Construction reelle** : la section 2 execute la vraie API (predicats, constante, `FolAtom`, `Negation`, conditionnels probabilistes, `complement()`).\n",
+ "- **Requete ME** : le probleme d'optimisation de `RpclMeReasoner` est **sous contraintes** ; aucun des solveurs generaux embarques ne le couvre (NLCG : sans contraintes ; CMAES : contraintes de bord seulement ; Gurobi : licence native absente). La section 4 execute la tentative et intercepte le refus reel du solveur. Pistes de levee NON VERIFIEES : solveur sous contraintes (Gurobi, si licence/native disponibles) ou recompilation du shade (`dotnet-build/build-TweetyRpclShade.csproj`) - aucune n'a ete demontree.\n",
+ "- **Code historique** : l'ancien code des sections 3-4 reste conserve en commentaire sous les cellules reecrites ; sa reactivation exigera une reecriture (API 1.30 reelle : `commons.syntax.Predicate` au lieu de `FolPredicate`, variables a majuscule, `Probability(java.lang.Double)`).\n",
+ "- Les exercices restent des stubs C.1 et utilisent la **vraie API RP-CL** (types bien exposes) ; seule leur boucle ME complete depend de la levee du verrou solveur.\n",
"\n",
"### References\n",
"\n",
@@ -543,7 +989,8 @@
"- Kern-Isberner, G. (2001). *Conditionals in Nonmonotonic Reasoning and Belief Revision*. LNCS 2087.\n",
"- Jaynes, E. T. (1957). *Information Theory and Statistical Mechanics*. Physical Review 106(4).\n",
"- TweetyProject - [logics-rpcl module](https://tweetyproject.org/).\n",
- "- Port C#/.NET via IKVM - EPIC [#4667](https://github.com/jsboige/CoursIA/issues/4667).\n"
+ "- Port C#/.NET via IKVM - EPIC [#4667](https://github.com/jsboige/CoursIA/issues/4667).\n",
+ ""
]
}
],
@@ -559,8 +1006,20 @@
"name": "C#",
"pygments_lexer": "csharp",
"version": "13.0"
+ },
+ "papermill": {
+ "default_parameters": {},
+ "duration": 11.411791,
+ "end_time": "2026-09-27T22:57:44.393893+00:00",
+ "environment_variables": {},
+ "exception": null,
+ "input_path": "C:\\Users\\jsboi\\AppData\\Local\\Temp\\claude\\d--dev-CoursIA\\d7e38c20-8e6d-4897-ad92-66b5a98e1f96\\scratchpad\\17824-tweety-rpcl\\MyIA.AI.Notebooks\\SymbolicAI\\Tweety\\Tweety-07b-Ranking-Probabilistic-CSharp.ipynb",
+ "output_path": "C:\\Users\\jsboi\\AppData\\Local\\Temp\\claude\\d--dev-CoursIA\\d7e38c20-8e6d-4897-ad92-66b5a98e1f96\\scratchpad\\17824-tweety-rpcl\\MyIA.AI.Notebooks\\SymbolicAI\\Tweety\\Tweety-07b-Ranking-Probabilistic-CSharp_output_20260928_005732.ipynb",
+ "parameters": {},
+ "start_time": "2026-09-27T22:57:32.982102+00:00",
+ "version": "2.7.0"
}
},
"nbformat": 4,
"nbformat_minor": 5
-}
\ No newline at end of file
+}
diff --git a/MyIA.AI.Notebooks/SymbolicAI/Tweety/Tweety-07b-Ranking-Probabilistic-Python.ipynb b/MyIA.AI.Notebooks/SymbolicAI/Tweety/Tweety-07b-Ranking-Probabilistic-Python.ipynb
index fff6a811fb..a76ef86907 100644
--- a/MyIA.AI.Notebooks/SymbolicAI/Tweety/Tweety-07b-Ranking-Probabilistic-Python.ipynb
+++ b/MyIA.AI.Notebooks/SymbolicAI/Tweety/Tweety-07b-Ranking-Probabilistic-Python.ipynb
@@ -1229,41 +1229,40 @@
},
{
"cell_type": "markdown",
+ "id": "9ff5e5ce",
+ "metadata": {},
"source": [
"***\n",
"\n",
- "## Note-de-parite cross-langage (c.757 — Tweety-7b jumeau Python ↔ C#)\n",
+ "## Parité cross-langage : Tweety-07b Python et C#\n",
"\n",
- "Le notebook jumeau `Tweety-07b-Ranking-Probabilistic-CSharp.ipynb` (.NET Interactive) couvre les memes fondements theoriques que ce notebook-ci (RP-CL = **Ranking Probabilistic Conditional Logic** avec Maximum Entropy sur conditionnels relationnels), mais selon une architecture **fondamentalement differente** de c.756 (Tweety-7a from-scratch) :\n",
+ "Les deux notebooks utilisent TweetyProject, mais **ne démontrent pas les mêmes algorithmes**. Le titre commun regroupe deux approches distinctes ; il ne garantit ni les mêmes exemples ni les mêmes résultats. Le notebook Python étudie les arguments dans un graphe de Dung ; le notebook C# étudie les conditionnels probabilistes relationnels. Le recours au même écosystème Java ne transforme pas une distribution sur des sous-graphes en modèle Maximum Entropy de RP-CL.\n",
"\n",
"| Aspect | Python (ce notebook) | C# jumeau |\n",
- "|--------|---------------------|-----------|\n",
- "| **Moteur** | JVM Tweety via `jpype` (42 JARs, `init_tweety()`) | **IKVM 8.14.0 runtime** (charge DLL Java `tweety-rpcl.dll` 13 Mo compilee depuis fat-jar shade Maven) |\n",
- "| **Dep externe runtime** | JDK zulu17.50.19 + libs natives | IKVM 8.14.0 + IKVM.Image + IKVM.Image.runtime.win-x64 (NuGet) |\n",
- "| **Diagnostic runtime** | `JVM demarree avec 42 JARs` (cell 3) | `IKVM home=OK` (cell 3) puis `[DIAGNOSTIC IKVM] types non exposes` (cells 8/10/12) |\n",
- "| **5.7 Ranking semantiques** | `RankingSemantics` + `SimpleRankingReasoner` (cell 8, output `—— 5.7 Semantiques Basees sur le Classement ——`) | Cell 8 stub diagnostic IKVM : code preserve en commentaire (RP-CL Java types non exposes par IKVM 8.15 sur JAR shades avec deps transitives) |\n",
- "| **5.8 Argumentation probabiliste** | `ProbabilisticArgumentationFramework` + `DialecticalProbability` (cell 13, output `JVM pret` puis `Dialectical probability = ...`) | Cell 10 stub diagnostic IKVM : idem, code preserve |\n",
- "| **Exemple guide medical** | Debate medical 5 args `e1,t1,e2,t2,c1` + attacks `[(c1,t2),(e1,t1),(e2,e1)]` (cell 16, AAF affichee) | Cell 12 stub diagnostic IKVM : idem, code preserve |\n",
- "| **Exercices** | 3 stubs (ranking cell 11, probabilistic cell 18, environnemental cell 21) | 3 stubs (chainage medical cell 15, contradictoires cell 17, systeme expert cell 19) |\n",
+ "|---|---|---|\n",
+ "| Runtime | JPype, JVM et JARs TweetyProject ; l'initialisation affiche 42 JARs et les outils externes disponibles | IKVM 8.14 et `tweety-rpcl.dll`, sans JVM séparée ; les classes `org.tweetyproject.logics.rpcl.*` sont exposées |\n",
+ "| Classement | `CategorizerRankingReasoner`, `BurdenBasedRankingReasoner`, `DiscussionBasedRankingReasoner`, Tuples*, Strategy-Based, SAF-Based, Counting et Propagation sur des `DungTheory` ; sorties de classements affichées | Pas de calcul Categorizer ou Burden-Based exécuté ; le code historique correspondant reste en commentaire et n'est pas directement réactivable |\n",
+ "| Probabilités | `SubgraphProbabilityFunction` sur les sous-graphes d'un `DungTheory` ; probabilités d'acceptation, `Division`, loterie et utilité attendue affichées | Pas de calcul de probabilité d'acceptation par sous-graphe exécuté |\n",
+ "| Exemple médical | Cinq arguments `e1,t1,e2,t2,c1` et les attaques `c1→t2`, `e1→t1`, `e2→e1` ; trois classements calculés avant et après l'ajout de `e3` | Conditionnels sur la fièvre et la grippe ; ce n'est ni le même graphe ni la même question |\n",
+ "| RP-CL | Pas de `RpclBeliefSet` ni de requête Maximum Entropy exécutés | Trois conditionnels construits dans un `RpclBeliefSet` ; `RpclMeReasoner.query` appelé avec NLCG, qui refuse les contraintes |\n",
+ "| Exercices étudiants | Comparaison Tuples*/Counting, témoignage incertain et débat environnemental : stubs à compléter | Chaînage médical, contraintes potentiellement incompatibles et système expert : stubs à compléter |\n",
"\n",
- "**Frameworks uniquement Python (Tweety ecosystem)** : 5.7 Ranking semantics + 5.8 Probabilistic argumentation + Maximum Entropy reasoning sur belief sets probabilistes. **Ces algorithmes n'ont pas de pendant C#** car l'IKVM 8.15 n'expose pas les types RP-CL du JAR shade transitif (meme bug que Tw-3-ML PR #5207). Sibling `tweety-pl.dll` (Tweety-2c-FOL, sans deps lourdes transitive) expose 33 types et marche, mais RP-CL est inatteignable.\n",
+ "### Ce que prouvent les sorties\n",
"\n",
- "**Pattern cross-langage Tweety-7b** :\n",
+ "La cellule de classement Python exécute les raisonneurs Java sur plusieurs graphes : sur le premier exemple, Categorizer rend notamment `a=0.38` et `b=1.0`, tandis que Burden-Based donne `[b > d > c > e > a]`. Ces valeurs classent des **arguments** ; elles ne sont pas des probabilités de conditionnels relationnels. Dans l'exemple médical guidé, le graphe initial classe `t1` devant `t2` ; l'ajout d'un argument attaquant `e2` réduit le score Categorizer de `t1` de `0.667` à `0.600`. Ce second exemple reste une analyse de Dung, et non une inférence RP-CL.\n",
"\n",
- "- **c.756 (Tweety-7a Extended Frameworks) C#** = **from-scratch BCL .NET 9** (Prong B #3801, 0 NuGet, 0 jpype, 0 IKVM, 0 JVM). Algorithmes simples (Kleene 3-valued, ADF fixed-point, SetAF labelling, EAF reinstatement) reinplementables.\n",
- "- **c.757 (Tweety-7b Ranking-Probabilistic) C#** = **IKVM runtime (.NET ↔ JVM)** chargeant la DLL Java `tweety-rpcl.dll`. Algorithmes complexes (Maximum Entropy inference sur RP-CL belief sets, NP-difficile, semantique ReferenceWorld) **irreimplementables from-scratch sans travail de PhD**.\n",
- "- Les 2 patterns sont **complementaires** : Prong B #3801 quand l'algorithme est reimplementable (Tweety-7a), IKVM sinon (Tweety-7b). Le diagnostic IKVM est **honnete** : `RECOVERABLE-LOCAL` partiel documente, cellules exemples preservees en commentaire, exercices stubs independants des types Tweety.\n",
+ "La cellule probabiliste Python utilise l'approche **par constellations** : arguments et attaques peuvent être absents selon le sous-graphe. Elle affiche 19 sous-graphes, `P(Accepte(a)) = 0.5263`, `P(Division=({a,c}, {b})) = 0.3158` et une utilité attendue de `-0.2632` pour la loterie définie dans la cellule. Ces nombres viennent de `SubgraphProbabilityFunction` et de `ArgumentationLottery` sous la sémantique grounded, pas d'une distribution Maximum Entropy RP-CL. La distinction importe pédagogiquement : ici, l'incertitude porte sur la présence des éléments du graphe et l'acceptation d'un argument ; côté C#, une base de croyances relie des formules du premier ordre par des probabilités conditionnelles.\n",
"\n",
- "**Substance pedagogique distincte (c.757)** :\n",
+ "Côté C#, la DLL expose les classes RP-CL nécessaires à la construction : le diagnostic compte 31 types dans l'espace de noms RP-CL, au lieu de zéro comme l'affirmait l'ancienne note. Le notebook construit effectivement trois conditionnels et affiche la base ; l'appel du raisonneur ME avec le solveur NLCG configuré est tenté, mais ce solveur refuse un problème sous contraintes. **Aucune distribution Maximum Entropy n'a été calculée** dans ces deux notebooks. Un solveur compatible reste à identifier et tester avant de promettre ce résultat ; l'exposition des types n'établit pas à elle seule que l'inférence fonctionne.\n",
"\n",
- "- **Python notebook** montre l'usage de l'ecosysteme Tweety RP-CL (5.7 Ranking + 5.8 Probabilistic + Maximum Entropy) via JVM, avec resultats concrets (debate medical 5 args, chainage RP-CL).\n",
- "- **C# jumeau** montre qu'on peut **consommer une DLL Java dans .NET via IKVM** sans JVM separee, malgre le bug IKVM 8.15 sur JAR shades transitifs. Pedagogie du **port cross-runtime** et de la **transparence diagnostique** (le verdict `RECOVERABLE-LOCAL` partiel documente).\n",
+ "### Portée de la comparaison et provenance\n",
"\n",
- "**Verification cross-langage (c.757 G.1 firsthand, 2026-07-22)** : les cellules code Python Papermill-executees sur 2026-06-05 (9.95s, 0 erreur) ; les cellules code C# .NET Interactive sur 2026-07-07 (cellules setup/diagnostic OK, cellules exemples diagnostiquees IKVM avec code preserve en commentaire, 3 exercices stubs C.1-conformants `Console.WriteLine(... \"Exercice a completer\")`). Les notebooks utilisent le **meme cadre theorique RP-CL** mais sur des **shapes** differents (Python = Pedagogie Framework ; C# = Diagnostic IKVM transparent) — la parite est sur l'**algorithme sous-jacent** (Maximum Entropy inference sur RP-CL belief sets), pas sur l'exemple execute.\n",
+ "Le niveau `native-both` du registre de jumeaux signifie que **chaque côté fait son travail avec un moteur externe de référence** : Python appelle les raisonneurs Tweety via JPype ; C# appelle les classes Tweety via IKVM. Il ne signifie ni correspondance cellule par cellule ni équivalence sémantique. L'ancienne note attribuait à Python RP-CL et Maximum Entropy, et attribuait à C# une absence de types IKVM : les lectures des cellules et sorties actuelles réfutent ces deux affirmations. Le diagnostic doit être relu lorsque le JAR, la DLL ou le solveur change ; il n'est pas une propriété permanente d'IKVM.\n",
"\n",
- "Voir aussi : `MyIA.AI.Notebooks/SymbolicAI/Tweety/Tweety-07b-Ranking-Probabilistic-CSharp.ipynb` (jumeau C# IKVM), `MyIA.AI.Notebooks/SymbolicAI/Tweety/Tweety-07a-Extended-Frameworks-Python.ipynb` + `-Csharp.ipynb` (autre jumeau cross-langage audite c.756, from-scratch BCL .NET 9 vs IKVM), `MyIA.AI.Notebooks/SymbolicAI/Tweety/Tweety-01-Setup-Python.ipynb` (init JVM Tweety), `MyIA.AI.Notebooks/SymbolicAI/Tweety/Tweety-5-Abstract-Argumentation.ipynb` + `-Csharp.ipynb` (jumeau c.744 DEEP), `MyIA.AI.Notebooks/SymbolicAI/Tweety/Tweety-06-Structured-Argumentation-Python.ipynb` + `-Csharp.ipynb` (jumeau c.743 DEEP).\n"
- ],
- "metadata": {}
+ "Les deux modalités restent utiles à des fins différentes. Pour comparer des classements et des probabilités d'acceptation dans l'argumentation abstraite, suivre les exemples Python ci-dessus. Pour construire des conditionnels RP-CL depuis .NET et observer la limite actuelle du solveur, consulter le [notebook C#](Tweety-07b-Ranking-Probabilistic-CSharp.ipynb). Tweety-07a illustre une autre approche C# sur les frameworks étendus ; son architecture ne doit pas servir à inférer que les résultats des deux Tweety-07b sont interchangeables.\n",
+ "\n",
+ "Voir aussi : [configuration Python et JVM](Tweety-01-Setup-Python.ipynb), [frameworks étendus Python](Tweety-07a-Extended-Frameworks-Python.ipynb) et [frameworks étendus C#](Tweety-07a-Extended-Frameworks-CSharp.ipynb), [argumentation abstraite](Tweety-5-Abstract-Argumentation.ipynb), et les [dialogues d'agents](Tweety-08-Agent-Dialogues-Python.ipynb).\n"
+ ]
},
{
"cell_type": "markdown",
@@ -1437,22 +1436,22 @@
],
"metadata": {
"cost": {
- "api_usd_est": 0.0,
"api_provider": "none",
- "qcc_tokens_est": 0,
+ "api_usd_est": 0.0,
"cpu_min": 1,
+ "external_account": false,
+ "free_alternative": "self",
"gpu_min": 0,
"gpu_required": false,
- "vram_gb": 0,
- "vram_tier": "none",
+ "metadata_written": "2026-08-03",
"network": true,
- "external_account": false,
- "free_alternative": "self",
+ "notes": "Tweety probabilistic ranking logic (Java) via JPype bridge. Deterministic exact probabilistic arithmetic (not MCMC). CPU-only. 8/8 cells executed.",
+ "qcc_tokens_est": 0,
"reduced_pedagogical": false,
"reproducibility": "HIGH",
- "metadata_written": "2026-08-03",
"validator": "check_cost_metadata.py",
- "notes": "Tweety probabilistic ranking logic (Java) via JPype bridge. Deterministic exact probabilistic arithmetic (not MCMC). CPU-only. 8/8 cells executed."
+ "vram_gb": 0,
+ "vram_tier": "none"
},
"kernelspec": {
"display_name": "Python 3",
diff --git a/scripts/notebook_tools/twin_pairs.d/tweety-7b-ranking-probabilistic.yaml b/scripts/notebook_tools/twin_pairs.d/tweety-7b-ranking-probabilistic.yaml
index 345d34ad1a..df9a3dbe5c 100644
--- a/scripts/notebook_tools/twin_pairs.d/tweety-7b-ranking-probabilistic.yaml
+++ b/scripts/notebook_tools/twin_pairs.d/tweety-7b-ranking-probabilistic.yaml
@@ -3,10 +3,8 @@
python: MyIA.AI.Notebooks/SymbolicAI/Tweety/Tweety-07b-Ranking-Probabilistic-Python.ipynb
csharp: MyIA.AI.Notebooks/SymbolicAI/Tweety/Tweety-07b-Ranking-Probabilistic-CSharp.ipynb
parity_level: native-both
- bridge_verdict: SOTA-OK
- bridge_verdict_reason: "Lib-vs-lib meme moteur Java TweetyProject (semantiques de rangement ranking + probabilistes + division) : C# branche IKVM 8.14.0 + tweety-rpcl.dll (tracked) + 23 refs `org.tweetyproject.*` actifs (3 cellules avec using explicite, classes Dung Division, RankingSemantics Java invoquees). Python branche JPype + `from org.tweetyproject.arg.dung.divisions import Division` + meme moteur Java. Verifie firsthand (c.227, 2026-08-12, po-2023:CoursIA-2) : 23 refs = la plus grosse utilisation TweetyProject parmi les paires Tweety du registre (audited individu M-XX), les deux cotes operent sur les memes semantiques ranking (Categorizer-based, Burden-based) avec les memes theorems de comparaison."
known_differences:
+ - "Audit 2026-09-28 : Python execute CategorizerRankingReasoner, BurdenBasedRankingReasoner et SubgraphProbabilityFunction/Division (cellules 4988945f et 3ec0ceec) ; aucune construction RP-CL ni requete ME. C# execute RpclBeliefSet et trois conditionnels ; RpclMeReasoner.query refuse les contraintes. Socle moteur TweetyProject commun, mais pas de parite des algorithmes ou des exemples executes."
+ - "La note de parite Python a ete corrigee (cellule markdown 19) : elle distingue le classement et les probabilites sur sous-graphes Python de la construction RP-CL C# et du refus du solveur ME."
- 'PR #17056 (redressement densite #17040) : cote C# seul edite -- markdown 14 -> 11 cellules (retrait de lectures dupliquees). attestation firsthand : code source ET outputs byte-identiques des deux cotes (aucune re-execution due, C.2), jumeau Python intact -- la parite native-both est preservee, seule la prose a evolue.'
- - "Socle commun : semantiques de rangement et probabilistes (ranking, division) via TweetyProject."
- - "Lib-vs-lib : C# via IKVM (`#r \"org.tweetyproject.tweety-rpcl.dll\"`). Python via JPype (`from org.tweetyproject.arg.dung.divisions import Division`). Meme moteur Java."
- "Re-baseline 2026-07-25 (po-2024, consolidation #8264) : SHA Python avance depuis l'audit 2026-07-23 via #8170 (markdown hyphenation (Note-de-parite)) ; drift verifie paraphite-preservant (ne touche pas l'axe de parite semantic)."
diff --git a/scripts/notebook_tools/twin_pairs.d/tweety-7b-ranking-probabilistic/0009-2026-09-28-myia-po-2025-CoursIA.yaml b/scripts/notebook_tools/twin_pairs.d/tweety-7b-ranking-probabilistic/0009-2026-09-28-myia-po-2025-CoursIA.yaml
new file mode 100644
index 0000000000..a3a0052ff8
--- /dev/null
+++ b/scripts/notebook_tools/twin_pairs.d/tweety-7b-ranking-probabilistic/0009-2026-09-28-myia-po-2025-CoursIA.yaml
@@ -0,0 +1,6 @@
+date: '2026-09-28'
+by: myia-po-2025:CoursIA
+python_sha: 5b83f08c99987d683be5a96b04d9d008a18b83eb
+csharp_sha: 6ceb2fb65ec09f1539be75da659fd387ce8d4783
+content_python_sha: fc5c46f627b86abc2bf8aa94a38985e42a83c43f129348062973f989348a9e18
+content_csharp_sha: e980b32d4408f0c5a3b822d9a9e2bd5d2b3c43df624aefaf0b3ce4e8bf8f59af
diff --git a/scripts/notebook_tools/twin_pairs.d/tweety-7b-ranking-probabilistic/0010-2026-09-29-myia-po-2025-CoursIA.yaml b/scripts/notebook_tools/twin_pairs.d/tweety-7b-ranking-probabilistic/0010-2026-09-29-myia-po-2025-CoursIA.yaml
new file mode 100644
index 0000000000..c5daf8b19c
--- /dev/null
+++ b/scripts/notebook_tools/twin_pairs.d/tweety-7b-ranking-probabilistic/0010-2026-09-29-myia-po-2025-CoursIA.yaml
@@ -0,0 +1,6 @@
+date: '2026-09-29'
+by: myia-po-2025:CoursIA
+python_sha: 85ed459360a7e77d59a6beb591ad7054c06813f4
+csharp_sha: 6ceb2fb65ec09f1539be75da659fd387ce8d4783
+content_python_sha: 379d1467ad311b523822494fbe01ce2382ddec5fa6b26193a9eda2379719605a
+content_csharp_sha: e980b32d4408f0c5a3b822d9a9e2bd5d2b3c43df624aefaf0b3ce4e8bf8f59af
diff --git a/scripts/notebook_tools/twin_pairs.d/tweety-7b-ranking-probabilistic/0011-2026-09-29-myia-po-2025-CoursIA.yaml b/scripts/notebook_tools/twin_pairs.d/tweety-7b-ranking-probabilistic/0011-2026-09-29-myia-po-2025-CoursIA.yaml
new file mode 100644
index 0000000000..81bd4fa7fb
--- /dev/null
+++ b/scripts/notebook_tools/twin_pairs.d/tweety-7b-ranking-probabilistic/0011-2026-09-29-myia-po-2025-CoursIA.yaml
@@ -0,0 +1,6 @@
+date: '2026-09-29'
+by: myia-po-2025:CoursIA
+python_sha: a76ef86907b1d3ade359240f3aaa77fe46446bab
+csharp_sha: 6ceb2fb65ec09f1539be75da659fd387ce8d4783
+content_python_sha: 3d9aea4560a5a2df3f3cc65ce577676b49b47feb1d99c447a2bdab874d2bb54b
+content_csharp_sha: e980b32d4408f0c5a3b822d9a9e2bd5d2b3c43df624aefaf0b3ce4e8bf8f59af