Changeset 2313


Ignore:
Timestamp:
Feb 11, 2010 11:26:54 AM (10 years ago)
Author:
wehart
Message:

Merged revisions 2234-2312 via svnmerge from
https://software.sandia.gov/svn/public/coopr/coopr.opt/trunk

........

r2234 | wehart | 2010-02-01 19:34:02 -0700 (Mon, 01 Feb 2010) | 2 lines


Updating changelog.

........

r2236 | wehart | 2010-02-01 19:38:27 -0700 (Mon, 01 Feb 2010) | 2 lines


Tagging coopr.opt 2.3 release

........

r2250 | wehart | 2010-02-03 13:42:06 -0700 (Wed, 03 Feb 2010) | 3 lines


Update to descriptions of solver status and associted termination
conditions.

........

r2251 | wehart | 2010-02-03 13:56:43 -0700 (Wed, 03 Feb 2010) | 3 lines


Changes due to refinement of termination condition management
Bug fix and update to baseline data.

........

r2257 | wehart | 2010-02-03 22:45:40 -0700 (Wed, 03 Feb 2010) | 6 lines


Augmenting the SolverResults? logic to support default values. This
capability is currently disabled, but I'm leaving it in in case we
want to use this in the future.


Misc fix to the activation logic.

........

r2258 | wehart | 2010-02-03 23:33:12 -0700 (Wed, 03 Feb 2010) | 4 lines


Adding a subpackage for optimization-specific testing tools.
Currently, this contains a customized PyUnit? testing class
that contains new testing functions.

........

r2259 | wehart | 2010-02-04 08:58:44 -0700 (Thu, 04 Feb 2010) | 4 lines


Adding new termination conditions.


Fixing problem setting up testing utilities when YAML is not installed.

........

r2263 | wehart | 2010-02-05 08:18:57 -0700 (Fri, 05 Feb 2010) | 6 lines


Misc rework of the converter utility to recognize that *.py files have
Pyomo models.


NOTE: If we start working with PuLP, then we might have an issue
distinguishing PuLP vs Pyomo Python files.

........

r2280 | jwatson | 2010-02-08 11:26:49 -0700 (Mon, 08 Feb 2010) | 1 line


Adding a suffixes attribute to the base solver class. This is a list of suffixes that the solver will - assuming it can - load into a solution. Examples are rc, dual, slack, etc. I modified the derived solver plugin classes to throw an exception if provided a suffix that it can't handle. I have little doubt that this change will cause some tests to fail - I'll look at this in a bit. The change was motivated by the expense of querying a solution, loading a solution, and shipping a lot of unnecessary information across the network.

........

Location:
coopr.opt/stable/2.3
Files:
10 edited
3 copied

Legend:

Unmodified
Added
Removed
  • coopr.opt/stable/2.3

  • coopr.opt/stable/2.3/coopr/opt/__init__.py

    r2201 r2313  
    1717import solver
    1818import reader
     19import testing
    1920from parallel import *
    2021
  • coopr.opt/stable/2.3/coopr/opt/base/convert.py

    r2201 r2313  
    1313import copy
    1414import os
    15 from formats import ProblemFormat
     15from formats import ProblemFormat, guess_format
    1616from error import *
    1717from pyutilib.component.core import *
     
    4848       if os.sep in fname:   #pragma:nocover
    4949          fname = tmp.split(os.sep)[-1]
    50        suffix = fname.split('.')[-1]
    51        try:
    52           if suffix == "lp":
    53              source_ptype = [ProblemFormat.cpxlp]
    54           else:
    55              source_ptype = [getattr(ProblemFormat,suffix)]
    56        except AttributeError:
    57           raise ConverterError, "Unknown suffix type: "+suffix
     50       source_ptype = [guess_format(fname)]
     51       if source_ptype is [None]:
     52            raise ConverterError, "Unknown suffix type: "+suffix
    5853    else:
    5954       source_ptype = args[0].valid_problem_types()
  • coopr.opt/stable/2.3/coopr/opt/base/formats.py

    r1938 r2313  
    1717
    1818#
    19 # pyomo - A coopr.pyomo.PyomoModel object
     19# pyomo - A coopr.pyomo.PyomoModel object, or a *.py file that defines such an object
    2020# cpxlp - A CPLEX LP file
    2121# nl - AMPL *.nl file
     
    5151    formats['osrl']=ResultsFormat.osrl
    5252    formats['soln']=ResultsFormat.soln
    53     formats['yaml']=ResultsFormat.yaml
     53    formats['yml']=ResultsFormat.yaml
    5454    formats['results']=ResultsFormat.yaml
    5555    for fmt in formats:
    5656        if filename.endswith('.'+fmt):
    5757            return formats[fmt]
    58    
     58    return None
     59
  • coopr.opt/stable/2.3/coopr/opt/base/solver.py

    r2201 r2313  
    129129        self._assert_available=False
    130130        self._report_timing = False # timing statistics are always collected, but optionally reported.
     131        self.suffixes = [] # a list of the suffixes the user has request be loaded in a solution.
    131132
    132133        # a fairly universal solver feature, at least when dealing
     
    189190          elif key == "available":
    190191             self._assert_available=True
     192          elif key == "suffixes":
     193             val = kwds[key]
     194             self._suffixes=kwds[key]
    191195          else:
    192196             raise ValueError, "Unknown option="+key+" for solver="+self.type
  • coopr.opt/stable/2.3/coopr/opt/results/container.py

    r2109 r2313  
    3333        self._required=required
    3434
    35     def _repn_(self, option):
    36         if not option.schema and not self._required and self.value is undefined:
    37             return ignore
    38         if option.ignore_time and str(self.scalar_type) == str(ScalarType.time):
    39             return ignore
     35    def get_value(self):
    4036        if type(self.value) is EnumValue:
    4137            value = str(self.value)
     
    4440        else:
    4541            value = self.value
     42        return value
     43
     44    def _repn_(self, option):
     45        if not option.schema and not self._required and self.value is undefined:
     46            return ignore
     47        if option.ignore_time and str(self.scalar_type) == str(ScalarType.time):
     48            return ignore
     49        value = self.get_value()
     50        #
     51        # Disabled logic for managing default values, and the
     52        # ignore_defaults option
     53        #
     54        #if option.ignore_defaults:
     55        #    try:
     56        #        if self._default == value:
     57        #            return ignore
     58        #    except AttributeError:
     59        #        pass
    4660        if option.schema:
    4761            tmp = {'value':value}
     
    6983        if option.ignore_time and str(self.scalar_type) == str(ScalarType.time):
    7084            return ignore
    71         if type(self.value) is EnumValue:
    72             value = self.yaml_fix(str(self.value))
    73         elif type(self.value) is UndefinedData:
    74             value = '<undefined>'
    75         else:
    76             value = self.yaml_fix(self.value)
     85        value = self.yaml_fix(self.get_value())
    7786        if not option.schema and self.description is None and self.units is None:
    7887            print >>ostream, value
     
    278287            if 'required' in kwds and kwds['required'] is True:
    279288                data._required = True
     289            #
     290            # This logic would setup a '_default' value, which copies the
     291            # initial value of an attribute.  I don't think we need this,
     292            # but for now I'm going to leave this logic in the code.
     293            #
     294            #if 'value' in kwds:
     295            #    data._default = kwds['value']
    280296            dict.__setitem__(self, tmp, data)
    281297
     
    335351                self.declare(tmp)
    336352            item = dict.__getitem__(self,tmp)
     353            item._active=True
    337354            item.load(repn[key])
    338355
  • coopr.opt/stable/2.3/coopr/opt/results/solution.py

    r2109 r2313  
    1616from pyutilib.math import as_number
    1717
    18 default_print_options = Bunch(schema=False, sparse=True, num_solutions=None, ignore_time=False)
     18default_print_options = Bunch(schema=False, sparse=True, num_solutions=None, ignore_time=False, ignore_defaults=False)
    1919
    2020SolutionStatus = Enum('globallyOptimal', 'locallyOptimal',
     
    177177
    178178    def load(self, repn):
    179         if isinstance(repn, basestring):
     179        if isinstance(repn, basestring) or repn is None:
    180180            return
    181181        index = {}
  • coopr.opt/stable/2.3/coopr/opt/results/solver.py

    r2095 r2313  
    1515
    1616
    17 SolverStatus = Enum('error', 'warning', 'ok', 'aborted')
    18 TerminationCondition = Enum('maxIterations', 'minFunctionValue', 'minStepLength',
    19                             'unbounded', 'globallyOptimal', 'locallyOptimal',
    20                             'optimal', 'bestSoFar', 'feasible', 'infeasible',
    21                             'stoppedByLimit', 'unsure', 'error', 'other')
     17SolverStatus = Enum(
     18    'ok',                   # Normal termination
     19    'warning',              # Termination with unusual condtion
     20    'error',                # Terminated internally with error
     21    'aborted',              # Terminated due to external conditions (e.g. interrupts)
     22    'unknown'               # An unitialized value
     23    )
     24
     25TerminationCondition = Enum(
     26    # OK
     27    'maxIterations',        # Exceeded maximum number of iterations allowed by user
     28    'minFunctionValue',     # Found solution smaller than specified function value
     29    'minStepLength',        # Step length is smaller than specified limit
     30    'globallyOptimal',      # Found a globally optimal solution
     31    'locallyOptimal',       # Found a locally optimal solution
     32    'optimal',              # Found an optimal solution
     33    'maxEvaluations',       # Exceeded maximum number of problem evaluations
     34    # WARNING
     35    'unbounded',            # Demonstrated that problem is unbounded
     36    'infeasible',           # Demonstrated that the problem is infeasible
     37    'invalidProlem',        # The problem setup or characteristics are not valide for the solver
     38    'other'                 # Other, uncategorized normal termination
     39    # ERROR
     40    'solverFailure',        # Solver failed to terminate correctly
     41    'internalSolverError',  # Internal solver error
     42    'error',                # Other errors
     43    # ABORTED
     44    'userInterrupt',        # Interrupt signal generated by user
     45    'resourceInterrupt',    # Interrupt signal in resources used by optimizer
     46    'licensingProblems',    # Problem accessing solver license
     47    # UNKNOWN
     48    'unknown'               # An unitialized value
     49    )
    2250
    2351
     
    5280    def __init__(self):
    5381        MapContainer.__init__(self)
    54         self.declare('solver_ID')
     82        self.declare('name')
    5583        self.declare('status', value=SolverStatus.ok)
    5684        self.declare('return_code')
     
    5886        self.declare('user_time', type=ScalarType.time)
    5987        self.declare('system_time', type=ScalarType.time)
    60         self.declare('termination_condition', value=TerminationCondition.unsure)
     88        self.declare('wallclock_time', type=ScalarType.time)
     89        self.declare('termination_condition', value=TerminationCondition.unknown)
    6190        self.declare('termination_message')
    6291        self.declare('statistics', value=SolverStatistics(), active=False)
  • coopr.opt/stable/2.3/coopr/opt/tests/base/test1.txt

    r1918 r2313  
    2121- Status: ok
    2222  Message:
    23   Termination condition: unsure
     23  Termination condition: unknown
    2424  ServiceURI:
    2525  ServiceName:
  • coopr.opt/stable/2.3/coopr/opt/tests/base/test4_sol.txt

    r1918 r2313  
    2020- Status: ok
    2121  Message: PICO Solver\x3a final f = 88.200000
    22   Termination condition: unsure
     22  Termination condition: unknown
    2323  Id: 0
    2424
Note: See TracChangeset for help on using the changeset viewer.