Distributed EM Example

Java RMI is used to perform a simple distributed simulation of the example from section 1 of Time-Recursive EM Examples, R. Perry, June 1998. See Java and RMI and Communications and Tracking for more information about ongoing Java, RMI, EM, and Viterbi projects here.

In this example we run three processes on three different machines, using Java RMI for communication between them over the net.

The first process is a Sensor Server which simulates a sensor that provides measurements from a scaled binary data stream with additive Gaussian noise. Each data sample y is constructed using the formula y = c*b + z, where c is a non-zero deterministic scale factor, zis zero-mean Gaussian noise, and b is supposed to be a deterministic sequence of binary 0 and 1 values, though it just happens to be generated randomly in this simulation. The Sensor Server implements a Sensor interface which provides a get_y() function to get the next data sample.

The second process is an EM Server which implements a version of the time-recursive EM algorithm. Using the EM interface, it provides a get_b() function which, given a measured data value y, provides an estimate of the associated binary value of b.

The third process is a Sensor Client which obtains measurements from the Sensor Server and uses the EM Server to produce estimates of the associated binary data.

The main action can be seen in this section of SensorClient.java:

    // process N samples
    //
    double yK;
    int bK;

    for( int k = 0; k < N; ++k) {

      yK = S.get_y();

      System.out.println( "yK = " + yK);

      bK = em.get_b( yK);

      System.out.println( "bK = " + bK);
    }
where S is an instance of Sensor running on the Sensor Server, and em is an instance of EM running on the EM Server. The functions S.get_y() and em.get_b() are not really part of the Sensor Client; they are running on their associated servers on different machines, but are accessed as though they were local functions using Java's remote method invocation (RMI).

Given the proper values for the server hostnames and port numbers, the setup necessary to do RMI is quite simple, involving just a call to Naming.lookup:

    int port;
    String serverhost, rmi;
    ...
    rmi = "rmi://" + serverhost + ":" + port + "/SensorServer";
    Sensor S = (Sensor) Naming.lookup( rmi);
    ...
    rmi = "rmi://" + serverhost + ":" + port + "/EMServer";
    EM em = (EM) Naming.lookup( rmi);
For this example, the servers and client are run on different machines but from the same NFS-mounted directory. Each server writes its hostname and port number to a file, and the Sensor client reads those files to determine the serverhost and port variables used above.

In this sample run, the server.sh script is used to start the servers using a range of port numbers until a free port is found and the server successfully starts.

Notes

This example simply demonstrates the use of Java RMI to perform a distributed simulation. A more realistic simulation to model a multitarget multisensor tracking problem would probably have the following features: a DataServer responsible for generating the measurement data; multiple SensorServers, each with its own location parameters; and a FusionClient to collect data from the SensorServers and robustly handle cases of SensorServer failure.

Based on the location parameters of a given SensorServer and the time of the data request, the DataServer would present the Sensor with data suitably coordinate-transformed and with appropriate noise added. Each SensorServer would perform some processing of the data and make its results available to the FusionClient. The FusionClient, obtaining results from all of the Sensors, would perform global processing and make its results available to the SensorServers.

Source files: