Changeset 2207


Ignore:
Timestamp:
Jan 30, 2010 12:46:35 AM (10 years ago)
Author:
wehart
Message:

Merged revisions 2192-2206 via svnmerge from
https://software.sandia.gov/svn/public/coopr/coopr.pysp/trunk

........

r2199 | jwatson | 2010-01-29 07:57:20 -0700 (Fri, 29 Jan 2010) | 1 line


Fixed linearization issue in PH when a variable lower and upper bounds are equal

........

r2200 | jwatson | 2010-01-29 15:22:46 -0700 (Fri, 29 Jan 2010) | 3 lines


Supressing warning output if variable lower and upper bounds are equal when linearizing - this happens far too often for the message to be of any use.

........

r2201 | wehart | 2010-01-29 17:38:14 -0700 (Fri, 29 Jan 2010) | 2 lines


Update to Coopr to account for changes in PyUtilib? package names.

........

Location:
coopr.pysp/stable/2.2
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • coopr.pysp/stable/2.2

  • coopr.pysp/stable/2.2/coopr/pysp/__init__.py

    r1768 r2207  
    99#  _________________________________________________________________________
    1010
    11 import pyutilib.plugin.core
     11import pyutilib.component.core
    1212
    13 pyutilib.plugin.core.PluginGlobals.push_env( "coopr.pysp" )
     13pyutilib.component.core.PluginGlobals.push_env( "coopr.pysp" )
    1414
    1515from scenariotree import *
     
    2222from ph_script import *
    2323
    24 pyutilib.plugin.core.PluginGlobals.pop_env()
     24pyutilib.component.core.PluginGlobals.pop_env()
    2525
    2626
  • coopr.pysp/stable/2.2/coopr/pysp/asynchph.py

    r1998 r2207  
    1010
    1111import sys
    12 import pyutilib.plugin.core
     12import pyutilib.component.core
    1313import types
    1414from coopr.pyomo import *
     
    2626from phutils import *
    2727
    28 from pyutilib.plugin.core import ExtensionPoint
     28from pyutilib.component.core import ExtensionPoint
    2929
    3030from coopr.pysp.phextension import IPHExtension
  • coopr.pysp/stable/2.2/coopr/pysp/ph.py

    r2192 r2207  
    2828from phutils import *
    2929
    30 from pyutilib.plugin.core import ExtensionPoint
     30from pyutilib.component.core import ExtensionPoint
    3131
    3232from coopr.pysp.phextension import IPHExtension
     
    3737   # routine to compute linearization breakpoints uniformly between the bounds and the mean.
    3838   #
     39
     40   # IMPT: In general, the breakpoint computation codes can return a 2-list even if the lb equals
     41   #       the ub. This case happens quite often in real models (although typically lb=xvag=ub).
     42   #       See the code for constructing the pieces on how this case is handled in the linearization.
    3943   
    4044   def compute_uniform_breakpoints(self, lb, node_min, xavg, node_max, ub, num_breakpoints_per_side):
     
    108112      breakpoints.append(ub)
    109113
    110       # add the mean - it's always a breakpoint. unless!
     114      # add the mean - it's always a breakpoint. unless! -
    111115      # it happens to be equal to (within tolerance) the lower or upper bounds.
    112116      # sort to insert it in the correct place.
     
    375379   # on this piece, variable is the actual instance variable, and average is the instance
    376380   # parameter specifying the average of this variable across instances sharing passing
    377    # through a common tree node. lb and ub are floats.
     381   # through a common tree node. lb and ub are floats.
     382   # IMPT: There are cases where lb=ub, in which case the slope is 0 and the intercept
     383   #       is simply the penalty at the lower(or upper) bound.
    378384   def _create_piecewise_constraint_expression(self, lb, ub, instance_variable, variable_average, quad_variable):
    379385
    380386      penalty_at_lb = (lb - variable_average()) * (lb - variable_average())
    381387      penalty_at_ub = (ub - variable_average()) * (ub - variable_average())
    382       slope = (penalty_at_ub - penalty_at_lb) / (ub - lb)
     388      slope = None
     389      if fabs(ub-lb) > self._integer_tolerance:
     390         slope = (penalty_at_ub - penalty_at_lb) / (ub - lb)
     391      else:
     392         slope = 0.0
    383393      intercept = penalty_at_lb - slope * lb
    384394      expression = (0.0, quad_variable - slope * instance_variable - intercept, None)
     
    12941304                                 ub = x.ub()
    12951305
    1296                               if x.lb == x.ub:
    1297                                  print "***WARNING - LB EQUALS UB"
    1298                                  print "VALUE=",x.lb
    1299                                  print "VARIABLE="+variable_name+indexToString(index)
    1300 
    13011306                              node_min = node_min_parameter[index]()
    13021307                              node_max = node_max_parameter[index]()
  • coopr.pysp/stable/2.2/coopr/pysp/phextension.py

    r1768 r2207  
    1111__all__ = ['IPHExtension']
    1212
    13 from pyutilib.plugin.core import *
     13from pyutilib.component.core import *
    1414
    1515class IPHExtension(Interface):
  • coopr.pysp/stable/2.2/coopr/pysp/testphextension.py

    r2192 r2207  
    99#  _________________________________________________________________________
    1010
    11 from pyutilib.plugin.core import *
     11from pyutilib.component.core import *
    1212from coopr.pysp import phextension
    1313
  • coopr.pysp/stable/2.2/coopr/pysp/wwphextension.py

    r2192 r2207  
    1010
    1111import types
    12 from pyutilib.plugin.core import *
     12from pyutilib.component.core import *
    1313from coopr.pysp import phextension
    1414from coopr.pysp.phutils import *
Note: See TracChangeset for help on using the changeset viewer.