Skip to content

MIPStart is ignored by CBC? #44

@jooyous

Description

@jooyous

I'm having some trouble with MIPStart. For the following toy model

import mip
from random import randint

class DelayedConstraintGenerator(mip.ConstrsGenerator):
    def generate_constrs(self, model):
        print("generating_constraints", model.status)
        model += model.vars[9] == 1

m = mip.Model(sense=mip.MAXIMIZE)
vs = [m.add_var(str(x), obj=1, var_type=mip.BINARY) for x in range(10)]

m.lazy_constrs_generator = DelayedConstraintGenerator()

m += mip.xsum(vs[0::2]) <= 3
m += vs[6] + vs[7] <= 1

L = []
for v in vs[:3]:
    L.append((v, 1))

m.start = L
m.validate_mip_start()
    
status = m.optimize()
print(status, m.objective_value)

I get the following output:

Checking feasibility of MIPStart
Model LP relaxation bound is 8.0
	fixing 0 to 1 ... ok, obj now: 8.0
	fixing 1 to 1 ... ok, obj now: 8.0
	fixing 2 to 1 ... ok, obj now: 8.0
Linear Programming relaxation of model with fixations from MIPStart is feasible.
MIP model may still be infeasible.
generating_constraints OptimizationStatus.OPTIMAL
generating_constraints OptimizationStatus.OPTIMAL
generating_constraints OptimizationStatus.OPTIMAL
generating_constraints OptimizationStatus.OPTIMAL
OptimizationStatus.OPTIMAL 8.0

but the output from CBC warns that it ignores my start values:

...
Starting MIP optimization
Option for preprocess changed from sos to off
Option for heuristicsOnOff changed from on to off
maxSavedSolutions was changed from 0 to 10
integerTolerance was changed from 1e-06 to 1e-06
Continuous objective value is 8 - 0.00 seconds
Cutoff increment increased from 1e-05 to 0.9999
Cbc0045I Warning: MIPstart solution is not valid, column names do not match, ignoring it.
Coin0506I Presolve 0 (-2) rows, 0 (-10) columns and 0 (-7) elements
Clp1000I sum of infeasibilities 0 - average nan, 0 fixed columns
Coin0506I Presolve 0 (0) rows, 0 (0) columns and 0 (0) elements
Clp0000I Optimal - objective value 8
...

I notice that the validate_mip_start method uses constraints to add the values onto the model, so it might not be checking the way MIPStart is done in CBC. I tried adding MIPStarts with smaller models and it worked, so I'm not sure why this particular use case is triggering this comment. Could you please look into this? Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions