File: StatisticReader_ProblemNameReader.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 (30 lines) | stat: -rw-r--r-- 966 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
import os

from StatisticReader import StatisticReader

class ProblemNameReader(StatisticReader):
   '''
      reads a problem name
   '''
   name = 'ProblemNameReader'
   regular_exp = '@01'
   datakey = 'ProblemName'
   columnwidth = 40
   columnheaderstr = 'Problem Name'.ljust(columnwidth)
   extensions = ["mps", "cip", "fzn", "pip"]

   def extractStatistic(self, line):
      fullname = self.getSplitLineWithRegexp(self.regular_exp, line, index = 1, startofline = True)
      if fullname != None:
         namewithextension=os.path.basename(fullname);
         namewithextension = os.path.splitext(namewithextension)[0]
            
         if ".mps" in namewithextension[-4:]:
            namewithextension = namewithextension[:-4]
            
         if namewithextension.endswith('.lp'):
            namewithextension=namewithextension[:-3]
         #print namewithextension
         StatisticReader.setProblemName(namewithextension)
      return None