Esempio n. 1
0
 /// <summary>
 /// Sets the specification engine.
 /// </summary>
 internal void SetSpecificationEngine(SpecificationEngine specificationEngine)
 {
     if (this.Configuration.IsLivenessCheckingEnabled)
     {
         this.Strategy = new TemperatureCheckingStrategy(this.Configuration, specificationEngine, this.Strategy);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Returns the next integer choice.
        /// </summary>
        /// <param name="maxValue">Max value</param>
        /// <param name="next">Next</param>
        /// <returns>Boolean</returns>
        public override bool GetNextIntegerChoice(int maxValue, out int next)
        {
            CaptureAndCheckProgramState();

            if (IsReplayingCycle)
            {
                ScheduleStep nextStep = PotentialCycle[CurrentCycleIndex];
                if (nextStep.Type != ScheduleStepType.NondeterministicChoice ||
                    nextStep.IntegerChoice == null)
                {
                    Debug.WriteLine("<LivenessDebug> Trace is not reproducible: next step is not a nondeterministic integer choice.");
                    EscapeUnfairCycle();
                    return(SchedulingStrategy.GetNextIntegerChoice(maxValue, out next));
                }

                Debug.WriteLine("<LivenessDebug> Replaying '{0}' '{1}'.", nextStep.Index, nextStep.IntegerChoice.Value);

                next = nextStep.IntegerChoice.Value;

                SchedulingStrategy.ForceNextIntegerChoice(maxValue, next);

                CurrentCycleIndex++;
                if (CurrentCycleIndex == PotentialCycle.Count)
                {
                    CurrentCycleIndex = 0;
                }

                return(true);
            }
            else
            {
                return(SchedulingStrategy.GetNextIntegerChoice(maxValue, out next));
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Called for errors detected by a specific scheduling strategy.
 /// </summary>
 /// <param name="strategy">The scheduling strategy that was used.</param>
 /// <param name="strategyDescription">More information about the scheduling strategy.</param>
 public virtual void OnStrategyError(SchedulingStrategy strategy, string strategyDescription)
 {
     if (this.Logger.IsVerbose)
     {
         this.Logger.WriteLine(this.FormatOnStrategyErrorLogMessage(strategy, strategyDescription));
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Called for errors detected by a specific scheduling strategy.
 /// </summary>
 /// <param name="strategy">The scheduling strategy that was used.</param>
 /// <param name="strategyDescription">More information about the scheduling strategy.</param>
 public virtual void OnStrategyError(SchedulingStrategy strategy, string strategyDescription)
 {
     if (this.IsVerbose)
     {
         this.WriteLine(FormatOnStrategyErrorString(strategy, strategyDescription));
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LivenessCheckingStrategy"/> class.
 /// </summary>
 internal LivenessCheckingStrategy(Configuration configuration, SpecificationEngine specificationEngine,
                                   SchedulingStrategy strategy)
 {
     this.Configuration       = configuration;
     this.SpecificationEngine = specificationEngine;
     this.SchedulingStrategy  = strategy;
 }
Esempio n. 6
0
 /// <summary>
 /// Called for errors detected by a specific scheduling strategy.
 /// </summary>
 /// <param name="strategy">The scheduling strategy that was used.</param>
 /// <param name="strategyDescription">More information about the scheduling strategy.</param>
 public virtual void OnStrategyError(SchedulingStrategy strategy, string strategyDescription)
 {
     if (this.IsVerbose)
     {
         var desc = string.IsNullOrEmpty(strategyDescription) ? $" Description: {strategyDescription}" : string.Empty;
         this.WriteLine($"<StrategyLog> Found bug using '{strategy}' strategy.{desc}");
     }
 }
Esempio n. 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReplayStrategy"/> class.
 /// </summary>
 internal ReplayStrategy(Configuration configuration, ScheduleTrace trace, bool isFair, SchedulingStrategy suffixStrategy)
 {
     this.Configuration   = configuration;
     this.ScheduleTrace   = trace;
     this.ScheduledSteps  = 0;
     this.IsSchedulerFair = isFair;
     this.IsReplaying     = true;
     this.SuffixStrategy  = suffixStrategy;
     this.ErrorText       = string.Empty;
 }
Esempio n. 8
0
 /// <summary>
 /// Setups the scheduling strategy.
 /// </summary>
 private static void SetupSchedulingStrategy()
 {
     if (Configuration.SchedulingStrategy.Equals("") ||
         Configuration.SchedulingStrategy.Equals("random"))
     {
         AnalysisContext.Strategy = SchedulingStrategy.Random;
     }
     else if (Configuration.SchedulingStrategy.Equals("dfs"))
     {
         AnalysisContext.Strategy = SchedulingStrategy.DFS;
     }
 }
        /// <summary>
        /// Constructor.
        /// </summary>
        public DynamicAnalysisConfiguration()
            : base()
        {
            this.AssemblyToBeAnalyzed = "";

            this.SchedulingStrategy = SchedulingStrategy.Random;
            this.SchedulingIterations = 1;
            this.RandomSchedulingSeed = null;

            this.RedirectConsoleOutput = true;
            this.PrintTrace = false;
            this.SuppressTrace = false;
        }
Esempio n. 10
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public DynamicAnalysisConfiguration()
            : base()
        {
            this.AssemblyToBeAnalyzed = "";

            this.SchedulingStrategy   = SchedulingStrategy.Random;
            this.SchedulingIterations = 1;
            this.RandomSchedulingSeed = null;

            this.RedirectConsoleOutput = true;
            this.PrintTrace            = false;
            this.SuppressTrace         = false;
        }
Esempio n. 11
0
        /// <summary>
        /// Returns the next choice to schedule.
        /// </summary>
        /// <param name="next">Next</param>
        /// <param name="choices">Choices</param>
        /// <param name="current">Curent</param>
        /// <returns>Boolean</returns>
        public override bool GetNext(out ISchedulable next, List <ISchedulable> choices, ISchedulable current)
        {
            CaptureAndCheckProgramState();

            if (IsReplayingCycle)
            {
                var enabledChoices = choices.Where(choice => choice.IsEnabled).ToList();
                if (enabledChoices.Count == 0)
                {
                    next = null;
                    return(false);
                }

                ScheduleStep nextStep = PotentialCycle[CurrentCycleIndex];
                if (nextStep.Type != ScheduleStepType.SchedulingChoice)
                {
                    Debug.WriteLine("<LivenessDebug> Trace is not reproducible: next step is not a scheduling choice.");
                    EscapeUnfairCycle();
                    return(SchedulingStrategy.GetNext(out next, choices, current));
                }

                Debug.WriteLine("<LivenessDebug> Replaying '{0}' '{1}'.", nextStep.Index, nextStep.ScheduledMachineId);

                next = enabledChoices.FirstOrDefault(choice => choice.Id == nextStep.ScheduledMachineId);
                if (next == null)
                {
                    Debug.WriteLine("<LivenessDebug> Trace is not reproducible: cannot detect machine with id '{0}'.", nextStep.ScheduledMachineId);
                    EscapeUnfairCycle();
                    return(SchedulingStrategy.GetNext(out next, choices, current));
                }

                SchedulingStrategy.ForceNext(next, choices, current);

                CurrentCycleIndex++;
                if (CurrentCycleIndex == PotentialCycle.Count)
                {
                    CurrentCycleIndex = 0;
                }

                return(true);
            }
            else
            {
                return(SchedulingStrategy.GetNext(out next, choices, current));
            }
        }
Esempio n. 12
0
 public static SchedulingStrategyDto ToSchedulingStrategyDto(this SchedulingStrategy ss)
 {
     return(new SchedulingStrategyDto
     {
         ChargingEnd1 = ss.ChargingEnd1,
         ChargingEnd2 = ss.ChargingEnd2,
         ChargingSOCPoint1 = ss.ChargingSOCPoint1,
         ChargingSOCPoint2 = ss.ChargingSOCPoint2,
         ChargingStart1 = ss.ChargingStart1,
         ChargingStart2 = ss.ChargingStart2,
         DieselPOutputMax = ss.DieselPOutputMax,
         DieselStartSOC = ss.DieselStartSOC,
         DieselStopPower = ss.DieselStopPower,
         DieselStopSOC = ss.DieselStopSOC,
         DischargeEnd1 = ss.DischargeEnd1,
         DischargeEnd2 = ss.DischargeEnd2,
         DischargeSOCPoint1 = ss.DischargeSOCPoint1,
         DischargeSOCPoint2 = ss.DischargeSOCPoint2,
         DischargeStart1 = ss.DischargeStart1,
         DischargeStart2 = ss.DischargeStart2,
         Id = ss.Key,
         MicrogridId = ss.MicrogridId,
         PGridMax = ss.PGridMax,
         POutputMax = ss.POutputMax,
         Power1 = ss.Power1,
         Power2 = ss.Power2,
         Power3 = ss.Power3,
         Power4 = ss.Power4,
         Power5 = ss.Power5,
         SOC1 = ss.SOC1,
         SOC2 = ss.SOC2,
         SOC3 = ss.SOC3,
         SOC4 = ss.SOC4,
         SOC5 = ss.SOC5,
         SOC6 = ss.SOC6,
         SOC7 = ss.SOC7
     });
 }
Esempio n. 13
0
        /// <summary>
        /// Tells whether a document can be scheduled, given certain scheduling restrictions.
        /// </summary>
        /// <param name="document">The document to schedule</param>
        /// <param name="schedulingStrategy">True if the instrument supports only a single global
        /// retention time window, or false if the instrument can set the window for each transition</param>
        /// <returns>True if a scheduled method may be created from this document</returns>
        public bool CanSchedule(SrmDocument document, SchedulingStrategy schedulingStrategy)
        {
            // Check if results information can be used for retention times
            bool resultsAvailable = (UseMeasuredRTs && document.Settings.HasResults);
            bool singleWindow = (schedulingStrategy == SchedulingStrategy.single_window);

            //  If the user has assigned a retention time predictor and the calculator is usable
            if (RetentionTime != null && RetentionTime.IsUsable)
            {
                // As long as the instrument is not limited to a single retention
                // time window, or their is no option to use results information,
                // then this document can be scheduled.
                if (!singleWindow || !resultsAvailable || MeasuredRTWindow == RetentionTime.TimeWindow)
                    return true;
            }
            // If no results available (and no predictor), then no scheduling
            if (!resultsAvailable)
            {
                // Actually we *can* still schedule if everything has an explicit RT
                if (document.Molecules.Any(p => p.ExplicitRetentionTime == null))
                    return false;
            }
            // Otherwise, if every precursor has enough result information
            // to predict a retention time, then this document can be scheduled.
            bool anyTimes = false;
            foreach (var nodePep in document.Molecules)
            {
                foreach (TransitionGroupDocNode nodeGroup in nodePep.Children)
                {
                    double windowRT;
                    if (PredictRetentionTime(document, nodePep, nodeGroup, null, ExportSchedulingAlgorithm.Average, singleWindow, out windowRT).HasValue)
                        anyTimes = true;
                    else if (schedulingStrategy != SchedulingStrategy.any)
                        return false;
                }
            }
            return anyTimes;
        }
Esempio n. 14
0
 /// <summary>
 /// Setups the scheduling strategy.
 /// </summary>
 private static void SetupSchedulingStrategy()
 {
     if (Configuration.SchedulingStrategy.Equals("") ||
         Configuration.SchedulingStrategy.Equals("random"))
     {
         AnalysisContext.Strategy = SchedulingStrategy.Random;
     }
     else if (Configuration.SchedulingStrategy.Equals("dfs"))
     {
         AnalysisContext.Strategy = SchedulingStrategy.DFS;
     }
 }
Esempio n. 15
0
        /// <summary>
        /// Constructor.
        /// </summary>
        protected Configuration()
        {
            this.SolutionFilePath = "";
            this.OutputFilePath = "";
            this.ProjectName = "";

            this.Timeout = 0;

            this.PauseOnAssertionFailure = false;
            this.InteroperationEnabled = true;

            this.CompilationTarget = CompilationTarget.Execution;
            this.OptimizationTarget = OptimizationTarget.Release;

            this.CustomCompilerPassAssemblyPaths = new HashSet<string>();

            this.AnalyzeDataFlow = false;
            this.AnalyzeDataRaces = false;
            this.DoStateTransitionAnalysis = false;
            this.ShowControlFlowInformation = false;
            this.ShowDataFlowInformation = false;
            this.ShowFullDataFlowInformation = false;

            this.AssemblyToBeAnalyzed = "";
            this.ScheduleFile = "";

            this.SchedulingStrategy = SchedulingStrategy.Random;
            this.SchedulingIterations = 1;
            this.RandomSchedulingSeed = null;

            this.PerformFullExploration = false;
            this.MaxSchedulingSteps = 0;
            this.ParallelBugFindingTasks = 1;
            this.TestingSchedulerProcessId = -1;
            this.TestingProcessId = -1;
            this.ConsiderDepthBoundHitAsBug = false;
            this.PrioritySwitchBound = 0;
            this.DelayBound = 0;
            this.CoinFlipBound = 0;
            this.SafetyPrefixBound = 0;

            this.AttachDebugger = false;
            this.ScheduleIntraMachineConcurrency = false;
            this.LivenessTemperatureThreshold = 0;
            this.CacheProgramState = false;
            this.EnableCycleReplayingStrategy = false;
            this.BoundOperations = false;
            this.DynamicEventQueuePrioritization = false;

            this.EnableDataRaceDetection = false;

            this.EnableVisualization = false;

            this.ContainerId = 0;
            this.NumberOfContainers = 1;
            this.RemoteApplicationFilePath = "";

            this.Verbose = 1;
            this.ShowWarnings = false;
            this.EnableDebugging = false;
            this.EnableProfiling = false;
            this.KeepTemporaryFiles = false;
            this.RedirectTestConsoleOutput = true;
            this.PrintTrace = false;
            this.SuppressTrace = false;
            this.ThrowInternalExceptions = false;
        }
Esempio n. 16
0
        /// <summary>
        /// Returns a string formatted for the <see cref="OnStrategyError"/> event and its parameters.
        /// </summary>
        /// <param name="strategy">The scheduling strategy that was used.</param>
        /// <param name="strategyDescription">More information about the scheduling strategy.</param>
        public virtual string FormatOnStrategyErrorString(SchedulingStrategy strategy, string strategyDescription)
        {
            var desc = string.IsNullOrEmpty(strategyDescription) ? $" Description: {strategyDescription}" : string.Empty;

            return($"<StrategyLog> Found bug using '{strategy}' strategy.{desc}");
        }
Esempio n. 17
0
 public override void OnStrategyError(SchedulingStrategy strategy, string strategyDescription)
 {
     base.OnStrategyError(strategy, strategyDescription);
     StrategyError?.Invoke(strategy, strategyDescription);
 }
Esempio n. 18
0
 /// <summary>
 /// Called for errors detected by a specific scheduling strategy.
 /// </summary>
 /// <param name="strategy">The scheduling strategy that was used.</param>
 /// <param name="strategyDescription">More information about the scheduling strategy.</param>
 public void OnStrategyError(SchedulingStrategy strategy, string strategyDescription)
 {
 }
Esempio n. 19
0
 /// <summary>
 /// Updates the configuration with the scheduling strategy
 /// and returns it.
 /// </summary>
 /// <param name="strategy">SchedulingStrategy</param>
 /// <returns>Configuration</returns>
 public Configuration WithStrategy(SchedulingStrategy strategy)
 {
     this.SchedulingStrategy = strategy;
     return this;
 }
 /// <summary>
 /// Returns the next choice to schedule.
 /// </summary>
 /// <param name="next">Next</param>
 /// <param name="choices">Choices</param>
 /// <param name="current">Curent</param>
 /// <returns>Boolean</returns>
 public override bool GetNext(out ISchedulable next, List <ISchedulable> choices, ISchedulable current)
 {
     CheckLivenessTemperature();
     return(SchedulingStrategy.GetNext(out next, choices, current));
 }
Esempio n. 21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ComboStrategy"/> class.
 /// </summary>
 internal ComboStrategy(SchedulingStrategy prefixStrategy, SchedulingStrategy suffixStrategy)
 {
     this.PrefixStrategy = prefixStrategy;
     this.SuffixStrategy = suffixStrategy;
 }
 /// <summary>
 /// Returns the next integer choice.
 /// </summary>
 /// <param name="maxValue">The max value.</param>
 /// <param name="next">Next</param>
 /// <returns>Boolean</returns>
 public override bool GetNextIntegerChoice(int maxValue, out int next)
 {
     CheckLivenessTemperature();
     return(SchedulingStrategy.GetNextIntegerChoice(maxValue, out next));
 }
 public AppointmentSchedulingService(SchedulingStrategy schedulingStrategyContext)
 {
     this.schedulingStrategyContext      = schedulingStrategyContext;
     this.appointmentGeneralitiesManager = new AppointmentGeneralitiesManager();
 }
Esempio n. 24
0
 public ExhaustiveScheduler(int numThreads, ulong maxChoices, int yieldLookbackPenalty)
 {
     _numThreads           = numThreads;
     _strategy             = new SchedulingStrategy(maxChoices);
     _yieldLookbackPenalty = yieldLookbackPenalty;
 }
Esempio n. 25
0
        /// <summary>
        /// Constructor.
        /// </summary>
        protected Configuration()
        {
            this.SolutionFilePath = "";
            this.OutputFilePath   = "";
            this.ProjectName      = "";

            this.Timeout = 0;

            this.PauseOnAssertionFailure = false;
            this.InteroperationEnabled   = true;

            this.CompilationTarget  = CompilationTarget.Execution;
            this.OptimizationTarget = OptimizationTarget.Release;

            this.CustomCompilerPassAssemblyPaths = new HashSet <string>();

            this.AnalyzeDataFlow             = false;
            this.AnalyzeDataRaces            = false;
            this.DoStateTransitionAnalysis   = false;
            this.ShowControlFlowInformation  = false;
            this.ShowDataFlowInformation     = false;
            this.ShowFullDataFlowInformation = false;

            this.AssemblyToBeAnalyzed = "";
            this.TestMethodName       = "";
            this.ScheduleFile         = "";

            this.SchedulingStrategy   = SchedulingStrategy.Random;
            this.SchedulingIterations = 1;
            this.RandomSchedulingSeed = null;

            this.PerformFullExploration   = false;
            this.MaxFairSchedulingSteps   = 0;
            this.MaxUnfairSchedulingSteps = 0;
            this.UserExplicitlySetMaxFairSchedulingSteps = false;
            this.ParallelBugFindingTasks    = 1;
            this.TestingSchedulerProcessId  = -1;
            this.TestingProcessId           = -1;
            this.ConsiderDepthBoundHitAsBug = false;
            this.PrioritySwitchBound        = 0;
            this.DelayBound        = 0;
            this.CoinFlipBound     = 0;
            this.SafetyPrefixBound = 0;

            this.AttachDebugger = false;
            this.ScheduleIntraMachineConcurrency = false;
            this.LivenessTemperatureThreshold    = 0;
            this.CacheProgramState            = false;
            this.EnableCycleReplayingStrategy = false;
            this.BoundOperations = false;
            this.DynamicEventQueuePrioritization = false;

            this.EnableDataRaceDetection = false;

            this.ReportCodeCoverage = false;

            this.ContainerId               = 0;
            this.NumberOfContainers        = 1;
            this.RemoteApplicationFilePath = "";

            this.Verbose                   = 1;
            this.ShowWarnings              = false;
            this.EnableDebugging           = false;
            this.EnableProfiling           = false;
            this.KeepTemporaryFiles        = false;
            this.RedirectTestConsoleOutput = true;
            this.PrintTrace                = false;
            this.SuppressTrace             = false;
            this.ThrowInternalExceptions   = false;
        }
Esempio n. 26
0
        /// <summary>
        /// Constructor.
        /// </summary>
        protected Configuration()
        {
            this.SolutionFilePath = string.Empty;
            this.OutputFilePath   = string.Empty;
            this.ProjectName      = string.Empty;

            this.Timeout = 0;

            this.CompilationTarget  = CompilationTarget.Execution;
            this.OptimizationTarget = OptimizationTarget.Release;

            this.CustomCompilerPassAssemblyPaths = new HashSet <string>();

            this.AnalyzeDataFlow             = false;
            this.AnalyzeDataRaces            = false;
            this.DoStateTransitionAnalysis   = false;
            this.ShowControlFlowInformation  = false;
            this.ShowDataFlowInformation     = false;
            this.ShowFullDataFlowInformation = false;
            this.RewriteCSharpVersion        = new Version();

            this.RuntimeGeneration = 0;

            this.AssemblyToBeAnalyzed   = string.Empty;
            this.TestingRuntimeAssembly = string.Empty;
            this.TestMethodName         = string.Empty;

            this.SchedulingStrategy        = SchedulingStrategy.Random;
            this.ReductionStrategy         = ReductionStrategy.None;
            this.SchedulingIterations      = 1;
            this.RandomSchedulingSeed      = null;
            this.IncrementalSchedulingSeed = false;

            this.PerformFullExploration   = false;
            this.MaxFairSchedulingSteps   = 0;
            this.MaxUnfairSchedulingSteps = 0;
            this.UserExplicitlySetMaxFairSchedulingSteps = false;
            this.ParallelBugFindingTasks     = 1;
            this.RunAsParallelBugFindingTask = false;
            this.TestingSchedulerEndPoint    = Guid.NewGuid().ToString();
            this.TestingSchedulerProcessId   = -1;
            this.TestingProcessId            = 0;
            this.ConsiderDepthBoundHitAsBug  = false;
            this.PrioritySwitchBound         = 0;
            this.DelayBound        = 0;
            this.CoinFlipBound     = 0;
            this.SafetyPrefixBound = 0;

            this.EnableLivenessChecking        = true;
            this.LivenessTemperatureThreshold  = 0;
            this.EnableCycleDetection          = false;
            this.EnableUserDefinedStateHashing = false;
            this.EnableMonitorsInProduction    = false;
            this.EnableNoApiCallAfterTransitionStmtAssertion = true;

            this.AttachDebugger = false;

            this.ScheduleFile  = string.Empty;
            this.ScheduleTrace = string.Empty;

            this.EnableDataRaceDetection = false;

            this.ReportCodeCoverage     = false;
            this.ReportActivityCoverage = false;
            this.DebugActivityCoverage  = false;

            this.ContainerId               = 0;
            this.NumberOfContainers        = 1;
            this.RemoteApplicationFilePath = string.Empty;

            this.Verbose            = 1;
            this.ShowWarnings       = false;
            this.EnableDebugging    = false;
            this.EnableProfiling    = false;
            this.KeepTemporaryFiles = false;

            this.EnableColoredConsoleOutput = false;
            this.ThrowInternalExceptions    = false;
            this.DisableEnvironmentExit     = true;
        }
Esempio n. 27
0
 /// <summary>
 /// Updates the configuration with the scheduling strategy
 /// and returns it.
 /// </summary>
 /// <param name="strategy">SchedulingStrategy</param>
 /// <returns>Configuration</returns>
 public Configuration WithStrategy(SchedulingStrategy strategy)
 {
     this.SchedulingStrategy = strategy;
     return(this);
 }
Esempio n. 28
0
        /// <summary>
        /// Constructor.
        /// </summary>
        protected Configuration()
        {
            this.SolutionFilePath = "";
            this.OutputFilePath = "";
            this.ProjectName = "";

            this.Verbose = 1;
            this.Timeout = 0;

            this.InteroperationEnabled = true;

            this.CompilationTargets = new HashSet<CompilationTarget>();
            this.CompilationTargets.Add(CompilationTarget.Execution);
            this.CompilationTargets.Add(CompilationTarget.Testing);

            this.RunStaticAnalysis = false;
            this.ShowGivesUpInformation = false;
            this.ShowRuntimeResults = false;
            this.ShowDFARuntimeResults = false;
            this.ShowROARuntimeResults = false;
            this.DoStateTransitionAnalysis = true;
            this.AnalyzeExceptionHandling = false;

            this.AssemblyToBeAnalyzed = "";

            this.SchedulingStrategy = SchedulingStrategy.Random;
            this.SchedulingIterations = 1;
            this.RandomSchedulingSeed = null;

            this.RedirectConsoleOutput = true;
            this.PrintTrace = false;
            this.SuppressTrace = false;

            this.FullExploration = false;
            this.DepthBound = 10000;
            this.ConsiderDepthBoundHitAsBug = false;
            this.BugDepth = 2;
            this.DelayBound = 2;
            this.SafetyPrefixBound = 0;

            this.ScheduleIntraMachineConcurrency = false;
            this.CheckLiveness = false;
            this.CacheProgramState = false;
            this.BoundOperations = false;
            this.DynamicEventQueuePrioritization = false;

            this.NumberOfContainers = 1;
            this.ContainerId = 0;
            this.ApplicationFilePath = "";
        }
Esempio n. 29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TemperatureCheckingStrategy"/> class.
 /// </summary>
 internal TemperatureCheckingStrategy(Configuration configuration, SpecificationEngine specificationEngine,
                                      SchedulingStrategy strategy)
     : base(configuration, specificationEngine, strategy)
 {
 }
Esempio n. 30
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SchedulingContext"/> class.
        /// </summary>
        private SchedulingContext(Configuration configuration, ILogger logger)
        {
            this.Configuration  = configuration;
            this.ValueGenerator = new RandomValueGenerator(configuration);

            if (!configuration.UserExplicitlySetLivenessTemperatureThreshold &&
                configuration.MaxFairSchedulingSteps > 0)
            {
                configuration.LivenessTemperatureThreshold = configuration.MaxFairSchedulingSteps / 2;
            }

            SchedulingStrategy strategy = null;

            if (configuration.SchedulingStrategy is "replay")
            {
                this.ReplayStrategy      = new ReplayStrategy(configuration);
                strategy                 = this.ReplayStrategy;
                this.IsReplayingSchedule = true;
            }
            else if (configuration.SchedulingStrategy is "interactive")
            {
                configuration.TestingIterations      = 1;
                configuration.PerformFullExploration = false;
                configuration.IsVerbose = true;
                strategy = new InteractiveStrategy(configuration, logger);
            }
            else if (configuration.SchedulingStrategy is "random")
            {
                strategy = new RandomStrategy(configuration.MaxFairSchedulingSteps, this.ValueGenerator);
            }
            else if (configuration.SchedulingStrategy is "pct")
            {
                strategy = new PCTStrategy(configuration.MaxUnfairSchedulingSteps, configuration.StrategyBound,
                                           this.ValueGenerator);
            }
            else if (configuration.SchedulingStrategy is "fairpct")
            {
                var prefixLength = configuration.SafetyPrefixBound is 0 ?
                                   configuration.MaxUnfairSchedulingSteps : configuration.SafetyPrefixBound;
                var prefixStrategy = new PCTStrategy(prefixLength, configuration.StrategyBound, this.ValueGenerator);
                var suffixStrategy = new RandomStrategy(configuration.MaxFairSchedulingSteps, this.ValueGenerator);
                strategy = new ComboStrategy(prefixStrategy, suffixStrategy);
            }
            else if (configuration.SchedulingStrategy is "probabilistic")
            {
                strategy = new ProbabilisticRandomStrategy(configuration.MaxFairSchedulingSteps,
                                                           configuration.StrategyBound, this.ValueGenerator);
            }
            else if (configuration.SchedulingStrategy is "dfs")
            {
                strategy = new DFSStrategy(configuration.MaxUnfairSchedulingSteps);
            }
            else if (configuration.SchedulingStrategy is "rl")
            {
                this.Strategy = new QLearningStrategy(configuration.AbstractionLevel, configuration.MaxUnfairSchedulingSteps, this.ValueGenerator);
            }

            if (configuration.SchedulingStrategy != "replay" &&
                configuration.ScheduleFile.Length > 0)
            {
                this.ReplayStrategy      = new ReplayStrategy(configuration, strategy);
                strategy                 = this.ReplayStrategy;
                this.IsReplayingSchedule = true;
            }

            this.Strategy = strategy;
        }