private Action GetRevealedDependencyParameterizedAction()
        {
            ParametrizedAction revealDependencyParameterized = new ParametrizedAction("reveal-dependency");
            Parameter          agentParameter      = GetAgentParameter();
            Parameter          dependencyParameter = GetDependencyParameter();

            revealDependencyParameterized.AddParameter(agentParameter);
            revealDependencyParameterized.AddParameter(dependencyParameter);

            CompoundFormula preconditions = new CompoundFormula("and");
            CompoundFormula effects       = new CompoundFormula("and");

            ParametrizedPredicate revealedSomething  = GetParameterizedRevealedSomething();
            ParametrizedPredicate revealedDependency = GetParameterizedRevealed();
            ParametrizedPredicate belongsTo          = GetParameterizedBelongsTo();

            Predicate notRevealedSomething  = revealedSomething.Negate();
            Predicate notRevealedDependency = revealedDependency.Negate();

            preconditions.AddOperand(notRevealedSomething);
            preconditions.AddOperand(notRevealedDependency);
            preconditions.AddOperand(belongsTo);

            effects.AddOperand(revealedSomething);
            effects.AddOperand(revealedDependency);

            revealDependencyParameterized.Preconditions = preconditions;
            revealDependencyParameterized.SetEffects(effects);

            return(revealDependencyParameterized);
        }
        /*
         * private List<Action> GetRevealedDummyDependencyActions(List<Agent> m_agents)
         * {
         *  List<Action> actions = new List<Action>();
         *  foreach(Agent agent in m_agents)
         *  {
         *      int amountOfDependencies = amountOfAgentDependencies[agent];
         *      if (amountOfDependencies < maxDependenciesOfAgent) //only do this dummy action for agents which don't have the max dependencies amount, so they will not stuck the other agents who want to reveal a dependency...
         *          actions.Add(GetRevealedDummyDependencyAction(agent));
         *  }
         *
         *  return actions;
         * }
         */
        /*
         * private Action GetRevealedDummyDependencyAction(Agent agent)
         * {
         *  Constant a = mapAgentToConstant[agent];
         *  Action dummyAction = new Action("reveal-dummy-dependency_" + a.Name);
         *
         *  CompoundFormula preconditions = new CompoundFormula("and");
         *
         *  GroundedFunctionPredicate amountOfDepRevGrounded = GetAmountOfDependenciesRevealedGrounded(a);
         *  GroundedFunctionPredicate equalsToMax = GetEqualsToMaxGrounded(amountOfDepRevGrounded);
         *  Predicate notEqualsToMax = equalsToMax.Negate();
         *
         *  GroundedFunctionPredicate increaseAmountOfDepRev = GetIncreaseAmountOfDependenciesRevealedGrounded(amountOfDepRevGrounded);
         *  //GroundedPredicate revealedSomething = new GroundedPredicate("revealed-something");
         *  //revealedSomething.AddConstant(a);
         *
         *  //Predicate notRevealedSomething = revealedSomething.Negate();
         *
         *  preconditions.AddOperand(notEqualsToMax);
         *  PredicateFormula effects = new PredicateFormula(increaseAmountOfDepRev);
         *
         *  foreach (Dependency dependency in agentsDependencies[agent])
         *  {
         *      GroundedPredicate revealedDependency = new GroundedPredicate("revealed");
         *      Constant d = mapDependencyToConstant[dependency];
         *      revealedDependency.AddConstant(d);
         *
         *      preconditions.AddOperand(revealedDependency);
         *  }
         *
         *  dummyAction.Preconditions = preconditions;
         *  dummyAction.SetEffects(effects);
         *
         *  return dummyAction;
         * }
         */
        /*
         * private Action GetResetDependenciesRevealedAction(GroundedFunctionPredicate totalCostFunctionPredicate)
         * {
         *  Action resetDependenciesRevealed = new Action(resetDependenciesActionName);
         *
         *  CompoundFormula preconditions = new CompoundFormula("and");
         *  CompoundFormula effects = new CompoundFormula("and");
         *
         *  foreach(Constant agent in agentsConstants)
         *  {
         *      GroundedPredicate revealedSomething = new GroundedPredicate("revealed-something");
         *      revealedSomething.AddConstant(agent);
         *
         *      Predicate notRevealedSomething = revealedSomething.Negate();
         *
         *      preconditions.AddOperand(revealedSomething);
         *      effects.AddOperand(notRevealedSomething);
         *  }
         *
         *  effects.AddOperand(GetIncreaseTotalCostFunction(totalCostFunctionPredicate, revealedDependencyCost));
         *
         *  resetDependenciesRevealed.Preconditions = preconditions;
         *  resetDependenciesRevealed.SetEffects(effects);
         *
         *  return resetDependenciesRevealed;
         * }
         */
        private Action GetRevealedDependencyParameterizedAction()
        {
            ParametrizedAction revealDependencyParameterized = new ParametrizedAction("reveal-dependency");
            Parameter          agentParameter      = GetAgentParameter();
            Parameter          dependencyParameter = GetDependencyParameter();
            Parameter          num1Parameter       = GetNum1Parameter();
            Parameter          num2Parameter       = GetNum2Parameter();

            revealDependencyParameterized.AddParameter(agentParameter);
            revealDependencyParameterized.AddParameter(dependencyParameter);
            revealDependencyParameterized.AddParameter(num1Parameter);
            revealDependencyParameterized.AddParameter(num2Parameter);

            CompoundFormula preconditions = new CompoundFormula("and");
            CompoundFormula effects       = new CompoundFormula("and");

            ParametrizedPredicate nextN1N2 = GetParameterizedNext(num1Parameter, num2Parameter);
            ParametrizedPredicate revealedNumberOfDependenciesN1 = GetParameterizedRevealedNumberOfDependencies(agentParameter, num1Parameter);
            ParametrizedPredicate revealedNumberOfDependenciesN2 = GetParameterizedRevealedNumberOfDependencies(agentParameter, num2Parameter);

            //ParametrizedPredicate revealedSomething = GetParameterizedRevealedSomething();
            ParametrizedPredicate revealedDependency = GetParameterizedRevealed();
            ParametrizedPredicate belongsTo          = GetParameterizedBelongsTo();

            Predicate NotRevealedNumberOfDependenciesN1 = revealedNumberOfDependenciesN1.Negate();

            //Predicate notRevealedSomething = revealedSomething.Negate();
            //Predicate notRevealedDependency = revealedDependency.Negate();

            preconditions.AddOperand(nextN1N2);
            preconditions.AddOperand(revealedNumberOfDependenciesN1);
            //preconditions.AddOperand(notRevealedSomething);
            //preconditions.AddOperand(notRevealedDependency);
            preconditions.AddOperand(belongsTo);

            //effects.AddOperand(revealedSomething);
            effects.AddOperand(revealedDependency);
            if (limitingTheNumberOfDependenciesToBeRevealed)
            {
                effects.AddOperand(NotRevealedNumberOfDependenciesN1);
                effects.AddOperand(revealedNumberOfDependenciesN2);
            }

            revealDependencyParameterized.Preconditions = preconditions;
            revealDependencyParameterized.SetEffects(effects);

            return(revealDependencyParameterized);
        }
コード例 #3
0
        private Action GetStartGoingSoloParameterizedAction()
        {
            ParametrizedAction startGoingSoloParameterized = new ParametrizedAction("start-going-solo");
            Parameter          agentParameter = GetAgentParameter();

            startGoingSoloParameterized.AddParameter(agentParameter);
            ParametrizedPredicate inJoinedStage = GetParameterizedInJoinedStagePredicate();
            ParametrizedPredicate goingSolo     = GetParameterizedGoingSoloPredicate();

            Predicate notInJoinedStage = inJoinedStage.Negate();

            PredicateFormula preconditions = new PredicateFormula(inJoinedStage);
            CompoundFormula  effects       = new CompoundFormula("and");

            effects.AddOperand(goingSolo);
            effects.AddOperand(notInJoinedStage);

            startGoingSoloParameterized.Preconditions = preconditions;
            startGoingSoloParameterized.SetEffects(effects);

            return(startGoingSoloParameterized);
        }