/// <summary> /// Visits and handles the effect. /// </summary> /// <param name="effect">Effect.</param> public void Visit(NumericAssignEffect effect) { IAtom groundedFunctionAtom = GroundingManager.GroundAtomDeep(effect.FunctionAtom, Substitution, State); double value = NumericEvaluator.Value.Evaluate(effect.Value, Substitution, State); effect.ApplyAssignOperation(State, groundedFunctionAtom, value); }
/// <summary> /// Visits the given input data node. /// </summary> /// <param name="data">Input data node.</param> public override void PostVisit(InputData.PDDL.NumericAssignEffect data) { int functionNameId = IdManager.Functions.GetId(data.Function.Name, data.Function.Terms.Count); List <ITerm> terms = new List <ITerm>(); data.Function.Terms.ForEach(term => terms.Add(TermsBuilder.Value.Build(term))); NumericExpressionsBuilder numericExpressionsBuilder = new NumericExpressionsBuilder(IdManager); INumericExpression valueExpression = numericExpressionsBuilder.Build(data.Value); IAtom functionAtom = new Atom(functionNameId, terms); IEffect newEffect = null; switch (data.AssignOperator) { case InputData.PDDL.Traits.AssignOperator.ASSIGN: { newEffect = new NumericAssignEffect(functionAtom, valueExpression, IdManager); break; } case InputData.PDDL.Traits.AssignOperator.INCREASE: { newEffect = new NumericIncreaseEffect(functionAtom, valueExpression, IdManager); break; } case InputData.PDDL.Traits.AssignOperator.DECREASE: { newEffect = new NumericDecreaseEffect(functionAtom, valueExpression, IdManager); break; } case InputData.PDDL.Traits.AssignOperator.SCALE_UP: { newEffect = new NumericScaleUpEffect(functionAtom, valueExpression, IdManager); break; } case InputData.PDDL.Traits.AssignOperator.SCALE_DOWN: { newEffect = new NumericScaleDownEffect(functionAtom, valueExpression, IdManager); break; } default: { Debug.Assert(false); break; } } EffectsStack.Push(newEffect); }
/// <summary> /// Visits and handles the effect. /// </summary> /// <param name="effect">Effect.</param> public void Visit(NumericAssignEffect effect) { }
/// <summary> /// Visits and handles the effect. /// </summary> /// <param name="effect">Effect.</param> public void Visit(NumericAssignEffect effect) { NumericFunctionAssignmentEffects.Add(effect); }