source: coopr.opt/trunk/coopr/opt/results/solver.py @ 2251

Last change on this file since 2251 was 2251, checked in by wehart, 9 years ago

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

File size: 3.3 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    # WARNING
34    'unbounded',            # Demonstrated that problem is unbounded
35    'infeasible',           # Demonstrated that the problem is infeasible
36    'other'                 # Other, uncategorized normal termination
37    # ERROR
38    'solverFailure',        # Solver failed to terminate correctly
39    'internalSolverError',  # Internal solver error
40    'error',                # Other errors
41    # ABORTED
42    'userInterrupt',        # Interrupt signal generated by user
43    'resourceInterrupt',    # Interrupt signal in resources used by optimizer
44    'licensingProblems',    # Problem accessing solver license
45    # UNKNOWN
46    'unknown'               # An unitialized value
47    )
48
49
50
51class BranchAndBoundStats(MapContainer):
52
53    def __init__(self):
54        MapContainer.__init__(self)
55        self.declare('number of bounded subproblems')
56        self.declare('number of created subproblems')
57
58
59class BlackBoxStats(MapContainer):
60
61    def __init__(self):
62        MapContainer.__init__(self)
63        self.declare('number of function evaluations')
64        self.declare('number of gradient evaluations')
65        self.declare('number of iterations')
66
67
68class SolverStatistics(MapContainer):
69
70    def __init__(self):
71        MapContainer.__init__(self)
72        self.declare("branch_and_bound", value=BranchAndBoundStats(), active=False)
73        self.declare("black_box", value=BlackBoxStats(), active=False)
74
75
76class SolverInformation(MapContainer):
77
78    def __init__(self):
79        MapContainer.__init__(self)
80        self.declare('solver_ID')
81        self.declare('status', value=SolverStatus.ok)
82        self.declare('return_code')
83        self.declare('message')
84        self.declare('user_time', type=ScalarType.time)
85        self.declare('system_time', type=ScalarType.time)
86        self.declare('termination_condition', value=TerminationCondition.unknown)
87        self.declare('termination_message')
88        self.declare('statistics', value=SolverStatistics(), active=False)
89
Note: See TracBrowser for help on using the repository browser.