Changeset 3092


Ignore:
Timestamp:
Oct 13, 2010 3:13:23 PM (11 years ago)
Author:
jwatson
Message:

Update to PySP to suppress canonical expression representations when using ASL. Otherwise, things choke badly.

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

Legend:

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

    r3073 r3092  
    640640                                                         scenario._name,
    641641                                                         self._model,
    642                                                          self._verbose)
     642                                                         self._verbose,
     643                                                         preprocess=False)
     644
     645         # IMPT: disable canonical representation construction for ASL solvers.
     646         #       this is a hack, in that we need to address encodings and
     647         #       the like at a more general level.
     648         if self._solver_type == "asl":
     649            scenario_instance.skip_canonical_repn = True
     650         else:
     651            scenario_instance.preprocess()
    643652
    644653         self._instances[scenario._name] = scenario_instance
    645654         self._instances[scenario._name].name = scenario._name
    646655         self._instance_augmented_attributes[scenario._name] = []
     656
    647657
    648658      # perform a single pass of garbage collection and re-enable automatic collection.
  • coopr.pysp/trunk/coopr/pysp/phinit.py

    r3088 r3092  
    366366      if options.verbose is True:
    367367         print "Scenario reference instance filename="+reference_instance_filename
    368       reference_instance = reference_model.create(reference_instance_filename)
     368      reference_instance = reference_model.create(reference_instance_filename, preprocess=False)
     369      # IMPT: disable canonical representation construction for ASL solvers.
     370      #       this is a hack, in that we need to address encodings and
     371      #       the like at a more general level.
     372      if options.solver_type == "asl":
     373         reference_instance.skip_canonical_repn = True
     374      else:
     375         reference_instance.preprocess()
     376     
    369377   except IOError:
    370378      print "***ERROR: Failed to load scenario reference instance data from file="+reference_instance_filename
  • coopr.pysp/trunk/coopr/pysp/phutils.py

    r3073 r3092  
    180180#
    181181# construct a scenario instance!
    182 # IMPT: the returned instance is guaranteed to be preprocessed().
    183182#
    184183def construct_scenario_instance(scenario_tree_instance,
     
    186185                                scenario_name,
    187186                                reference_model,
    188                                 verbose):
     187                                verbose,
     188                                preprocess = True):
    189189
    190190   if verbose is True:
     
    218218         scenario_data.read(model=scenario_instance)
    219219         scenario_instance.load(scenario_data)
    220          scenario_instance.preprocess()         
     220         if preprocess is True:
     221            scenario_instance.preprocess()         
    221222   except:
    222223      print "Encountered exception in model instance creation - traceback:"
Note: See TracChangeset for help on using the changeset viewer.