Ejemplo n.º 1
0
        public override AutomataBDD EncodeComposition(BDDEncoder encoder)
        {
            AutomataBDD processAutomataBDD = this.Process.Encode(encoder);

            if (encoder.model.mapChannelToSize.ContainsKey(this.ChannelName))
            {
                int channelEventIndex = encoder.GetChannelIndex(this.ChannelName, BDDEncoder.EventChannelInfo.EventType.ASYNC_CHANNEL_OUTPUT);

                return(AutomataBDD.ChannelOutputPrefixing(this.ChannelName, channelEventIndex, new List <Expression>(this.ExpressionList), AssignmentExpr, processAutomataBDD, encoder.model));
            }
            else
            {
                List <Expression> expressionList = (this.ExpressionList != null) ? new List <Expression>(this.ExpressionList) : new List <Expression>();
                int channelEventIndex            = encoder.GetEventIndex(this.ChannelName, expressionList.Count);

                return(AutomataBDD.SyncChannelOutputPrefixing(channelEventIndex, expressionList, processAutomataBDD, encoder.model));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Encode sync channel out transition as event!a.b.c
        /// </summary>
        /// <param name="encoder"></param>
        /// <param name="processVariableName"></param>
        /// <param name="localVars">Local of the current SymbolicLTS is unchanged</param>
        /// <returns></returns>
        public List <CUDDNode> EncodeSyncChannelOutTransition(BDDEncoder encoder, string processVariableName, List <int> localVars)
        {
            Expression guard = Expression.EQ(new Variable(processVariableName),
                                             new IntConstant(encoder.stateIndexOfCurrentProcess[this.FromPNPlace.ID]));

            guard = Expression.CombineGuard(guard, GuardCondition);

            List <Expression> parameters = encoder.GetParaExpInEvent(this.Event);
            int channelEventIndex        = encoder.GetEventIndex(this.Event.BaseName, parameters.Count);

            guard = Expression.AND(guard, new Assignment(Model.EVENT_NAME, new IntConstant(channelEventIndex)));
            for (int i = 0; i < parameters.Count; i++)
            {
                //assign event parameter to the values in the event expression
                guard = Expression.AND(guard, new Assignment(encoder.model.eventParameterVariables[i], parameters[i]));
            }

            guard = Expression.AND(guard, new Assignment(processVariableName,
                                                         new IntConstant(encoder.stateIndexOfCurrentProcess[this.ToPNPlace.ID])));

            List <CUDDNode> transitions = guard.TranslateBoolExpToBDD(encoder.model).GuardDDs;

            return(encoder.model.AddVarUnchangedConstraint(transitions, localVars));
        }