Changeset 3607


Ignore:
Timestamp:
Feb 12, 2011 8:00:06 PM (9 years ago)
Author:
wehart
Message:

A variety of solver changes, mostly to handle suffix options
within the solver_options that are past to the test driver.

Location:
coopr.plugins/releases/2.5/coopr/plugins
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • coopr.plugins/releases/2.5/coopr/plugins/mip/ASL.py

    r3095 r3607  
    9191            opt=[]
    9292            for key in self.options:
    93                 if key is 'solver':
     93                if key is 'solver' or key is 'suffixes':
    9494                    continue
    9595                if isinstance(self.options[key],basestring) and ' ' in self.options[key]:
  • coopr.plugins/releases/2.5/coopr/plugins/mip/CBCplugin.py

    r3095 r3607  
    142142        # Define command line
    143143        #
    144         if (self.mipgap is not None):
     144        if (self.options.mipgap is not None):
    145145           raise ValueError, "The mipgap parameter is currently not being processed by CBC solver plugin"
    146146       
     
    156156                #opt = ""               
    157157            for key in self.options:
     158                if key is 'suffixes':
     159                    continue
    158160                if isinstance(self.options[key],basestring) and ' ' in self.options[key]:
    159161                    opt += " "+key+"=\""+str(self.options[key])+"\""
     
    172174                opt = ""               
    173175            for key in self.options:
     176                if key is 'suffixes':
     177                    continue
    174178                if isinstance(self.options[key],basestring) and ' ' in self.options[key]:
    175179                    opt += " -"+key+" \""+str(self.options[key])+"\""
     
    292296        extract_duals = False
    293297        extract_reduced_costs = False
    294         for suffix in self.suffixes:
     298        for suffix in self.options.suffixes:
    295299           flag=False
    296300           if re.match(suffix, "dual"):
  • coopr.plugins/releases/2.5/coopr/plugins/mip/CPLEX.py

    r3095 r3607  
    212212        if self._timelimit is not None and self._timelimit > 0.0:
    213213            cplex_script_file.write("set timelimit "+`self._timelimit`+"\n")
    214         if (self.mipgap is not None) and (self.mipgap > 0.0):
    215             cplex_script_file.write("set mip tolerances mipgap "+`self.mipgap`+"\n")           
     214        if (self.options.mipgap is not None) and (self.options.mipgap > 0.0):
     215            cplex_script_file.write("set mip tolerances mipgap "+`self.options.mipgap`+"\n")           
    216216        for key in self.options:
    217                 if key in ['relax_integrality']:
    218                     pass
     217                if key in ['relax_integrality', 'suffixes', 'mipgap']:
     218                    continue
    219219                elif isinstance(self.options[key],basestring) and ' ' in self.options[key]:
    220220                    opt = " ".join(key.split('_'))+" "+str(self.options[key])
     
    365365        extract_slacks = False
    366366        extract_reduced_costs = False
    367         for suffix in self.suffixes:
     367        for suffix in self.options.suffixes:
    368368           flag=False
    369369           if re.match(suffix,"dual"):
  • coopr.plugins/releases/2.5/coopr/plugins/mip/CPLEXDirect.py

    r3277 r3607  
    355355
    356356       # set up all user-specified parameters.
    357        if (self.mipgap is not None) and (self.mipgap > 0.0):
    358           self._active_cplex_instance.parameters.mip.tolerances.mipgap.set(self.mipgap)
     357       if (self.options.mipgap is not None) and (self.options.mipgap > 0.0):
     358          self._active_cplex_instance.parameters.mip.tolerances.mipgap.set(self.options.mipgap)
    359359
    360360       # and kick off the solve.
     
    392392        if self._timelimit is not None and self._timelimit > 0.0:
    393393            cplex_script_file.write("set timelimit "+`self._timelimit`+"\n")
    394         if (self.mipgap is not None) and (self.mipgap > 0.0):
    395             cplex_script_file.write("set mip tolerances mipgap "+`self.mipgap`+"\n")           
     394        if (self.options.mipgap is not None) and (self.options.mipgap > 0.0):
     395            cplex_script_file.write("set mip tolerances mipgap "+`self.options.mipgap`+"\n")           
    396396        for key in self.options:
    397                 if key in ['relax_integrality']:
     397                if key in ['relax_integrality', 'suffixes', 'mipgap']:
    398398                    pass
    399399                elif isinstance(self.options[key],basestring) and ' ' in self.options[key]:
     
    546546        extract_slacks = False
    547547        extract_reduced_costs = False
    548         for suffix in self.suffixes:
     548        for suffix in self.options.suffixes:
    549549           flag=False
    550550           if re.match(suffix,"dual"):
  • coopr.plugins/releases/2.5/coopr/plugins/mip/GLPK.py

    r3095 r3607  
    8888        cmd = [self._timer, '"%s"' % executable]
    8989        for key in self.options:
     90            if key is 'suffixes':
     91                continue
    9092            if isinstance(self.options[key], basestring) \
    9193                   and ' ' in self.options[key]:
     
    9799            cmd.append('--tmlim ' + str(self._timelimit))
    98100
    99         if (self.mipgap is not None) and (self.mipgap > 0.0):
    100             cmd.append('--mipgap ' + str(self.mipgap))
    101101        cmd.append('--output ' + self.soln_file)
    102102
     
    260260        # specified any others.
    261261        extract_duals = False
    262         for suffix in self.suffixes:
     262        for suffix in self.options.suffixes:
    263263            flag = False
    264264            if re.match(suffix, "dual"):
  • coopr.plugins/releases/2.5/coopr/plugins/mip/GUROBI.py

    r3256 r3607  
    174174        options_dict = {}
    175175        for key in self.options:
     176           if key is 'suffixes' or key is 'mipgap':
     177                continue
    176178           options_dict[key] = self.options[key]
    177179
     
    183185        script += "sys.path.append('%s')\n" % os.path.dirname(__file__)
    184186        script += "from GUROBI_RUN import *\n"
    185         script += "gurobi_run%s\n" % str((problem_filename, warmstart_filename, solution_filename, self.mipgap, options_dict))
     187        script += "gurobi_run%s\n" % str((problem_filename, warmstart_filename, solution_filename, self.options.mipgap, options_dict))
    186188        script += "quit()\n"
    187189
  • coopr.plugins/releases/2.5/coopr/plugins/mip/PICO.py

    r3095 r3607  
    8989        # Define command line
    9090        #
    91         if (self.mipgap is not None):
     91        if (self.options.mipgap is not None):
    9292           raise ValueError, "The mipgap parameter is currently not being processed by PICO solver plugin"       
    9393        env=copy.copy(os.environ)
     
    9898                opts = ["debug=2"]
    9999           for key in self.options:
     100                if key == 'suffixes' or key == 'mipgap':
     101                    continue
    100102                if isinstance(self.options[key],basestring) and ' ' in self.options[key]:
    101103                    opts.append(key+"=\""+str(self.options[key])+"\"")
     
    110112                opt = " --debug 2"
    111113           for key in self.options:
     114                if key == 'suffixes' or key == 'mipgap':
     115                    continue
    112116                if isinstance(self.options[key],basestring) and ' ' in self.options[key]:
    113117                    opt += " --"+key+"=\""+str(self.options[key])+"\""
     
    205209        # specified any others.
    206210        extract_duals = False
    207         for suffix in self.suffixes:
     211        for suffix in self.options.suffixes:
    208212           if re.match(suffix,"dual"):
    209213              extract_duals = True
  • coopr.plugins/releases/2.5/coopr/plugins/smanager/pyro.py

    r3192 r3607  
    3333class SolverManager_Pyro(AsynchronousSolverManager):
    3434
    35     pyutilib.component.core.alias('pyro')
     35    pyutilib.component.core.alias('pyro', "Asynchronous solver execution using Pyro")
    3636
    3737    def clear(self):
  • coopr.plugins/releases/2.5/coopr/plugins/testdriver/mip.py

    r3095 r3607  
    3939        pyutilib.services.TempfileManager.tempdir = options.currdir
    4040        #
     41        if options.solver_options is None:
     42            _options = Options()
     43        else:
     44            _options = options.solver_options
     45        _options.suffixes = ['.*']
    4146        if ':' in options.solver:
    4247            solver, sub_solver = options.solver.split(':')
    43             if options.solver_options is None:
    44                 _options = Options()
    45             else:
    46                 _options = options.solver_options
    4748            _options.solver = sub_solver
    4849            testcase.opt = coopr.opt.SolverFactory(solver, options=_options)
    4950        else:
    50             testcase.opt = coopr.opt.SolverFactory(options.solver, options=options.solver_options)
     51            testcase.opt = coopr.opt.SolverFactory(options.solver, options=_options)
    5152        if testcase.opt is None or not testcase.opt.available(False):
    5253            testcase.skipTest('Solver %s is not available' % options.solver)
    53         else:
    54             testcase.opt.suffixes = ['.*']
    5554
    5655    def tearDown(self, testcase, options):
Note: See TracChangeset for help on using the changeset viewer.