public RandomVariable calculate_next_backward_message(
RandomVariable forwardBelief,
RandomVariable present_backward_message, String perception)
{
RandomVariable result = present_backward_message.duplicate();
// System.Console.WriteLine("fb :-calculating new backward message");
// System.Console.WriteLine("fb :-diagonal matrix from sens model = ");
Matrix oMatrix = _sensorModel.asMatrix(perception);
// System.Console.WriteLine(oMatrix);
Matrix transitionMatrix = _transitionModel.asMatrix();// action
// should
// be
// passed
// in
// here?
// System.Console.WriteLine("fb :-present backward message = "
// +present_backward_message);
Matrix backwardMatrix = transitionMatrix.times(oMatrix
.times(present_backward_message.asMatrix()));
Matrix resultMatrix = backwardMatrix.arrayTimes(forwardBelief
.asMatrix());
result.updateFrom(resultMatrix);
result.normalize();
// System.Console.WriteLine("fb :-normalized new backward message = "
// +result);
return result;
}