Changeset 2374
 Timestamp:
 Feb 19, 2010 4:29:33 PM (10 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

coopr.pysp/trunk/coopr/pysp/scenariotree.py
r2365 r2374 428 428 for tree_node in tree_nodes_to_delete: 429 429 self._tree_nodes.remove(tree_node) 430 431 432 # renormalize the conditional probabilities of the 433 # children at each tree node. 434 for tree_node in self._tree_nodes: 435 sum_child_probabilities = 0.0 436 for child_node in tree_node._children: 437 sum_child_probabilities += child_node._conditional_probability 438 for child_node in tree_node._children: 439 child_node._conditional_probability = child_node._conditional_probability / sum_child_probabilities 440 441 # recompute the absolute scenario probabilities based 442 # on the renormalized conditional node probabilities. 443 for scenario in self._scenarios: 444 probability = 1.0 445 for tree_node in scenario._node_list: 446 probability = probability * tree_node._conditional_probability 447 scenario._probability = probability 430 448 431 449 #
Note: See TracChangeset
for help on using the changeset viewer.