Пример #1
0
        public Unit Execute(ProblemOccurrence po)
        {
            var alternatives = po.Alternatives(Repo.GetElement).Select(oo =>
            {
                oo.State = SolutionSpace.OptionState.Neglected;
                Repo.PropagateChanges(oo);
                return(oo);
            });

            po.State = po.DeduceState(alternatives);
            Repo.PropagateChanges(po);

            return(Unit.Instance);
        }
Пример #2
0
        public R Execute(OptionOccurrence oo)
        {
            oo.State = SolutionSpace.OptionState.Chosen;
            Repo.PropagateChanges(oo);

            (from po in oo.AssociatedProblemOccurrences(Repo.GetElement)
             from otherOo in po.Alternatives(Repo.GetElement)
             where !oo.Equals(otherOo)
             select otherOo).ForEach(otherOo =>
            {
                if (otherOo.State != SolutionSpace.OptionState.Chosen && otherOo.State != SolutionSpace.OptionState.Neglected)
                {
                    otherOo.State = SolutionSpace.OptionState.Neglected;
                    Repo.PropagateChanges(otherOo);
                }
            });

            return(UpdateProblemOccurrenceState.Execute(oo));
        }