Example #1
0
        /**
         * Resets the wave to it's original state
         */
        public Resolution Clear()
        {
            wave = new Wave(frequencies.Length, indexCount);

            if (backtrack)
            {
                backtrackItems        = new Deque <IndexPatternItem>();
                backtrackItemsLengths = new Deque <int>();
                backtrackItemsLengths.Push(0);
                prevChoices = new Deque <IndexPatternItem>();
            }

            status        = Resolution.Undecided;
            this.trackers = new List <ITracker>();
            pickHeuristic = pickHeuristicFactory(this);

            patternModelConstraint.Clear();

            if (status == Resolution.Contradiction)
            {
                return(status);
            }

            InitConstraints();

            return(status);
        }
Example #2
0
 internal IPickHeuristic GetHeuristic(
     IRandomPicker randomPicker,
     Func <double> randomDouble,
     TilePropagator propagator,
     TileModelMapping tileModelMapping,
     IPickHeuristic fallbackHeuristic)
 {
     return(new FollowPathHeuristic(
                randomPicker, randomDouble, propagator, tileModelMapping, fallbackHeuristic, this));
 }
 public FollowPathHeuristic(
     IRandomPicker randomPicker,
     Func <double> randomDouble,
     TilePropagator propagator,
     TileModelMapping tileModelMapping,
     IPickHeuristic fallbackHeuristic,
     EdgedPathView edgedPathView)
 {
     this.randomPicker      = randomPicker;
     this.randomDouble      = randomDouble;
     this.propagator        = propagator;
     this.tileModelMapping  = tileModelMapping;
     this.fallbackHeuristic = fallbackHeuristic;
     this.edgedPathView     = edgedPathView;
 }
 internal IPickHeuristic GetHeuristic(
     IRandomPicker randomPicker,
     Func <double> randomDouble,
     TilePropagator propagator,
     TileModelMapping tileModelMapping,
     IPickHeuristic fallbackHeuristic)
 {
     pathView        = PathSpec.MakeView(propagator);
     pathViewIsFresh = true;
     if (pathView is EdgedPathView epv)
     {
         return(new FollowPathHeuristic(
                    randomPicker, randomDouble, propagator, tileModelMapping, fallbackHeuristic, epv));
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Example #5
0
        /**
         * Resets the wave to it's original state
         */
        public Resolution Clear()
        {
            wave = new Wave(frequencies.Length, indexCount);

            if (backtrack)
            {
                backtrackItems        = new Deque <IndexPatternItem>();
                backtrackItemsLengths = new Deque <int>();
                backtrackItemsLengths.Push(0);
                prevChoices = new Deque <IndexPatternItem>();
            }

            status        = Resolution.Undecided;
            this.trackers = new List <ITracker>();
            if (frequencySets != null)
            {
                var entropyTracker = new ArrayPriorityEntropyTracker(wave, frequencySets, topology.Mask);
                entropyTracker.Reset();
                AddTracker(entropyTracker);
                pickHeuristic = new ArrayPriorityEntropyHeuristic(entropyTracker, randomDouble);
            }
            else
            {
                var entropyTracker = new EntropyTracker(wave, frequencies, topology.Mask);
                entropyTracker.Reset();
                AddTracker(entropyTracker);
                pickHeuristic = new EntropyHeuristic(entropyTracker, randomDouble);
            }

            patternModelConstraint.Clear();

            if (status == Resolution.Contradiction)
            {
                return(status);
            }

            InitConstraints();

            return(status);
        }