Changeset 1971


Ignore:
Timestamp:
Dec 6, 2009 6:24:10 PM (12 years ago)
Author:
wehart
Message:

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

........

r1954 | jwatson | 2009-12-01 20:20:15 -0700 (Tue, 01 Dec 2009) | 3 lines


Extracting solver runtime for CPLEX solver plugin, at the request of Steven from UC Davis. Extracting solver status is a major issue across-the-board for all solvers, as we are only populating a limited number of the fields (although the full set of statistics is available).

........

r1965 | jwatson | 2009-12-06 12:26:40 -0700 (Sun, 06 Dec 2009) | 3 lines


Migrating reduced-cost reads for CPLEX SOL file format into svn.

........

r1969 | wehart | 2009-12-06 15:53:36 -0700 (Sun, 06 Dec 2009) | 2 lines


Bug fix for mock tests.

........

r1970 | wehart | 2009-12-06 16:16:50 -0700 (Sun, 06 Dec 2009) | 3 lines


Bug fix: don't print None values for reduced cost
Updated cplex baselines.

........

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

Legend:

Unmodified
Added
Removed
  • coopr.plugins/stable/2.1

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

    r1950 r1971  
    247247        #
    248248        for line in output.split("\n"):
    249 #            print "LINE",line
    250249            tokens = re.split('[ \t]+',line.strip())
    251250            if len(tokens) > 3 and tokens[0] == "CPLEX" and tokens[1] == "Error":
     
    272271            elif len(tokens) >= 5 and tokens[4] == "MAXIMIZE":
    273272                results.problem.sense = ProblemSense.maximize
     273            elif len(tokens) >= 4 and tokens[0] == "Solution" and tokens[1] == "time" and tokens[2] == "=":
     274               # technically, I'm not sure if this is CPLEX user time or user+system - CPLEX doesn't appear
     275               # to differentiate, and I'm not sure we can always provide a break-down.
     276               results.solver.user_time = eval(tokens[3])
    274277        return results
    275278
     
    296299                variable_name = None
    297300                variable_value = None
     301                variable_reduced_cost = None
    298302                for i in range(1,len(tokens)):
    299303                   field_name =  string.strip(tokens[i].split('=')[0])
     
    303307                   elif field_name == "value":
    304308                      variable_value = field_value
     309                   elif field_name == "reducedCost":
     310                      variable_reduced_cost = field_value
     311
    305312                # skip the "constant-one" variable, used to capture/retain objective offsets in the CPLEX LP format.
    306313                if variable_name != "ONE_VAR_CONSTANT":
     
    310317                   except:
    311318                       soln.variable[variable_name].value = variable_value
     319                   if not variable_reduced_cost is None:
     320                        try:
     321                            soln.variable[variable_name].rc = eval(variable_reduced_cost)
     322                        except:
     323                            soln.variable[variable_name].rc = variable_reduced_cost
    312324            elif tokens[0] == "constraint":
    313325                constraint_name = None
  • coopr.plugins/stable/2.1/coopr/plugins/tests/mip/test1_cplex.txt

    r1950 r1971  
    4444      Id: 0
    4545      Value: 1
     46    X12:
     47      Id: 1
     48      Rc: 1
     49    X13:
     50      Id: 2
     51      Rc: 2
     52    X21:
     53      Id: 3
     54      Rc: 1
     55    X22:
     56      Id: 4
     57      Rc: 2
    4658    X23:
    4759      Id: 5
    4860      Value: 1
     61    X31:
     62      Id: 6
     63      Rc: 2
    4964    X32:
    5065      Id: 7
    5166      Value: 1
     67    X33:
     68      Id: 8
     69      Rc: 1
    5270  Constraint:
    5371    NODEA1:
  • coopr.plugins/stable/2.1/coopr/plugins/tests/mip/test4_cplex.txt

    r1950 r1971  
    4141      Value: 88.578
    4242  Variable:
     43    x0:
     44      Id: 0
     45      Rc: 1.3
     46    x1:
     47      Id: 1
     48      Rc: 0.07
     49    x2:
     50      Id: 2
     51      Rc: 1.03
     52    x3:
     53      Id: 3
     54      Rc: 1.63
    4355    x4:
    4456      Id: 4
    4557      Value: 46.8666666667
     58    x5:
     59      Id: 5
     60      Rc: 0.1
     61    x6:
     62      Id: 6
     63      Rc: 0.1
     64    x7:
     65      Id: 7
     66      Rc: 1.23
    4667  Constraint:
    4768    cons0:
  • coopr.plugins/stable/2.1/coopr/plugins/tests/mip/test_pico.py

    r1950 r1971  
    102102        else:
    103103            try:
    104                 results = self.pico.solve(currdir+"test4.nl", logfile=currdir+"test_solve4.log")
     104                results = self.pico.solve(currdir+"test4.nl", rformat=ResultsFormat.sol, logfile=currdir+"test_solve4.log")
    105105            except coopr.opt.ConverterError:
    106106                pass
Note: See TracChangeset for help on using the changeset viewer.