コード例 #1
0
ファイル: BeliefBase.cs プロジェクト: jstollznow/BeliefEngine
    private List <Sentence> adjustBeliefBase(Sentence newSentence)
    {
        Sentence        allSentences       = makeBBSet();
        List <Sentence> partialMeetOptions = new List <Sentence>();
        List <int>      order = new List <int>();

        for (int i = 0; i < allSentences.SubSentences.Count; i++)
        {
            order.Add(i);
        }
        List <List <int> > combos = Combos.GetAllCombos(order);

        combos.Reverse();
        foreach (List <int> combo in combos)
        {
            Sentence set = new Sentence(null);
            foreach (int index in combo)
            {
                set.SubSentences.Add(allSentences.SubSentences[index]);
                set.Joins.Add(new Operator("&&"));
            }
            set.Joins.RemoveAt(set.Joins.Count - 1);
            if (partialMeet(set, newSentence))
            {
                set.SubSentences.Add(newSentence);
                set.Joins.Add(new Operator("&&"));
                partialMeetOptions.Add(set);
            }
        }
        return(partialMeetOptions);
    }