Changeset 2313
- Timestamp:
- Feb 11, 2010 11:26:54 AM (11 years ago)
- Location:
- coopr.opt/stable/2.3
- Files:
-
- 10 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
coopr.opt/stable/2.3
- Property svnmerge-integrated changed
/coopr.opt/trunk merged: 2234,2236,2250-2251,2257-2259,2263,2280
- Property svnmerge-integrated changed
-
coopr.opt/stable/2.3/coopr/opt/__init__.py
r2201 r2313 17 17 import solver 18 18 import reader 19 import testing 19 20 from parallel import * 20 21 -
coopr.opt/stable/2.3/coopr/opt/base/convert.py
r2201 r2313 13 13 import copy 14 14 import os 15 from formats import ProblemFormat 15 from formats import ProblemFormat, guess_format 16 16 from error import * 17 17 from pyutilib.component.core import * … … 48 48 if os.sep in fname: #pragma:nocover 49 49 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 58 53 else: 59 54 source_ptype = args[0].valid_problem_types() -
coopr.opt/stable/2.3/coopr/opt/base/formats.py
r1938 r2313 17 17 18 18 # 19 # pyomo - A coopr.pyomo.PyomoModel object 19 # pyomo - A coopr.pyomo.PyomoModel object, or a *.py file that defines such an object 20 20 # cpxlp - A CPLEX LP file 21 21 # nl - AMPL *.nl file … … 51 51 formats['osrl']=ResultsFormat.osrl 52 52 formats['soln']=ResultsFormat.soln 53 formats['y aml']=ResultsFormat.yaml53 formats['yml']=ResultsFormat.yaml 54 54 formats['results']=ResultsFormat.yaml 55 55 for fmt in formats: 56 56 if filename.endswith('.'+fmt): 57 57 return formats[fmt] 58 58 return None 59 -
coopr.opt/stable/2.3/coopr/opt/base/solver.py
r2201 r2313 129 129 self._assert_available=False 130 130 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. 131 132 132 133 # a fairly universal solver feature, at least when dealing … … 189 190 elif key == "available": 190 191 self._assert_available=True 192 elif key == "suffixes": 193 val = kwds[key] 194 self._suffixes=kwds[key] 191 195 else: 192 196 raise ValueError, "Unknown option="+key+" for solver="+self.type -
coopr.opt/stable/2.3/coopr/opt/results/container.py
r2109 r2313 33 33 self._required=required 34 34 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): 40 36 if type(self.value) is EnumValue: 41 37 value = str(self.value) … … 44 40 else: 45 41 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 46 60 if option.schema: 47 61 tmp = {'value':value} … … 69 83 if option.ignore_time and str(self.scalar_type) == str(ScalarType.time): 70 84 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()) 77 86 if not option.schema and self.description is None and self.units is None: 78 87 print >>ostream, value … … 278 287 if 'required' in kwds and kwds['required'] is True: 279 288 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'] 280 296 dict.__setitem__(self, tmp, data) 281 297 … … 335 351 self.declare(tmp) 336 352 item = dict.__getitem__(self,tmp) 353 item._active=True 337 354 item.load(repn[key]) 338 355 -
coopr.opt/stable/2.3/coopr/opt/results/solution.py
r2109 r2313 16 16 from pyutilib.math import as_number 17 17 18 default_print_options = Bunch(schema=False, sparse=True, num_solutions=None, ignore_time=False )18 default_print_options = Bunch(schema=False, sparse=True, num_solutions=None, ignore_time=False, ignore_defaults=False) 19 19 20 20 SolutionStatus = Enum('globallyOptimal', 'locallyOptimal', … … 177 177 178 178 def load(self, repn): 179 if isinstance(repn, basestring) :179 if isinstance(repn, basestring) or repn is None: 180 180 return 181 181 index = {} -
coopr.opt/stable/2.3/coopr/opt/results/solver.py
r2095 r2313 15 15 16 16 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') 17 SolverStatus = 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 25 TerminationCondition = 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 ) 22 50 23 51 … … 52 80 def __init__(self): 53 81 MapContainer.__init__(self) 54 self.declare(' solver_ID')82 self.declare('name') 55 83 self.declare('status', value=SolverStatus.ok) 56 84 self.declare('return_code') … … 58 86 self.declare('user_time', type=ScalarType.time) 59 87 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) 61 90 self.declare('termination_message') 62 91 self.declare('statistics', value=SolverStatistics(), active=False) -
coopr.opt/stable/2.3/coopr/opt/tests/base/test1.txt
r1918 r2313 21 21 - Status: ok 22 22 Message: 23 Termination condition: un sure23 Termination condition: unknown 24 24 ServiceURI: 25 25 ServiceName: -
coopr.opt/stable/2.3/coopr/opt/tests/base/test4_sol.txt
r1918 r2313 20 20 - Status: ok 21 21 Message: PICO Solver\x3a final f = 88.200000 22 Termination condition: un sure22 Termination condition: unknown 23 23 Id: 0 24 24
Note: See TracChangeset
for help on using the changeset viewer.