Changeset 5784


Ignore:
Timestamp:
May 17, 2012 4:12:25 PM (7 years ago)
Author:
jwatson
Message:

Fixing divide-by-zero case in solution snap-shoting when solving the extensive form of a model. Caused when users experimentally set scenario node conditional probabilities to 0. Fixed by simply not trying to roll up variables for the associated nodes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • coopr.pysp/trunk/coopr/pysp/scenariotree.py

    r5700 r5784  
    202202                               var_value = value(var)
    203203                               avg += (scenario._probability * var_value)
    204                     if num_scenarios_with_index > 0:
     204                    # the node probability is allowed to be zero in the scenario tree specification.
     205                    # this is useful in cases where one wants to temporarily ignore certain scenarios.
     206                    # in this case, just skip reporting of variables for that node.
     207                           
     208                    if (num_scenarios_with_index > 0) and (node_probability > 0.0):
    205209                        variable[index] = avg / node_probability
    206210
Note: See TracChangeset for help on using the changeset viewer.