public void AddInitialStateFormula(CompoundFormula cf) { if (false && !cf.IsSimpleFormula()) { CompoundFormula cfCNF = (CompoundFormula)cf.ToCNF(); foreach (CompoundFormula cfSub in cfCNF.Operands) AddInitialStateFormula(cfSub); return; } m_lOriginalHiddenFormulas.Add(cf); m_lHiddenFormulas.Add((CompoundFormula)cf); EfficientFormula ef = new EfficientFormula(cf.Operator); ef.OriginalFormula = cf; m_lEfficientHidden.Add(ef); HashSet<Predicate> lHidden = cf.GetAllPredicates(); foreach (Predicate p in lHidden) { GroundedPredicate pCanonical = (GroundedPredicate)p.Canonical(); if (!Unknown.Contains(pCanonical)) Unknown.Add(pCanonical); if (!m_dMapPredicatesToFormulas.ContainsKey(pCanonical)) { m_dMapPredicatesToFormulas[pCanonical] = new List<int>(); int iIndex = m_dMapIndexToPredicate.Count; m_dMapIndexToPredicate.Add(pCanonical); m_dMapPredicatesToIndexes[pCanonical] = iIndex; m_dMapPredicateToEfficientFormula.Add(new List<int>()); } int iPredicate = m_dMapPredicatesToIndexes[pCanonical]; ef.SetVariableValue(iPredicate, !p.Negation); m_dMapPredicateToEfficientFormula[iPredicate].Add(m_lEfficientHidden.Count - 1); m_dMapPredicatesToFormulas[pCanonical].Add(m_lHiddenFormulas.Count - 1); } m_cfCNFHiddenState.AddOperand(cf); if (!cf.IsSimpleConjunction() && !cf.IsSimpleOneOf() && SDRPlanner.EnforceCNF) { m_cfCNFHiddenState = (CompoundFormula)m_cfCNFHiddenState.ToCNF(); } }