Changeset 1851


Ignore:
Timestamp:
Nov 12, 2009 6:22:15 PM (11 years ago)
Author:
jwatson
Message:

Added functionality to allow for passing MIP solver options across the Pyro solver manager.

Location:
coopr.plugins/trunk/coopr/plugins
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • coopr.plugins/trunk/coopr/plugins/mip/CPLEX.py

    r1768 r1851  
    215215           print "Solver script file=" + self.cplex_script_file_name
    216216           if (self.warm_start_solve is True) and (self.mst_file_name is not None):
    217               print "Solver warm-start file=" + self.mst_file_name               
     217              print "Solver warm-start file=" + self.mst_file_name
    218218
    219219        #
  • coopr.plugins/trunk/coopr/plugins/smanager/pyro.py

    r1768 r1851  
    4444        and the ActionHandle status indicates whether the queue was successful.
    4545        """
     46       
    4647        if 'opt' in kwds:
    4748            self._opt = kwds['opt']
    4849            del kwds['opt']
    4950        else:
    50             raise ActionManagerError, "Undefined solver"
     51            raise ActionManagerError, "No solver passed to SolverManager_Pyro, method=_perform_queue; use keyword option \"opt\""
     52
    5153        #
    5254        # Force coopr.opt to ignore tests for availability, at least locally
     
    5557        self._opt._presolve(*args, **kwds)
    5658        filestr = open(self._opt._problem_files[0],'r').read()
     59
    5760        #
    5861        # Delete this option, to ensure that the remote worker does the check for
     
    6063        #
    6164        del kwds['available']
    62         data=pyutilib.misc.Bunch(opt=self._opt.type, file=filestr, filename=self._opt._problem_files[0], kwds=kwds)
     65
     66        #
     67        # We can't pickl the options object itself - so extract a simple
     68        # dictionary of solver options and re-construct it on the other end.
     69        #
     70        solver_options = {}
     71        for key in self._opt.options:
     72           solver_options[key]=self._opt.options[key]
     73
     74        #
     75        # Pickl everything into one big data object via the "Bunch" command
     76        # and post the task!
     77        #
     78        data=pyutilib.misc.Bunch(opt=self._opt.type, file=filestr, filename=self._opt._problem_files[0], kwds=kwds, solver_options=solver_options)
    6379        task = pyutilib.pyro.Task(data=data, id=ah.id)
    6480        self.client.add_task(task)
    6581        self._ah[task.id] = ah
     82       
    6683        return ah
    6784
Note: See TracChangeset for help on using the changeset viewer.