Changeset 2428
- Timestamp:
- Mar 11, 2010 10:25:39 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
coopr.pysp/trunk/coopr/pysp/ef.py
r2427 r2428 105 105 for stage in scenario_tree._stages: 106 106 107 # first loop is to create master (blended) variables across all stages but the last. 107 108 for (stage_variable, index_template, stage_variable_indices) in stage._variables: 108 109 … … 167 168 setattr(binding_instance, new_constraint_name, new_constraint) 168 169 169 # create a variable to represent the expected cost at this node - 170 # the constraint to compute this comes later. 171 expected_cost_variable_name = "EXPECTED_COST_" + tree_node._name 172 expected_cost_variable = Var(name=expected_cost_variable_name) 173 expected_cost_variable._model = binding_instance 174 setattr(binding_instance, expected_cost_variable_name, expected_cost_variable) 170 # the second loop is for creating the stage cost variable in each tree node. 171 for tree_node in stage._tree_nodes: 172 173 # create a variable to represent the expected cost at this node - 174 # the constraint to compute this comes later. 175 expected_cost_variable_name = "EXPECTED_COST_" + tree_node._name 176 expected_cost_variable = Var(name=expected_cost_variable_name) 177 expected_cost_variable._model = binding_instance 178 setattr(binding_instance, expected_cost_variable_name, expected_cost_variable) 175 179 176 180 # if we're generating the weighted CVaR objective term, create the
Note: See TracChangeset
for help on using the changeset viewer.