Changeset 2404


Ignore:
Timestamp:
Feb 25, 2010 11:58:33 AM (10 years ago)
Author:
jwatson
Message:

Eliminated debug print statement from scenario tree class. Used new compute_scenario_cost method of scenario tree class to compute non-PH-weighted objective in PH output (per-iteration).

Location:
coopr.pysp/trunk/coopr/pysp
Files:
2 edited

Legend:

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

    r2401 r2404  
    13881388            for objective_name in instance.active_components(Objective):
    13891389               objective = instance.active_components(Objective)[objective_name]
    1390                print "%20s       %18.4f     %14.4f" % (scenario._name, ph_objective_values[scenario._name], 0.0)
     1390               print "%20s       %18.4f     %14.4f" % (scenario._name, ph_objective_values[scenario._name], self._scenario_tree.compute_scenario_cost(instance))
    13911391
    13921392   def solve(self):
  • coopr.pysp/trunk/coopr/pysp/scenariotree.py

    r2403 r2404  
    364364      for stage in self._stages:
    365365         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)
    367366         aggregate_cost += instance_cost_variable
    368367      return aggregate_cost
     
    661660            print "\t\t" + tree_node._name
    662661
    663          aggregate_cost = self.compute_scenario_cost(instance)
     662         aggregate_cost = 0.0
     663         for stage in self._stages:
     664            instance_cost_variable = instance.active_components(Var)[stage._cost_variable[0].name][stage._cost_variable[1]]()
     665            print "\tStage=%20s     Cost=%10.4f" % (stage._name, instance_cost_variable)
     666            aggregate_cost += instance_cost_variable
    664667         print "\tTotal scenario cost=%10.4f" % aggregate_cost
    665668         print ""
Note: See TracChangeset for help on using the changeset viewer.