Package org.integratedmodelling.riskwiz.domain

Examples of org.integratedmodelling.riskwiz.domain.DiscreteDomain


        int[] query = new int[projectionToNodeSpace.length];
   
        Vector<DiscreteDomain> domainProduct = node.getDiscreteCPT().getDomainProduct();

        for (int i = 0; i < query.length; i++) {
            DiscreteDomain dom = domainProduct.get(i);

            query[i] = dom.findState(projectionToNodeSpace[i]);
        }
        return query;
    }
View Full Code Here


               
                w.write("\">" + ln)
                w.write(
                        "         <NAME>" + IOUtil.mangleXMLString(nodeName)
                        + "</NAME>" + ln)
                DiscreteDomain domain = (DiscreteDomain) node.getDomain();
                
                if (!node.isUtility()) {             
                 
                    Vector<String> values = domain.getStates();

                    // valueCache.put(nodeName, values);
                    for (Iterator j = values.iterator(); j.hasNext();) {
                        w.write(
                                "        <OUTCOME>"
                                        + IOUtil.mangleXMLString(
                                                j.next().toString())
                                                + "</OUTCOME>"
                                                + ln)
                    }
                }
                Object o = node.getProperty("position")

                if (o instanceof List) { // implies o != null
                    String posString = null;

                    try {
                        Double xpos = (Double) ((List) o).get(0);
                        Double ypos = (Double) ((List) o).get(1);

                        posString = "(" + Math.round(xpos.doubleValue()) + ", "
                                + Math.round(ypos.doubleValue()) + ")"

                    } catch (Exception e) {}
                    if (posString != null) {
                        w.write(
                                "        <PROPERTY> position = " + posString
                                + " </PROPERTY>" + ln);
                   
                }
                w.write("      </VARIABLE>" + ln)
            }

            // Dump out the CPTs
            w.write("      <!-- Probability Distributions -->" + ln)
            for (Iterator i = nodes.iterator(); i.hasNext();) {
                BNNode node = (BNNode) i.next();

                if (node.isDecision()) {
                    continue;
                } // Decision nodes doesn't have CPT, so skip.

                String nodeName = node.getName();

                w.write("      <DEFINITION>" + ln); // $NON-NLS-1$
                w.write(
                        "        <FOR>" + IOUtil.mangleXMLString(nodeName)
                        + "</FOR>" + ln)
                Vector<DiscreteDomain> parentDomains = ((TabularFunction) node.getFunction()).getParentsDomains();            
               
                for (Iterator j = parentDomains.iterator(); j.hasNext();) {
                    DiscreteDomain parentDom = (DiscreteDomain) j.next();
                    String parentName = parentDom.getName();

                    w.write(
                            "        <GIVEN>"
                                    + IOUtil.mangleXMLString(parentName)
                                    + "</GIVEN>" + ln)
View Full Code Here

        throws IOException {
        w.write("         <parents>");
        Vector<DiscreteDomain> parentDomains = ((TabularFunction) node.getFunction()).getParentsDomains();

        for (Iterator j = parentDomains.iterator(); j.hasNext();) {
            DiscreteDomain parentDom = (DiscreteDomain) j.next();
            String parentName = parentDom.getName();

            w.write(IOUtil.mangleXMLString(parentName));
            if (j.hasNext()) {
                w.write(" ");
            }
View Full Code Here

        domainProduct = new Vector<DiscreteDomain>();
   
        domainProduct.addAll(first);
   
        for (Iterator iter = second.iterator(); iter.hasNext();) {
            DiscreteDomain domain = (DiscreteDomain) iter.next();

            // TODO attention! check for possible error
            if (!domainProduct.contains(domain)) {
                domainProduct.add(domain);
            }
View Full Code Here

        return new DT(dom);
    }
 
    public static CPT createCPT(String name, int order) {
        DiscreteDomain dom = new DiscreteDomain(name, order);

        return new CPT(dom, null);
    }
View Full Code Here

        return new CPT(dom, null);
    }
 
    public static DT createDT(String name, int order) {
        DiscreteDomain dom = new DiscreteDomain(name, order);

        return new DT(dom);
    }
View Full Code Here

        Vector<String> bifArray = new Vector<String>();
        TabularDetF cpf = (TabularDetF) node.getFunction();

        if (node.getDomType() == DomainType.labels
                || node.getDomType() == DomainType.intervals) {
            DiscreteDomain dom = (DiscreteDomain) cpf.getDomain();

            for (int i = 0; i < expressions.length; i++) {

                String token = expressions[i].trim();
View Full Code Here

  public void print(Vector<DiscreteDomain> domainProduct, int[] aref,
            Node  value) {
        String printEntry = "\nP(";

        for (int i = 0; i < domainProduct.size(); i++) {
            DiscreteDomain dom = domainProduct.elementAt(i);
            String domName = dom.getName();

            printEntry += " " + dom.getName() + "=" + dom.getState(aref[i]);
            if (i == 0 && domainProduct.size() > 1) {
                printEntry += " |";
            } else if (i < aref.length - 1) {
                printEntry += ",";
            }
View Full Code Here

  public void print(Vector<DiscreteDomain> domainProduct, int[] aref,
            double value) {
        String printEntry = "\nP(";

        for (int i = 0; i < aref.length; i++) {
            DiscreteDomain dom = domainProduct.elementAt(i);
            String domName = dom.getName();

            printEntry += " " + dom.getName() + "=" + dom.getState(aref[i]);
            if (i < aref.length - 1) {
                printEntry += ",";
            }
        }
        printEntry += ")= " + String.valueOf(value);
View Full Code Here

  public void print(Vector<DiscreteDomain> domainProduct, int[] aref,
            Node value) {
        String printEntry = "\nP(";

        for (int i = 0; i < aref.length; i++) {
            DiscreteDomain dom = domainProduct.elementAt(i);
            String domName = dom.getName();

            printEntry += " " + dom.getName() + "=" + dom.getState(aref[i]);
            if (i < aref.length - 1) {
                printEntry += ",";
            }
        }
        printEntry += ")= " + RT.toString(value);
View Full Code Here

TOP

Related Classes of org.integratedmodelling.riskwiz.domain.DiscreteDomain

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.