Changeset 1950 for coopr.plugins


Ignore:
Timestamp:
Nov 25, 2009 10:48:21 AM (10 years ago)
Author:
wehart
Message:

Merged revisions 1873-1949 via svnmerge from
https://software.sandia.gov/svn/public/coopr/coopr.plugins/trunk

........

r1875 | wehart | 2009-11-13 23:52:07 -0700 (Fri, 13 Nov 2009) | 2 lines


Update to trunk version number.

........

r1901 | wehart | 2009-11-18 13:18:12 -0700 (Wed, 18 Nov 2009) | 2 lines


Bug fixes to account for the reorganization of coopr.opt

........

r1906 | jwatson | 2009-11-18 20:14:57 -0700 (Wed, 18 Nov 2009) | 3 lines


Various fixes to CBC mip plugin - a few more to come!

........

r1910 | jwatson | 2009-11-18 21:22:13 -0700 (Wed, 18 Nov 2009) | 3 lines


Fixed bug in CBC when in NL/SOL mode that was setting each primal and dual variable twice when reading the solver output.

........

r1919 | wehart | 2009-11-20 15:27:53 -0700 (Fri, 20 Nov 2009) | 3 lines


Update of MIP solvers and how they load
SolverResults?.

........

r1923 | wehart | 2009-11-20 16:00:01 -0700 (Fri, 20 Nov 2009) | 2 lines


Update of baseline.

........

r1939 | wehart | 2009-11-23 11:08:15 -0700 (Mon, 23 Nov 2009) | 2 lines


Update to solvers to use the new structure for managing the parsing of solution results.

........

r1941 | wehart | 2009-11-23 11:30:19 -0700 (Mon, 23 Nov 2009) | 2 lines


Bug fix when pico_convert is not available.

........

r1945 | wehart | 2009-11-24 06:59:57 -0700 (Tue, 24 Nov 2009) | 2 lines


Adding error checks.

........

r1946 | wehart | 2009-11-24 07:04:19 -0700 (Tue, 24 Nov 2009) | 2 lines


Further fix to avoid parsing blank lines.

........

Location:
coopr.plugins/stable/2.1
Files:
27 edited

Legend:

Unmodified
Added
Removed
  • coopr.plugins/stable/2.1

  • coopr.plugins/stable/2.1/coopr/plugins/mip/CBC.py

    r1797 r1950  
    1313import re
    1414from coopr.opt.base import *
     15from coopr.opt.results import *
    1516from coopr.opt.solver import *
    1617import pyutilib.services
     
    3031        kwds['type'] = 'cbc'
    3132        SystemCallSolver.__init__(self, **kwds)
    32         #
    33         # Setup valid problem formats and valid results for each problem format
     33
     34        #
     35        # Set up valid problem formats and valid results for each problem format
    3436        #
    3537#        self._valid_problem_formats=[ProblemFormat.nl, ProblemFormat.cpxlp, ProblemFormat.mps]
    3638        self._valid_problem_formats=[ProblemFormat.cpxlp, ProblemFormat.nl, ProblemFormat.mps]       
    3739        self._valid_result_formats={}
    38         self._valid_result_formats[ProblemFormat.mps] = [ResultsFormat.log]
    39         self._valid_result_formats[ProblemFormat.nl] = [ResultsFormat.log]
    40         #self._valid_result_formats[ProblemFormat.nl] = [ResultsFormat.sol]
    41         self._valid_result_formats[ProblemFormat.cpxlp] = [ResultsFormat.log]
     40        self._valid_result_formats[ProblemFormat.cpxlp] = [ResultsFormat.soln]
     41        self._valid_result_formats[ProblemFormat.nl] = [ResultsFormat.sol]       
     42        self._valid_result_formats[ProblemFormat.mps] = [ResultsFormat.soln]
    4243
    4344    def _presolve(self, *args, **kwds):
     
    4647       # over-ridden in the base class solve (via keywords), but we should
    4748       # have real values by the time we're presolving.
    48 
    4949       if self._problem_format is None:
    5050
     
    5454             self._problem_format = ProblemFormat.cpxlp
    5555
     56       # in CBC, the results format is defined by the problem format;
     57       # you can't vary them independently.
    5658       if self._problem_format is ProblemFormat.nl:
    5759          self._results_format = ResultsFormat.sol
    5860       else:
    59           self._results_format = ResultsFormat.log
     61          # this really means "CBC-specific" format - not drawing from the
     62          # log file itself (although additional information is contained there).
     63          self._results_format = ResultsFormat.soln
    6064
    6165       # let the base class handle any remaining keywords/actions.
     
    7276    def create_command_line(self,executable,problem_files):
    7377        #
    74         # Define log file
     78        # Define the log file
    7579        #
    7680        if self.log_file is None:
     
    7882
    7983        #
    80         # Define solution file
     84        # Define the solution file
    8185        #
    8286
    8387        # the prefix of the problem filename is required because CBC has a specific
    84         # and automatic convention for generating the output solution filename
     88        # and automatic convention for generating the output solution filename.
     89        # the extracted prefix is the same name as the input filename, e.g., minus
     90        # the ".lp" extension.
    8591        problem_filename_prefix = problem_files[0]
    8692        if '.' in problem_filename_prefix:
     
    9197                problem_filename_prefix = tmp[0]
    9298
    93         if self.soln_file is None:
    94             self.soln_file = self.soln_file = pyutilib.services.TempfileManager.create_tempfile(suffix=fname+".soln")
    95         self.sol_file = problem_filename_prefix+".sol"
    96 
    97         #
    98         # Define results file
    99         #
    100         if self._results_format is None or self._results_format == ResultsFormat.log:
    101            self.results_file = self.log_file
     99        if self._results_format is ResultsFormat.sol:
     100           self.soln_file = problem_filename_prefix+".sol"
    102101        else:
    103            self.results_file = self.soln_file
    104         #elif self._results_format == ResultsFormat.osrl:
    105         #   self.results_file = self.tmpDir+os.sep+"cbc.osrl.xml"
    106 
     102           self.soln_file = problem_filename_prefix+".soln"
     103
     104        #
     105        # Define the results file
     106        #
     107        # results in CBC are split across the log file (solver statistics) and
     108        # the solution file (solutions!)
     109        self.results_file = self.soln_file
     110       
    107111        #
    108112        # Define command line
     
    122126                else:
    123127                    opt += " "+key+"="+str(self.options[key])
    124             self._nl_options = " ".join(self.options) + timing+ " stat= "+opt+" printingOptions=all"
     128            self._nl_options = " ".join(self.options) + timing+ " stat=1 "+opt+" printingOptions=all"
    125129            proc = self._timer + " " + executable + " " + problem_files[0] + " -AMPL "+self._nl_options
    126130        else:
     
    138142                else:
    139143                    opt += " -"+key+" "+str(self.options[key])
    140             proc = self._timer + " " + executable + opt + " -printingOptions all "+timing+ " -import "+problem_files[0]+ " -import -stat -solve -solu " + self.soln_file
     144            proc = self._timer + " " + executable + opt + " -printingOptions all "+timing+ " -import "+problem_files[0]+ " -import -stat 1 -solve -solu " + self.soln_file
    141145        return pyutilib.misc.Bunch(cmd=proc, log_file=self.log_file, env=None)
    142146
     
    149153        # Initial values
    150154        #
    151         results.solver.ncreated=0
    152         results.solver.nbounded=0
    153         soln = results.solution.create()
     155        results.solver.statistics.branch_and_bound.number_of_created_subproblems=0
     156        results.solver.statistics.branch_and_bound.number_of_bounded_subproblems=0
     157        soln = results.solution.add()
     158        soln.objective['f'].value=float('inf')
    154159        #
    155160        # Process logfile
     
    180185                results.problem.name = results.problem.name.split('\\')[-1]
    181186          if len(tokens) ==11 and tokens[0] == "Presolve" and tokens[3] == "rows,":
    182              results.problem.num_variables = eval(tokens[4])-eval(tokens[5][1:-1])
    183              results.problem.num_constraints = eval(tokens[1])-eval(tokens[2][1:-1])
    184              results.problem.num_nonzeros = eval(tokens[8])-eval(tokens[9][1:-1])
    185              results.problem.num_objectives = "1"
     187             results.problem.number_of_variables = eval(tokens[4])-eval(tokens[5][1:-1])
     188             results.problem.number_of_constraints = eval(tokens[1])-eval(tokens[2][1:-1])
     189             results.problem.number_of_nonzeros = eval(tokens[8])-eval(tokens[9][1:-1])
     190             results.problem.number_of_objectives = "1"
    186191          if len(tokens) >=9 and tokens[0] == "Problem" and tokens[2] == "has":
    187              results.problem.num_variables = tokens[5]
    188              results.problem.num_constraints = tokens[3]
    189              results.problem.num_nonzeros = tokens[8]
    190              results.problem.num_objectives = "1"
     192             results.problem.number_of_variables = tokens[5]
     193             results.problem.number_of_constraints = tokens[3]
     194             results.problem.number_of_nonzeros = tokens[8]
     195             results.problem.number_of_objectives = "1"
    191196          if len(tokens) == 5 and tokens[3] == "NAME":
    192197             results.problem.name = tokens[4]
     
    196201          if len(tokens) > 3 and tokens[0] == "Presolve" and tokens[6] == "infeasible":
    197202             soln.status = SolutionStatus.infeasible
    198              soln.value=None
     203             soln.objective['f'].value=None
    199204          if len(tokens) > 3 and tokens[0] == "Optimal" and tokens[1] == "objective":
    200205             soln.status = SolutionStatus.optimal
    201              soln.value=tokens[2]
     206             soln.objective['f'].value=tokens[2]
    202207          if len(tokens) > 6 and tokens[4] == "best" and tokens[5] == "objective":
    203              soln.value=tokens[6]
     208             soln.objective['f'].value=tokens[6]
    204209          if len(tokens) > 9 and tokens[7] == "(best" and tokens[8] == "possible":
    205210             results.problem.lower_bound=tokens[9]
     
    209214          if len(tokens) > 3 and tokens[0] == "Result" and tokens[2] == "Finished":
    210215             soln.status = SolutionStatus.optimal
    211              soln.value=tokens[4]
     216             soln.objective['f'].value=tokens[4]
    212217          if len(tokens) > 10 and tokens[4] == "time" and tokens[9] == "nodes":
    213              results.solver.ncreated=tokens[8]
    214              results.solver.nbounded=tokens[8]
    215              if eval(results.solver.nbounded) > 0:
    216                 soln.value=tokens[6]
     218             results.solver.statistics.branch_and_bound.number_of_created_subproblems=tokens[8]
     219             results.solver.statistics.branch_and_bound.number_of_bounded_subproblems=tokens[8]
     220             if eval(results.solver.statistics.branch_and_bound.number_of_bounded_subproblems) > 0:
     221                soln.objective['f'].value=tokens[6]
    217222          if len(tokens) == 5 and tokens[1] == "Exiting" and tokens[4] == "time":
    218223             soln.status = SolutionStatus.stoppedByLimit
    219224          if len(tokens) > 8 and tokens[7] == "nodes":
    220              results.solver.ncreated=tokens[6]
    221              results.solver.nbounded=tokens[6]
     225             results.solver.statistics.branch_and_bound.number_of_created_subproblems=tokens[6]
     226             results.solver.statistics.branch_and_bound.number_of_bounded_subproblems=tokens[6]
    222227          if len(tokens) == 2 and tokens[0] == "sys":
    223              results.solver.systime=tokens[1]
     228             results.solver.system_time=tokens[1]
    224229          if len(tokens) == 2 and tokens[0] == "user":
    225              results.solver.usrtime=tokens[1]
    226 
    227         if soln.value == "1e+50":
     230             results.solver.user_time=tokens[1]
     231          results.solver.user_time=-1.0
     232
     233        if soln.objective['f'].value == "1e+50":
    228234           if sense == 1:
    229               soln.value="Infinity"
     235              soln.objective['f'].value=float('inf')
    230236           else:
    231               soln.value="-Infinity"
    232         elif not soln.value is None:
    233            soln.value = eval(soln.value)*sense
     237              soln.objective['f'].value=float('-inf')
     238        elif not soln.objective['f'].value is None:
     239           soln.objective['f'].value = eval(soln.objective['f'].value)*sense
    234240        if soln.status is SolutionStatus.optimal:
    235241           soln.gap=0.0
    236242           if results.problem.sense == ProblemSense.minimize:
    237                 results.problem.lower_bound = soln.value
     243                results.problem.lower_bound = soln.objective['f'].value
    238244                if "upper_bound" in dir(results.problem):
    239245                    del results.problem.upper_bound
    240246           else:
    241                 results.problem.upper_bound = soln.value
     247                results.problem.upper_bound = soln.objective['f'].value
    242248                if "lower_bound" in dir(results.problem):
    243249                    del results.problem.lower_bound
     
    246252        return results
    247253
    248     def process_other_data(self,results):
    249         if os.path.exists(self.sol_file):
    250             results_reader = ReaderFactory(ResultsFormat.sol)
    251             results = results_reader(self.sol_file, results, results.solution(0))
    252             return
    253 
     254    def process_soln_file(self,results):
     255
     256        # if dealing with SOL format files, we've already read
     257        # this via the base class reader functionality.
     258        if self._results_format is ResultsFormat.sol:
     259           return
     260
     261        # otherwise, go with the native CBC solution format.
    254262        solution = results.solution(0)
    255263        if solution.status is SolutionStatus.infeasible:
     
    257265            # sure how to interpret it yet.
    258266            return
    259         results.problem.num_objectives=1
     267        results.problem.number_of_objectives=1
    260268
    261269        processing_constraints=None # None means header, True means constraints, False means variables.
     
    283291             # dual value not precisely equal to 0.0.
    284292             if constraint_dual != 0:
    285                 solution.dual.add(constraint, constraint_dual)
     293                solution.constraint[constraint].dual = constraint_dual
    286294
    287295          elif processing_constraints is False:
     
    293301             # variable value not precisely equal to 0.0.
    294302             if variable_value != 0:
    295                 solution.variable.add(variable, variable_value)
     303                solution.variable[variable].value = variable_value
    296304          else:
    297305             raise RuntimeError, "CBC encountered unexpected line=("+line.strip()+") in solution file="+self.soln_file+"; expecting header, but found data!"
  • coopr.plugins/stable/2.1/coopr/plugins/mip/CPLEX.py

    r1851 r1950  
    1313import re
    1414from coopr.opt.base import *
     15from coopr.opt.results import *
    1516from coopr.opt.solver import *
    1617import mockmip
     
    5253        self._valid_problem_formats=[ProblemFormat.cpxlp, ProblemFormat.mps]
    5354        self._valid_result_formats={}
    54         self._valid_result_formats[ProblemFormat.cpxlp] = [ResultsFormat.log]
    55         self._valid_result_formats[ProblemFormat.mps] = [ResultsFormat.log]
     55        self._valid_result_formats[ProblemFormat.cpxlp] = [ResultsFormat.soln]
     56        self._valid_result_formats[ProblemFormat.mps] = [ResultsFormat.soln]
    5657
    5758    #
     
    174175        # Define results file
    175176        #
    176         if self._results_format is None or self._results_format == ResultsFormat.log:
    177            self.results_file = self.log_file
     177        if self._results_format is None or self._results_format == ResultsFormat.soln:
     178           self.results_file = self.soln_file
    178179        elif self._results_format == ResultsFormat.sol:
    179            self.results_file = self.log_file
     180           self.results_file = self.sol_file
    180181
    181182        #
     
    229230        """
    230231        results = SolverResults()
     232        results.problem.number_of_variables = None
     233        results.problem.number_of_nonzeros = None
    231234        #
    232235        # Process logfile
     
    252255                cplex_version = tokens[2].rstrip(',')
    253256            elif len(tokens) >= 3 and tokens[0] == "Variables":
    254                 if results.problem.num_variables is None: # CPLEX 11.2 and subsequent has two Variables sections.
    255                     results.problem.num_variables = tokens[2]
     257                if results.problem.number_of_variables is None: # CPLEX 11.2 and subsequent has two Variables sections.
     258                    results.problem.number_of_variables = tokens[2]
    256259            # In CPLEX 11 (and presumably before), there was only a single line output to
    257260            # indicate the constriant count, e.g., "Linear constraints : 16 [Less: 7, Greater: 6, Equal: 3]".
     
    261264            # that's all.
    262265            elif len(tokens) >= 4 and tokens[0] == "Linear" and tokens[1] == "constraints":
    263                 results.problem.num_constraints = tokens[3]
     266                results.problem.number_of_constraints = tokens[3]
    264267            elif len(tokens) >= 3 and tokens[0] == "Nonzeros":
    265                 if hasattr(results.problem, "num_nonzeros") is False: # CPLEX 11.2 and subsequent has two Nonzeros sections.               
    266                     results.problem.num_nonzeros = tokens[2]
     268                if results.problem.number_of_nonzeros is None: # CPLEX 11.2 and subsequent has two Nonzeros sections.               
     269                    results.problem.number_of_nonzeros = tokens[2]
    267270            elif len(tokens) >= 5 and tokens[4] == "MINIMIZE":
    268271                results.problem.sense = ProblemSense.minimize
     
    271274        return results
    272275
    273     def process_other_data(self,results):
     276    def process_soln_file(self,results):
    274277        lp_solution=False
    275278        if not os.path.exists(self.soln_file):
    276279           return
    277280
    278         results.solver.ncreated=0
    279         results.solver.nbounded=0
     281        results.solver.statistics.branch_and_bound.number_of_created_subproblems=0
     282        results.solver.statistics.branch_and_bound.number_of_bounded_subproblems=0
    280283
    281284        soln = Solution()
     285        soln.objective['f'].value=None
    282286        INPUT = open(self.soln_file,"r")
    283         results.problem.num_objectives=1
     287        results.problem.number_of_objectives=1
    284288        for line in INPUT:
    285289            line = line.strip()
     
    301305                # skip the "constant-one" variable, used to capture/retain objective offsets in the CPLEX LP format.
    302306                if variable_name != "ONE_VAR_CONSTANT":
    303                    soln.variable.add(variable_name, variable_value)
     307                   try:
     308                       soln.variable[variable_name].value = eval(variable_value)
     309                       #print soln.variable[variable_name].value, type(soln.variable[variable_name].value)
     310                   except:
     311                       soln.variable[variable_name].value = variable_value
    304312            elif tokens[0] == "constraint":
    305313                constraint_name = None
     
    313321                      # assumes the name field is first.
    314322                      if eval(field_value) != 0.0:
    315                         constraint_dual = field_value
    316                         soln.dual.add(constraint_name, constraint_dual)                     
     323                        soln.constraint[constraint_name].dual = eval(field_value)
    317324                   elif field_name == "slack": # for MIPs
    318325                      # assumes the name field is first.
    319326                      if eval(field_value) != 0.0:
    320                         constraint_slack = field_value
    321                         soln.slack.add(constraint_name,constraint_slack)
     327                        soln.constraint[constraint_name].slack = eval(field_value)
    322328            elif tokens[0].startswith("problemName"):
    323329                filename = (string.strip(tokens[0].split('=')[1])).lstrip("\"").rstrip("\"")
     
    347353            elif tokens[0].startswith("objectiveValue"):
    348354                objective_value = (string.strip(tokens[0].split('=')[1])).lstrip("\"").rstrip("\"")
    349                 soln.value = objective_value
     355                soln.objective['f'].value = objective_value
    350356            elif tokens[0].startswith("solutionStatusString"):
    351357                solution_status = (string.strip(" ".join(tokens).split('=')[1])).lstrip("\"").rstrip("\"")
     
    354360                    soln.gap = 0.0
    355361                    if results.problem.sense == ProblemSense.minimize:
    356                         results.problem.lower_bound = soln.value
     362                        results.problem.lower_bound = soln.objective['f'].value
    357363                        if "upper_bound" in dir(results.problem):
    358364                            del results.problem.upper_bound
    359365                    else:
    360                         results.problem.upper_bound = soln.value
     366                        results.problem.upper_bound = soln.objective['f'].value
    361367                        if "lower_bound" in dir(results.problem):
    362368                            del results.problem.lower_bound
  • coopr.plugins/stable/2.1/coopr/plugins/mip/GLPK.py

    r1794 r1950  
    1313import re
    1414from coopr.opt.base import *
     15from coopr.opt.results import *
    1516from coopr.opt.solver import *
    1617import mockmip
     
    3637        self._valid_problem_formats=[ProblemFormat.mod, ProblemFormat.cpxlp, ProblemFormat.mps]
    3738        self._valid_result_formats={}
    38         self._valid_result_formats[ProblemFormat.mod] = [ResultsFormat.log]
    39         self._valid_result_formats[ProblemFormat.cpxlp] = [ResultsFormat.log]
    40         self._valid_result_formats[ProblemFormat.mps] = [ResultsFormat.log]
     39        self._valid_result_formats[ProblemFormat.mod] = [ResultsFormat.soln]
     40        self._valid_result_formats[ProblemFormat.cpxlp] = [ResultsFormat.soln]
     41        self._valid_result_formats[ProblemFormat.mps] = [ResultsFormat.soln]
    4142
    4243    def executable(self):
     
    6465        # Define results file
    6566        #
    66         if self._results_format is None or self._results_format == ResultsFormat.log:
    67            self.results_file = self.log_file
     67        if self._results_format is None or self._results_format == ResultsFormat.soln:
     68           self.results_file = self.soln_file
    6869           
    6970        #
     
    99100        # Initial values
    100101        #
    101         results.solver.ncreated=0
    102         results.solver.nbounded=0
    103         soln = results.solution.create()
     102        results.solver.statistics.branch_and_bound.number_of_created_subproblems=0
     103        results.solver.statistics.branch_and_bound.number_of_bounded_subproblems=0
     104        soln = results.solution.add()
     105        soln.objective['f']=float('inf')
    104106        #
    105107        # Process logfile
     
    115117          #print "LINE:", tokens
    116118          if len(tokens) > 4 and tokens[1] == "objval":
    117              soln.value = tokens[3]
     119             soln.objective['f'] = tokens[3]
    118120          elif len(tokens) > 3 and tokens[0] == "Objective" and tokens[1] == "value":
    119              soln.value = tokens[3]
     121             soln.objective['f'] = tokens[3]
    120122          elif len(tokens) > 4 and tokens[0] == "!" and tokens[2] == "objval":
    121              soln.value = tokens[4]
     123             soln.objective['f'] = tokens[4]
    122124          elif len(tokens) > 4 and tokens[0] == "+" and tokens[2] == "objval":
    123              soln.value = tokens[4]
     125             soln.objective['f'] = tokens[4]
    124126          elif len(tokens) > 4 and tokens[0] == "*" and tokens[2] == "objval":
    125              soln.value = tokens[4]
     127             soln.objective['f'] = tokens[4]
    126128          elif len(tokens) > 4 and tokens[0] == "+" and tokens[2] == "mip" and tokens[4] == "not":
    127              soln.value = "unknown"
     129             soln.objective['f'] = "unknown"
    128130             results.problem.lower_bound = tokens[8]
    129131          elif len(tokens) > 4 and tokens[0] == "+" and tokens[1] == "mip" and tokens[4] == "not":
    130              soln.value = "unknown"
     132             soln.objective['f'] = "unknown"
    131133             results.problem.lower_bound = tokens[7]
    132134          elif len(tokens) > 4 and tokens[0] == "+" and tokens[2] == "mip" and tokens[4] != "not":
    133              soln.value = tokens[4]
     135             soln.objective['f'] = tokens[4]
    134136             if tokens[6] != "tree":
    135137                results.problem.lower_bound = tokens[6]
    136138          elif len(tokens) > 4 and tokens[0] == "+" and tokens[1] == "mip" and tokens[4] != "not":
    137              soln.value = tokens[3]
     139             soln.objective['f'] = tokens[3]
    138140             results.problem.lower_bound = tokens[5]
    139141          elif len(tokens) == 6 and tokens[0] == "OPTIMAL" and tokens[1] == "SOLUTION" and tokens[5] == "PRESOLVER":
    140              results.solver.ncreated = 0
    141              results.solver.nbounded = 0
     142             results.solver.statistics.branch_and_bound.number_of_created_subproblems = 0
     143             results.solver.statistics.branch_and_bound.number_of_bounded_subproblems = 0
    142144             soln.status = SolutionStatus.optimal
    143145          elif len(tokens) == 7 and tokens[1] == "OPTIMAL" and tokens[2] == "SOLUTION" and tokens[6] == "PRESOLVER":
    144              results.solver.ncreated = 0
    145              results.solver.nbounded = 0
     146             results.solver.statistics.branch_and_bound.number_of_created_subproblems = 0
     147             results.solver.statistics.branch_and_bound.number_of_bounded_subproblems = 0
    146148             soln.status = SolutionStatus.optimal
    147149          elif len(tokens) > 10 and tokens[0] == "+" and tokens[8] == "empty":
    148              results.solver.ncreated = tokens[11][:-1]
    149              results.solver.nbounded = tokens[11][:-1]
     150             results.solver.statistics.branch_and_bound.number_of_created_subproblems = tokens[11][:-1]
     151             results.solver.statistics.branch_and_bound.number_of_bounded_subproblems = tokens[11][:-1]
    150152          elif len(tokens) > 9 and tokens[0] == "+" and tokens[7] == "empty":
    151              results.solver.ncreated = tokens[10][:-1]
    152              results.solver.nbounded = tokens[10][:-1]
     153             results.solver.statistics.branch_and_bound.number_of_created_subproblems = tokens[10][:-1]
     154             results.solver.statistics.branch_and_bound.number_of_bounded_subproblems = tokens[10][:-1]
    153155          elif len(tokens) == 2 and tokens[0] == "sys":
    154              results.solver.systime=tokens[1]
     156             results.solver.system_time=tokens[1]
    155157          elif len(tokens) == 2 and tokens[0] == "user":
    156              results.solver.usrtime=tokens[1]
     158             results.solver.user_time=tokens[1]
    157159          elif len(tokens) > 2 and tokens[0] == "OPTIMAL" and tokens[1] == "SOLUTION":
    158160             soln.status = SolutionStatus.optimal
     
    162164             soln.status = SolutionStatus.stoppedByLimit
    163165        if results.problem.upper_bound == "inf":
    164            results.problem.upper_bound = "Infinity"
     166           results.problem.upper_bound = 'Infinity'
    165167        if results.problem.lower_bound == "-inf":
    166168           results.problem.lower_bound = "-Infinity"
    167169        try:
    168             tmp = eval(results.problem.upper_bound.strip())
     170            val = results.problem.upper_bound
     171            tmp = eval(val.strip())
    169172            results.problem.upper_bound = str(tmp)
    170173        except:
    171174            pass
    172175        try:
    173             tmp = eval(results.problem.lower_bound.strip())
     176            val = results.problem.lower_bound
     177            tmp = eval(val.strip())
    174178            results.problem.lower_bound = str(tmp)
    175179        except:
    176180            pass
    177181        try:
    178             tmp = eval(soln.value.strip())
    179             soln.value = str(tmp)
     182            val = soln.objective['f'].value
     183            tmp = eval(val.strip())
     184            soln.objective['f'] = str(tmp)
    180185        except:
    181186            pass
     
    193198                    gap="Infinity"
    194199                 else:
    195                     soln.gap=eval(soln.value) - eval(results.problem.lower_bound)
     200                    soln.gap=eval(soln.objective['f']) - eval(results.problem.lower_bound)
    196201           elif "upper_bound" in dir(results.problem):
    197202              if results.problem.upper_bound is "Infinity":
    198203                 soln.gap="Infinity"
    199204              elif not results.problem.upper_bound is None:
    200                  soln.gap=eval(results.problem.upper_bound) - eval(soln.value)
     205                 soln.gap=eval(results.problem.upper_bound) - eval(soln.objective['f'])
    201206        if results.solver.status is SolverStatus.error:
    202207           results.solution.delete(0)
    203208        return results
    204209
    205     def process_other_data(self,results):
     210    def process_soln_file(self,results):
    206211        lp_solution=False
    207212        if not os.path.exists(self.soln_file):
     
    210215        INPUT = open(self.soln_file,"r")
    211216        state=0
    212         results.problem.num_objectives=1
     217        results.problem.number_of_objectives=1
    213218        for line in INPUT:
    214219          tokens = re.split('[ \t]+',line.strip())
     
    222227                results.problem.name = tokens[1]
    223228             elif len(tokens) == 2 and tokens[0] == "Rows:":
    224                 results.problem.num_constraints = tokens[1]
     229                results.problem.number_of_constraints = tokens[1]
    225230             elif len(tokens) >= 2 and tokens[0] == "Columns:":
    226                 results.problem.num_variables = tokens[1]
     231                results.problem.number_of_variables = tokens[1]
    227232             elif len(tokens) == 2 and tokens[0] == "Non-zeros:":
    228                 results.problem.num_nonzeros = tokens[1]
     233                results.problem.number_of_nonzeros = tokens[1]
    229234             elif len(tokens) >= 2 and tokens[0] == "Status:":
    230235                if tokens[1] == "OPTIMAL":
     
    243248                else:
    244249                   results.problem.sense = ProblemSense.maximize
    245                 soln.value=tokens[3]
     250                soln.objective['f']=tokens[3]
    246251                if soln.status is SolutionStatus.optimal:
    247252                   if tokens[4] == "(MINimum)":
    248                         results.problem.lower_bound = soln.value
     253                        results.problem.lower_bound = soln.objective['f'].value
    249254                        if "upper_bound" in dir(results.problem):
    250255                            del results.problem.upper_bound
    251256                   else:
    252                         results.problem.upper_bound = soln.value
     257                        results.problem.upper_bound = soln.objective['f'].value
    253258                        if "lower_bound" in dir(results.problem):
    254259                            del results.problem.lower_bound
     
    285290                else:
    286291                   if tmp.strip() == "< eps":
    287                       soln.dual.add( tmpname,0.0 )
     292                      soln.constraint[tmpname].dual = 0.0
    288293                   else:
    289                       soln.dual.add( tmpname,tmp )
     294                      soln.constraint[tmpname].dual = eval(tmp)
    290295          elif state==2:
    291296             #
     
    307312                tmp=tmp.strip()
    308313                if tmp=="":
    309                    soln.variable.add( tmpname,0.0 )
    310                 else:
    311                    soln.variable.add( tmpname,tmp )
     314                   soln.variable[tmpname].value = 0.0
     315                else:
     316                   soln.variable[tmpname].value = eval(tmp)
    312317          if state==-1:
    313318             break
  • coopr.plugins/stable/2.1/coopr/plugins/mip/NLWRITE.py

    r1768 r1950  
    1313import pyutilib.misc
    1414from coopr.opt.base import *
     15from coopr.opt.results import *
    1516from coopr.opt.solver import *
    1617
     
    2425        SystemCallSolver.__init__(self, **kwds)
    2526        self._valid_problem_formats=[ProblemFormat.nl]
    26         self._valid_result_formats=[ResultsFormat.log]
     27        self._valid_result_formats=[ResultsFormat.soln]
    2728
    2829    def defaultPath(self):
  • coopr.plugins/stable/2.1/coopr/plugins/mip/PICO.py

    r1797 r1950  
    1212import re
    1313from coopr.opt.base import *
     14from coopr.opt.results import *
    1415from coopr.opt.solver import *
    1516import pyutilib.services
     
    3738        self._valid_problem_formats=[ProblemFormat.cpxlp, ProblemFormat.nl, ProblemFormat.mps]
    3839        self._valid_result_formats = {}
    39         self._valid_result_formats[ProblemFormat.cpxlp] = [ResultsFormat.log]
    40         self._valid_result_formats[ProblemFormat.nl] = [ResultsFormat.log]
    41         self._valid_result_formats[ProblemFormat.mps] = [ResultsFormat.log]
     40        self._valid_result_formats[ProblemFormat.cpxlp] = [ResultsFormat.soln]
     41        self._valid_result_formats[ProblemFormat.nl] = [ResultsFormat.sol]
     42        self._valid_result_formats[ProblemFormat.mps] = [ResultsFormat.soln]
    4243
    4344    def executable(self):
     
    6869        # Define results file
    6970        #
    70         if self._results_format is None or self._results_format == ResultsFormat.log:
    71            self.results_file = self.log_file
     71        if self._results_format is None or self._results_format == ResultsFormat.soln:
     72           self.results_file = self.soln_file
    7273        elif self._results_format == ResultsFormat.sol:
    73            self.results_file = self.log_file
    74         else:
    75            self.results_file = self.soln_file
     74           self.results_file = self.sol_file
    7675        # 
    7776        # Eventually, these formats will be added to PICO...
     
    116115        # Initial values
    117116        #
    118         results.solver.ncreated=0
    119         results.solver.nbounded=0
    120         soln = results.solution.create()
     117        results.solver.statistics.branch_and_bound.number_of_created_subproblems=0
     118        results.solver.statistics.branch_and_bound.number_of_bounded_subproblems=0
     119        soln = results.solution.add()
     120        soln.objective['f'].value = None
    121121        #
    122122        # Process logfile
     
    133133             results.solver.status=SolverStatus.aborted
    134134          elif len(tokens) == 5 and tokens[0] == "Final" and tokens[1] == "Solution:":
    135              soln.value = tokens[4]
     135             soln.objective['f'].value = tokens[4]
    136136             soln.status = SolutionStatus.optimal
    137137          elif len(tokens) == 3 and tokens[0] == "LP" and tokens[1] == "value=":
    138              soln.value = tokens[2]
     138             soln.objective['f'].value = tokens[2]
    139139             soln.status=SolutionStatus.optimal
    140140             if results.problem.sense == ProblemSense.minimize:
     
    148148                results.problem.upper_bound = tokens[1]
    149149          elif len(tokens) == 3 and tokens[0] == "Created":
    150              results.solver.ncreated = tokens[1]
     150             results.solver.statistics.branch_and_bound.number_of_created_subproblems = tokens[1]
    151151          elif len(tokens) == 3 and tokens[0] == "Bounded":
    152              results.solver.nbounded = tokens[1]
     152             results.solver.statistics.branch_and_bound.number_of_bounded_subproblems = tokens[1]
    153153          elif len(tokens) == 2 and tokens[0] == "sys":
    154              results.solver.systime=tokens[1]
     154             results.solver.system_time=tokens[1]
    155155          elif len(tokens) == 2 and tokens[0] == "user":
    156              results.solver.usrtime=tokens[1]
     156             results.solver.user_time=tokens[1]
    157157          elif len(tokens) == 3 and tokens[0] == "Solving" and tokens[1] == "problem:":
    158158             results.problem.name = tokens[2]
    159159          elif len(tokens) == 4 and tokens[2] == "constraints:":
    160              results.problem.num_constraints = tokens[3]
     160             results.problem.number_of_constraints = tokens[3]
    161161          elif len(tokens) == 4 and tokens[2] == "variables:":
    162              results.problem.num_variables = tokens[3]
     162             results.problem.number_of_variables = tokens[3]
    163163          elif len(tokens) == 4 and tokens[2] == "nonzeros:":
    164              results.problem.num_nonzeros = tokens[3]
     164             results.problem.number_of_nonzeros = tokens[3]
    165165          elif len(tokens) == 3 and tokens[1] == "Sense:":
    166166             if tokens[2] == "minimization":
     
    174174           soln.gap=0.0
    175175           if results.problem.sense == ProblemSense.minimize:
    176                 results.problem.lower_bound = soln.value
     176                results.problem.lower_bound = soln.objective['f'].value
    177177                if "upper_bound" in dir(results.problem):
    178178                    del results.problem.upper_bound
    179179           else:
    180                 results.problem.upper_bound = soln.value
     180                results.problem.upper_bound = soln.objective['f'].value
    181181                if "lower_bound" in dir(results.problem):
    182182                    del results.problem.lower_bound
     
    185185        return results
    186186
    187     def process_other_data(self,results):
    188         if os.path.exists(self.sol_file):
    189             results_reader = ReaderFactory(ResultsFormat.sol)
    190             results = results_reader(self.sol_file, results, results.solution(0))
    191             #os.remove(self.sol_file)
    192             return
     187    def process_soln_file(self,results):
     188        #print "HERE",self._results_format, self._results_format is ResultsFormat.sol, self.results_reader
     189        if self._results_format is ResultsFormat.sol:
     190           return
     191
     192        #if os.path.exists(self.sol_file):
     193            #results_reader = ReaderFactory(ResultsFormat.sol)
     194            #results = results_reader(self.sol_file, results, results.solution(0))
     195            #return
     196
    193197        if not os.path.exists(self.soln_file):
    194198           return
     
    201205        for line in INPUT:
    202206            tokens = re.split('[ \t]+',line.strip())
     207            if len(tokens) == 0 or (len(tokens) == 1 and tokens[0]==''):
     208                continue
    203209            if tokens[0] == "Objective":
    204210                continue
     
    211217                # variables.
    212218                for (var,val) in tmp:
    213                     soln.variable.add( var, val )
     219                    soln.variable[var] = val
    214220                tmp=[]
    215221                continue
    216             tmp.append( (tokens[0],tokens[2]) )
     222            if len(tokens) < 3:
     223                print "ERROR", line,tokens
     224            tmp.append( (tokens[0],eval(tokens[2])) )
    217225        if lp_flag:
    218226            for (var,val) in tmp:
    219                 soln.dual.add( var, val )
     227                soln.constraint[var].dual = val
    220228        else:
    221229            for (var,val) in tmp:
    222                 soln.variable.add( var, val )
     230                soln.variable[var] = val
    223231        INPUT.close()
    224232
  • coopr.plugins/stable/2.1/coopr/plugins/smanager/pyro.py

    r1851 r1950  
    1616from coopr.opt.parallel.manager import *
    1717from coopr.opt.parallel.solver import *
    18 from coopr.opt.base import SolverResults
     18from coopr.opt.results import SolverResults
    1919
    2020import pickle
  • coopr.plugins/stable/2.1/coopr/plugins/tests/mip/diet_glpk.txt

    r1361 r1950  
    1 ==========================================================
    2 ---  Solver Results                                    ---
    3 ==========================================================
    4 ----------------------------------------------------------
    5 ------  Problem Information                         ------
    6 ----------------------------------------------------------
    7   lower_bound: 88.578
    8   name: diet
    9   num_constraints: 5
    10   num_nonzeros: 39
    11   num_objectives: 1
    12   num_variables: 8
    13   sense: minimize
    14 ----------------------------------------------------------
    15 ------  Solver Information                          ------
    16 ----------------------------------------------------------
    17   error_rc: 0
    18   nbounded: 0
    19   ncreated: 0
    20   status: ok
    21   num_solutions: 1
    22 ----------------------------------------------------------
    23 ------  Solution 1
    24 ----------------------------------------------------------
    25   gap: 0.0
    26   status: optimal
    27   value: 88.578
    28   Primal Variables
    29         Buy[MCH]        46.8667
    30   Dual Variables
    31         Diet[B2]        0.126
    32 ----------------------------------------------------------
     1# ==========================================================
     2# = Solver Results                                         =
     3# ==========================================================
     4
     5# ----------------------------------------------------------
     6#   Problem Information
     7# ----------------------------------------------------------
     8Problem:
     9- Name: diet
     10  Lower bound: 88.578
     11  Upper bound: inf
     12  Number of objectives: 1
     13  Number of constraints: 5
     14  Number of variables: 8
     15  Number of nonzeros: 39
     16  Sense: minimize
     17
     18# ----------------------------------------------------------
     19#   Solver Information
     20# ----------------------------------------------------------
     21Solver:
     22- Status: ok
     23  Termination condition: unsure
     24  Statistics:
     25    Branch and bound:
     26      Number of bounded subproblems: 0
     27      Number of created subproblems: 0
     28  Error rc: 0
     29
     30# ----------------------------------------------------------
     31#   Solution Information
     32# ----------------------------------------------------------
     33Solution:
     34- number of solutions: 1
     35  number of solutions displayed: 1
     36- Gap: 0.0
     37  Status: optimal
     38  Objective:
     39    f:
     40      Id: 0
     41      Value: 88.578
     42  Variable:
     43    Buy[MCH]:
     44      Id: 4
     45      Value: 46.8667
     46  Constraint:
     47    Diet[B2]:
     48      Id: 0
     49      Dual: 0.126
  • coopr.plugins/stable/2.1/coopr/plugins/tests/mip/test1_cbc.txt

    r1358 r1950  
    1 ==========================================================
    2 ---  Solver Results                                    ---
    3 ==========================================================
    4 ----------------------------------------------------------
    5 ------  Problem Information                         ------
    6 ----------------------------------------------------------
    7   lower_bound: 3
    8   name: TINYMATCHING
    9   num_constraints: 3
    10   num_nonzeros: 9
    11   num_objectives: 1
    12   num_variables: 9
    13   sense: minimize
    14 ----------------------------------------------------------
    15 ------  Solver Information                          ------
    16 ----------------------------------------------------------
    17   error_rc: 0
    18   nbounded: 0
    19   ncreated: 0
    20   status: ok
    21   num_solutions: 1
    22 ----------------------------------------------------------
    23 ------  Solution 1
    24 ----------------------------------------------------------
    25   gap: 0.0
    26   status: optimal
    27   value: 3
    28   Primal Variables
    29         X11     1
    30         X23     1
    31         X32     1
    32   Dual Variables
    33         NODEA1  1
    34         NODEA2  1
    35         NODEA3  1
    36 ----------------------------------------------------------
     1# ==========================================================
     2# = Solver Results                                         =
     3# ==========================================================
     4
     5# ----------------------------------------------------------
     6#   Problem Information
     7# ----------------------------------------------------------
     8Problem:
     9- Name: TINYMATCHING
     10  Lower bound: 3
     11  Upper bound: inf
     12  Number of objectives: 1
     13  Number of constraints: 3
     14  Number of variables: 9
     15  Number of nonzeros: 9
     16  Sense: minimize
     17
     18# ----------------------------------------------------------
     19#   Solver Information
     20# ----------------------------------------------------------
     21Solver:
     22- Status: ok
     23  Termination condition: unsure
     24  Statistics:
     25    Branch and bound:
     26      Number of bounded subproblems: 0
     27      Number of created subproblems: 0
     28  Error rc: 0
     29
     30# ----------------------------------------------------------
     31#   Solution Information
     32# ----------------------------------------------------------
     33Solution:
     34- number of solutions: 1
     35  number of solutions displayed: 1
     36- Gap: 0.0
     37  Status: optimal
     38  Objective:
     39    f:
     40      Id: 0
     41      Value: 3
     42  Variable:
     43    X11:
     44      Id: 0
     45      Value: 1
     46    X23:
     47      Id: 1
     48      Value: 1
     49    X32:
     50      Id: 2
     51      Value: 1
     52  Constraint:
     53    NODEA1:
     54      Id: 0
     55      Dual: 1
     56    NODEA2:
     57      Id: 1
     58      Dual: 1
     59    NODEA3:
     60      Id: 2
     61      Dual: 1
  • coopr.plugins/stable/2.1/coopr/plugins/tests/mip/test1_cplex.txt

    r1358 r1950  
    1 ==========================================================
    2 ---  Solver Results                                    ---
    3 ==========================================================
    4 ----------------------------------------------------------
    5 ------  Problem Information                         ------
    6 ----------------------------------------------------------
    7   lower_bound: 3
    8   name: TINYMATCHING
    9   num_constraints: 3
    10   num_nonzeros: 9
    11   num_objectives: 1
    12   num_variables: 9
    13   sense: minimize
    14 ----------------------------------------------------------
    15 ------  Solver Information                          ------
    16 ----------------------------------------------------------
    17   error_rc: 0
    18   nbounded: 0
    19   ncreated: 0
    20   status: ok
    21   num_solutions: 1
    22 ----------------------------------------------------------
    23 ------  Solution 1
    24 ----------------------------------------------------------
    25   gap: 0.0
    26   status: optimal
    27   value: 3
    28   Primal Variables
    29         X11     1
    30         X23     1
    31         X32     1
    32   Dual Variables
    33         NODEA1  1
    34         NODEA2  1
    35         NODEA3  1
    36 ----------------------------------------------------------
     1# ==========================================================
     2# = Solver Results                                         =
     3# ==========================================================
     4
     5# ----------------------------------------------------------
     6#   Problem Information
     7# ----------------------------------------------------------
     8Problem:
     9- Name: TINYMATCHING
     10  Lower bound: 3
     11  Upper bound: inf
     12  Number of objectives: 1
     13  Number of constraints: 3
     14  Number of variables: 9
     15  Number of nonzeros: 9
     16  Sense: minimize
     17
     18# ----------------------------------------------------------
     19#   Solver Information
     20# ----------------------------------------------------------
     21Solver:
     22- Status: ok
     23  Termination condition: unsure
     24  Statistics:
     25    Branch and bound:
     26      Number of bounded subproblems: 0
     27      Number of created subproblems: 0
     28  Error rc: 0
     29
     30# ----------------------------------------------------------
     31#   Solution Information
     32# ----------------------------------------------------------
     33Solution:
     34- number of solutions: 1
     35  number of solutions displayed: 1
     36- Gap: 0.0
     37  Status: optimal
     38  Objective:
     39    f:
     40      Id: 0
     41      Value: 3
     42  Variable:
     43    X11:
     44      Id: 0
     45      Value: 1
     46    X23:
     47      Id: 5
     48      Value: 1
     49    X32:
     50      Id: 7
     51      Value: 1
     52  Constraint:
     53    NODEA1:
     54      Id: 0
     55      Dual: 1
     56    NODEA2:
     57      Id: 1
     58      Dual: 1
     59    NODEA3:
     60      Id: 2
     61      Dual: 1
  • coopr.plugins/stable/2.1/coopr/plugins/tests/mip/test1_glpk.txt

    r1358 r1950  
    1 ==========================================================
    2 ---  Solver Results                                    ---
    3 ==========================================================
    4 ----------------------------------------------------------
    5 ------  Problem Information                         ------
    6 ----------------------------------------------------------
    7   lower_bound: 3
    8   name: TINYMATCHING
    9   num_constraints: 4
    10   num_nonzeros: 18
    11   num_objectives: 1
    12   num_variables: 9
    13   sense: minimize
    14 ----------------------------------------------------------
    15 ------  Solver Information                          ------
    16 ----------------------------------------------------------
    17   error_rc: 0
    18   nbounded: 0
    19   ncreated: 0
    20   status: ok
    21   num_solutions: 1
    22 ----------------------------------------------------------
    23 ------  Solution 1
    24 ----------------------------------------------------------
    25   gap: 0.0
    26   status: optimal
    27   value: 3
    28   Primal Variables
    29         X11     1
    30         X23     1
    31         X32     1
    32   Dual Variables
    33         NODEA1  1
    34         NODEA2  1
    35         NODEA3  2
    36 ----------------------------------------------------------
     1# ==========================================================
     2# = Solver Results                                         =
     3# ==========================================================
     4
     5# ----------------------------------------------------------
     6#   Problem Information
     7# ----------------------------------------------------------
     8Problem:
     9- Name: TINYMATCHING
     10  Lower bound: 3
     11  Upper bound: inf
     12  Number of objectives: 1
     13  Number of constraints: 4
     14  Number of variables: 9
     15  Number of nonzeros: 18
     16  Sense: minimize
     17
     18# ----------------------------------------------------------
     19#   Solver Information
     20# ----------------------------------------------------------
     21Solver:
     22- Status: ok
     23  Termination condition: unsure
     24  Statistics:
     25    Branch and bound:
     26      Number of bounded subproblems: 0
     27      Number of created subproblems: 0
     28  Error rc: 0
     29
     30# ----------------------------------------------------------
     31#   Solution Information
     32# ----------------------------------------------------------
     33Solution:
     34- number of solutions: 1
     35  number of solutions displayed: 1
     36- Gap: 0.0
     37  Status: optimal
     38  Objective:
     39    f:
     40      Id: 0
     41      Value: 3
     42  Variable:
     43    X11:
     44      Id: 0
     45      Value: 1
     46    X23:
     47      Id: 5
     48      Value: 1
     49    X32:
     50      Id: 7
     51      Value: 1
     52  Constraint:
     53    NODEA1:
     54      Id: 0
     55      Dual: 1
     56    NODEA2:
     57      Id: 1
     58      Dual: 1
     59    NODEA3:
     60      Id: 2
     61      Dual: 2
  • coopr.plugins/stable/2.1/coopr/plugins/tests/mip/test1_pico.txt

    r1358 r1950  
    1 ==========================================================
    2 ---  Solver Results                                    ---
    3 ==========================================================
    4 ----------------------------------------------------------
    5 ------  Problem Information                         ------
    6 ----------------------------------------------------------
    7   lower_bound: 3
    8   name: TINYMATCHING
    9   num_constraints: 3
    10   num_nonzeros: 9
    11   num_objectives: 1
    12   num_variables: 9
    13   sense: minimize
    14 ----------------------------------------------------------
    15 ------  Solver Information                          ------
    16 ----------------------------------------------------------
    17   error_rc: 0
    18   nbounded: 0
    19   ncreated: 0
    20   status: ok
    21   num_solutions: 1
    22 ----------------------------------------------------------
    23 ------  Solution 1
    24 ----------------------------------------------------------
    25   gap: 0.0
    26   status: optimal
    27   value: 3
    28   Primal Variables
    29         X11     1
    30         X23     1
    31         X32     1
    32   Dual Variables
    33         NODEA1  1
    34         NODEA2  1
    35         NODEA3  1
    36 ----------------------------------------------------------
     1# ==========================================================
     2# = Solver Results                                         =
     3# ==========================================================
     4
     5# ----------------------------------------------------------
     6#   Problem Information
     7# ----------------------------------------------------------
     8Problem:
     9- Name: TINYMATCHING
     10  Lower bound: 3
     11  Upper bound: inf
     12  Number of objectives: 1
     13  Number of constraints: 3
     14  Number of variables: 9
     15  Number of nonzeros: 9
     16  Sense: minimize
     17  Num objectives: 1
     18
     19# ----------------------------------------------------------
     20#   Solver Information
     21# ----------------------------------------------------------
     22Solver:
     23- Status: ok
     24  Termination condition: unsure
     25  Statistics:
     26    Branch and bound:
     27      Number of bounded subproblems: 0
     28      Number of created subproblems: 0
     29  Error rc: 0
     30
     31# ----------------------------------------------------------
     32#   Solution Information
     33# ----------------------------------------------------------
     34Solution:
     35- number of solutions: 1
     36  number of solutions displayed: 1
     37- Gap: 0.0
     38  Status: optimal
     39  Objective:
     40    f:
     41      Id: 0
     42      Value: 3
     43  Variable:
     44    X11:
     45      Id: 0
     46      Value: 1
     47    X23:
     48      Id: 1
     49      Value: 1
     50    X32:
     51      Id: 2
     52      Value: 1
     53  Constraint:
     54    NODEA1:
     55      Id: 0
     56      Dual: 1
     57    NODEA2:
     58      Id: 1
     59      Dual: 1
     60    NODEA3:
     61      Id: 2
     62      Dual: 1
  • coopr.plugins/stable/2.1/coopr/plugins/tests/mip/test2_cbc.txt

    r1350 r1950  
    1 ==========================================================
    2 ---  Solver Results                                    ---
    3 ==========================================================
    4 ----------------------------------------------------------
    5 ------  Problem Information                         ------
    6 ----------------------------------------------------------
    7   name: test2
    8   num_constraints: 2
    9   num_nonzeros: 4
    10   num_objectives: 1
    11   num_variables: 2
    12   sense: maximize
    13   upper_bound: 2
    14 ----------------------------------------------------------
    15 ------  Solver Information                          ------
    16 ----------------------------------------------------------
    17   error_rc: 0
    18   nbounded: 0
    19   ncreated: 0
    20   status: ok
    21   num_solutions: 1
    22 ----------------------------------------------------------
    23 ------  Solution 1
    24 ----------------------------------------------------------
    25   gap: 0.0
    26   status: optimal
    27   value: 2
    28   Primal Variables
    29         x2      1
    30 ----------------------------------------------------------
     1# ==========================================================
     2# = Solver Results                                         =
     3# ==========================================================
     4
     5# ----------------------------------------------------------
     6#   Problem Information
     7# ----------------------------------------------------------
     8Problem:
     9- Name: test2
     10  Lower bound: -inf
     11  Upper bound: 2
     12  Number of objectives: 1
     13  Number of constraints: 2
     14  Number of variables: 2
     15  Number of nonzeros: 4
     16  Sense: maximize
     17
     18# ----------------------------------------------------------
     19#   Solver Information
     20# ----------------------------------------------------------
     21Solver:
     22- Status: ok
     23  Termination condition: unsure
     24  Statistics:
     25    Branch and bound:
     26      Number of bounded subproblems: 0
     27      Number of created subproblems: 0
     28  Error rc: 0
     29
     30# ----------------------------------------------------------
     31#   Solution Information
     32# ----------------------------------------------------------
     33Solution:
     34- number of solutions: 1
     35  number of solutions displayed: 1
     36- Gap: 0.0
     37  Status: optimal
     38  Objective:
     39    f:
     40      Id: 0
     41      Value: 2
     42  Variable:
     43    x2:
     44      Id: 0
     45      Value: 1
  • coopr.plugins/stable/2.1/coopr/plugins/tests/mip/test2_cplex.txt

    r1358 r1950  
    1 ==========================================================
    2 ---  Solver Results                                    ---
    3 ==========================================================
    4 ----------------------------------------------------------
    5 ------  Problem Information                         ------
    6 ----------------------------------------------------------
    7   name: test2
    8   num_constraints: 2
    9   num_nonzeros: 4
    10   num_objectives: 1
    11   num_variables: 2
    12   sense: maximize
    13   upper_bound: 2
    14 ----------------------------------------------------------
    15 ------  Solver Information                          ------
    16 ----------------------------------------------------------
    17   error_rc: 0
    18   nbounded: 0
    19   ncreated: 0
    20   status: ok
    21   num_solutions: 1
    22 ----------------------------------------------------------
    23 ------  Solution 1
    24 ----------------------------------------------------------
    25   gap: 0.0
    26   status: optimal
    27   value: 2
    28   Primal Variables
    29         x2      1
    30   Constraint Slacks
    31         C1      4
    32         c2      1
    33 ----------------------------------------------------------
     1# ==========================================================
     2# = Solver Results                                         =
     3# ==========================================================
     4
     5# ----------------------------------------------------------
     6#   Problem Information
     7# ----------------------------------------------------------
     8Problem:
     9- Name: test2
     10  Lower bound: -inf
     11  Upper bound: 2
     12  Number of objectives: 1
     13  Number of constraints: 2
     14  Number of variables: 2
     15  Number of nonzeros: 4
     16  Sense: maximize
     17
     18# ----------------------------------------------------------
     19#   Solver Information
     20# ----------------------------------------------------------
     21Solver:
     22- Status: ok
     23  Termination condition: unsure
     24  Statistics:
     25    Branch and bound:
     26      Number of bounded subproblems: 0
     27      Number of created subproblems: 0
     28  Error rc: 0
     29
     30# ----------------------------------------------------------
     31#   Solution Information
     32# ----------------------------------------------------------
     33Solution:
     34- number of solutions: 1
     35  number of solutions displayed: 1
     36- Gap: 0.0
     37  Status: optimal
     38  Objective:
     39    f:
     40      Id: 0
     41      Value: 2
     42  Variable:
     43    x2:
     44      Id: 1
     45      Value: 1
     46  Constraint:
     47    C1:
     48      Id: 0
     49      Slack: 4
     50    c2:
     51      Id: 1
     52      Slack: 1
  • coopr.plugins/stable/2.1/coopr/plugins/tests/mip/test2_glpk.txt

    r1345 r1950  
    1 ==========================================================
    2 ---  Solver Results                                    ---
    3 ==========================================================
    4 ----------------------------------------------------------
    5 ------  Problem Information                         ------
    6 ----------------------------------------------------------
    7   name: None
    8   num_constraints: 2
    9   num_nonzeros: 4
    10   num_objectives: 1
    11   num_variables: 2
    12   sense: maximize
    13   upper_bound: 2
    14 ----------------------------------------------------------
    15 ------  Solver Information                          ------
    16 ----------------------------------------------------------
    17   error_rc: 0
    18   nbounded: 0
    19   ncreated: 0
    20   status: ok
    21   num_solutions: 1
    22 ----------------------------------------------------------
    23 ------  Solution 1
    24 ----------------------------------------------------------
    25   gap: 0.0
    26   status: optimal
    27   value: 2
    28   Primal Variables
    29         x2      1
    30 ----------------------------------------------------------
     1# ==========================================================
     2# = Solver Results                                         =
     3# ==========================================================
     4
     5# ----------------------------------------------------------
     6#   Problem Information
     7# ----------------------------------------------------------
     8Problem:
     9- Lower bound: -inf
     10  Upper bound: 2
     11  Number of objectives: 1
     12  Number of constraints: 2
     13  Number of variables: 2
     14  Number of nonzeros: 4
     15  Sense: maximize
     16
     17# ----------------------------------------------------------
     18#   Solver Information
     19# ----------------------------------------------------------
     20Solver:
     21- Status: ok
     22  Termination condition: unsure
     23  Statistics:
     24    Branch and bound:
     25      Number of bounded subproblems: 0
     26      Number of created subproblems: 0
     27  Error rc: 0
     28
     29# ----------------------------------------------------------
     30#   Solution Information
     31# ----------------------------------------------------------
     32Solution:
     33- number of solutions: 1
     34  number of solutions displayed: 1
     35- Gap: 0.0
     36  Status: optimal
     37  Objective:
     38    f:
     39      Id: 0
     40      Value: 2
     41  Variable:
     42    x2:
     43      Id: 1
     44      Value: 1
  • coopr.plugins/stable/2.1/coopr/plugins/tests/mip/test2_pico.txt

    r1345 r1950  
    1 ==========================================================
    2 ---  Solver Results                                    ---
    3 ==========================================================
    4 ----------------------------------------------------------
    5 ------  Problem Information                         ------
    6 ----------------------------------------------------------
    7   name: test2
    8   num_constraints: 2
    9   num_nonzeros: 4
    10   num_objectives: 1
    11   num_variables: 2
    12   sense: maximize
    13   upper_bound: 2
    14 ----------------------------------------------------------
    15 ------  Solver Information                          ------
    16 ----------------------------------------------------------
    17   error_rc: 0
    18   nbounded: 1
    19   ncreated: 1
    20   status: ok
    21   num_solutions: 1
    22 ----------------------------------------------------------
    23 ------  Solution 1
    24 ----------------------------------------------------------
    25   gap: 0.0
    26   status: optimal
    27   value: 2
    28   Primal Variables
    29         x2      1
    30 ----------------------------------------------------------
     1# ==========================================================
     2# = Solver Results                                         =
     3# ==========================================================
     4
     5# ----------------------------------------------------------
     6#   Problem Information
     7# ----------------------------------------------------------
     8Problem:
     9- Name: test2
     10  Lower bound: -inf
     11  Upper bound: 2
     12  Number of objectives: 1
     13  Number of constraints: 2
     14  Number of variables: 2
     15  Number of nonzeros: 4
     16  Sense: maximize
     17  Num objectives: 1
     18
     19# ----------------------------------------------------------
     20#   Solver Information
     21# ----------------------------------------------------------
     22Solver:
     23- Status: ok
     24  Termination condition: unsure
     25  Statistics:
     26    Branch and bound:
     27      Number of bounded subproblems: 1
     28      Number of created subproblems: 1
     29  Error rc: 0
     30
     31# ----------------------------------------------------------
     32#   Solution Information
     33# ----------------------------------------------------------
     34Solution:
     35- number of solutions: 1
     36  number of solutions displayed: 1
     37- Gap: 0.0
     38  Status: optimal
     39  Objective:
     40    f:
     41      Id: 0
     42      Value: 2
     43  Variable:
     44    x2:
     45      Id: 0
     46      Value: 1
  • coopr.plugins/stable/2.1/coopr/plugins/tests/mip/test4_cbc.txt

    r1794 r1950  
    1 ==========================================================
    2 ---  Solver Results                                    ---
    3 ==========================================================
    4 ----------------------------------------------------------
    5 ------  Problem Information                         ------
    6 ----------------------------------------------------------
    7   lower_bound: 88.578
    8   name: None
    9   num_constraints: 4
    10   num_nonzeros: 31
    11   num_objectives: 1
    12   num_variables: 8
    13   sense: minimize
    14 ----------------------------------------------------------
    15 ------  Solver Information                          ------
    16 ----------------------------------------------------------
    17   error_rc: 0
    18   id: 0
    19   message: Cbc 1.04 optimal, objective 9e+01. 1 iterations
    20   nbounded: 0
    21   ncreated: 0
    22   status: ok
    23   num_solutions: 1
    24 ----------------------------------------------------------
    25 ------  Solution 1
    26 ----------------------------------------------------------
    27   gap: 0.0
    28   message: Cbc 1.04 optimal, objective 9e+01
    29 1 iterations
    30   status: optimal
    31   value: 88.578
    32   Primal Variables
    33         v4      46.8666666667
    34   Dual Variables
    35         c2      0.126
    36 ----------------------------------------------------------
     1# ==========================================================
     2# = Solver Results                                         =
     3# ==========================================================
     4
     5# ----------------------------------------------------------
     6#   Problem Information
     7# ----------------------------------------------------------
     8Problem:
     9- Name: None
     10  Lower bound: 88.578
     11  Upper bound: inf
     12  Number of objectives: 1
     13  Number of constraints: 4
     14  Number of variables: 8
     15  Number of nonzeros: 31
     16  Sense: minimize
     17
     18# ----------------------------------------------------------
     19#   Solver Information
     20# ----------------------------------------------------------
     21Solver:
     22- Status: ok
     23  Message: Cbc 1.04 optimal, objective 9e+01; 1 iterations
     24  Termination condition: unsure
     25  Statistics:
     26    Branch and bound:
     27      Number of bounded subproblems: 0
     28      Number of created subproblems: 0
     29  Id: 0
     30  Error rc: 0
     31
     32# ----------------------------------------------------------
     33#   Solution Information
     34# ----------------------------------------------------------
     35Solution:
     36- number of solutions: 2
     37  number of solutions displayed: 2
     38- Gap: 0.0
     39  Status: optimal
     40  Objective:
     41    f:
     42      Id: 0
     43      Value: 88.578
     44- Status: unknown
     45  Message: Cbc 1.04 optimal, objective 9e+01; 1 iterations
     46  Variable:
     47    v4:
     48      Id: 4
     49      Value: 46.8666666667
     50  Constraint:
     51    c2:
     52      Id: 2
     53      Dual: 0.126
  • coopr.plugins/stable/2.1/coopr/plugins/tests/mip/test4_cplex.txt

    r1797 r1950  
    1 ==========================================================
    2 ---  Solver Results                                    ---
    3 ==========================================================
    4 ----------------------------------------------------------
    5 ------  Problem Information                         ------
    6 ----------------------------------------------------------
    7   lower_bound: 88.578
    8   name: tmp0pico_convert
    9   num_constraints: 8
    10   num_nonzeros: 62
    11   num_objectives: 1
    12   num_variables: 8
    13   sense: minimize
    14 ----------------------------------------------------------
    15 ------  Solver Information                          ------
    16 ----------------------------------------------------------
    17   error_rc: 0
    18   nbounded: 0
    19   ncreated: 0
    20   status: ok
    21   num_solutions: 1
    22 ----------------------------------------------------------
    23 ------  Solution 1
    24 ----------------------------------------------------------
    25   gap: 0.0
    26   status: optimal
    27   value: 88.578
    28   Primal Variables
    29         x4      46.8666666667
    30   Dual Variables
    31         cons2   0.126
    32   Constraint Slacks
    33         cons0   -3
    34         cons1   -1
    35         cons3   -939.333333333
    36         cons4   9297
    37         cons5   9299
    38         cons6   9300
    39         cons7   8360.66666667
    40 ----------------------------------------------------------
     1# ==========================================================
     2# = Solver Results                                         =
     3# ==========================================================
     4
     5# ----------------------------------------------------------
     6#   Problem Information
     7# ----------------------------------------------------------
     8Problem:
     9- Name: tmp0pico_convert
     10  Lower bound: 88.578
     11  Upper bound: inf
     12  Number of objectives: 1
     13  Number of constraints: 8
     14  Number of variables: 8
     15  Number of nonzeros: 62
     16  Sense: minimize
     17
     18# ----------------------------------------------------------
     19#   Solver Information
     20# ----------------------------------------------------------
     21Solver:
     22- Status: ok
     23  Termination condition: unsure
     24  Statistics:
     25    Branch and bound:
     26      Number of bounded subproblems: 0
     27      Number of created subproblems: 0
     28  Error rc: 0
     29
     30# ----------------------------------------------------------
     31#   Solution Information
     32# ----------------------------------------------------------
     33Solution:
     34- number of solutions: 1
     35  number of solutions displayed: 1
     36- Gap: 0.0
     37  Status: optimal
     38  Objective:
     39    f:
     40      Id: 0
     41      Value: 88.578
     42  Variable:
     43    x4:
     44      Id: 4
     45      Value: 46.8666666667
     46  Constraint:
     47    cons0:
     48      Id: 0
     49      Slack: -3
     50    cons1:
     51      Id: 1
     52      Slack: -1
     53    cons2:
     54      Id: 2
     55      Dual: 0.126
     56    cons3:
     57      Id: 3
     58      Slack: -939.333333333
     59    cons4:
     60      Id: 4
     61      Slack: 9297
     62    cons5:
     63      Id: 5
     64      Slack: 9299
     65    cons6:
     66      Id: 6
     67      Slack: 9300
     68    cons7:
     69      Id: 7
     70      Slack: 8360.66666667
  • coopr.plugins/stable/2.1/coopr/plugins/tests/mip/test4_glpk.txt

    r1797 r1950  
    1 ==========================================================
    2 ---  Solver Results                                    ---
    3 ==========================================================
    4 ----------------------------------------------------------
    5 ------  Problem Information                         ------
    6 ----------------------------------------------------------
    7   lower_bound: 88.578
    8   name: None
    9   num_constraints: 8
    10   num_nonzeros: 62
    11   num_objectives: 1
    12   num_variables: 8
    13   sense: minimize
    14 ----------------------------------------------------------
    15 ------  Solver Information                          ------
    16 ----------------------------------------------------------
    17   error_rc: 0
    18   nbounded: 0
    19   ncreated: 0
    20   status: ok
    21   num_solutions: 1
    22 ----------------------------------------------------------
    23 ------  Solution 1
    24 ----------------------------------------------------------
    25   gap: 0.0
    26   status: optimal
    27   value: 88.578
    28   Primal Variables
    29         x4      46.8667
    30   Dual Variables
    31         cons2   0.126
    32 ----------------------------------------------------------
     1# ==========================================================
     2# = Solver Results                                         =
     3# ==========================================================
     4
     5# ----------------------------------------------------------
     6#   Problem Information
     7# ----------------------------------------------------------
     8Problem:
     9- Lower bound: 88.578
     10  Upper bound: inf
     11  Number of objectives: 1
     12  Number of constraints: 8
     13  Number of variables: 8
     14  Number of nonzeros: 62
     15  Sense: minimize
     16
     17# ----------------------------------------------------------
     18#   Solver Information
     19# ----------------------------------------------------------
     20Solver:
     21- Status: ok
     22  Termination condition: unsure
     23  Statistics:
     24    Branch and bound:
     25      Number of bounded subproblems: 0
     26      Number of created subproblems: 0
     27  Error rc: 0
     28
     29# ----------------------------------------------------------
     30#   Solution Information
     31# ----------------------------------------------------------
     32Solution:
     33- number of solutions: 1
     34  number of solutions displayed: 1
     35- Gap: 0.0
     36  Status: optimal
     37  Objective:
     38    f:
     39      Id: 0
     40      Value: 88.578
     41  Variable:
     42    x4:
     43      Id: 4
     44      Value: 46.8667
     45  Constraint:
     46    cons2:
     47      Id: 0
     48      Dual: 0.126
  • coopr.plugins/stable/2.1/coopr/plugins/tests/mip/test4_pico.txt

    r1794 r1950  
    1 ==========================================================
    2 ---  Solver Results                                    ---
    3 ==========================================================
    4 ----------------------------------------------------------
    5 ------  Problem Information                         ------
    6 ----------------------------------------------------------
    7   lower_bound: 88.578
    8   name: test4
    9   num_constraints: 8
    10   num_nonzeros: 62
    11   num_objectives: 1
    12   num_variables: 8
    13   sense: minimize
    14 ----------------------------------------------------------
    15 ------  Solver Information                          ------
    16 ----------------------------------------------------------
    17   error_rc: 0
    18   id: 0
    19   message: PICO Solver: final f = 88.578000
    20   nbounded: 0
    21   ncreated: 0
    22   status: ok
    23   num_solutions: 1
    24 ----------------------------------------------------------
    25 ------  Solution 1
    26 ----------------------------------------------------------
    27   gap: 0.0
    28   message: PICO Solver: final f = 88.578000
    29   status: optimal
    30   value: 88.578
    31   Primal Variables
    32         v4      46.8666666667
    33   Dual Variables
    34         c2      0.126
    35 ----------------------------------------------------------
     1# ==========================================================
     2# = Solver Results                                         =
     3# ==========================================================
     4
     5# ----------------------------------------------------------
     6#   Problem Information
     7# ----------------------------------------------------------
     8Problem:
     9- Name: test4
     10  Lower bound: 88.578
     11  Upper bound: inf
     12  Number of objectives: 1
     13  Number of constraints: 8
     14  Number of variables: 8
     15  Number of nonzeros: 62
     16  Sense: minimize
     17
     18# ----------------------------------------------------------
     19#   Solver Information
     20# ----------------------------------------------------------
     21Solver:
     22- Status: ok
     23  Message: PICO Solver\x3a final f = 88.578000
     24  Termination condition: unsure
     25  Statistics:
     26    Branch and bound:
     27      Number of bounded subproblems: 0
     28      Number of created subproblems: 0
     29  Id: 0
     30  Error rc: 0
     31
     32# ----------------------------------------------------------
     33#   Solution Information
     34# ----------------------------------------------------------
     35Solution:
     36- number of solutions: 2
     37  number of solutions displayed: 2
     38- Gap: 0.0
     39  Status: optimal
     40  Objective:
     41    f:
     42      Id: 0
     43      Value: 88.578
     44- Status: unknown
     45  Message: PICO Solver\x3a final f = 88.578000
     46  Variable:
     47    v4:
     48      Id: 4
     49      Value: 46.8666666667
     50  Constraint:
     51    c2:
     52      Id: 2
     53      Dual: 0.126
  • coopr.plugins/stable/2.1/coopr/plugins/tests/mip/test_cbc.py

    r1797 r1950  
    2222from coopr.opt import ResultsFormat, ProblemFormat
    2323
     24coopr.opt.SolverResults.default_print_options.ignore_time = True
    2425try:
    2526    cbc = coopr.plugins.mip.CBC(keepFiles=True)
     
    5859        """ Test CBC - test1.mps """
    5960        results = self.cbc.solve(currdir+"test1.mps",logfile=currdir+"test_solve1.log", solnfile=currdir+"test1.soln")
    60         results.write(currdir+"test_solve1.txt",times=False)
     61        results.write(filename=currdir+"test_solve1.txt",times=False)
    6162        self.failUnlessFileEqualsBaseline(currdir+"test_solve1.txt", currdir+"test1_cbc.txt")
    6263        os.remove(currdir+"test_solve1.log")
     
    6566    def test_solve2a(self):
    6667        """ Test CBC - test1.mps """
    67         results = self.cbc.solve(currdir+"test1.mps", rformat=ResultsFormat.log, logfile=currdir+"test_solve2a.log", solnfile=currdir+"test1.soln")
    68         results.write(currdir+"test_solve2a.txt",times=False)
     68        results = self.cbc.solve(currdir+"test1.mps", rformat=ResultsFormat.soln, logfile=currdir+"test_solve2a.log", solnfile=currdir+"test1.soln")
     69        results.write(filename=currdir+"test_solve2a.txt",times=False)
    6970        self.failUnlessFileEqualsBaseline(currdir+"test_solve2a.txt", currdir+"test1_cbc.txt")
    7071        os.remove(currdir+"test_solve2a.log")
     
    7374    def test_solve2b(self):
    7475        """ Test CBC - test1.mps """
    75         results = self.cbc.solve(currdir+"test1.mps", pformat=ProblemFormat.mps, rformat=ResultsFormat.log, logfile=currdir+"test_solve2b.log", solnfile=currdir+"test1.soln")
    76         results.write(currdir+"test_solve2b.txt",times=False)
     76        results = self.cbc.solve(currdir+"test1.mps", pformat=ProblemFormat.mps, rformat=ResultsFormat.soln, logfile=currdir+"test_solve2b.log", solnfile=currdir+"test1.soln")
     77        results.write(filename=currdir+"test_solve2b.txt",times=False)
    7778        self.failUnlessFileEqualsBaseline(currdir+"test_solve2b.txt", currdir+"test1_cbc.txt")
    7879        os.remove(currdir+"test_solve2b.log")
     
    8283        """ Test CBC - test2.lp """
    8384        results = self.cbc.solve(currdir+"test2.lp", logfile=currdir+"test_solve3.log", solnfile=currdir+"test2.soln")
    84         results.write(currdir+"test_solve3.txt",times=False)
     85        results.write(filename=currdir+"test_solve3.txt",times=False)
    8586        self.failUnlessFileEqualsBaseline(currdir+"test_solve3.txt", currdir+"test2_cbc.txt")
    8687        os.remove(currdir+"test_solve3.log")
     
    8990    def test_solve4(self):
    9091        """ Test CBC - test4.nl """
    91         results = self.cbc.solve(currdir+"test4.nl", rformat=ResultsFormat.log, logfile=currdir+"test_solve4.log", solnfile=currdir+"test4.soln")
    92         results.write(currdir+"test_solve4.txt",times=False)
     92        results = self.cbc.solve(currdir+"test4.nl", rformat=ResultsFormat.sol, logfile=currdir+"test_solve4.log", solnfile=currdir+"test4.soln")
     93        results.write(filename=currdir+"test_solve4.txt",times=False)
    9394        self.failUnlessFileEqualsBaseline(currdir+"test_solve4.txt", currdir+"test4_cbc.txt")
    9495        os.remove(currdir+"test_solve4.log")
     
    103104    def Xtest_options(self):
    104105        """ Test CBC options behavior """
    105         results = self.cbc.solve(currdir+"bell3a.mps", logfile=currdir+        "test_options.log", options="sec=0.1 foo=1 bar='a=b c=d' zz=yy")
    106         results.write(currdir+"test_options.txt",times=False)
     106        results = self.cbc.solve(currdir+"bell3a.mps", logfile=currdir+"test_options.log", options="sec=0.1 foo=1 bar='a=b c=d' zz=yy")
     107        results.write(filename=currdir+"test_options.txt",times=False)
    107108        self.failUnlessFileEqualsBaseline(currdir+"test_options.txt", currdir+  "test4_cbc.txt")
    108109        os.remove(currdir+"test4.sol")
     
    112113        """ Test CBC - prod.mod """
    113114        results = self.cbc.solve(currdir+"prod.mod", logfile=currdir+"test_prod.log", solnfile=currdir+"prod.soln")
    114         results.write(currdir+"test_prod.txt",times=False)
     115        results.write(filename=currdir+"test_prod.txt",times=False)
    115116        self.failUnlessFileEqualsBaseline(currdir+"test_prod.txt", currdir+"prod_cbc.txt")
    116117        os.remove(currdir+"test_prod.log")
     
    161162        """ Test CBC - test1.mps """
    162163        results = self.cbc.solve(currdir+"test1.mps",logfile=currdir+"test_solve1a.log", solnfile=currdir+"test_solve1a.soln")
    163         results.write(currdir+"test_solve1a.txt",times=False)
     164        results.write(filename=currdir+"test_solve1a.txt",times=False)
    164165        self.failUnlessFileEqualsBaseline(currdir+"test_solve1a.txt", currdir+"test1_cbc.txt")
    165166        os.remove(currdir+"test_solve1a.log")
    166         os.remove(currdir+"test_solve1a.soln")
     167        #os.remove(currdir+"test_solve1a.soln")
    167168
    168169
  • coopr.plugins/stable/2.1/coopr/plugins/tests/mip/test_cplex.py

    r1797 r1950  
    2222from coopr.opt import ResultsFormat, ProblemFormat, ConverterError
    2323
     24coopr.opt.SolverResults.default_print_options.ignore_time = True
    2425try:
    2526    cplex = coopr.plugins.mip.CPLEX(keepFiles=True)
     
    6465        """ Test CPLEX - test1.mps """
    6566        results = self.cplex.solve(currdir+"test1.mps", logfile=currdir+"test_solve1.log")
    66         results.write(currdir+"test_solve1.txt",times=False)
     67        results.write(filename=currdir+"test_solve1.txt",times=False)
    6768        self.failUnlessFileEqualsBaseline(currdir+"test_solve1.txt", currdir+"test1_cplex.txt")
    6869        #os.remove(currdir+"test_solve1.log")
     
    7071    def test_solve2a(self):
    7172        """ Test CPLEX - test1.mps """
    72         results = self.cplex.solve(currdir+"test1.mps", rformat=ResultsFormat.log, logfile=currdir+"test_solve2a.log")
    73         results.write(currdir+"test_solve2a.txt",times=False)
     73        results = self.cplex.solve(currdir+"test1.mps", rformat=ResultsFormat.soln, logfile=currdir+"test_solve2a.log")
     74        results.write(filename=currdir+"test_solve2a.txt",times=False)
    7475        self.failUnlessFileEqualsBaseline(currdir+"test_solve2a.txt", currdir+"test1_cplex.txt")
    7576        #os.remove(currdir+"test_solve2a.log")
     
    7778    def test_solve2b(self):
    7879        """ Test CPLEX - test1.mps """
    79         results = self.cplex.solve(currdir+"test1.mps", pformat=ProblemFormat.mps, rformat=ResultsFormat.log, logfile=currdir+"test_solve2b.log")
    80         results.write(currdir+"test_solve2b.txt",times=False)
     80        results = self.cplex.solve(currdir+"test1.mps", pformat=ProblemFormat.mps, rformat=ResultsFormat.soln, logfile=currdir+"test_solve2b.log")
     81        results.write(filename=currdir+"test_solve2b.txt",times=False)
    8182        self.failUnlessFileEqualsBaseline(currdir+"test_solve2b.txt", currdir+"test1_cplex.txt")
    8283        #os.remove(currdir+"test_solve2b.log")
     
    8586        """ Test CPLEX - test2.lp """
    8687        results = self.cplex.solve(currdir+"test2.lp", logfile=currdir+"test_solve3.log")
    87         results.write(currdir+"test_solve3.txt",times=False)
     88        results.write(filename=currdir+"test_solve3.txt",times=False)
    8889        self.failUnlessFileEqualsBaseline(currdir+"test_solve3.txt", currdir+"test2_cplex.txt")
    8990        if os.path.exists(currdir+"test2.solution.dat"):
     
    9596        if pico_convert_available:
    9697            results = self.cplex.solve(currdir+"test4.nl", logfile=currdir+"test_solve4.log")
    97             results.write(currdir+"test_solve4.txt",times=False)
     98            results.write(filename=currdir+"test_solve4.txt",times=False)
    9899            self.failUnlessFileEqualsBaseline(currdir+"test_solve4.txt", currdir+"test4_cplex.txt")
    99100        else:
     
    112113        """ Test CPLEX options behavior """
    113114        results = self.cplex.solve(currdir+"bell3a.mps", logfile=currdir+"test_options.log", options="sec=0.1 foo=1 bar='a=b c=d' xx_zz=yy")
    114         results.write(currdir+"test_options.txt",times=False)
     115        results.write(filename=currdir+"test_options.txt",times=False)
    115116        self.failUnlessFileEqualsBaseline(currdir+"test_options.txt", currdir+  "test4_cplex.txt")
    116117        #os.remove(currdir+"test4.sol")
     
    122123           pass
    123124        results = self.cplex.solve(currdir+"test4.nl", logfile=currdir+"test_solve5.log", keepfiles=True)
    124         results.write(currdir+"test_mock5.txt",times=False)
     125        results.write(filename=currdir+"test_mock5.txt",times=False)
    125126        self.failUnlessFileEqualsBaseline(currdir+"test_mock5.txt", currdir+"test4_cplex.txt")
    126127        os.remove(currdir+"test4.sol")
  • coopr.plugins/stable/2.1/coopr/plugins/tests/mip/test_factory.py

    r1768 r1950  
    127127        ans = coopr.opt.ReaderFactory()
    128128        #self.failUnlessEqual(len(ans),4)
    129         self.failUnlessEqual(set(ans), set(["osrl","rtest", "sol","results"]))
     129        self.failUnlessEqual(set(ans), set(["osrl","rtest", "sol","yaml"]))
    130130
    131131    def test_reader_instance(self):
  • coopr.plugins/stable/2.1/coopr/plugins/tests/mip/test_glpk.py

    r1797 r1950  
    2222from coopr.opt import ResultsFormat, ProblemFormat
    2323
     24coopr.opt.SolverResults.default_print_options.ignore_time = True
    2425try:
    2526    glpk = coopr.plugins.mip.GLPK(keepFiles=True)
     
    5859        """ Test GLPK - test1.mps """
    5960        results = self.glpk.solve(currdir+"test1.mps",logfile=currdir+"test_solve1.log", solnfile=currdir+"test1.soln")
    60         results.write(currdir+"test_solve1.txt", times=False)
     61        results.write(filename=currdir+"test_solve1.txt", times=False)
    6162        self.failUnlessFileEqualsBaseline(currdir+"test_solve1.txt", currdir+"test1_glpk.txt")
    6263        os.remove(currdir+"test_solve1.log")
     
    6566    def test_solve2a(self):
    6667        """ Test GLPK - test1.mps """
    67         results = self.glpk.solve(currdir+"test1.mps", rformat=ResultsFormat.log, logfile=currdir+"test_solve2a.log", solnfile=currdir+"test1.soln")
    68         results.write(currdir+"test_solve2a.txt", times=False)
     68        results = self.glpk.solve(currdir+"test1.mps", rformat=ResultsFormat.soln, logfile=currdir+"test_solve2a.log", solnfile=currdir+"test1.soln")
     69        results.write(filename=currdir+"test_solve2a.txt", times=False)
    6970        self.failUnlessFileEqualsBaseline(currdir+"test_solve2a.txt", currdir+"test1_glpk.txt")
    7071        os.remove(currdir+"test_solve2a.log")
     
    7374    def test_solve2b(self):
    7475        """ Test GLPK - test1.mps """
    75         results = self.glpk.solve(currdir+"test1.mps", pformat=ProblemFormat.mps, rformat=ResultsFormat.log, logfile=currdir+"test_solve2b.log", solnfile=currdir+"test1.soln")
    76         results.write(currdir+"test_solve2b.txt", times=False)
     76        results = self.glpk.solve(currdir+"test1.mps", pformat=ProblemFormat.mps, rformat=ResultsFormat.soln, logfile=currdir+"test_solve2b.log", solnfile=currdir+"test1.soln")
     77        results.write(filename=currdir+"test_solve2b.txt", times=False)
    7778        self.failUnlessFileEqualsBaseline(currdir+"test_solve2b.txt", currdir+"test1_glpk.txt")
    7879        os.remove(currdir+"test_solve2b.log")
     
    8283        """ Test GLPK - test2.lp """
    8384        results = self.glpk.solve(currdir+"test2.lp", logfile=currdir+"test_solve3.log", solnfile=currdir+"test2.soln")
    84         results.write(currdir+"test_solve3.txt", times=False)
     85        results.write(filename=currdir+"test_solve3.txt", times=False)
    8586        self.failUnlessFileEqualsBaseline(currdir+"test_solve3.txt", currdir+"test2_glpk.txt")
    8687        os.remove(currdir+"test_solve3.log")
     
    8990    def test_solve4(self):
    9091        """ Test GLPK - test4.nl """
    91         results = self.glpk.solve(currdir+"test4.nl", rformat=ResultsFormat.log, logfile=currdir+"test_solve4.log", solnfile=currdir+"test4.soln")
    92         results.write(currdir+"test_solve4.txt", times=False)
     92        results = self.glpk.solve(currdir+"test4.nl", rformat=ResultsFormat.soln, logfile=currdir+"test_solve4.log", solnfile=currdir+"test4.soln")
     93        results.write(filename=currdir+"test_solve4.txt", times=False)
    9394        self.failUnlessFileEqualsBaseline(currdir+"test_solve4.txt", currdir+"test4_glpk.txt")
    9495        os.remove(currdir+"test_solve4.log")
     
    99100    def Xtest_solve5(self):
    100101        """ Test GLPK - test5.mps """
    101         results = self.glpk.solve(currdir+"test5.mps", rformat=ResultsFormat.log, logfile=currdir+"test_solve5.log", solnfile=currdir+"test5.soln",timelimit=300)
     102        results = self.glpk.solve(currdir+"test5.mps", rformat=ResultsFormat.soln, logfile=currdir+"test_solve5.log", solnfile=currdir+"test5.soln",timelimit=300)
    102103        self.failUnlessEqual(results.solution(0).status, coopr.opt.SolutionStatus.bestSoFar)
    103104        os.remove(currdir+"test_solve5.log")
     
    107108        """ Test GLPK - diet.mod """
    108109        results = self.glpk.solve(currdir+"diet.mod", logfile=currdir+"test_diet.log", solnfile=currdir+"diet.soln")
    109         results.write(currdir+"test_diet.txt", times=False)
     110        results.write(filename=currdir+"test_diet.txt", times=False)
    110111        self.failUnlessFileEqualsBaseline(currdir+"test_diet.txt", currdir+"diet_glpk.txt")
    111112        os.remove(currdir+"test_diet.log")
     
    120121    def Xtest_options(self):
    121122        """ Test GLPK options behavior """
    122         results = self.glpk.solve(currdir+"bell3a.mps", logfile=currdir+        "test_options.log", options="maxCPUMinutes=0.1 foo=1 bar='a=b c=d' zz=yy")
    123         results.write(currdir+"test_options.txt",times=False)
     123        results = self.glpk.solve(currdir+"bell3a.mps", logfile=currdir+"test_options.log", options="maxCPUMinutes=0.1 foo=1 bar='a=b c=d' zz=yy")
     124        results.write(filename=currdir+"test_options.txt",times=False)
    124125        self.failUnlessFileEqualsBaseline(currdir+"test_options.txt", currdir+  "test4_glpk.txt")
    125126        #os.remove(currdir+"test4.sol")
    126127        #os.remove(currdir+"test_solve4.log")
    127128
    128     def test_error1(self):
     129    def Xtest_error1(self):
    129130        """ Bad results format """
    130131        try:
     
    168169        """ Test GLPK - test1.mps """
    169170        results = self.glpk.solve(currdir+"test1.mps")
    170         results.write(currdir+"test_solve1.txt", times=False)
     171        results.write(filename=currdir+"test_solve1.txt", times=False)
    171172        self.failUnlessFileEqualsBaseline(currdir+"test_solve1.txt", currdir+"test1_glpk.txt")
    172173        if os.path.exists(currdir+"glpk.log"):
  • coopr.plugins/stable/2.1/coopr/plugins/tests/mip/test_pico.py

    r1768 r1950  
    2222from coopr.opt import ResultsFormat, ProblemFormat
    2323
     24coopr.opt.SolverResults.default_print_options.ignore_time = True
    2425try:
    2526    pico_convert =  pyutilib.services.registered_executable("pico_convert")
     
    6465        """ Test PICO - test1.mps """
    6566        results = self.pico.solve(currdir+"test1.mps", logfile=currdir+"test_solve1.log")
    66         results.write(currdir+"test_solve1.txt",times=False)
     67        results.write(filename=currdir+"test_solve1.txt",times=False)
    6768        self.failUnlessFileEqualsBaseline(currdir+"test_solve1.txt", currdir+"test1_pico.txt")
    6869        os.remove(currdir+"test_solve1.log")
     
    7071    def test_solve2a(self):
    7172        """ Test PICO - test1.mps """
    72         results = self.pico.solve(currdir+"test1.mps", rformat=ResultsFormat.log, logfile=currdir+"test_solve2a.log")
    73         results.write(currdir+"test_solve2a.txt",times=False)
     73        results = self.pico.solve(currdir+"test1.mps", rformat=ResultsFormat.soln, logfile=currdir+"test_solve2a.log")
     74        results.write(filename=currdir+"test_solve2a.txt",times=False)
    7475        self.failUnlessFileEqualsBaseline(currdir+"test_solve2a.txt", currdir+"test1_pico.txt")
    7576        os.remove(currdir+"test_solve2a.log")
     
    7778    def test_solve2b(self):
    7879        """ Test PICO - test1.mps """
    79         results = self.pico.solve(currdir+"test1.mps", pformat=ProblemFormat.mps, rformat=ResultsFormat.log, logfile=currdir+"test_solve2b.log")
    80         results.write(currdir+"test_solve2b.txt",times=False)
     80        results = self.pico.solve(currdir+"test1.mps", pformat=ProblemFormat.mps, rformat=ResultsFormat.soln, logfile=currdir+"test_solve2b.log")
     81        results.write(filename=currdir+"test_solve2b.txt",times=False)
    8182        self.failUnlessFileEqualsBaseline(currdir+"test_solve2b.txt", currdir+"test1_pico.txt")
    8283        os.remove(currdir+"test_solve2b.log")
     
    8586        """ Test PICO - test2.lp """
    8687        results = self.pico.solve(currdir+"test2.lp", logfile=currdir+"test_solve3.log")
    87         results.write(currdir+"test_solve3.txt",times=False)
     88        results.write(filename=currdir+"test_solve3.txt",times=False)
    8889        self.failUnlessFileEqualsBaseline(currdir+"test_solve3.txt", currdir+"test2_pico.txt")
    8990        if os.path.exists(currdir+"test2.solution.dat"):
     
    9495        """ Test PICO - test4.nl """
    9596        if pico_convert_available:
    96             results = self.pico.solve(currdir+"test4.nl", logfile=currdir+"test_solve4.log")
    97             results.write(currdir+"test_solve4.txt",times=False)
     97            results = self.pico.solve(currdir+"test4.nl", rformat=ResultsFormat.sol,  logfile=currdir+"test_solve4.log")
     98            results.write(filename=currdir+"test_solve4.txt",times=False)
    9899            self.failUnlessFileEqualsBaseline(currdir+"test_solve4.txt", currdir+"test4_pico.txt")
    99100            os.remove(currdir+"test4.sol")
     
    102103            try:
    103104                results = self.pico.solve(currdir+"test4.nl", logfile=currdir+"test_solve4.log")
    104             except ConverterError:
     105            except coopr.opt.ConverterError:
    105106                pass
    106107       
     
    110111           pass
    111112        results = self.pico.solve(currdir+"test4.nl", logfile=currdir+"test_solve5.log")
    112         results.write(currdir+"test_mock5.txt",times=False)
     113        results.write(filename=currdir+"test_mock5.txt",times=False)
    113114        self.failUnlessFileEqualsBaseline(currdir+"test_mock5.txt", currdir+"test4_pico.txt")
    114115        os.remove(currdir+"test4.sol.txt")
     
    122123        """ Test PICO options behavior """
    123124        results = self.pico.solve(currdir+"bell3a.mps", logfile=currdir+"test_options.log", options="maxCPUMinutes=0.1 foo=1 bar='a=b c=d' zz=yy")
    124         results.write(currdir+"test_options.txt",times=False)
     125        results.write(filename=currdir+"test_options.txt",times=False)
    125126        self.failUnlessFileEqualsBaseline(currdir+"test_options.txt", currdir+"test4_pico.txt")
    126127        #os.remove(currdir+"test4.sol")
  • coopr.plugins/stable/2.1/coopr/plugins/tests/mip/test_solver.py

    r1768 r1950  
    1313import unittest
    1414from nose.tools import nottest
     15#import coopr
     16import coopr.opt
    1517import coopr.plugins.mip
    16 import coopr.opt
    17 import coopr
    1818import pyutilib.services
    1919import pyutilib.common
  • coopr.plugins/stable/2.1/setup.py

    r1847 r1950  
    4242
    4343setup(name='coopr.plugins',
    44       version='2.0',
     44      version='2.1',
    4545      maintainer='William E. Hart',
    4646      maintainer_email='wehart@sandia.gov',
Note: See TracChangeset for help on using the changeset viewer.