示例#1
0
        private void StartVerification(ListViewItem item)
        {
            if (!ModuleSpecificCheckPassed())
            {
                return;
            }

            if (!Spec.GrabSharedDataLock())
            {
                MessageBox.Show(Resources.Please_wait_for_the_simulation_or_parsing_finished_before_verification, Common.Ultility.Ultility.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            DisableAllControls();


            try
            {
                Spec.LockSharedData(false);

                StatusLabel_Text.Text = Resources.ModelCheckingForm_StartVerification_Verification_Starts;



                item.ImageIndex = UNKNOWN_ICON;

                Assertion = Spec.AssertionDatabase[item.SubItems[2].Text];
                Assertion.UIInitialize(this, ComboBox_AdmissibleBehavior.SelectedIndex == -1 ? 0 : ComboBox_AdmissibleBehavior.SelectedIndex,
                                       ComboBox_VerificationEngine.SelectedIndex == -1 ? 0 : ComboBox_VerificationEngine.SelectedIndex);

                Assertion.VerificationOutput.GenerateCounterExample = CheckBox_GenerateWitnessTrace.Checked;

                Assertion.Action       += OnAction;
                Assertion.ReturnResult += VerificationFinished;
                Assertion.Cancelled    += Verification_Cancelled;
                Assertion.Failed       += MC_Failed;

                seconds           = 1;
                ProgressBar.Value = 0;
                MCTimer.Start();
                Assertion.Start();
            }
            catch (RuntimeException e)
            {
                Spec.UnLockSharedData();
                Common.Ultility.Ultility.LogRuntimeException(e);
                Button_Verify.Text = VERIFY;
                this.Close();
                return;
            }
            catch (Exception ex)
            {
                Spec.UnLockSharedData();
                Common.Ultility.Ultility.LogException(ex, Spec);
                Button_Verify.Text = VERIFY;
                this.Close();
                return;
            }
        }
示例#2
0
        public void startVerification(string assert)
        {
            do
            {
                mCurAssert = assert;
                if (!mListener.moduleSpecificCheckPassed())
                {
                    break;
                }

                if (!mSpec.GrabSharedDataLock())
                {
                    MessageBox.Show(Resources.Please_wait_for_the_simulation_or_parsing_finished_before_verification, Common.Utility.Utilities.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    break;
                }

                mListener.disableAllControls();
                try
                {
                    mSpec.LockSharedData(false);

                    mListener.updateStatusLabel(Resources.ModelCheckingForm_StartVerification_Verification_Starts);
                    mListener.updateResStartVerify();

                    mAssertion = mSpec.AssertionDatabase[assert];

                    int admissibleIndex         = mListener.getCmbAdmissibleIndex();
                    int verificationEngineIndex = mListener.getCmbVerificationEngineIndex();
                    mAssertion.UIInitialize(mForm, admissibleIndex == -1 ? 0 : admissibleIndex,
                                            verificationEngineIndex == -1 ? 0 : verificationEngineIndex);

                    mAssertion.VerificationOutput.GenerateCounterExample = mListener.generateCounterExample();
                    mAssertion.Action       += mListener.onAction;
                    mAssertion.ReturnResult += VerificationFinished;
                    mAssertion.Cancelled    += Verification_Cancelled;
                    mAssertion.Failed       += MC_Failed;

                    mSeconds = 1;
                    mTimer.Start();
                    mAssertion.Start();
                }
                catch (RuntimeException e)
                {
                    mSpec.UnLockSharedData();
                    Common.Utility.Utilities.LogRuntimeException(e);
                    mListener.updateVerifyBtnLabel(LABEL_VERIFY);
                    mListener.closeForm();
                    return;
                }
                catch (Exception ex)
                {
                    mSpec.UnLockSharedData();
                    Common.Utility.Utilities.LogException(ex, mSpec);
                    mListener.updateVerifyBtnLabel(LABEL_VERIFY);
                    mListener.closeForm();
                    return;
                }
            } while (false);
        }
示例#3
0
        /* todo: xingzc.
         *
         * Need GlobalVar info to initialze nodeInfoTemplates/nodeInfoNone/nodeInfoCalculatorKind
         *
         * Need to know if left/right is parameterized system and cutnumber. This affects initialize() and Parser.
         * For parameterized system, no need to get a subgraph from a Configuration. A counter vector will be ok.
         * Probably we can still obtain a subgraph. But do not need to compare subgraphs. Instead, extract a counter
         * vector from the subgraph and use it to represent the state info.
         */
        public List <PairUpCandidate> execute(Graph left, Graph right, List <string> vars, bool notMaximalBipartite, SpecificationBase leftSpec, SpecificationBase rightSpec, bool eventDetails, bool matchProcessParameters, bool matchStateStructure, bool matchIfGuardCondition)
        {
            if (left.UserData != null)
            {
                this.cutnumber1 = (int)left.UserData;
            }
            if (right.UserData != null)
            {
                this.cutnumber2 = (int)right.UserData;
            }
            this.compareParameterizedSystem = (this.cutnumber1 != -1) && (this.cutnumber2 != -1);

            this.compareConfigGraph = compareConfigGraph && !compareParameterizedSystem;

            this.notMaximalBipartiteMatch = notMaximalBipartite;

            this.matchEventDetails = eventDetails;

            //ly; newly added.
            this.compareConfigGraph = matchStateStructure;
            //todo: matchIfGuardCondition needs to be added.

            List <string> primitiveVariables = new List <string>();

            Valuation leftValuation = leftSpec.GetEnvironment();

            foreach (string varName in vars)
            {
                if (leftValuation != null && leftValuation.Variables != null)
                {
                    ExpressionValue value = leftValuation.Variables.GetContainsKey(varName);
                    if (value is RecordValue)
                    {
                        RecordValue   array = value as RecordValue;
                        List <string> names = new List <string>();
                        for (int i = 0; i < array.Associations.Length; i++)
                        {
                            names.Add(varName);
                        }
                        selectedVariables.Add(names.ToArray());
                        vectorLength.Add(array.Associations.Length); // array length
                    }
                    else if (false)
                    {
                        // todo: xingzc. processing other complex data type
                    }
                    else // primitive types
                    {
                        primitiveVariables.Add(varName);
                    }
                }

                /* now assume variables of left/right graphs are the same and variables of all the nodes are the same
                 * thus, no need to do this
                 */
                /*if (rightValuation != null && rightValuation.Variables != null)
                 * {
                 *  ExpressionValue value = rightValuation.Variables.GetContainsKey(varName);
                 *  if (value is RecordValue)
                 *  {
                 *      selectedVariables.Add(new string[] {varName});
                 *      //vectorsLength.Add((value as RecordValue).Associations.Length); // array length
                 *  }
                 *  else if (false)
                 *  {
                 *      // todo: xingzc. processing other complex data type
                 *  }
                 *  else // primitive types
                 *  {
                 *      primitiveVariables.Add(varName);
                 *  }
                 * }*/
            }

            if (primitiveVariables.Count > 0)
            {
                selectedVariables.Add(primitiveVariables.ToArray());
                vectorLength.Add(primitiveVariables.Count);
            }

            initialize();

            PAT.GenericDiff.diff.GenericDiff diff = new PAT.GenericDiff.diff.GenericDiff(
                diffParameters.compatibleTypes,
                diffParameters.mappingWeights,
                diffParameters.distanceThresholdVectors,
                diffParameters.epsilonEdgesExcluded,
                diffParameters.maxIteration,
                diffParameters.noPairupIdenticalNodesWithOthers,
                diffParameters.stepsOfNeighbors,
                diffParameters.stopGreedySearchThreshold,
                diffParameters.stopPropagationThreshold,
                diffParameters.removeOutliersThreshold,
                diffParameters.considerNodeDistance,
                diffParameters.considerEdgeDistance,
                diffParameters.includeUnmatched,
                diffParameters.includeNeighbors,
                diffParameters.conductCandidatesSearch,
                diffParameters.appendEpsilonPairups,
                diffParameters.doGreedySearch,
                diffParameters.compareAdditionalInfo,
                diffParameters.notMaximalBipartiteMatch,
                diffParameters.searchPotentialCandidatesKind,
                diffParameters.neighborhoodMatchingStrategyKind,
                diffParameters.removeOutliersStrtegyKind,
                diffParameters.matchingStrategyKind,
                null);

            leftSpec.GrabSharedDataLock();
            leftSpec.LockSharedData(true);
            PATModelFileParser modelParser1 = new PATModelFileParser(left, Side.LHS, compareParameterizedSystem, this.compareConfigGraph, matchProcessParameters, infinity, cutnumber1);

            PAT.GenericDiff.graph.Graph graphLeft = createGraph(Side.LHS, modelParser1, leftGraphDataConfigs, "leftgraph");
            leftSpec.UnLockSharedData();

            rightSpec.GrabSharedDataLock();
            rightSpec.LockSharedData(true);
            PATModelFileParser modelParser2 = new PATModelFileParser(right, Side.RHS, compareParameterizedSystem, this.compareConfigGraph, matchProcessParameters, infinity, cutnumber2);

            PAT.GenericDiff.graph.Graph graphRight = createGraph(Side.RHS, modelParser2, rightGraphDataConfigs, "rightgraph");
            rightSpec.UnLockSharedData();

            List <PairUpCandidate> matches = diff.compare(graphLeft, graphRight);

            return(matches);
        }
示例#4
0
        private void StartVerification(ListViewItem item)
        {
            if (!ModuleSpecificCheckPassed())
            {
                return;
            }

            if (!Spec.GrabSharedDataLock())
            {
                MessageBox.Show(Resources.Please_wait_for_the_simulation_or_parsing_finished_before_verification, Common.Ultility.Ultility.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            DisableAllControls();


            try
            {
                Spec.LockSharedData(false);

                StatusLabel_Text.Text = Resources.ModelCheckingForm_StartVerification_Verification_Starts;

                //these data will not change for SpecProcess.SharedData, so once it is created after parsing, there is no need to set them again.
                //SpecProcess.SharedData.VariableLowerBound = Valuation.VariableLowerBound;
                //SpecProcess.SharedData.VariableUpperLowerBound = Valuation.VariableUpperLowerBound;
                //SpecProcess.SharedData.AlphaDatabase = Specification.AlphaDatabase;
                //SpecProcess.SharedData.HasSyncrhonousChannel = Specification.HasSyncrhonousChannel;
                //SpecProcess.SharedData.SyncrhonousChannelNames = Specification.SyncrhonousChannelNames;


                //SpecProcess.SharedData.FairnessType = AssertionBase.FairnessType;
                //SpecProcess.SharedData.CalculateParticipatingProcess = AssertionBase.FairnessType == FairnessType.PROCESS_LEVEL_WEAK_FAIRNESS || AssertionBase.FairnessType == FairnessType.PROCESS_LEVEL_STRONG_FAIRNESS || Assertion.MustAbstract;
                //SpecProcess.SharedData.CalculateCreatedProcess = Assertion.MustAbstract;
                //SpecProcess.SharedData.DataManager = DataStore.DataManager;


                item.ImageIndex = UNKNOWN_ICON;

                Assertion = Spec.AssertionDatabase[item.SubItems[2].Text];
                Assertion.UIInitialize(this, Fairness, this.CheckBox_PartialOrderReduction.Checked, this.CheckBox_Verbose.Checked, this.CheckBox_Parallel.Checked, this.ShortestPath, this.CheckBox_BDD.Checked, this.CheckBox_CheckNonZenoness.Checked, GetParameters());


                Assertion.Action       += OnAction;
                Assertion.ReturnResult += VerificationFinished;
                Assertion.Cancelled    += Verification_Cancelled;
                Assertion.Failed       += MC_Failed;

                seconds           = 1;
                ProgressBar.Value = 0;
                //timer.Reset();
                //startMemroySize = GC.GetTotalMemory(true);
                MCTimer.Start();
                //timer.Start();
                Assertion.Start();
            }
            catch (RuntimeException e)
            {
                Common.Ultility.Ultility.LogRuntimeException(e);
                this.Close();
                return;
            }
            catch (Exception ex)
            {
                //TextBox_Output.Text += ex.Message + "\r\n" + ex.StackTrace;
                //EnableAllControls();
                Common.Ultility.Ultility.LogException(ex, Spec);
                this.Close();
                return;
            }
        }