Example #1
0
        public List <State> GetResultStates()
        {
            ResultStatesFluents = new List <Hashtable>();
            List <State> result           = new List <State>();
            int          fluentsCount     = fluents.Count;
            int          allPossibilities = (int)Math.Pow(2, fluentsCount);
            int          counter          = 0;

            Fluent[]    allFluents           = new Fluent[fluentsCount];
            Hashtable[] fluentsPossibilities = new Hashtable[allPossibilities];
            Hashtable   fluentsState         = null;

            bool[] state = null;


            foreach (Fluent f in fluents.Keys)
            {
                allFluents[counter] = f;
                counter++;
            }

            Object[] expression = value.ToArray();
            Array.Reverse(expression, 0, expression.Length);

            for (int i = 0; i < allPossibilities; i++)
            {
                state        = Utility.DecimalToBinary(i, fluentsCount);
                fluentsState = new Hashtable();
                for (int j = 0; j < fluentsCount; j++)
                {
                    fluentsState.Add(allFluents[j], state[j]);
                }
                fluentsPossibilities[i] = fluentsState;
                bool b = expressionValue(expression, fluentsState);
                if (b)
                {
                    ResultStatesFluents.Add(fluentsState);
                    List <State> formulaRes = getState(fluentsState);
                    foreach (State resSt in formulaRes)
                    {
                        result.Add(resSt);
                    }
                }
            }

            return(result);
        }
 public FluentResult(Fluent fluentR, Utility.FluentStatus status)
 {
     this.FluentR = fluentR;
     this.Status  = status;
 }
Example #3
0
 public SignedFluent(Fluent FluentValue, bool FluentSign)
 {
     this.FluentSign  = FluentSign;
     this.FluentValue = FluentValue;
 }