Sorry, but I'm totally confused now.
You say:
"sum(j=1..z) [P(Tj | a1, a2......,am) ]"
What is "Tj" here? Is there any difference in your notation between P(Tj) and P(j)?? Also, if P is the probability measure, then "a1, a2 ..." must be EVENTS, while as I see here they are random discrete variables, aren't they?
Let's make it straight, can you rewrite it like optimization problem in form:
Maximize ... subject to constraints ...
?