source: coopr.opt/stable/2.3/coopr/opt/results/solver.py @ 2313

Last change on this file since 2313 was 2313, checked in by wehart, 10 years ago

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.

........

File size: 3.6 KB
Line 
1#  _________________________________________________________________________
2#
3#  Coopr: A COmmon Optimization Python Repository
4#  Copyright (c) 2008 Sandia Corporation.
5#  This software is distributed under the BSD License.
6#  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
7#  the U.S. Government retains certain rights in this software.
8#  For more information, see the Coopr README.txt file.
9#  _________________________________________________________________________
10
11__all__ = ['SolverInformation', 'SolverStatus', 'TerminationCondition']
12
13from container import *
14from pyutilib.enum import Enum
15
16
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    )
50
51
52
53class BranchAndBoundStats(MapContainer):
54
55    def __init__(self):
56        MapContainer.__init__(self)
57        self.declare('number of bounded subproblems')
58        self.declare('number of created subproblems')
59
60
61class BlackBoxStats(MapContainer):
62
63    def __init__(self):
64        MapContainer.__init__(self)
65        self.declare('number of function evaluations')
66        self.declare('number of gradient evaluations')
67        self.declare('number of iterations')
68
69
70class SolverStatistics(MapContainer):
71
72    def __init__(self):
73        MapContainer.__init__(self)
74        self.declare("branch_and_bound", value=BranchAndBoundStats(), active=False)
75        self.declare("black_box", value=BlackBoxStats(), active=False)
76
77
78class SolverInformation(MapContainer):
79
80    def __init__(self):
81        MapContainer.__init__(self)
82        self.declare('name')
83        self.declare('status', value=SolverStatus.ok)
84        self.declare('return_code')
85        self.declare('message')
86        self.declare('user_time', type=ScalarType.time)
87        self.declare('system_time', type=ScalarType.time)
88        self.declare('wallclock_time', type=ScalarType.time)
89        self.declare('termination_condition', value=TerminationCondition.unknown)
90        self.declare('termination_message')
91        self.declare('statistics', value=SolverStatistics(), active=False)
92
Note: See TracBrowser for help on using the repository browser.