MSC Trial 2

Ken Webb 2010-04-11T02:28:27Z

In this Malleable Software Challenge (MSC) trial, I will run an existing Xholon application, and will then delete some nodes or subtrees in the application. The application should continue to run without crashing, while exhibiting some reduced functionality. As a sample application, I will use the existing CTRNN model.

The first thing to try is to remove the node from the composite structure hierarchy, using the Edit --> Cut menu item on the node's context menu in the Xholon GUI. This removes the node from the tree, but the node may continue functioning as a tween tree or tween node in the network. It won't be visible anymore in the Xholon GUI, but it may continue to function as before if other nodes have port or other references to it.

I will write a script that can be injected at runtime, as a child of the node or subtree to be deleted. The script will remove the node from the composite structure hierarchy, and will then attempt to remove or isolate it from any network that it's part of.

The first image below is the normal JFreeChart chart when all nodes are functioning.

The remaining three images show the result when nodes are deleted: (1) Neuron2 node, (2) Neuron0 node, (3) Neuron0 node after the seventh timestep.


Deleting nodes without causing a crash can be quite complex. For example, the CTRNN sample app uses asynchronous messaging between some of the nodes, but some other nodes directly modify variables in the nodes they connect to. It would be a significant effort to write a script that could deal with all the possible cases, and this would require the use of Java reflection. It would be best to have a general purpose script for the simple cases, and rely on app-specific or domain-specific scripts for the more difficult cases.

A Script

To apply the script that deletes the nodes that resulted in the above JFreeChart charts, select and copy the following line. Then right-click the node in the Xholon GUI, and select Edit --> Paste Last Child .

<DeleteNode implName=""/>

Here's the script itself:


import java.util.List;

import org.primordion.xholon.base.IXholon;
import org.primordion.xholon.base.PortInformation;
import org.primordion.xholon.base.Xholon;
import org.primordion.xholon.service.IXholonService;

public class DeleteNode extends Xholon {
  public void postConfigure() {
    IXholon node = getParentNode();
    if (node == null) {return;}
    // Remove the node from the composite structure tree.
    // Make the node non-functional in any network it belongs to,
    // by routing all output ports to the wiring service for safe handling.
    IXholon wiringServiceInstance = getService(IXholonService.XHSRV_WIRING);
    List portList = node.getAllPorts();
    for (int i = 0; i < portList.size(); i++) {
      PortInformation portInfo = (PortInformation)portList.get(i);
      if ("port".equals(portInfo.getFieldName())) {
        node.setPort(portInfo.getFieldNameIndex(), wiringServiceInstance);
      // TODO handle non-port ports

return to main page