Changeset 1980


Ignore:
Timestamp:
Dec 12, 2009 12:51:19 AM (10 years ago)
Author:
jwatson
Message:

Added extraction of reduced-costs for variables in CBC plugin solution reader. Additionally, all values need to be pushed into the solution, whether non-zero or not. If this isn't done, then when the instance is loaded, only a subset of the variable values (and reduced-costs) are over-ridden. Supression of 0 values does happen in the solution output routine.

NOTE: This does kill the CBC tests due to the presence of reduced-costs in the solution print. Correcting these will require some help from Bill.

File:
1 edited

Legend:

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

    r1939 r1980  
    288288             constraint_dual = eval(tokens[3])
    289289
    290              # assume that CBC has taken care of rounding - we report any
    291              # dual value not precisely equal to 0.0.
    292              if constraint_dual != 0:
    293                 solution.constraint[constraint].dual = constraint_dual
     290             solution.constraint[constraint].dual = constraint_dual
    294291
    295292          elif processing_constraints is False:
    296              variable = tokens[1]
     293             variable_name = tokens[1]
    297294             variable_value = eval(tokens[2])
    298295             variable_reduced_cost = eval(tokens[3]) # currently ignored.
    299296
    300              # assume that CBC has taken care of rounding - we report any
    301              # variable value not precisely equal to 0.0.
    302              if variable_value != 0:
    303                 solution.variable[variable].value = variable_value
     297             solution.variable[variable_name].value = variable_value
     298             solution.variable[variable_name].rc = variable_reduced_cost
    304299          else:
    305300             raise RuntimeError, "CBC encountered unexpected line=("+line.strip()+") in solution file="+self.soln_file+"; expecting header, but found data!"
Note: See TracChangeset for help on using the changeset viewer.