To prevent spam users, you can only post on this forum after registration, which is by invitation. If you want to post on the forum, please send me a mail (h DOT m DOT w DOT verbeek AT tue DOT nl) and I'll send you an invitation in return for an account.

Add an initial and final marking to a Petri net discovered with own algorithm

Dear community,

sorry I have to bother you again...

I try to add an initial as well as a final marking to my discovered petri net, so that it is directly usable for conformance checking.

I tried this:

_____________________________________________________________________________________
        //create markings and connections
        Place source = null;
        Place sink = null;
        for(Place p : net.getPlaces()){
            if(net.getInEdges(p).isEmpty())
                source = p;
            if(net.getOutEdges(p).isEmpty())
                sink = p;
        }
       
       
        Marking sourceM = new Marking();
        sourceM.add(source);
        Marking sinkM = new Marking();
        sinkM.add(source);
       
        InitialMarkingConnection imc = new InitialMarkingConnection(net, sourceM);
        FinalMarkingConnection fmc = new FinalMarkingConnection(net, sinkM);
___________________________________________________________________________________

But I don't get the connections as outputs. Can you tell me if I am doing this right?
I remember there was a method to return intermediate results, but I forgot the name of the method.

Kind regards,

Oliver




Comments

  • Dear Oliver,

    You're almost there. The only thing left to do is to add both connections to the ProM framework:
    context.addConnection(imc);
    context.addConnection(fmc);
    The replayer wil check the connections in the ProM framework for the initial and final marking. If you do not add them to the framework, the replayer will not be bale to find them.

    Of course, you do need a context (a PluginContext) to do this.

    Kind regards,

    Eric.

  • Btw, I would add the sink place to the sink marking, not the source place :-).
  • Oh, and perhaps also a good idea to make the markings provided objects, might also help: The following snippet shows what I am using:

                context.getProvidedObjectManager().createProvidedObject(
    "Initial marking for " + net.getLabel(),
                        initialMarking, Marking.class, context);
                context.addConnection(new InitialMarkingConnection(net,
    initialMarking));

                for (Marking finalMarking : finalMarkings) {
                    context.getProvidedObjectManager().createProvidedObject(
    "Final marking for " + net.getLabel(),
                            finalMarking, Marking.class, context);
                    context.addConnection(new FinalMarkingConnection(net, finalMarking));
                }


    Note that I allow multiple final markings. The replayer can handle that.

  • Dear Eric,

    thank you very much for the fast and again very useful reply.

    Best regards,
    Oliver :)

Sign In or Register to comment.