Changeset 2072


Ignore:
Timestamp:
Dec 30, 2009 12:46:50 AM (10 years ago)
Author:
wehart
Message:

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

........

r1974 | wehart | 2009-12-06 17:20:56 -0700 (Sun, 06 Dec 2009) | 2 lines


Updating PyPI categories

........

r1977 | wehart | 2009-12-08 17:06:21 -0700 (Tue, 08 Dec 2009) | 2 lines


Eliminating some debugging IO

........

r1983 | jwatson | 2009-12-12 10:42:44 -0700 (Sat, 12 Dec 2009) | 3 lines


Added "warm_start_capable" query method to OptSolver? base class. Default is to return False.

........

r1986 | jwatson | 2009-12-12 11:42:50 -0700 (Sat, 12 Dec 2009) | 3 lines


The new solution module re-work didn't define stoppedByLimit in the SolutionStatus? enum type, and many of the MIP solver plugins are expecting this symbol.

........

r1987 | jwatson | 2009-12-12 11:43:30 -0700 (Sat, 12 Dec 2009) | 3 lines


Missing an import of SolverStatus? enum in shellcmd.py, triggering an error in an exception case.

........

r2003 | wehart | 2009-12-15 23:17:34 -0700 (Tue, 15 Dec 2009) | 7 lines


Adding default options to SolutionSet? object's call method. Thus, I can
do


results.solution()


to get the first solution.

........

r2007 | wehart | 2009-12-17 14:14:17 -0700 (Thu, 17 Dec 2009) | 2 lines


Bug fix in output

........

r2019 | wehart | 2009-12-17 21:59:44 -0700 (Thu, 17 Dec 2009) | 2 lines


Misc fix. Adding symbol_map attribute. However, this isn't populated/used right now.

........

r2030 | jwatson | 2009-12-22 14:55:52 -0700 (Tue, 22 Dec 2009) | 7 lines


Added a "solve_all_instances" utility function to the solver manager library. This function takes three arguments:

  • a solver manager
  • a solver
  • a list of instances The routine applies the supplied solver (through the supplied solver manager) to each of the instances, retreives the results, loads them into the corresponding instance, and performs a barrier synchronization - returning when all instance solves are complete.

........

r2033 | jwatson | 2009-12-22 21:05:07 -0700 (Tue, 22 Dec 2009) | 3 lines


Adding "mipgap" attribute to the base solver class, mirroring the timelimit option. This option is pervasive, and the solver plugins themselves need to know how to write the option.

........

r2047 | wehart | 2009-12-26 17:04:46 -0700 (Sat, 26 Dec 2009) | 2 lines


Removing some debugging print statements

........

Location:
coopr.opt/stable/2.1
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • coopr.opt/stable/2.1

  • coopr.opt/stable/2.1/coopr/opt/base/solver.py

    r1949 r2072  
    127127        self._assert_available=False
    128128
     129        # a fairly universal solver feature, at least when dealing
     130        # with problems containing integers. promoted to a base class
     131        # attribute to allow each sub-solver to automatically write
     132        # out the appropriate option. default is None, meaning
     133        # unassigned. currently not allowing the mipgap to be over-ridden
     134        # via an argument to the solve() method, mainly because we don't
     135        # want to persistence of this parameter to be violated.
     136        self.mipgap = None
     137
    129138    def available(self, exception_flag=True):
    130139        """ True if the solver is available """
     
    135144            raise pyutilib.common.ApplicationError, "OptSolver plugin %s is disabled" % self.name
    136145        return tmp
     146
     147    def warm_start_capable(self):
     148       """ True is the solver can accept a warm-start solution """
     149       return False
    137150
    138151    def solve(self, *args, **kwds):
  • coopr.opt/stable/2.1/coopr/opt/parallel/manager.py

    r1973 r2072  
    1010
    1111
    12 __all__ = ['ActionManagerError', 'ActionHandle', 'AsynchronousActionManager', 'ActionStatus', 'FailedActionHandle']
     12__all__ = ['ActionManagerError', 'ActionHandle', 'AsynchronousActionManager', 'ActionStatus', 'FailedActionHandle', 'solve_all_instances']
    1313
    1414from pyutilib.enum import Enum
    1515
    16 
    1716ActionStatus = Enum('done', 'error', 'queued', 'executing', 'unknown')
    1817
     18# a simple utility to, given a solver manager and a solver, apply the solver to
     19# each problem instance, load the results into the instance, and execute a barrier
     20# synchronization.
     21def solve_all_instances(solver_manager, solver, instances):
     22   action_handles = []
     23   instance_map = {}
     24   for instance in instances:
     25      action_handle = solver_manager.queue(instance, opt=solver)
     26      instance_map[action_handle] = instance
     27      action_handles.append(action_handle)
     28   solver_manager.wait_all(action_handles)
     29   for action_handle in action_handles:
     30      results = solver_manager.get_results(action_handle)
     31      instance_map[action_handle].load(results)
     32   return
    1933
    2034class ActionManagerError(Exception):
  • coopr.opt/stable/2.1/coopr/opt/results/container.py

    r1949 r2072  
    216216            return self[self._convert(name)]
    217217        except Exception, err:
    218             if name[0] != '_':
    219                 print "EXCEPTION: ",str(err),name
     218            #if name[0] != '_':
     219                #print "EXCEPTION: ",str(err),name
    220220            pass
    221221        raise AttributeError, "Unknown attribute `"+str(name)+"' for object with type "+str(type(self))
     
    264264
    265265    def declare(self, name, **kwds):
    266         #print "DECLARE",name,kwds
    267266        if name in self or type(name) is int:
    268267            return
     
    275274                kwds['value']._required = True
    276275            dict.__setitem__(self, tmp, kwds['value'])
    277             #if isinstance(kwds['value'],MapContainer):
    278                 #print "ZZ", repr(dict.__getitem__(self, tmp))
    279276        else:
    280277            data = ScalarData(**kwds)
     
    286283        if not option.schema and not self._active and not self._required:
    287284            return ignore
    288         #print "HERE",self._order
    289285        if self._ordered:
    290286            tmp = []
     
    296292            tmp = {}
    297293            for key in self.keys():
    298                 #print "ZZZ",type(dict.__getitem__(self,key))
    299294                rep = dict.__getitem__(self, key)._repn_(option)
    300295                if not rep == ignore:
     
    309304
    310305    def __repr__(self):
    311         return str(self._repn_(self._options))
     306        return str(self._repn_(self._option))
    312307
    313308    def __str__(self):
  • coopr.opt/stable/2.1/coopr/opt/results/results.py

    r1973 r2072  
    3939        MapContainer.__init__(self)
    4040        self._sections = []
     41        self.symbol_map = None
    4142        self._descriptions = {}
    4243        self.add('problem', ListContainer(problem.ProblemInformation), False, "Problem Information")
  • coopr.opt/stable/2.1/coopr/opt/results/solution.py

    r1949 r2072  
    1919
    2020SolutionStatus = Enum('globallyOptimal', 'locallyOptimal',
    21                             'optimal', 'bestSoFar', 'feasible', 'infeasible',
     21                            'optimal', 'bestSoFar', 'feasible', 'infeasible', 'stoppedByLimit',
    2222                            'unknown', 'unsure', 'error', 'other')
    2323
     
    231231        return len(self._list)
    232232
    233     def __call__(self, i):
     233    def __call__(self, i=0):
    234234        return self._list[i]
    235235
  • coopr.opt/stable/2.1/coopr/opt/solver/shellcmd.py

    r1949 r2072  
    1515from coopr.opt.base import *
    1616from coopr.opt.base.solver import *
     17from coopr.opt.results import SolverStatus
    1718import tempfile
    1819
  • coopr.opt/stable/2.1/setup.py

    r1949 r2072  
    6161            'Programming Language :: Unix Shell',
    6262            'Topic :: Scientific/Engineering :: Mathematics',
    63             'Topic :: Software Development :: Libraries :: Python Modules'
     63            'Topic :: Software Development :: Libraries :: Python Modules',
     64            'Topic :: Scientific/Engineering'
    6465        ],
    6566      packages=packages,
Note: See TracChangeset for help on using the changeset viewer.