public static void addEvidence(Network bn, String nodeName, String status)
            throws ShanksException {

        if (bn == null || nodeName == null || status == null) {
            throw new ShanksException("Null parameter in addEvidence method.");
        }
        try {
            if (!bn.isPropagatedEvidence(nodeName)) {
                if (bn.isRealEvidence(nodeName)) {
                    bn.clearEvidence(nodeName);
                }
                bn.setEvidence(nodeName, status);
                bn.updateBeliefs();
            }
        } catch (Exception e) {
            bn.updateBeliefs();
            HashMap<String, Float> belief = ShanksAgentBayesianReasoningCapability
                    .getNodeStatesHypotheses(bn, nodeName);

            String msg = e.getMessage() + " -> values for node: " + nodeName
                    + " -> ";
            boolean zeroBel = false;
            for (Entry<String, Float> entry : belief.entrySet()) {
                if (status.equals(entry.getKey()) && entry.getValue() == 0.0f) {
                    zeroBel = true;
                    // Impossible value calculated by inference (this is because the BN is a big shit...
                    // But it is not a real error...
                    break;
                }
                msg = msg + entry.getKey() + "-" + entry.getValue() + " ";
            }
            if (!zeroBel) {
                throw new ShanksException(msg);
            }
        }
    }
public static void addEvidence ( Network bn , String nodeName , String status ) throws ShanksException { if ( bn == null || nodeName == null || status == null ) { throw new ShanksException ( "Null parameter in addEvidence method." ) ; } try { if ( ! bn . isPropagatedEvidence ( nodeName ) ) { if ( bn . isRealEvidence ( nodeName ) ) { bn . clearEvidence ( nodeName ) ; } bn . setEvidence ( nodeName , status ) ; bn . updateBeliefs ( ) ; } } catch ( Exception e ) { bn . updateBeliefs ( ) ; HashMap < String , Float > belief = ShanksAgentBayesianReasoningCapability . getNodeStatesHypotheses ( bn , nodeName ) ; String msg = e . getMessage ( ) + " -> values for node: " + nodeName + " -> " ; boolean zeroBel = false ; for ( Entry < String , Float > entry : belief . entrySet ( ) ) { if ( status . equals ( entry . getKey ( ) ) && entry . getValue ( ) == 0.0f ) { zeroBel = true ; break ; } msg = msg + entry . getKey ( ) + "-" + entry . getValue ( ) + " " ; } if ( ! zeroBel ) { throw new ShanksException ( msg ) ; } } }
Add information to the Bayesian network to reason with it.

@param bn
@param nodeName
@param status
@throws ShanksException