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

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

Renaming TerminationStatus? to TerminationCondition?. This is a
more sensible description of this enum type.

File size: 2.2 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('error', 'warning', 'ok', 'aborted')
18TerminationCondition = Enum('maxIterations', 'minFunctionValue', 'minStepLength', 
19                            'unbounded', 'globallyOptimal', 'locallyOptimal',
20                            'optimal', 'bestSoFar', 'feasible', 'infeasible',
21                            'stoppedByLimit', 'unsure', 'error', 'other')
22
23
24
25class BranchAndBoundStats(MapContainer):
26
27    def __init__(self):
28        MapContainer.__init__(self)
29        self.declare('number of bounded subproblems')
30        self.declare('number of created subproblems')
31
32
33class BlackBoxStats(MapContainer):
34
35    def __init__(self):
36        MapContainer.__init__(self)
37        self.declare('number of function evaluations')
38        self.declare('number of gradient evaluations')
39        self.declare('number of iterations')
40
41
42class SolverStatistics(MapContainer):
43
44    def __init__(self):
45        MapContainer.__init__(self)
46        self.declare("branch_and_bound", value=BranchAndBoundStats(), active=False)
47        self.declare("black_box", value=BlackBoxStats(), active=False)
48
49
50class SolverInformation(MapContainer):
51
52    def __init__(self):
53        MapContainer.__init__(self)
54        self.declare('solver_ID')
55        self.declare('status', value=SolverStatus.ok)
56        self.declare('return_code')
57        self.declare('message')
58        self.declare('user_time', type=ScalarType.time)
59        self.declare('system_time', type=ScalarType.time)
60        self.declare('termination_condition', value=TerminationCondition.unsure)
61        self.declare('termination_message')
62        self.declare('statistics', value=SolverStatistics(), active=False)
63
Note: See TracBrowser for help on using the repository browser.