Package org.integratedmodelling.riskwiz.pt.map

Examples of org.integratedmodelling.riskwiz.pt.map.FMarginalizationMap


        for (BNNode node : bNNodes) {
            if (node.isNature() || node.isDecision()) {
                ClusterBundle cbundle = clusterHash.get(node);
                SJTVertex jtcluster = cbundle.jtcluster;
                FMarginalizationMap mfmap = cbundle.mfmap;
                PT likelihood = new PT(mfmap.getProjectionDomainProduct());

                PT.marginalizeDomainsFast(likelihood,
                        jtcluster.getPotential().getProbabilityPotential(),
                        mfmap);
                likelihood.normalize();
View Full Code Here


            if (node.isNature()) {
        
                JTPotential clusterPT = parentCluster.getPotential();
                PT nodePT = node.getDiscreteCPT();
                FastMap2 fmap = clusterPT.createSubtableFastMap(nodePT);
                FMarginalizationMap mfmap = clusterPT.createFMarginalizationMap(
                        node.getDiscretizedDomain());
                FastMap2 liklihoodfmap = clusterPT.createSubtableFastMap(
                        DomainFactory.createDomainProduct(
                                node.getDiscretizedDomain()));

                clusterHash.put(node,
                        new ClusterBundle(parentCluster, fmap, mfmap,
                        liklihoodfmap));
            } else if (node.isUtility()) {
                JTPotential clusterPT = parentCluster.getPotential();
                Vector<DiscreteDomain> parentDomains = node.getDiscreteCPT().getParentsDomains();
                FastMap2 fmap = clusterPT.createSubtableFastMap(parentDomains);
                FMarginalizationMap mfmap = clusterPT.createFMarginalizationMap(
                        node.getDiscreteCPT().getParentsDomains());

                clusterHash.put(node,
                        new ClusterBundle(parentCluster, fmap, mfmap, null));
            }
View Full Code Here

                domsSet.add(first.getDiscretizedDomain());
                marginals.remove(first);
            }
            if (!domsSet.isEmpty()) {
        
                FMarginalizationMap mmap = new FMarginalizationMap(
                        currentDomainProduct, domsSet);

                rootMmaps.add(mmap);
                currentDomainProduct.removeAll(domsSet);
            }
View Full Code Here

        return new FastMap2(this.domainProduct, domainProduct);
    }

    public FMarginalizationMap createFMarginalizationMap(
            DiscreteDomain dom) {
        return new FMarginalizationMap(this.domainProduct, dom);
    }
View Full Code Here

        return new FMarginalizationMap(this.domainProduct, dom);
    }

    public FMarginalizationMap createFMarginalizationMap(
            Vector<DiscreteDomain> doms) {
        return new FMarginalizationMap(this.domainProduct, doms);
    }
View Full Code Here

        Vector<DiscreteDomain> parentDomains = new Vector<DiscreteDomain>();

        parentDomains.addAll(pt.getDomainProduct());
        parentDomains.remove(dom);
   
        FMarginalizationMap mdmap = new FMarginalizationMap(
                pt.getDomainProduct(), parentDomains);

        // Vector <DiscreteDomain> domProduct=pt.getDomainProduct();
        // System.out.println();
        // for (DiscreteDomain domain : domProduct) {
        // System.out.print (dom.getName()+", ");
        // }
        // System.out.println();

        Vector<DiscreteDomain> projectionDomainProduct = mdmap.getProjectionDomainProduct();
        PT probPotential = new PT(projectionDomainProduct);
        PT utilPotential = new PT(projectionDomainProduct);

        System.out.println(
                "Utility Potential:\n" + pt.getUtilityPotential().toString()
                + "\n");

        CPT policy = new CPT(dom, parentDomains);

        policy.setAll(0);
   
        PT weightedUtil = PT.multiplySimTables(pt.getUtilityPotential(),
                pt.getProbabilityPotential());

        if (probPotential.isSingleValue) {
            int[] fiber = new int[] { -1 };
            int[] maxReference = weightedUtil.getMaxReference(fiber);
            double probScalar = pt.getProbabilityPotential().getValue(
                    maxReference);

            probPotential.setScalarValue(probScalar);
     
            utilPotential.setScalarValue(
                    weightedUtil.getValue(maxReference) / probScalar);
            policy.setValue(maxReference, 1);

        } else {
     
            int[] productStructureIterator = utilPotential.index2addr(0);
            boolean done = false;

            while (!done) {
                int[] fiber = mdmap.getFiber(productStructureIterator);
                int[] maxReference = weightedUtil.getMaxReference(fiber);
                double probVal = pt.getProbabilityPotential().getValue(
                        maxReference);

                probPotential.setValue(productStructureIterator, probVal);
View Full Code Here

TOP

Related Classes of org.integratedmodelling.riskwiz.pt.map.FMarginalizationMap

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.