Example #1
0
        /// <summary>
        /// Run the verification and get the result.
        /// </summary>
        /// <returns></returns>
        public override void RunVerification()
        {
            if (ConstraintType == QueryConstraintType.NONE)
            {
                 base.RunVerification();
                 return;
            }

            if (IsSafety)
            {
                RunVerificationSafety();
                return;
            }

            if (!IsNegateLiveness)
            {
                RunVerificationNegate();
                return;
            }

            if (SelectedEngineName == Constants.ENGINE_MDP_SEARCH)
            {

                switch (ConstraintType)
                {
                    case QueryConstraintType.PROB:
                        DRA = NegativeDRA;
                        BuildMDP(); //note this function is just used to calculate the maximal probability.
                        Min = 1 - mdp.MaxProbability(VerificationOutput);

                        DRA = PositiveDRA;
                        BuildMDP();
                        Max = mdp.MaxProbability(VerificationOutput);

                        break;
                    case QueryConstraintType.PMAX:
                        DRA = PositiveDRA;
                        BuildMDP();
                        Max = mdp.MaxProbability(VerificationOutput);
                        break;
                    case QueryConstraintType.PMIN:
                        if (AlmostFair) //note add by ssz
                        {
                            DRA = PositiveDRA;
                            BuildMDP();
                            Min = mdp.MinProbability(VerificationOutput);
                        }
                        else
                        {
                            DRA = NegativeDRA;
                            BuildMDP();
                            Min = 1 - mdp.MaxProbability(VerificationOutput);
                        }
                        break;
                }
            }
            else if (SelectedEngineName == Constants.ENGINE_MDP_MEC_SEARCH)
            {

                switch (ConstraintType)
                {
                    case QueryConstraintType.PROB:
                        DRA = NegativeDRA;
                        BuildMD_ImprovedTarjan(); //note this function is just used to calculate the maximal probability.
                        Min = 1 - mdp.MaxProbability(VerificationOutput);

                        DRA = PositiveDRA;
                        BuildMD_ImprovedTarjan();
                        Max = mdp.MaxProbability(VerificationOutput);

                        break;
                    case QueryConstraintType.PMAX:
                        DRA = PositiveDRA;
                        //BuildMDP();
                        BuildMD_ImprovedTarjan();
                        Max = mdp.MaxProbability(VerificationOutput);
                        break;
                    case QueryConstraintType.PMIN:
                        if (AlmostFair) //note add by ssz
                        {
                            DRA = PositiveDRA;
                            BuildMD_ImprovedTarjan();
                            Min = mdp.MinProbability(VerificationOutput);
                        }
                        else
                        {
                            DRA = NegativeDRA;
                            BuildMD_ImprovedTarjan();
                            Min = 1 - mdp.MaxProbability(VerificationOutput);
                        }
                        break;
                }
            }
            else if (SelectedEngineName == Constants.ENGINE_MDP_SIM_SEARCH)
            {
                switch (ConstraintType)
                {
                    case QueryConstraintType.PROB:
                        DRA = NegativeDRA;
                        BuildMDP(); //note this function is just used to calculate the maximal probability.
                        mdp = mdp.ComputeGCPP(VerificationOutput);
                        Min = 1 - mdp.MaxProbability(VerificationOutput);

                        DRA = PositiveDRA;
                        BuildMDP();
                        mdp = mdp.ComputeGCPP(VerificationOutput);
                        Max = mdp.MaxProbability(VerificationOutput);

                        break;
                    case QueryConstraintType.PMAX:
                        DRA = PositiveDRA;
                        BuildMDP();
                        mdp = mdp.ComputeGCPP(VerificationOutput);
                        Max = mdp.MaxProbability(VerificationOutput);
                        break;
                    case QueryConstraintType.PMIN:
                        if (AlmostFair) //note add by ssz
                        {
                            DRA = PositiveDRA;
                            BuildMDP();
                            mdp = mdp.ComputeGCPP(VerificationOutput);
                            Min = mdp.MinProbability(VerificationOutput);
                        }
                        else
                        {
                            DRA = NegativeDRA;
                            BuildMDP();
                            mdp = mdp.ComputeGCPP(VerificationOutput);
                            Min = 1 - mdp.MaxProbability(VerificationOutput);
                        }
                        break;
                }
            }

            if (Min == 1)
            {
                VerificationOutput.VerificationResult = VerificationResultType.VALID;
            }
            else if (Max == 0)
            {
                VerificationOutput.VerificationResult = VerificationResultType.INVALID;
            }
            else
            {
                VerificationOutput.VerificationResult = VerificationResultType.WITHPROBABILITY;
            }
        }