catch (IOException e){
e.printStackTrace();
fail("ERROR IO!!!!!!!!!");
}
ResidentNode residentSpeed = (ResidentNode)mebn.getNode("Speed");
assertNotNull(residentSpeed);
// set up instances of object entities
// we need only one object
mebn.getObjectEntityContainer().addEntityInstance(new ObjectEntityInstance("OBJ1", mebn.getObjectEntityContainer().getObjectEntityByName("Object")));
// add three regions
mebn.getObjectEntityContainer().addEntityInstance(new ObjectEntityInstance("RGN1", mebn.getObjectEntityContainer().getObjectEntityByName("Region")));
mebn.getObjectEntityContainer().addEntityInstance(new ObjectEntityInstance("RGN2", mebn.getObjectEntityContainer().getObjectEntityByName("Region")));
mebn.getObjectEntityContainer().addEntityInstance(new ObjectEntityInstance("RGN3", mebn.getObjectEntityContainer().getObjectEntityByName("Region")));
// add three timesteps
// mebn.getObjectEntityContainer().addEntityInstance(new ObjectEntityInstance("T0", mebn.getObjectEntityContainer().getObjectEntityByName("TimeStep")));
// mebn.getObjectEntityContainer().addEntityInstance(new ObjectEntityInstance("T1", mebn.getObjectEntityContainer().getObjectEntityByName("TimeStep")));
mebn.getObjectEntityContainer().addEntityInstance(new ObjectEntityInstance("T2", mebn.getObjectEntityContainer().getObjectEntityByName("TimeStep")));
probabilisticNetwork = new ProbabilisticNetwork(mebn.getName());
SSBN ssbn = new SSBN();
ssbn.setNetwork(probabilisticNetwork);
speedOBJ1T2 = new ProbabilisticNode();
speedOBJ1T2.setName(residentSpeed.getName() + "_OBJ1_T2");
probabilisticNetwork.addNode(speedOBJ1T2);
SSBNNode ssbnNodeSpeedOBJ1T2 = SSBNNode.getInstance(probabilisticNetwork, residentSpeed, speedOBJ1T2);
ssbn.getSsbnNodeList().add(ssbnNodeSpeedOBJ1T2);
ssbnNodeSpeedOBJ1T2.addArgument(residentSpeed.getMFrag().getOrdinaryVariableByName("obj"), "OBJ1");
ssbnNodeSpeedOBJ1T2.addArgument(residentSpeed.getMFrag().getOrdinaryVariableByName("t"), "T2");
// Speed(OBJ1, T0),
// ProbabilisticNode speedOBJ1T0 = new ProbabilisticNode();
// speedOBJ1T0.setName(residentSpeed.getName() + "_OBJ1_T0");
// probabilisticNetwork.addNode(speedOBJ1T0);
// SSBNNode ssbnNodeSpeedOBJ1T0 = SSBNNode.getInstance(probabilisticNetwork, residentSpeed, speedOBJ1T0);
// ssbn.getSsbnNodeList().add(ssbnNodeSpeedOBJ1T0);
// ssbnNodeSpeedOBJ1T0.addArgument(residentSpeed.getMFrag().getOrdinaryVariableByName("obj"), "OBJ1");
// ssbnNodeSpeedOBJ1T0.addArgument(residentSpeed.getMFrag().getOrdinaryVariableByName("tPrev"), "T0");
// ssbnNodeSpeedOBJ1T2.addParent(ssbnNodeSpeedOBJ1T0, false); // this should also add the edge
// Speed(OBJ1, T1),
ProbabilisticNode speedOBJ1T1 = new ProbabilisticNode();
speedOBJ1T1.setName(residentSpeed.getName() + "_OBJ1_T1");
probabilisticNetwork.addNode(speedOBJ1T1);
SSBNNode ssbnNodeSpeedOBJ1T1 = SSBNNode.getInstance(probabilisticNetwork, residentSpeed, speedOBJ1T1);
ssbn.getSsbnNodeList().add(ssbnNodeSpeedOBJ1T1);
ssbnNodeSpeedOBJ1T1.addArgument(residentSpeed.getMFrag().getOrdinaryVariableByName("obj"), "OBJ1");
ssbnNodeSpeedOBJ1T1.addArgument(residentSpeed.getMFrag().getOrdinaryVariableByName("tPrev"), "T1");
ssbnNodeSpeedOBJ1T2.addParent(ssbnNodeSpeedOBJ1T1, false); // this should also add the edge
// TerrainType(RGN1),
ResidentNode terrainTypeResident = mebn.getDomainResidentNode("TerrainType");
ProbabilisticNode terrainTypeRGN1 = new ProbabilisticNode();
terrainTypeRGN1.setName(terrainTypeResident.getName() + "_RGN1");
probabilisticNetwork.addNode(terrainTypeRGN1);
SSBNNode ssbnNodeTerrainTypeRGN1 = SSBNNode.getInstance(probabilisticNetwork, terrainTypeResident, terrainTypeRGN1);
ssbn.getSsbnNodeList().add(ssbnNodeTerrainTypeRGN1);
ssbnNodeTerrainTypeRGN1.addArgument(residentSpeed.getMFrag().getOrdinaryVariableByName("rgn"), "RGN1");
ssbnNodeSpeedOBJ1T2.addParent(ssbnNodeTerrainTypeRGN1,false); // this should also add the edge
// TerrainType(RGN2),
ProbabilisticNode terrainTypeRGN2 = new ProbabilisticNode();
terrainTypeRGN2.setName(terrainTypeResident.getName() + "_RGN2");
probabilisticNetwork.addNode(terrainTypeRGN2);
SSBNNode ssbnNodeTerrainTypeRGN2 = SSBNNode.getInstance(probabilisticNetwork, terrainTypeResident, terrainTypeRGN2);
ssbn.getSsbnNodeList().add(ssbnNodeTerrainTypeRGN2);
ssbnNodeTerrainTypeRGN2.addArgument(residentSpeed.getMFrag().getOrdinaryVariableByName("rgn"), "RGN2");
ssbnNodeSpeedOBJ1T2.addParent(ssbnNodeTerrainTypeRGN2,false); // this should also add the edge
// TerrainType(RGN3),
// ProbabilisticNode terrainTypeRGN3 = new ProbabilisticNode();
// terrainTypeRGN3.setName(terrainTypeResident.getName() + "_RGN3");
// probabilisticNetwork.addNode(terrainTypeRGN3);
// SSBNNode ssbnNodeTerrainTypeRGN3 = SSBNNode.getInstance(probabilisticNetwork, terrainTypeResident, terrainTypeRGN3);
// ssbn.getSsbnNodeList().add(ssbnNodeTerrainTypeRGN3);
// ssbnNodeTerrainTypeRGN3.addArgument(residentSpeed.getMFrag().getOrdinaryVariableByName("rgn"), "RGN3");
// ssbnNodeSpeedOBJ1T2.addParent(ssbnNodeTerrainTypeRGN3,false); // this should also add the edge
// ObjectType(OBJ1)
ResidentNode objectTypeResident = mebn.getDomainResidentNode("ObjectType");
ProbabilisticNode objectTypeOBJ1 = new ProbabilisticNode();
objectTypeOBJ1.setName(objectTypeResident.getName() + "_OBJ1");
probabilisticNetwork.addNode(objectTypeOBJ1);
SSBNNode ssbnNodeObjectTypeOBJ1 = SSBNNode.getInstance(probabilisticNetwork, objectTypeResident, objectTypeOBJ1);
ssbn.getSsbnNodeList().add(ssbnNodeObjectTypeOBJ1);
ssbnNodeObjectTypeOBJ1.addArgument(residentSpeed.getMFrag().getOrdinaryVariableByName("obj"), "OBJ1");
ssbnNodeSpeedOBJ1T2.addParent(ssbnNodeObjectTypeOBJ1,false); // this should also add the edge