hasExchangeIllicitCargoPartitionState = 2;
}
// Define if ship has evasive behavior
int hasEvasiveBehaviorState = 0;
ProbabilisticNode parent = (ProbabilisticNode) pn
.getNode("hasExchangeIllicitCargoPartition_ship1");
ProbabilisticNode child = (ProbabilisticNode) pn
.getNode("hasEvasiveBehavior_ship1");
PotentialTable table = ((PotentialTable) child.getProbabilityFunction());
int[] coord = new int[child.getParents().size() + 1];
coord[0] = 0;
coord[table.getVariableIndex(parent)] = hasExchangeIllicitCargoPartitionState;
if (Math.random() <= table.getValue(coord))
hasEvasiveBehaviorState = 0;
else
hasEvasiveBehaviorState = 1;
// Define if ship's electronicis is working
int isElectronicsWorkingState = 0;
child = (ProbabilisticNode) pn.getNode("isElectronicsWorking_ship1");
table = ((PotentialTable) child.getProbabilityFunction());
coord = new int[child.getParents().size() + 1];
coord[0] = 0;
if (Math.random() <= table.getValue(coord)) {
isElectronicsWorkingState = 0;
ship.setElectronicsWorking(true);
} else {
isElectronicsWorkingState = 1;
ship.setElectronicsWorking(false);
}
// Define if ship has responsive AIS
child = (ProbabilisticNode) pn.getNode("hasResponsiveAIS_ship1");
table = ((PotentialTable) child.getProbabilityFunction());
coord = new int[child.getParents().size() + 1];
coord[0] = 0;
parent = (ProbabilisticNode) pn.getNode("hasEvasiveBehavior_ship1");
coord[table.getVariableIndex(parent)] = hasEvasiveBehaviorState;
parent = (ProbabilisticNode) pn.getNode("isElectronicsWorking_ship1");
coord[table.getVariableIndex(parent)] = isElectronicsWorkingState;
if (Math.random() <= table.getValue(coord)) {
ship.setHasResponsiveAIS(true);
} else {
ship.setHasResponsiveAIS(false);
}
// Define if ship has responsive radio
child = (ProbabilisticNode) pn.getNode("hasResponsiveRadio_ship1");
table = ((PotentialTable) child.getProbabilityFunction());
coord = new int[child.getParents().size() + 1];
coord[0] = 0;
parent = (ProbabilisticNode) pn.getNode("hasEvasiveBehavior_ship1");
coord[table.getVariableIndex(parent)] = hasEvasiveBehaviorState;
parent = (ProbabilisticNode) pn.getNode("isElectronicsWorking_ship1");
coord[table.getVariableIndex(parent)] = isElectronicsWorkingState;