@Override public void setDAG(DynamicDAG dag) { this.dynamicDAG = dag; this.dagTime0=this.dynamicDAG.toDAGTime0(); this.dagTimeT=this.dynamicDAG.toDAGTimeT(); }
/** * Tests if this DynamicDAG contains cycles. * @return a boolean indicating if this DynamicDAG contains cycles (true) or not (false). */ public boolean containCycles() { return this.toDAGTimeT().containCycles() || this.toDAGTime0().containCycles(); }
/** * Returns the Bayesian network at Time 0. * @return a {@link BayesianNetwork} object. */ public BayesianNetwork toBayesianNetworkTime0(){ DAG dagTime0 = this.getDynamicDAG().toDAGTime0(); BayesianNetwork bnTime0 = new BayesianNetwork(dagTime0); for (Variable dynamicVar : this.getDynamicVariables()) { Variable staticVar = dagTime0.getVariables().getVariableByName(dynamicVar.getName()); ConditionalDistribution deepCopy = Serialization.deepCopy(this.getConditionalDistributionTime0(dynamicVar)); deepCopy.setVar(staticVar); List<Variable> newParents = deepCopy.getConditioningVariables().stream().map(var -> dagTime0.getVariables().getVariableByName(var.getName())).collect(Collectors.toList()); deepCopy.setConditioningVariables(newParents); bnTime0.setConditionalDistribution(staticVar,deepCopy); } return bnTime0; }
if (dynamicDAG.toDAGTime0().containCycles() || dynamicDAG.toDAGTimeT().containCycles()) { System.out.println("ERROR: DAG WITH CYCLES"); System.out.println(dynamicDAG.toString());
if (dynamicDAG.toDAGTime0().containCycles() || dynamicDAG.toDAGTimeT().containCycles()) {