public void setDistributionList(List<EF_ConditionalDistribution> distributionList_) {

    distributionList = distributionList_;

    sizeSS = 0;
    for (EF_ConditionalDistribution ef_dist : distributionList) {
      sizeSS += ef_dist.sizeOfSufficientStatistics();
    }

    CompoundVector vectorNatural = this.createEmtpyCompoundVector();

    for (EF_ConditionalDistribution dist : distributionList) {
      vectorNatural.setVectorByPosition(dist.getVariable().getVarID(), dist.getNaturalParameters());
    }
    this.naturalParameters = vectorNatural;
    this.momentParameters = null;
  }
  public boolean equal_efBN(EF_BayesianNetwork ef_bayesianNetwork, double threshold) {

    for (EF_ConditionalDistribution this_dist : this.getDistributionList()) {
      EF_ConditionalDistribution ef_dist =
          ef_bayesianNetwork.getDistribution(this_dist.getVariable());
      if (!this_dist.getClass().getName().equals(ef_dist.getClass().getName())) return false;
      List<Variable> this_Vars = this_dist.getConditioningVariables();
      List<Variable> ef_Vars = ef_dist.getConditioningVariables();
      if (this_Vars.size() != ef_Vars.size()) return false;
      for (Variable var : this_Vars) {
        if (!ef_Vars.contains(var)) return false;
      }
    }

    return this.getNaturalParameters()
        .equalsVector(ef_bayesianNetwork.getNaturalParameters(), threshold);
  }
  public EF_BayesianNetwork(BayesianNetwork network) {
    distributionList = new ArrayList(network.getNumberOfVars());

    sizeSS = 0;
    for (ConditionalDistribution dist : network.getConditionalDistributions()) {
      EF_ConditionalDistribution ef_dist = dist.toEFConditionalDistribution();
      distributionList.add(ef_dist.getVariable().getVarID(), ef_dist);
      sizeSS += ef_dist.sizeOfSufficientStatistics();
    }

    CompoundVector vectorNatural = this.createEmtpyCompoundVector();

    for (EF_ConditionalDistribution dist : distributionList) {
      vectorNatural.setVectorByPosition(dist.getVariable().getVarID(), dist.getNaturalParameters());
    }
    this.naturalParameters = vectorNatural;
    this.momentParameters = null;
  }
  public EF_BayesianNetwork(List<ParentSet> parentSets) {
    distributionList = new ArrayList(parentSets.size());

    sizeSS = 0;
    for (ParentSet parentSet : parentSets) {
      // ConditionalDistribution dist =
      // parentSet.getMainVar().newConditionalDistribution(parentSet.getParents());
      // dist.randomInitialization(new Random(0));
      EF_ConditionalDistribution ef_dist =
          parentSet
              .getMainVar()
              .getDistributionType()
              .newEFConditionalDistribution(parentSet.getParents());
      distributionList.add(ef_dist.getVariable().getVarID(), ef_dist);
      sizeSS += ef_dist.sizeOfSufficientStatistics();
    }
    CompoundVector vectorNatural = this.createEmtpyCompoundVector();

    for (EF_ConditionalDistribution dist : distributionList) {
      vectorNatural.setVectorByPosition(dist.getVariable().getVarID(), dist.getNaturalParameters());
    }
    this.naturalParameters = vectorNatural;
    this.momentParameters = null;
  }