Implementação dos registros de Log de eventos!
authormaroni <maroni@192.168.1.103>
Mon, 2 Apr 2012 18:01:24 +0000 (15:01 -0300)
committermaroni <maroni@192.168.1.103>
Mon, 2 Apr 2012 18:01:24 +0000 (15:01 -0300)
src/java/org/ufcspa/simdecs/test/Teste.java
web/login.xhtml
web/redes/influencia.xml [new file with mode: 0644]
web/simulador/endereco.txt

index 06428db..e454cc4 100644 (file)
@@ -4,24 +4,53 @@
  */
 package org.ufcspa.simdecs.test;
 
+import java.io.File;
+import unbbayes.io.xmlbif.version6.XMLBIFIO;
+import unbbayes.prs.bn.JunctionTreeAlgorithm;
+import unbbayes.prs.bn.ProbabilisticNetwork;
+import unbbayes.prs.bn.ProbabilisticNode;
+
 /**
  *
  * @author maroni
  */
 public class Teste {
-    private static long getIdFromUID(String pUID, String prefixo) {
-        String id = pUID.replaceAll(prefixo, "");
-        id = id.substring(0, id.indexOf(":"));
-        return Long.parseLong(id);
-    }
+    public static void main(String[] args) {
+        final String caminhoRede = "/Users/maroni/NetBeansProjects/SimDeCS/web/redes/influencia.xml";
+        ProbabilisticNetwork rede;
 
-    private static long getIdPacienteFromUID(String pUID) {
-        String id = pUID.substring(pUID.indexOf(":paciente-") + ":paciente-".length());
-        return Long.parseLong(id);
-    }
+        try {
+            // required to run unbbayes gui classes on server
+            System.setProperty("java.awt.headless", "false"); 
+            rede = new ProbabilisticNetwork(null);
+            XMLBIFIO.loadXML(new File(caminhoRede), rede);
+            JunctionTreeAlgorithm jt = new JunctionTreeAlgorithm();
+            jt.setNet(rede);       
+            jt.run();
 
-    public static void main(String[] args) {
-        System.out.println(getIdFromUID("sintoma-np-12:paciente-1", "sintoma-np-"));        
-        System.out.println(getIdPacienteFromUID("sintoma-np-12:paciente-15"));        
+            
+           for (int j = 0; j < rede.getNodeCount(); j++) {
+                if (!(rede.getNodeAt(j) instanceof ProbabilisticNode)) {
+                    System.out.println(rede.getNodeAt(j).getClass());
+                    continue;
+                }
+                            
+               ProbabilisticNode nodoAtual = (ProbabilisticNode) rede.getNodeAt(j);
+               System.out.println(nodoAtual.getName());
+               
+               // Verificando a tabela de probabilidades do nodo
+                for (int pb = 0; pb < nodoAtual.getStatesSize(); pb++) {
+                        System.out.println(nodoAtual.getStateAt(pb)+":"+nodoAtual.getMarginalAt(pb));
+                }
+                 System.out.println("");
+           }
+            
+            
+        } catch (Exception e) {
+            e.printStackTrace();
+            System.exit(1);
+        }
+
+    
     }
 }
index 9f31a9e..8a34894 100644 (file)
@@ -35,7 +35,7 @@
             <a href="simulador/index.html">Acesso ao Simulador</a>
             <br/>
             <br/>
-            <h:outputText value="Versão 3.1.0" />
+            <h:outputText value="Versão 3.1.1" />
         </center>
     </h:body>
 </html>
diff --git a/web/redes/influencia.xml b/web/redes/influencia.xml
new file mode 100644 (file)
index 0000000..31017ce
--- /dev/null
@@ -0,0 +1,89 @@
+<?xml version='1.0' encoding='US-ASCII'?>
+<xbifns:XMLBIF version="0.6" xmlns:xbifns="http://unbbayes.sourceforge.net/xml/XMLBIF_0_6.xsd">
+  <xbifns:header>
+    <xbifns:version>1.0</xbifns:version>
+    <xbifns:name>influencia</xbifns:name>
+    <xbifns:creator>UnBBayes</xbifns:creator>
+  </xbifns:header>
+  <xbifns:staticProperty>
+    <xbifns:nodeSize>40</xbifns:nodeSize>
+    <xbifns:nodeFontSize>0</xbifns:nodeFontSize>
+    <xbifns:colorUtilityNode>0</xbifns:colorUtilityNode>
+    <xbifns:colorDecisionNode>0</xbifns:colorDecisionNode>
+    <xbifns:colorDiscreteProbabilisticNode>0</xbifns:colorDiscreteProbabilisticNode>
+    <xbifns:colorContinuousProbilisticNode>0</xbifns:colorContinuousProbilisticNode>
+    <xbifns:colorExplanationNode>0</xbifns:colorExplanationNode>
+  </xbifns:staticProperty>
+  <xbifns:hierarchy>
+    <xbifns:root name="root">
+      <xbifns:level name=""/>
+    </xbifns:root>
+  </xbifns:hierarchy>
+  <xbifns:network>
+    <xbifns:variables>
+      <xbifns:variable perguntas="" tipo="E" tempoEtapa="0.0" custoEtapa="0.0" rgbColor="-14336" height="60.0" width="80.0" yPos="60" xPos="80" type="Decision" name="Resultado">
+        <xbifns:description/>
+        <xbifns:state name="resultado1"/>
+        <xbifns:state name="resultado2"/>
+        <xbifns:state name="resultado3"/>
+      </xbifns:variable>
+      <xbifns:variable perguntas="" tipo="E" tempoEtapa="0.0" custoEtapa="0.0" rgbColor="-16711681" height="60.0" width="80.0" yPos="90" xPos="80" type="Utility" name="Utility">
+        <xbifns:description/>
+        <xbifns:state name="Utilidade"/>
+      </xbifns:variable>
+      <xbifns:variable perguntas="" tipo="E" tempoEtapa="0.0" custoEtapa="0.0" rgbColor="-256" height="60.0" width="80.0" yPos="150" xPos="160" type="DiscreteProbabilistic" name="Entrada2">
+        <xbifns:description/>
+        <xbifns:state name="Sim"/>
+        <xbifns:state name="Nao"/>
+      </xbifns:variable>
+      <xbifns:variable perguntas="" tipo="E" tempoEtapa="0.0" custoEtapa="0.0" rgbColor="-256" height="60.0" width="80.0" yPos="150" xPos="80" type="DiscreteProbabilistic" name="Entrada1">
+        <xbifns:description/>
+        <xbifns:state name="Sim"/>
+        <xbifns:state name="Nao"/>
+      </xbifns:variable>
+    </xbifns:variables>
+    <xbifns:structure>
+      <xbifns:edge child="Utility" parent="Resultado"/>
+      <xbifns:edge child="Utility" parent="Entrada2"/>
+      <xbifns:edge child="Utility" parent="Entrada1"/>
+    </xbifns:structure>
+    <xbifns:conditionalDistributionSet>
+      <xbifns:conditionalDistribution type="Discrete">
+        <xbifns:owner name="Utility"/>
+        <xbifns:parents>
+          <xbifns:parent index="0" name="Entrada1"/>
+          <xbifns:parent index="1" name="Entrada2"/>
+          <xbifns:parent index="2" name="Resultado"/>
+        </xbifns:parents>
+        <xbifns:CPT>
+          <xbifns:dependentParentIndex index="0">1.0</xbifns:dependentParentIndex>
+          <xbifns:dependentParentIndex index="1">0.0</xbifns:dependentParentIndex>
+          <xbifns:dependentParentIndex index="2">0.0</xbifns:dependentParentIndex>
+          <xbifns:dependentParentIndex index="3">0.0</xbifns:dependentParentIndex>
+          <xbifns:dependentParentIndex index="4">0.0</xbifns:dependentParentIndex>
+          <xbifns:dependentParentIndex index="5">0.0</xbifns:dependentParentIndex>
+          <xbifns:dependentParentIndex index="6">0.0</xbifns:dependentParentIndex>
+          <xbifns:dependentParentIndex index="7">1.0</xbifns:dependentParentIndex>
+          <xbifns:dependentParentIndex index="8">0.0</xbifns:dependentParentIndex>
+          <xbifns:dependentParentIndex index="9">1.0</xbifns:dependentParentIndex>
+          <xbifns:dependentParentIndex index="10">1.0</xbifns:dependentParentIndex>
+          <xbifns:dependentParentIndex index="11">0.0</xbifns:dependentParentIndex>
+        </xbifns:CPT>
+      </xbifns:conditionalDistribution>
+      <xbifns:conditionalDistribution type="Discrete">
+        <xbifns:owner name="Entrada2"/>
+        <xbifns:CPT>
+          <xbifns:dependentParentIndex index="0">0.5</xbifns:dependentParentIndex>
+          <xbifns:dependentParentIndex index="1">0.5</xbifns:dependentParentIndex>
+        </xbifns:CPT>
+      </xbifns:conditionalDistribution>
+      <xbifns:conditionalDistribution type="Discrete">
+        <xbifns:owner name="Entrada1"/>
+        <xbifns:CPT>
+          <xbifns:dependentParentIndex index="0">0.5</xbifns:dependentParentIndex>
+          <xbifns:dependentParentIndex index="1">0.5</xbifns:dependentParentIndex>
+        </xbifns:CPT>
+      </xbifns:conditionalDistribution>
+    </xbifns:conditionalDistributionSet>
+  </xbifns:network>
+</xbifns:XMLBIF>
\ No newline at end of file
index 831425f..fbeea0d 100755 (executable)
@@ -1 +1 @@
-http://200.18.67.61/simdecs2/
+http://localhost:8080/SimDeCS/
\ No newline at end of file