Changeset 2308


Ignore:
Timestamp:
Feb 10, 2010 10:29:42 PM (10 years ago)
Author:
wehart
Message:

Generalizing the suffix management in the MIP solvers so
they match regular expressions for suffixes. This allows
the user to specify the '.*' suffix, which matches everything.

Reworked the MIP tests, which all pass now.

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

Legend:

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

    r2281 r2308  
    264264        extract_reduced_costs = False
    265265        for suffix in self.suffixes:
    266            if suffix == "dual":
     266           flag=False
     267           if re.match(suffix, "dual"):
    267268              extract_duals = True
    268            elif suffix == "rc":
     269              flag=True
     270           if re.match(suffix, "rc"):
    269271              extract_reduced_costs = True
    270            else:
     272              flag=True
     273           if not flag:
    271274              raise RuntimeError,"***CBC solver plugin cannot extract solution suffix="+suffix
    272275
  • coopr.plugins/trunk/coopr/plugins/mip/CPLEX.py

    r2284 r2308  
    351351        extract_reduced_costs = False
    352352        for suffix in self.suffixes:
    353            if suffix == "dual":
    354               extract_duals = True
    355            elif suffix == "slack":
    356               extract_slacks = True             
    357            elif suffix == "rc":
    358               extract_reduced_costs = True
    359            else:
     353           flag=False
     354           if re.match(suffix,"dual"):
     355                extract_duals = True
     356                flag=True
     357           if re.match(suffix,"slack"):
     358                extract_slacks = True             
     359                flag=True
     360           if re.match(suffix,"rc"):
     361                extract_reduced_costs = True
     362                flag=True
     363           if not flag:
    360364              raise RuntimeError,"***CPLEX solver plugin cannot extract solution suffix="+suffix
    361365
  • coopr.plugins/trunk/coopr/plugins/mip/GLPK.py

    r2281 r2308  
    219219        extract_duals = False
    220220        for suffix in self.suffixes:
    221            if suffix != "dual":
    222               raise RuntimeError,"***GLPK solver plugin cannot extract solution suffix="+suffix
    223            else:
    224               extract_duals = True
     221            flag=False
     222            if re.match(suffix,"dual"):
     223                extract_duals = True
     224                flag=True
     225            if not flag:
     226                raise RuntimeError,"***GLPK solver plugin cannot extract solution suffix="+suffix
    225227
    226228        lp_solution = True # if false, we're dealing with a MIP!
  • coopr.plugins/trunk/coopr/plugins/mip/PICO.py

    r2281 r2308  
    198198        extract_duals = False
    199199        for suffix in self.suffixes:
    200            if suffix == "dual":
     200           if re.match(suffix,"dual"):
    201201              extract_duals = True
    202202           else:
  • coopr.plugins/trunk/coopr/plugins/tests/mip/test_asl.py

    r2215 r2308  
    5151        else:
    5252            self.asl = coopr.plugins.mip.MockASL(keepFiles=True)
     53        self.asl.suffixes=['.*']
    5354
    5455    def tearDown(self):
  • coopr.plugins/trunk/coopr/plugins/tests/mip/test_cbc.py

    r1939 r2308  
    4545        else:
    4646            self.cbc = coopr.plugins.mip.MockCBC(keepFiles=True)
     47        self.cbc.suffixes=['.*']
    4748
    4849    def tearDown(self):
  • coopr.plugins/trunk/coopr/plugins/tests/mip/test_cplex.py

    r2048 r2308  
    5050        else:
    5151            self.cplex = coopr.plugins.mip.MockCPLEX(keepFiles=True)
     52        self.cplex.suffixes=['.*']
    5253
    5354    def tearDown(self):
  • coopr.plugins/trunk/coopr/plugins/tests/mip/test_glpk.py

    r1939 r2308  
    4545        else:
    4646            self.glpk = coopr.plugins.mip.MockGLPK(keepFiles=True)
     47        self.glpk.suffixes=['.*']
    4748
    4849    def tearDown(self):
  • coopr.plugins/trunk/coopr/plugins/tests/mip/test_pico.py

    r1969 r2308  
    5151        else:
    5252            self.pico = coopr.plugins.mip.MockPICO(keepFiles=True)
     53        self.pico.suffixes=['.*']
    5354
    5455    def tearDown(self):
Note: See TracChangeset for help on using the changeset viewer.