Changeset 2403
- Timestamp:
- Feb 25, 2010 11:42:02 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
coopr.pysp/trunk/coopr/pysp/scenariotree.py
r2375 r2403 355 355 def get_scenario(self, name): 356 356 return self._scenario_map[name] 357 358 # 359 # compute the scenario cost for the input instance, i.e., 360 # the sum of all stage cost variables. 361 # 362 def compute_scenario_cost(self, instance): 363 aggregate_cost = 0.0 364 for stage in self._stages: 365 instance_cost_variable = instance.active_components(Var)[stage._cost_variable[0].name][stage._cost_variable[1]]() 366 print "\tStage=%20s Cost=%10.4f" % (stage._name, instance_cost_variable) 367 aggregate_cost += instance_cost_variable 368 return aggregate_cost 357 369 358 370 # … … 649 661 print "\t\t" + tree_node._name 650 662 651 aggregate_cost = 0.0 652 for stage in self._stages: 653 instance_cost_variable = instance.active_components(Var)[stage._cost_variable[0].name][stage._cost_variable[1]]() 654 print "\tStage=%20s Cost=%10.4f" % (stage._name, instance_cost_variable) 655 aggregate_cost += instance_cost_variable 663 aggregate_cost = self.compute_scenario_cost(instance) 656 664 print "\tTotal scenario cost=%10.4f" % aggregate_cost 657 665 print ""
Note: See TracChangeset
for help on using the changeset viewer.