Esempio n. 1
0
        public WavePropagator(
            PatternModel model,
            ITopology topology,
            int backtrackDepth            = 0,
            IWaveConstraint[] constraints = null,
            Func <double> randomDouble    = null,
            FrequencySet[] frequencySets  = null,
            bool clear = true)
        {
            this.patternCount = model.PatternCount;
            this.frequencies  = model.Frequencies;

            this.indexCount     = topology.IndexCount;
            this.backtrack      = backtrackDepth != 0;
            this.backtrackDepth = backtrackDepth;
            this.constraints    = constraints ?? new IWaveConstraint[0];
            this.topology       = topology;
            this.randomDouble   = randomDouble ?? new Random().NextDouble;
            this.frequencySets  = frequencySets;
            directionsCount     = topology.DirectionsCount;

            patternModelConstraint = new PatternModelConstraint(this, model);

            if (clear)
            {
                Clear();
            }
        }
Esempio n. 2
0
        public WavePropagator(
            PatternModel model,
            ITopology topology,
            int backtrackDepth            = 0,
            IWaveConstraint[] constraints = null,
            Func <double> randomDouble    = null,
            Func <WavePropagator, IPickHeuristic> pickHeuristicFactory = null,
            bool clear = true)
        {
            this.patternCount = model.PatternCount;
            this.frequencies  = model.Frequencies;

            this.indexCount           = topology.IndexCount;
            this.backtrack            = backtrackDepth != 0;
            this.backtrackDepth       = backtrackDepth;
            this.constraints          = constraints ?? new IWaveConstraint[0];
            this.topology             = topology;
            this.randomDouble         = randomDouble ?? new Random().NextDouble;
            directionsCount           = topology.DirectionsCount;
            this.pickHeuristicFactory = pickHeuristicFactory;

            if (this.pickHeuristicFactory == null)
            {
                this.pickHeuristicFactory = (wavePropagator) =>
                {
                    var entropyTracker = new EntropyTracker(wavePropagator.Wave, wavePropagator.Frequencies, wavePropagator.Topology.Mask);
                    entropyTracker.Reset();
                    wavePropagator.AddTracker(entropyTracker);
                    return(new RandomPickerHeuristic(entropyTracker, this.randomDouble));
                };
            }

            patternModelConstraint = new PatternModelConstraint(this, model);

            if (clear)
            {
                Clear();
            }
        }