Changeset 2669


Ignore:
Timestamp:
Jun 16, 2010 5:10:50 PM (11 years ago)
Author:
jwatson
Message:

Fix to runef involving the same issue as in the previous commit.

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

Legend:

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

    r2465 r2669  
    633633         raise RuntimeError, "Failed to create model instance for scenario=" + scenario._name
    634634
     635      # IMPT: This is kind of a hack now, as there is currently no way to propagate
     636      #       solver capabilities through to the corresponding file writer - it
     637      #       has to go through the model. for now, assume the solver has all capabilities.
     638      scenario_instance.has_capability = lambda x: True
     639
    635640      # name each instance with the scenario name, so the prefixes in the EF make sense.
    636641      scenario_instance.name = scenario._name
     
    648653                                         generate_weighted_cvar = generate_weighted_cvar,
    649654                                         cvar_weight = cvar_weight,
    650                                          risk_alpha = risk_alpha)   
     655                                         risk_alpha = risk_alpha)
     656   binding_instance.has_capability = lambda x: True   
    651657
    652658   print "Starting to write extensive form"
     
    667673
    668674   binding_instance = create_ef_instance(scenario_tree, scenario_instances)
     675   binding_instance.has_capability = lambda x: True     
    669676
    670677   print "Starting to write extensive form"
  • coopr.pysp/trunk/coopr/pysp/ef_writer_script.py

    r2466 r2669  
    161161      if ef_solver is None:
    162162         raise ValueError, "Failed to create solver manager of type="+options.solver_type+" for use in extensive form solve"
     163
     164      # at this point you have a specific solver - communicate solver capabilities
     165      # to the writer via the instance.
     166      binding_instance.has_capability = ef_solver.has_capability
     167      for scenario_name, scenario_instance in scenario_instances.items():
     168         scenario_instance.has_capability = ef_solver.has_capability
    163169
    164170      print "Queuing extensive form solve"
Note: See TracChangeset for help on using the changeset viewer.