Table Of Contents
Table Of Contents

Markov-Chain-Based Classifier

The MarkovClassifier module uses a Markov process to classify packets. The current state of the Markov process selects the output gate, a configurable transition matrix determines the probabilities of state change, and the configured wait intervals determine the time between state changes.

In this example network, packets are generated by an active packet source (ActivePacketSource). The packet source pushes packets into a classifier (MarkovClassifier). The classifier is connected to two passive packet sinks (PassivePacketSink). The classifier pushes packets into one of the packet sinks based on the current state of the Markov process.

network MarkovClassifierTutorialStep
{
    @display("bgb=600,300");
    submodules:
        producer: ActivePacketSource {
            @display("p=100,100");
        }
        classifier: MarkovClassifier {
            @display("p=300,100");
        }
        consumer1: PassivePacketSink {
            @display("p=500,100");
        }
        consumer2: PassivePacketSink {
            @display("p=500,200");
        }
    connections allowunconnected:
        producer.out --> classifier.in;
        classifier.out++ --> consumer1.in;
        classifier.out++ --> consumer2.in;
}
[Config MarkovClassifier]
network = MarkovClassifierTutorialStep
sim-time-limit = 100s

*.producer.packetLength = 1B
*.producer.productionInterval = 1s
*.classifier.transitionProbabilities = "0 1 1 0"
*.classifier.waitIntervals = "40 4"