File: StatisticReader_TimeLimitReader.py

package info (click to toggle)
scip 10.0.1%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 76,156 kB
  • sloc: ansic: 716,600; cpp: 41,095; awk: 9,195; sh: 4,918; makefile: 4,044; python: 2,076; perl: 731; xml: 660; java: 314; php: 24; lisp: 15
file content (51 lines) | stat: -rw-r--r-- 2,043 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from StatisticReader import StatisticReader
import re

class TimeLimitReader(StatisticReader):
   '''
   extracts the time limit for an instance
   '''
   name = 'TimeLimitReader'
   solvingtimereadkeys = {StatisticReader.SOLVERTYPE_SCIP : "Solving Time (sec) :",
                  StatisticReader.SOLVERTYPE_CPLEX : "Solution time =",
                  StatisticReader.SOLVERTYPE_GUROBI : "Explored ",
                  StatisticReader.SOLVERTYPE_CBC : "Coin:Total time (CPU seconds):",
                  StatisticReader.SOLVERTYPE_XPRESS : " *** Search "}
                   
   timelimitreadkeys= {
                  StatisticReader.SOLVERTYPE_SCIP : '(SCIP> limits/time =|SCIP> set limits time)',
                  StatisticReader.SOLVERTYPE_CPLEX : 'CPLEX> New value for time limit in seconds',
                  StatisticReader.SOLVERTYPE_GUROBI : "Changed value of parameter TimeLimit to",
                  StatisticReader.SOLVERTYPE_CBC : "Coin:seconds has value",
                  StatisticReader.SOLVERTYPE_XPRESS : " @05"}
                   
   solvingtimelineindex = {
                  StatisticReader.SOLVERTYPE_SCIP : -1,
                  StatisticReader.SOLVERTYPE_CPLEX : 3,
                  StatisticReader.SOLVERTYPE_GUROBI : -2,
                  StatisticReader.SOLVERTYPE_CBC : 4,
                  StatisticReader.SOLVERTYPE_XPRESS : 5}
   columnwidth = 20
   datakey = 'TimeLimit'
   columnheaderstr = 'Timelimit'.rjust(columnwidth)
   #timelimit = 7200.00
   timelimit_reached = 'true'
   timelimit_not_reached = 'false'

   
   def __init__(self):
      self.timelimit=7200

   def extractStatistic(self, line):
        
      if re.search(self.timelimitreadkeys[StatisticReader.solvertype], line):
         self.timelimit = float(line.split()[-1])
      elif self.solvingtimereadkeys[StatisticReader.solvertype] in line:
         self.solvingtime = float(line.split()[self.solvingtimelineindex[StatisticReader.solvertype]])
      return None

   def execEndOfProb(self):
      return self.timelimit