Add soft-evidence to the Bayesian network to reason with it.

@param bn
@param nodeName
@param softEvidence
@throws ShanksException
322043
public static void addSoftEvidence(Network bn, String nodeName,
            HashMap<String, Double> softEvidence) throws ShanksException {
        String auxNodeName = softEvidenceNodePrefix + nodeName;
        int targetNode = bn.getNode(nodeName);
        boolean found = false;
        int[] children = bn.getChildren(targetNode);
        for (int child : children) {
            if (bn.getNodeName(child).equals(auxNodeName)) {
                if (bn.getOutcomeCount(child) == 2
                        && bn.getOutcomeId(child, 0).equals(triggerState)) {
                    found = true;
                    break;
                }
            }
        }
        if (!found) {
            // Create soft-evidence node
            bn.addNode(NodeType.Cpt, auxNodeName);
            bn.setNodeName(auxNodeName, auxNodeName);
            int node = bn.getNode(auxNodeName);
            bn.setOutcomeId(node, 0, triggerState);
            bn.setOutcomeId(node, 1, "NON" + triggerState);
            // bn.insertOutcome(auxNode, 0, triggerState);
            // bn.insertOutcome(auxNode, 1, "NON" + triggerState);
            double[] cpt = bn.getNodeDefinition(auxNodeName);
            for (int i = 0; i < cpt.length; i++) {
                cpt[i] = (float) 0.5;
            }

            bn.addArc(targetNode, bn.getNode(auxNodeName));
            cpt = bn.getNodeDefinition(auxNodeName);
            for (int i = 0; i < cpt.length; i++) {
                cpt[i] = (float) 0.5;
            }
        }
        ShanksAgentBayesianReasoningCapability
                .updateSoftEvidenceAuxiliaryNodeCPT(bn, nodeName, softEvidence);
        ShanksAgentBayesianReasoningCapability.addEvidence(bn,
                softEvidenceNodePrefix + nodeName, triggerState);

    }
664047
public synchronized void addEvidence(EvidenceType type, Evidence e) {
        if (null != type) {
            switch (type) {
                case VENDOR:
                    vendors.add(e);
                    break;
                case PRODUCT:
                    products.add(e);
                    break;
                case VERSION:
                    versions.add(e);
                    break;
                default:
                    break;
            }
        }
    }
249659
public static void addEvidences(BayesianReasonerShanksAgent agent,
            HashMap<String, String> evidences) throws ShanksException {
        ShanksAgentBayesianReasoningCapability.addEvidences(
                agent.getBayesianNetwork(), evidences);
    }
707537
public static HashMap<String, HashMap<String, Float>> getAllHypotheses(
            Network bn) throws ShanksException {
        HashMap<String, HashMap<String, Float>> result = new HashMap<String, HashMap<String, Float>>();
        for (int node : bn.getAllNodes()) {
            String nodeName = bn.getNodeName(node);
            HashMap<String, Float> hypotheses = ShanksAgentBayesianReasoningCapability
                    .getNodeStatesHypotheses(bn, nodeName);
            result.put(nodeName, hypotheses);
        }
        return result;
    }
1331575
public void putBbNodefunc(BbListener listener, Object userhandle) throws LpSolveException {
		bbNodeListener = listener;
		bbNodeUserhandle = (listener != null) ? userhandle : null;
		addLp(this);
		registerBbNodefunc();
	}
986946
public static void addEvidence(BayesianReasonerShanksAgent agent,
            String nodeName, String status) throws ShanksException {
        ShanksAgentBayesianReasoningCapability.addEvidence(
                agent.getBayesianNetwork(), nodeName, status);
    }
157939
static Claim claimFromNode(JsonNode node, ObjectReader objectReader) {
        if (node == null || node.isNull() || node.isMissingNode()) {
            return new NullClaim();
        }
        return new JsonNodeClaim(node, objectReader);
    }
797204
public boolean addToCorruptReplicasMap(Block blk, DatanodeDescriptor dn) {
    Collection<DatanodeDescriptor> nodes = getNodes(blk);
    if (nodes == null) {
      nodes = new TreeSet<DatanodeDescriptor>();
      corruptReplicasMap.put(blk, nodes);
    }
    boolean added = false;
    if (!nodes.contains(dn)) {
      added = nodes.add(dn);
      NameNode.stateChangeLog.info("BLOCK NameSystem.addToCorruptReplicasMap: "+
                                   blk.getBlockName() +
                                   " added as corrupt on " + dn.getName() +
                                   " by " + Server.getRemoteIp());
    } else {
      NameNode.stateChangeLog.info("BLOCK NameSystem.addToCorruptReplicasMap: "+
                                   "duplicate requested for " + 
                                   blk.getBlockName() + " to add as corrupt " +
                                   "on " + dn.getName() +
                                   " by " + Server.getRemoteIp());
    }
    return added;
  }
819802
public void addNode(N node)
    {
        if(!nodes.containsKey(node))
            nodes.put(node, new Pair<HashSet<N>, HashSet<N>>(new HashSet<N>(), new HashSet<N>()));
    }
731565
public void heartbeatNode (String nodeName)
    {
        updatePartial(NodeRecord.getKey(nodeName),
                      NodeRecord.LAST_UPDATED, new Timestamp(System.currentTimeMillis()));
    }
151106
public static void addSoftEvidences(BayesianReasonerShanksAgent agent,
            HashMap<String, HashMap<String, Double>> softEvidences)
            throws ShanksException {
        ShanksAgentBayesianReasoningCapability.addSoftEvidences(
                agent.getBayesianNetwork(), softEvidences);
    }
186911
public static HashMap<String, Float> getNodeStatesHypotheses(Network bn,
            String nodeName) throws ShanksException {
        try {
            int node = ShanksAgentBayesianReasoningCapability.getNode(bn,
                    nodeName);
            String[] states = bn.getOutcomeIds(node);
            HashMap<String, Float> result = new HashMap<String, Float>();
            for (int i = 0; i < states.length; i++) {
                String status = states[i];
                Float hypothesis = (float) bn.getNodeValue(node)[i];
                result.put(status, hypothesis);
            }
            return result;
        } catch (Exception e) {
            throw new ShanksException("Problem getting hypotheses from: "
                    + nodeName + " -> Exception message: " + e.getMessage());
        }
    }
100566
private void buildComplexConcept(INode node, List<String> tokensOfNodeLabel, String meaningfulTokens) {
        // label of node
        String token;
        // List of ACoLs identifiers
        List<String> vec = new ArrayList<String>();
        // formula for the complex concept
        StringBuilder formulaOfConcept = new StringBuilder();
        // logical connective
        String connective = " ";
        // brackets to add
        String bracket = "";
        // whether to insert brackets
        boolean insert;
        // how many left brackets do not have corresponding right ones
        int bracketsBalance = 0;
        // number of left brackets
        int leftBrackets = 0;
        // for each token of node label
        for (int i = 0; i < tokensOfNodeLabel.size(); i++) {
            token = (tokensOfNodeLabel.get(i));
            // If logical AND or OR
            if (andWords.contains(" " + token + " ") || orWords.contains(" " + token + " ")) {
                insert = false;
                // If non first token
                if (vec != null && vec.size() > 0) {
                    // construct formula
                    if (connective.isEmpty()) {
                        formulaOfConcept.append(" | ").append(bracket).append(encloseWithParentheses(vec));
                    } else {
                        formulaOfConcept.append(connective).append(bracket).append(encloseWithParentheses(vec));
                    }
                    insert = true;
                    connective = "";
                    bracket = "";
                    vec = new ArrayList<String>();
                    leftBrackets = 0;
                }
                // If bracket
                if (token.equals("(") && bracketsBalance >= 0) {
                    connective = " & ";
                    bracket = "(";
                    bracketsBalance = bracketsBalance + 1;
                    leftBrackets = leftBrackets + 1;
                } else if (token.equals(")") && bracketsBalance > 0) {
                    if (insert) {
                        formulaOfConcept.append(")");
                    }
                    bracketsBalance = bracketsBalance - 1;
                } else {
                    connective = " | ";
                }
                // If logical not
            } else if (notWords.contains(" " + token + " ")) {
                if (vec != null && vec.size() > 0) {
                    formulaOfConcept.append(connective).append(encloseWithParentheses(vec));
                    vec = new ArrayList<String>();
                    connective = "";
                }
                // What to add
                if (connective.contains("&") || connective.contains("|")) {
                    connective = connective + " ~ ";
                } else {
                    connective = " & ~ ";
                }
            } else {
                if (meaningfulTokens.contains(" " + i + " ")) {
                    // fill list with ACoL ids
                    vec.add((node.getNodeData().getId() + "." + i));
                }
            }
        }
        // Dealing with first token of the node
        if (vec != null && vec.size() > 0) {
            //construct formula
            if (connective.contains("&") || connective.contains("|") || connective.equals(" ")) {
                formulaOfConcept.append(connective).append(bracket).append(encloseWithParentheses(vec));
            } else {
                formulaOfConcept.append(" & ").append(encloseWithParentheses(vec));
            }
            connective = "";
        } else {
            if (leftBrackets > 0) {
                bracketsBalance = bracketsBalance - leftBrackets;
            }
        }
        if (bracketsBalance > 0) {
            for (int i = 0; i < bracketsBalance; i++) {
                formulaOfConcept.append(")");
            }
        }
        // dealing with brackets
        String foc = formulaOfConcept.toString();
        foc = foc.replace('[', '(');
        foc = foc.replace(']', ')');
        foc = foc.replaceAll(", ", " & ");
        foc = foc.trim();
        if (foc.startsWith("&")) {
            StringTokenizer atoms = new StringTokenizer(foc, "&");
            foc = atoms.nextToken();
        }
        foc = foc.trim();
        if (foc.startsWith("|")) {
            StringTokenizer atoms = new StringTokenizer(foc, "|");
            foc = atoms.nextToken();
        }
        // bracket counters
        StringTokenizer open = new StringTokenizer(foc, "(", true);
        int openCount = 0;
        while (open.hasMoreTokens()) {
            String tmp = open.nextToken();
            if (tmp.equals("(")) {
                openCount++;
            }
        }
        StringTokenizer closed = new StringTokenizer(foc, ")", true);
        while (closed.hasMoreTokens()) {
            String tmp = closed.nextToken();
            if (tmp.equals(")")) {
                openCount--;
            }
        }
        formulaOfConcept = new StringBuilder(foc);
        if (openCount > 0) {
            for (int par = 0; par < openCount; par++) {
                formulaOfConcept.append(")");
            }
        }
        if (openCount < 0) {
            for (int par = 0; par < openCount; par++) {
                formulaOfConcept.insert(0, "(");
            }
        }
        // assign formula to the node
        node.getNodeData().setcLabFormula(formulaOfConcept.toString());
    }
949132
public void buildDefaultValueInfo(XMLNode node, Content annotationDocTree) {
        ((AnnotationTypeOptionalMemberWriter) writer).addDefaultValueInfo(currentMember,
                annotationDocTree);
    }
591562
@Override
	public boolean add(P polyline, double precision, OutputParameter<P> firstNeighbour, OutputParameter<P> secondNeighbour) {
		assert firstNeighbour != null;
		assert secondNeighbour != null;
		final OutputParameter<GISTreeSetNode<P>> insertionNode = new OutputParameter<>();
		GISTreeSetNode<P> node = null;
		if (ComplexInsertionNodeSelector.computeConnectableInsertion(
				getTree(),
				polyline,
				precision,
				insertionNode, firstNeighbour, secondNeighbour)) {
			node = insertionNode.get();
		} else {
			return false;
		}

		return GISTreeSetUtil.addInside(this, node, polyline, this);
	}
1374442
public static void addEvidences(ProbabilisticNetwork bn,
            Map<String, String> evidences) throws ShanksException {
        for (Entry<String, String> evidence : evidences.entrySet()) {
            ShanksAgentBayesianReasoningCapability.addEvidence(bn,
                    evidence.getKey(), evidence.getValue());
        }
    }
84950
public void setProbability(int i, double v) { 
    if (TopicDistribution_Type.featOkTst && ((TopicDistribution_Type)jcasType).casFeat_probability == null)
      jcasType.jcas.throwFeatMissing("probability", "ch.epfl.bbp.uima.types.TopicDistribution");
    jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((TopicDistribution_Type)jcasType).casFeatCode_probability), i);
    jcasType.ll_cas.ll_setDoubleArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((TopicDistribution_Type)jcasType).casFeatCode_probability), i, v);}